-
Using a WeMos D1 R2 via wifi.
-
Using Android 4.4.2
-
Using Blynk 2.27.21
-
Using Blynk server.
-
Not sure how to see what Blynk library version I’m using.
-
When I have the Blynk app on the screen of the phone, notifications come through no problem.
-
When the app is running in the background but is not up on the screen, notifications are ignored.
-
Tried updating Blynk and restarting the phone: no difference.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
char auth[] = "";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";
unsigned long triptime;
WidgetRTC rtc;
void setup()
{
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(D7, INPUT_PULLUP);
digitalWrite(D7, HIGH);
triptime=0;
setSyncInterval(10 * 60); // Time sync interval in seconds (10 minutes)
}
BLYNK_CONNECTED()
{
// Synchronize time on connection
rtc.begin();
}
void loop()
{
Blynk.run();
if(digitalRead(D7)==0 && millis() > triptime)
{
String currentTime = String(hour()) + ":" + minute() + ":" + second();
String currentDate = String(day()) + "/" + month() + "/" + (year()-2000);
String message = String(currentTime + " " + currentDate + " D7 tripped.");
Blynk.notify(message);
Serial.println(message);
triptime = millis()+5000;
}
}
No problems on ESP8266:
⸮[5214] Connecting to WiFi-E83D
[6716] Connected to WiFi
[6716] IP: 192.168.1.103
[6716]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.4.8 on Arduino
[6722] Connecting to blynk-cloud.com:8442
[7313] Ready (ping: 0ms).
[7886] Time sync: OK
14:36:40 21/12/20 D7 tripped.
14:36:53 21/12/20 D7 tripped.
14:38:31 21/12/20 D7 tripped.
14:38:46 21/12/20 D7 tripped.
14:39:33 21/12/20 D7 tripped.