So I had an ESP based water leak detector made a few months back which I resurrected. It used to work great. I had it running on batteries so to save power I wouldn’t connect to the blynk server until I would detect water, and then connect to server, beep loudly and then wait for a few seconds, and then send push notification and an email. I used to get the notification as well as email. Used to work like a charm.
But now at first I ran into the problems of server domain name changing and the library update etc. After going through it, I am able to connect to the server on the phone app as well as on the ESP. All this is good.
However I am not able to get push notifications. I get the email, I get other data such as water level etc, but no notification on the phone.
In order to debug the issue, I ended up in reducing my program down to a simple loop(). The loop() has a delay of 1 sec so it executes once a second approx. In there I have a counter. All the loop() does is it calls blynk.run(), increments the counter and if it is 80, it sends out the push notification and resets the counter. In addition it displays the counter on the LCD widget that I have defined in the app.
I see the incrementing count being displayed on the LCD widget on my phone app. But I don’t get the push notification when the count reaches 80, which takes about 80 sec since each loop() call takes at least a second.
That’s one issue. Other thing I noticed is that now if the phone goes to sleep, the blynk app disconnects from the server even when the app is running and is on the screen (not in the background). But all the above tests that I have done I made sure that the phone does not go to sleep. I keep touching the screen. But it concerns me since even if I got it working, it won’t be practical because the phone will be in sleep mode most of the time, of course, and I won’t get the notification. In the previous version of the app that I had, all I had to do is to start the app when I rebooted my phone, and then I would get the notifications even when the app would be running in the background.
Any help will be appreciated. I can provide my account email address if that would help debug the issue.