facing issue with blynk android app … when I try to refresh the page the device suddenly disappears but is visible on web dashboard …facing this issue from latest update … blynk please solve this bug #bugs #projecthelp
#define BLYNK_TEMPLATE_ID "temepelateid"
#define BLYNK_DEVICE_NAME "devicename "
#define BLYNK_AUTH_TOKEN "authtoken"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
#include <Arduino.h>
#include <PZEM004Tv30.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//LiquidCrystal_I2C lcd(0x27,16,2);
#if defined(ESP32)
/*************************
* ESP32 initialization
* ---------------------
*
* The ESP32 HW Serial interface can be routed to any GPIO pin
* Here we initialize the PZEM on Serial2 with RX/TX pins 16 and 17
*/
#if !defined(PZEM_RX_PIN) && !defined(PZEM_TX_PIN)
#define PZEM_RX_PIN 16
#define PZEM_TX_PIN 17
#endif
#define PZEM_SERIAL Serial2
#define CONSOLE_SERIAL Serial
PZEM004Tv30 pzem(PZEM_SERIAL, PZEM_RX_PIN, PZEM_TX_PIN);
#elif defined(ESP8266)
/*************************
* ESP8266 initialization
* ---------------------
*
* esp8266 can connect with PZEM only via Serial0
* For console output we use Serial1, which is gpio2 by default
*/
#define PZEM_SERIAL Serial
#define CONSOLE_SERIAL Serial1
PZEM004Tv30 pzem(PZEM_SERIAL);
#else
/*************************
* Arduino initialization
* ---------------------
*
* Not all Arduino boards come with multiple HW Serial ports.
* Serial2 is for example available on the Arduino MEGA 2560 but not Arduino Uno!
* The ESP32 HW Serial interface can be routed to any GPIO pin
* Here we initialize the PZEM on Serial2 with default pins
*/
#define PZEM_SERIAL Serial2
#define CONSOLE_SERIAL Serial
PZEM004Tv30 pzem(PZEM_SERIAL);
#endif
float voltage ;
float current ;
float power;
float energy ;
float frequency ;
float factor ;
float apparentPower ;
float reactivePower;
void sendSensor()
{
//Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
voltage = pzem.voltage();
current = pzem.current();
power = pzem.power()*pzem.pf();
factor = pzem.pf();
apparentPower = pzem.power();
reactivePower = pzem.power();
energy = pzem.energy();
Blynk.virtualWrite(V0, voltage);
Blynk.virtualWrite(V1, current);
Blynk.virtualWrite(V2,power);
Blynk.virtualWrite(V3, factor);
Blynk.virtualWrite(V4, apparentPower);
Blynk.virtualWrite(V5,reactivePower);
Blynk.virtualWrite(V6,energy);
lcd.setCursor(0, 0);
lcd.print("V= ");
lcd.setCursor(2, 0);
lcd.print(voltage);
lcd.setCursor(9, 0);
lcd.print("A= ");
lcd.setCursor(11, 0);
lcd.print(current);
lcd.setCursor(9, 1);
lcd.print("W= ");
lcd.setCursor(11, 1);
lcd.print(power);
lcd.setCursor(0, 1);
lcd.print("PF=");
lcd.setCursor(3, 1);
lcd.print(factor);
delay(500);
}
char auth[] = "authtoken";
char ssid[] = "myssid"; // type your wifi name
char pass[] = "mypass"; // type your wifi password
BlynkTimer timer;
void setup() {
lcd.init();
lcd.backlight();
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
//Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
timer.setInterval(100L, sendSensor);
}
void loop() {
Blynk.run();
timer.run();
}