the brown things are heating pads that i control via a WION electric outlet
the black cat crawled into my lap one summer and started having kittens on my lap… she has been with me since… before that time she spent a cold winter in an earlier version of the cat shelter and i fed her every day
Looks like a fire extinguisher, maybe it pops and lets CO2 out? I can’t imagine foam/water is a good idea with the electrics…
The pin numbers in this bit of code are all messed-up, which makes it a bit confusing as D3 is referenced here as Relay_2
But D3 is actually GPIO0 which is referenced as TRIGGER_PIN:
and is used to call Wi-Fi manager in void setup…
I still think there’s some Wi-Fi Manager related code missing, but @Kimberly_Reck says that it’s working well.
Pete.
yes , it does not make sense
ill post latest code and videos/pic in a bit
/* */
const int Dimmer_Light = 5; //D1
const int Relay_1 = 13; //D2
const int Relay_2 = 15; //D3
const int Relay_3 = 14; //D5
const int Relay_4 = 16; //D0
const int Blue_LED = 2; //D4
bool Connected2Blynk = false;
#define BLYNK_PRINT Serial
#define TRIGGER_PIN 0
#define DHTPIN 4 // Digital pin connected to the DHT sensor
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
char auth[] = "9ddfgdfgdfgdfgdf18e648b";// auth code for app b
#define DHTTYPE DHT22 // DHT 22, AM2302, AM2321
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
char ssid[] = "fledrtertertr";
char pass[] = "flertertertert";
BlynkTimer timer;
//********************* LED DETAILS *********************************************
int PWM_LED1;
int RELAY_1;
int RELAY_2;
int RELAY_3;
int RELAY_4;
//*********************************************************************************
//########################################
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
// Delay between measurements.
delay(delayMS);
float fahrenheittemp = 70;
// Get temperature event and print its value.
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
Serial.println(F("Error reading temperature!"));
}
else {
float celsius = event.temperature;
float fahrenheit = (celsius * 1.8) + 32;
fahrenheittemp = fahrenheit;
Serial.print(F("Temperature: "));
// Serial.print(event.temperature);
Serial.print(fahrenheit);
Blynk.virtualWrite(V6, fahrenheit);
}
// Get humidity event and print its value.
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
Serial.println(F("Error reading humidity!"));
}
else {
Serial.print(F(" Humidity: "));
Serial.print(event.relative_humidity);
Serial.println(F("%"));
Blynk.virtualWrite(V5, (event.relative_humidity));
}
if(fahrenheittemp > 100){
Blynk.email("kimbrec@cdw.com", "ESP8266 Alert", "Temperature over 100!!");
Blynk.notify("ESP8266 Alert - Temperature over 100F!");
}
}
//#########################################
BLYNK_WRITE(V0) //slider in Virtual Pin 0 (0...256)
{
PWM_LED1 = param.asInt();
analogWrite(Dimmer_Light,PWM_LED1);
}
BLYNK_WRITE(V1) //on off for additional light
{
RELAY_1 = param.asInt();
digitalWrite(Relay_1,RELAY_1);
}
BLYNK_WRITE(V2) //on off for additional light
{
RELAY_2 = param.asInt();
digitalWrite(Relay_2,RELAY_2);
}
BLYNK_WRITE(V3) //on off for additional light
{
RELAY_3 = param.asInt();
digitalWrite(Relay_3,RELAY_3);
}
BLYNK_WRITE(V4) //on off for additional light
{
RELAY_4 = param.asInt();
digitalWrite(Relay_4,RELAY_4);
}
//########################################
void sendWifi() {
int wifisignal = WiFi.RSSI();
Blynk.virtualWrite(V10, wifisignal);
}
//########################################
void CheckConnection(){
Connected2Blynk = Blynk.connected();
if(!Connected2Blynk){
Serial.println("Not connected to Blynk server");
Blynk.connect(3333); // timeout set to 10 seconds and then continue without Blynk
}
else{
Serial.println("Connected to Blynk server");
}
}
//########################################
void setup()
{
// pinMode(Wlan_Setup, INPUT);
pinMode(Dimmer_Light, OUTPUT);
pinMode(Relay_1, OUTPUT);
pinMode(Relay_2, OUTPUT);
pinMode(Relay_3, OUTPUT);
pinMode(Relay_4, OUTPUT);
pinMode(Blue_LED, OUTPUT);
Serial.begin(9600);
void wifisetup();
WiFi.begin(WiFi.SSID().c_str(), WiFi.psk().c_str());
delay(1000);
Serial.println("");
Serial.println("####################");
Serial.println("WiFi connected");
Serial.println("controller IP address: ");
Serial.println(WiFi.localIP());
Serial.println("controller WLAN: ");
Serial.println(WiFi.SSID());
Serial.println("controller Signal Strength: ");
Serial.println(WiFi.RSSI());
Serial.println("controller set PSK: ");
if ( digitalRead(TRIGGER_PIN) == LOW ) {
WiFiManager wifiManager;
//reset settings - for testing
wifiManager.resetSettings();
Serial.println("WiFi settings have been cleared!!!!!!");
digitalWrite(Blue_LED,0);
//sets timeout until configuration portal gets turned off
//useful to make it all retry or go to sleep
//in seconds
//wifiManager.setTimeout(120);
//WITHOUT THIS THE AP DOES NOT SEEM TO WORK PROPERLY WITH SDK 1.5 , update to at least 1.5.1
//WiFi.mode(WIFI_STA);
if (!wifiManager.startConfigPortal("CatHouseController")) {
Serial.println("failed to connect and hit timeout");
delay(3000);
//reset and try again, or maybe put it to deep sleep
ESP.reset();
delay(5000);
}
//if you get here you have connected to the WiFi
Serial.println("connected...Meow Meow Meow :)");
}
Serial.println(WiFi.psk());
Serial.println("####################");
delay(1000);
// Blynk.begin(auth, ssid, pass);
Blynk.begin(auth, WiFi.SSID().c_str(), WiFi.psk().c_str());
Blynk.config(auth);
Blynk.connect(3333);
if (Blynk.connect() == false) {
// Wait until connected
digitalWrite(Blue_LED,0);
}
else{
digitalWrite(Blue_LED,1);
}
Serial.println("Connected to Blynk server");
timer.setInterval(11000L, CheckConnection); // check if still connected every 11 seconds
#define TRIGGER_PIN 0
pinMode(TRIGGER_PIN, INPUT);
Serial.begin(9600);
// Initialize device.
dht.begin();
Serial.println(F("DHTxx Unified Sensor Example"));
// Print temperature sensor details.
sensor_t sensor;
dht.temperature().getSensor(&sensor);
Serial.println(F("------------------------------------"));
Serial.println(F("Temperature Sensor"));
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("°C"));
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("°C"));
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("°C"));
Serial.println(F("------------------------------------"));
// Print humidity sensor details.
dht.humidity().getSensor(&sensor);
Serial.println(F("Humidity Sensor"));
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("%"));
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("%"));
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("%"));
Serial.println(F("------------------------------------"));
// Set delay between sensor readings based on sensor details.
delayMS = sensor.min_delay / 1000;
timer.setInterval(300L, sendSensor);
timer.setInterval(300L, sendWifi);
}
//########################################
void loop()
{
if(Connected2Blynk){
Blynk.run();
}
timer.run();
}
//########################################
Please edit your post and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
Pete.
that looks like 3 periods and didnt work
It’s not three periods.
I’ve provided you with the correct backtick characters, all you have to do is copy and paste.
Pete.
and i copied and pasted those
didnt work
they look like periods… what are the ascii values?
… AHH!!! 29 freaking years in computing… acute , grave , grave accent , left quote , open quote the thing shared with a tilde… NEVER HEARD OF BACKTICK! must be a mac user thing… sigh
this was the useful answer… thanks
You can type Alt + 96 for ascii code
else
PC keyboard Alt Gr 7
Ive migrated all my widgets over to a local server as my bought energy and apps all went poof on the cloud server.
nothing i wanted to spin up in a day but the server is on an old RasPi 2 and is doing fine.
If you’re still running your Legacy local server, have you upgraded to the latest version?…
I guess this will probably be the last legacy update.
Pete.