Hello. I have 6 different ESP32 devices uploading to a Blynk project. They all have the identical code, writing to different Virtual Pins. This was the workaround to the Blynk Legacy project I had where the devices were able to update to the same project. I have had network issues from the beginning requiring a reset of the ESP. They immediately reconnect and stay connected for variable amounts of time. I set a static IP of the devices, and also reserved those IPs on my wifi router. My router is a TP LINK DECO that claims up to 250 devices.
My issue is that some of the devices stay connected all the time, while other devices often disconnect and do not reconnect to Blynk. Unfortunately, the only time Blynk reports the device offline is if all 6 devices are offline so the timeline isnt much help. I do have another project with a single device and the issues are worse with that one. I have attached the photo of the timeline below.
I have tried the blynk.Edgent sketch with no luck either due to the device limits.
My code is below
#define BLYNK_FIRMWARE_VERSION "0.0.5"
#define BLYNK_TEMPLATE_ID "Redacted"
#define BLYNK_DEVICE_NAME "House Automation"
#define BLYNK_AUTH_TOKEN "Redacted-"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include "DHT.h"
#define DHTPIN 15
#define DHTTYPE DHT22
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "redacted";
char pass[] = "redacted";
IPAddress device_ip (192, 168, 68, 246);
IPAddress dns_ip ( 8, 8, 8, 8);
IPAddress gateway_ip (192, 168, 68, 1);
IPAddress subnet_mask(255, 255, 255, 0);
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
void temp()
{
float h = dht.readHumidity();
float t = dht.readTemperature(true);
Blynk.virtualWrite(V11, t-3);
Blynk.virtualWrite(V12, h);
}
void connection()
{
if(!Blynk.connected()) {
ESP.restart();
}
}
void setup(){
Serial.begin(115200);
dht.begin();
WiFi.config(device_ip, gateway_ip, subnet_mask, dns_ip);
Blynk.begin(auth, ssid, pass);
timer.setInterval(10000L, temp);
timer.setInterval(30000L, connection);
}
void loop(){
Blynk.run();
timer.run();
}