Random Device Offline (Clean Loop)

15:38:35.433 ->     ___  __          __
15:38:35.466 ->    / _ )/ /_ _____  / /__
15:38:35.503 ->   / _  / / // / _ \/  '_/
15:38:35.537 ->  /____/_/\_, /_//_/_/\_\
15:38:35.570 ->         /___/ v1.2.0 on ESP8266
15:38:35.604 -> 
15:38:35.604 ->  #StandWithUkraine    https://bit.ly/swua
15:38:35.638 -> 
15:38:35.638 -> 
15:38:36.123 -> [5349] Current time: Tue Jun  6 10:08:36 2023
15:38:36.156 -> [5349] Connecting to blynk.cloud:443
15:38:38.460 -> [7687] <[1D|00|01|00|20]Vnk3zsjgDnrvhx8TzrtoHb6SiVPyjght
15:38:38.595 -> [7827] >[00|00|01|00|C8]
15:38:38.628 -> [7827] Ready (ping: 2ms).
15:38:38.628 -> [7827] Free RAM: 30400
15:38:38.662 -> [7894] <[11|00|02|00]qver[00]1.2.0[00]h-beat[00]45[00]buff-in[00]1024[00]dev[00]ESP8266[00]fw-type[00]TMPL669iSps_V[00]build[00]Jun[20|20]6[20]2023[20]15:37:23[00]tmpl[00]TMPL669iSps_V[00]
15:38:39.510 -> [8749] >[00|00|02|00|C8]
15:39:24.048 -> [53276] <[06|00|03|00|00]
15:39:30.042 -> [59277] <[06|00|04|00|00]
15:39:36.048 -> [65278] <[06|00|05|00|00]
15:39:42.030 -> [71279] <[06|00|06|00|00]
15:39:42.504 -> [71750] Heartbeat timeout: 71750, 8749, 71279
15:39:47.060 -> [76280] Current time: Tue Jun  6 10:09:47 2023
15:39:47.093 -> [76281] Connecting to blynk.cloud:443
15:40:02.050 -> [91283] Connection failed
15:40:02.084 -> [91288] Current time: Tue Jun  6 10:10:02 2023
15:40:02.118 -> [91288] Connecting to blynk.cloud:443
15:40:17.058 -> [106291] Connection failed
15:40:17.092 -> [106292] Current time: Tue Jun  6 10:10:17 2023
15:40:17.126 -> [106292] Connecting to blynk.cloud:443
15:40:32.050 -> [121294] Connection failed
15:40:32.083 -> [121296] Current time: Tue Jun  6 10:10:32 2023
15:40:32.150 -> [121296] Connecting to blynk.cloud:443
15:40:47.046 -> [136298] Connection failed
15:40:47.079 -> [136302] Current time: Tue Jun  6 10:10:47 2023
15:40:47.147 -> [136303] Connecting to blynk.cloud:443
15:41:02.055 -> [151305] Connection failed
15:41:02.088 -> [151307] Current time: Tue Jun  6 10:11:02 2023
15:41:02.155 -> [151307] Connecting to blynk.cloud:443
15:41:17.057 -> [166309] Connection failed
15:41:17.090 -> [166310] Current time: Tue Jun  6 10:11:17 2023
15:41:17.156 -> [166310] Connecting to blynk.cloud:443
15:41:32.091 -> [181313] Connection failed
15:41:32.091 -> [181314] Current time: Tue Jun  6 10:11:32 2023
15:41:32.158 -> [181314] Connecting to blynk.cloud:443
15:41:47.082 -> [196316] Connection failed
15:41:47.116 -> [196321] Current time: Tue Jun  6 10:11:47 2023
15:41:47.149 -> [196321] Connecting to blynk.cloud:443
15:42:02.083 -> [211323] Connection failed
15:42:02.117 -> [211325] Current time: Tue Jun  6 10:12:02 2023
15:42:02.184 -> [211325] Connecting to blynk.cloud:443
15:42:17.089 -> [226327] Connection failed
15:42:17.122 -> [226331] Current time: Tue Jun  6 10:12:17 2023
15:42:17.156 -> [226331] Connecting to blynk.cloud:443
15:42:32.083 -> [241334] Connection failed
15:42:32.116 -> [241335] Current time: Tue Jun  6 10:12:32 2023
15:42:32.183 -> [241335] Connecting to blynk.cloud:443
15:42:47.106 -> [256338] Connection failed
15:42:47.139 -> [256339] Current time: Tue Jun  6 10:12:47 2023
15:42:47.172 -> [256340] Connecting to blynk.cloud:443
15:43:02.111 -> [271342] Connection failed
15:43:02.146 -> [271343] Current time: Tue Jun  6 10:13:02 2023
15:43:02.179 -> [271343] Connecting to blynk.cloud:443
15:43:17.101 -> [286345] Connection failed
15:43:17.134 -> [286350] Current time: Tue Jun  6 10:13:17 2023
15:43:17.205 -> [286350] Connecting to blynk.cloud:443
15:43:32.118 -> [301353] Connection failed
15:43:32.155 -> [301357] Current time: Tue Jun  6 10:13:32 2023
15:43:32.188 -> [301357] Connecting to blynk.cloud:443
15:43:47.118 -> [316360] Connection failed
15:43:47.159 -> [316361] Current time: Tue Jun  6 10:13:47 2023
15:43:47.193 -> [316362] Connecting to blynk.cloud:443
15:43:53.824 -> [323052] Connection failed
15:43:53.865 -> [323053] Current time: Tue Jun  6 10:13:53 2023
15:43:53.899 -> [323053] Connecting to blynk.cloud:443
15:44:00.799 -> [330051] Connection failed
15:44:00.840 -> [330052] Current time: Tue Jun  6 10:14:00 2023
15:44:00.878 -> [330052] Connecting to blynk.cloud:443
15:44:07.816 -> [337051] Connection failed
15:44:07.857 -> [337052] Current time: Tue Jun  6 10:14:07 2023
15:44:07.896 -> [337052] Connecting to blynk.cloud:443
15:44:14.803 -> [344050] Connection failed
15:44:14.844 -> [344052] Current time: Tue Jun  6 10:14:14 2023
15:44:14.882 -> [344052] Connecting to blynk.cloud:443
15:44:21.810 -> [351050] Connection failed
15:44:21.851 -> [351051] Current time: Tue Jun  6 10:14:21 2023
15:44:21.884 -> [351051] Connecting to blynk.cloud:443
15:44:28.800 -> [358049] Connection failed
15:44:28.841 -> [358051] Current time: Tue Jun  6 10:14:28 2023
15:44:28.908 -> [358051] Connecting to blynk.cloud:443
15:44:35.811 -> [365049] Connection failed
15:44:35.852 -> [365050] Current time: Tue Jun  6 10:14:35 2023
15:44:35.889 -> [365050] Connecting to blynk.cloud:443
15:44:42.816 -> [372048] Connection failed
15:44:42.857 -> [372050] Current time: Tue Jun  6 10:14:42 2023
15:44:42.890 -> [372050] Connecting to blynk.cloud:443
15:44:49.823 -> [379048] Connection failed
15:44:49.862 -> [379049] Current time: Tue Jun  6 10:14:49 2023
15:44:49.897 -> [379049] Connecting to blynk.cloud:443
15:44:56.798 -> [386048] Connection failed
15:44:56.838 -> [386049] Current time: Tue Jun  6 10:14:56 2023
15:44:56.905 -> [386049] Connecting to blynk.cloud:443
15:45:03.829 -> [393047] Connection failed
15:45:03.829 -> [393048] Current time: Tue Jun  6 10:15:03 2023
15:45:03.902 -> [393048] Connecting to blynk.cloud:443
15:45:10.803 -> [400047] Connection failed
15:45:10.844 -> [400048] Current time: Tue Jun  6 10:15:10 2023
15:45:10.878 -> [400048] Connecting to blynk.cloud:443
15:45:17.828 -> [407046] Connection failed
15:45:17.828 -> [407047] Current time: Tue Jun  6 10:15:17 2023
15:45:17.895 -> [407048] Connecting to blynk.cloud:443
15:45:24.821 -> [414046] Connection failed
15:45:24.861 -> [414047] Current time: Tue Jun  6 10:15:24 2023
15:45:24.894 -> [414047] Connecting to blynk.cloud:443
15:45:31.798 -> [421045] Connection failed
15:45:31.838 -> [421047] Current time: Tue Jun  6 10:15:31 2023
15:45:31.910 -> [421047] Connecting to blynk.cloud:443
15:45:38.829 -> [428045] Connection failed
15:45:38.829 -> [428046] Current time: Tue Jun  6 10:15:38 2023
15:45:38.896 -> [428046] Connecting to blynk.cloud:443
15:45:45.814 -> [435044] Connection failed
15:45:45.856 -> [435046] Current time: Tue Jun  6 10:15:45 2023
15:45:45.889 -> [435046] Connecting to blynk.cloud:443
15:45:52.824 -> [442044] Connection failed
15:45:52.824 -> [442045] Current time: Tue Jun  6 10:15:52 2023
15:45:52.891 -> [442045] Connecting to blynk.cloud:443
15:45:59.819 -> [449044] Connection failed
15:45:59.859 -> [449045] Current time: Tue Jun  6 10:15:59 2023
15:45:59.892 -> [449045] Connecting to blynk.cloud:443
15:46:06.829 -> [456044] Connection failed
15:46:06.829 -> [456045] Current time: Tue Jun  6 10:16:06 2023
15:46:06.898 -> [456045] Connecting to blynk.cloud:443
15:46:13.799 -> [463043] Connection failed
15:46:13.839 -> [463044] Current time: Tue Jun  6 10:16:13 2023
15:46:13.906 -> [463044] Connecting to blynk.cloud:443
15:46:20.797 -> [470042] Connection failed
15:46:20.837 -> [470043] Current time: Tue Jun  6 10:16:20 2023
15:46:20.874 -> [470044] Connecting to blynk.cloud:443
15:46:27.815 -> [477042] Connection failed
15:46:27.855 -> [477043] Current time: Tue Jun  6 10:16:27 2023
15:46:27.894 -> [477043] Connecting to blynk.cloud:443
15:46:34.812 -> [484041] Connection failed
15:46:34.853 -> [484043] Current time: Tue Jun  6 10:16:34 2023
15:46:34.886 -> [484043] Connecting to blynk.cloud:443
15:46:41.821 -> [491041] Connection failed
15:46:41.854 -> [491042] Current time: Tue Jun  6 10:16:41 2023
15:46:41.887 -> [491042] Connecting to blynk.cloud:443
15:46:48.794 -> [498040] Connection failed
15:46:48.834 -> [498042] Current time: Tue Jun  6 10:16:48 2023
15:46:48.902 -> [498042] Connecting to blynk.cloud:443
15:46:55.816 -> [505040] Connection failed
15:46:55.856 -> [505041] Current time: Tue Jun  6 10:16:55 2023
15:46:55.891 -> [505041] Connecting to blynk.cloud:443
15:47:02.822 -> [512040] Connection failed
15:47:02.822 -> [512041] Current time: Tue Jun  6 10:17:02 2023
15:47:02.893 -> [512041] Connecting to blynk.cloud:443
15:47:09.794 -> [519039] Connection failed
15:47:09.834 -> [519040] Current time: Tue Jun  6 10:17:09 2023
15:47:09.874 -> [519040] Connecting to blynk.cloud:443
15:47:16.820 -> [526039] Connection failed
15:47:16.820 -> [526040] Current time: Tue Jun  6 10:17:16 2023
15:47:16.894 -> [526040] Connecting to blynk.cloud:443
15:47:23.797 -> [533038] Connection failed
15:47:23.831 -> [533039] Current time: Tue Jun  6 10:17:23 2023
15:47:23.899 -> [533040] Connecting to blynk.cloud:443
15:47:30.790 -> [540038] Connection failed
15:47:30.831 -> [540039] Current time: Tue Jun  6 10:17:30 2023
15:47:30.899 -> [540039] Connecting to blynk.cloud:443
15:47:37.798 -> [547037] Connection failed
15:47:37.838 -> [547038] Current time: Tue Jun  6 10:17:37 2023
15:47:37.871 -> [547039] Connecting to blynk.cloud:443
15:47:44.814 -> [554037] Connection failed
15:47:44.855 -> [554038] Current time: Tue Jun  6 10:17:44 2023
15:47:44.889 -> [554038] Connecting to blynk.cloud:443
15:47:51.810 -> [561036] Connection failed
15:47:51.850 -> [561038] Current time: Tue Jun  6 10:17:51 2023
15:47:51.891 -> [561038] Connecting to blynk.cloud:443
15:47:58.790 -> [568036] Connection failed
15:47:58.824 -> [568037] Current time: Tue Jun  6 10:17:58 2023
15:47:58.895 -> [568037] Connecting to blynk.cloud:443
15:48:05.809 -> [575036] Connection failed
15:48:05.842 -> [575037] Current time: Tue Jun  6 10:18:05 2023
15:48:05.878 -> [575037] Connecting to blynk.cloud:443
15:48:12.795 -> [582035] Connection failed
15:48:12.829 -> [582036] Current time: Tue Jun  6 10:18:12 2023
15:48:12.900 -> [582036] Connecting to blynk.cloud:443
15:48:19.808 -> [589035] Connection failed
15:48:19.849 -> [589036] Current time: Tue Jun  6 10:18:19 2023
15:48:19.883 -> [589036] Connecting to blynk.cloud:443
15:48:26.791 -> [596034] Connection failed
15:48:26.831 -> [596035] Current time: Tue Jun  6 10:18:26 2023
15:48:26.869 -> [596035] Connecting to blynk.cloud:443
15:48:33.814 -> [603034] Connection failed
15:48:33.854 -> [603035] Current time: Tue Jun  6 10:18:33 2023
15:48:33.887 -> [603035] Connecting to blynk.cloud:443
15:48:40.790 -> [610033] Connection failed
15:48:40.824 -> [610034] Current time: Tue Jun  6 10:18:40 2023
15:48:40.891 -> [610035] Connecting to blynk.cloud:443
15:48:47.818 -> [617058] Connection failed
15:48:47.852 -> [617059] Current time: Tue Jun  6 10:18:47 2023
15:48:47.924 -> [617059] Connecting to blynk.cloud:443
15:48:54.822 -> [624057] Connection failed
15:48:54.857 -> [624059] Current time: Tue Jun  6 10:18:54 2023
15:48:54.891 -> [624059] Connecting to blynk.cloud:443
15:49:01.840 -> [631057] Connection failed
15:49:01.840 -> [631058] Current time: Tue Jun  6 10:19:01 2023
15:49:01.911 -> [631058] Connecting to blynk.cloud:443
15:49:08.816 -> [638056] Connection failed
15:49:08.849 -> [638058] Current time: Tue Jun  6 10:19:08 2023
15:49:08.916 -> [638058] Connecting to blynk.cloud:443
15:49:15.812 -> [645056] Connection failed
15:49:15.853 -> [645057] Current time: Tue Jun  6 10:19:15 2023
15:49:15.920 -> [645057] Connecting to blynk.cloud:443
15:49:22.840 -> [652056] Connection failed
15:49:22.840 -> [652057] Current time: Tue Jun  6 10:19:22 2023
15:49:22.907 -> [652057] Connecting to blynk.cloud:443
15:49:29.809 -> [659055] Connection failed
15:49:29.850 -> [659056] Current time: Tue Jun  6 10:19:29 2023
15:49:29.921 -> [659056] Connecting to blynk.cloud:443
15:49:36.814 -> [666055] Connection failed
15:49:36.848 -> [666056] Current time: Tue Jun  6 10:19:36 2023
15:49:36.888 -> [666056] Connecting to blynk.cloud:443
15:49:43.843 -> [673054] Connection failed
15:49:43.843 -> [673055] Current time: Tue Jun  6 10:19:43 2023
15:49:43.910 -> [673056] Connecting to blynk.cloud:443
15:49:50.810 -> [680054] Connection failed
15:49:50.850 -> [680055] Current time: Tue Jun  6 10:19:50 2023
15:49:50.917 -> [680055] Connecting to blynk.cloud:443
15:49:57.829 -> [687053] Connection failed
15:49:57.868 -> [687055] Current time: Tue Jun  6 10:19:57 2023
15:49:57.903 -> [687055] Connecting to blynk.cloud:443
15:50:04.832 -> [694053] Connection failed
15:50:04.873 -> [694054] Current time: Tue Jun  6 10:20:04 2023
15:50:04.914 -> [694054] Connecting to blynk.cloud:443
15:50:11.806 -> [701052] Connection failed
15:50:11.846 -> [701054] Current time: Tue Jun  6 10:20:11 2023
15:50:11.916 -> [701054] Connecting to blynk.cloud:443
15:50:18.837 -> [708052] Connection failed
15:50:18.837 -> [708053] Current time: Tue Jun  6 10:20:18 2023
15:50:18.911 -> [708053] Connecting to blynk.cloud:443
15:50:25.837 -> [715052] Connection failed
15:50:25.837 -> [715053] Current time: Tue Jun  6 10:20:25 2023
15:50:25.906 -> [715053] Connecting to blynk.cloud:443
15:50:32.813 -> [722051] Connection failed
15:50:32.854 -> [722052] Current time: Tue Jun  6 10:20:32 2023
15:50:32.888 -> [722052] Connecting to blynk.cloud:443
15:50:39.808 -> [729051] Connection failed
15:50:39.847 -> [729052] Current time: Tue Jun  6 10:20:39 2023
15:50:39.916 -> [729052] Connecting to blynk.cloud:443
15:50:46.820 -> [736050] Connection failed
15:50:46.862 -> [736051] Current time: Tue Jun  6 10:20:46 2023
15:50:46.895 -> [736051] Connecting to blynk.cloud:443
15:50:53.837 -> [743050] Connection failed
15:50:53.837 -> [743051] Current time: Tue Jun  6 10:20:53 2023
15:50:53.905 -> [743051] Connecting to blynk.cloud:443
15:51:00.803 -> [750049] Connection failed
15:51:00.845 -> [750050] Current time: Tue Jun  6 10:21:00 2023
15:51:00.916 -> [750051] Connecting to blynk.cloud:443
15:51:07.823 -> [757049] Connection failed
15:51:07.864 -> [757050] Current time: Tue Jun  6 10:21:07 2023
15:51:07.900 -> [757050] Connecting to blynk.cloud:443
15:51:14.807 -> [764048] Connection failed
15:51:14.840 -> [764050] Current time: Tue Jun  6 10:21:14 2023
15:51:14.908 -> [764050] Connecting to blynk.cloud:443
15:51:21.829 -> [771048] Connection failed
15:51:21.863 -> [771049] Current time: Tue Jun  6 10:21:21 2023
15:51:21.896 -> [771049] Connecting to blynk.cloud:443
15:51:28.814 -> [778047] Connection failed

I don’t understand how the last sketch you posted can be producing this “Current time” output in the serial monitor.

Pete.

Pete I just doubled checked and I have uploaded the above sketch. The time still shows up on SM.
The time is wrong however and it is not my location time, nor is it the time in Singapore, which is the server region I am connecting. Strange!
My current time is 16:47

16:45:38.228 ->    / _ )/ /_ _____  / /__
16:45:38.275 ->   / _  / / // / _ \/  '_/
16:45:38.322 ->  /____/_/\_, /_//_/_/\_\
16:45:38.322 ->         /___/ v1.2.0 on ESP8266
16:45:38.370 -> 
16:45:38.370 ->  #StandWithUkraine    https://bit.ly/swua
16:45:38.417 -> 
16:45:38.417 -> 
16:45:38.464 -> [5130] Current time: Tue Jun  6 11:15:38 2023
16:45:38.558 -> [5130] Connecting to blynk.cloud:443
16:45:42.552 -> [9190] <[1D|00|01|00|20]Vnk3zsjgDnrvhx8TzrtoHb6SiVPyjght
16:45:42.694 -> [9322] >[00|00|01|00|C8]
16:45:42.694 -> [9323] Ready (ping: 2ms).
16:45:42.741 -> [9323] Free RAM: 30400
16:45:42.741 -> [9390] <[11|00|02|00]qver[00]1.2.0[00]h-beat[00]45[00]buff-in[00]1024[00]dev[00]ESP8266[00]fw-type[00]TMPL669iSps_V[00]build[00]Jun[20|20]6[20]2023[20]16:44:30[00]tmpl[00]TMPL669iSps_V[00]
16:45:42.975 -> [9558] >[00|00|02|00|C8]

The time is Zulu time, which is used by the servers to avoid any timezone issues.
Looks like that is produced by the library when you use SSL, but I’ve never seen that before.

Can you take this device offline.
I’ll upload your sketch and see if I can force a connection to the DGP1 server by using the server suffix, then see if I have the same issues.

Pete.

1 Like

Intresting!
I have disconnected the device from power. I do appriciate the help :slight_smile:
auth details in case you require,

#define BLYNK_TEMPLATE_ID "TMPL669iSps_V"
#define BLYNK_TEMPLATE_NAME "TEST"
#define BLYNK_AUTH_TOKEN "Vnk3zsjgDnrvhx8TzrtoHb6SiVPyjght"

I uploaded this code to a Wemos D1 Mini Pro. It’s the same as yours but forces a connection to server SPG1…

#define BLYNK_TEMPLATE_ID "TMPL669iSps_V"
#define BLYNK_TEMPLATE_NAME "TEST"
#define BLYNK_AUTH_TOKEN "Vnk3zsjgDnrvhx8TzrtoHb6SiVPyjght"

#define BLYNK_PRINT Serial
#define BLYNK_DEBUG

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266_SSL.h>

char ssid[] = "REDACTED";
char pass[] = "REDACTED";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "sgp1.blynk.cloud",443);
}

void loop()
{
  Blynk.run();
}

This is the serial output at boot-up…

0⸮~?⸮4⸮Ҷ⸮⸮OCE⸮⸮aOCAM4⸮,C|X[288] Connecting to REDACTED
12:57:09.880 -> [4621] Connected to WiFi
12:57:09.914 -> [4621] IP: 192.168.1.20
12:57:09.949 -> [4622] 
12:57:09.949 ->     ___  __          __
12:57:09.984 ->    / _ )/ /_ _____  / /__
12:57:09.984 ->   / _  / / // / _ \/  '_/
12:57:10.019 ->  /____/_/\_, /_//_/_/\_\
12:57:10.053 ->         /___/ v1.2.0 on ESP8266
12:57:10.088 -> 
12:57:10.088 ->  #StandWithUkraine    https://bit.ly/swua
12:57:10.123 -> 
12:57:10.123 -> 
12:57:10.157 -> [4847] Current time: Tue Jun  6 11:57:11 2023
12:57:10.192 -> [4847] Connecting to sgp1.blynk.cloud:443
12:57:11.925 -> [6659] <[1D|00|01|00|20]Vnk3zsjgDnrvhx8TzrtoHb6SiVPyjght
12:57:12.094 -> [6831] >[00|00|01|00|C8]
12:57:12.128 -> [6831] Ready (ping: 1ms).
12:57:12.163 -> [6831] Free RAM: 30400
12:57:12.163 -> [6898] <[11|00|02|00]qver[00]1.2.0[00]h-beat[00]45[00]buff-in[00]1024[00]dev[00]ESP8266[00]fw-type[00]TMPL669iSps_V[00]build[00]Jun[20|20]6[20]2023[20]12:55:57[00]tmpl[00]TMPL669iSps_V[00]
12:57:12.401 -> [7156] >[00|00|02|00|C8]
12:57:57.406 -> [52155] <[06|00|03|00|00]
12:57:57.611 -> [52344] >[00|00|03|00|C8]
12:58:42.612 -> [97343] <[06|00|04|00|00]
12:58:42.780 -> [97514] >[00|00|04|00|C8]

As you can see, it’s connecting to SPG1 and should be showing as Online on your web console and timeline.
I’m getting a 1ms ping from London to Singapore, which is similar to your SSL ping times.

It’s currently been online for over 30 minutes without any issues, the latest serial monitor output was…

13:33:20.908 -> [2175535] <[06|00]2[00|00]
13:33:21.077 -> [2175715] >[00|00]2[00|C8]
13:34:06.091 -> [2220715] <[06|00]3[00|00]
13:34:06.262 -> [2220886] >[00|00]3[00|C8]

Your device timeline should confirm these numbers.

I’ll keep monitoring it, but clearly it’s already been running longer than it does for you.

It’s obviously not a Blynk account or server issue, as I’m using your account which lives on the SPG1 server. It’s not a code issue, as we’re running the same code.

That leaves hardware or internet as the culprit.
My money is on it being an issue with your internet, or a WAN issue that is local to you, and outside of Blynk’s control.

Pete.

1 Like

I’ll keep monitoring it, but clearly it’s already been running longer than it does for you.

It’s obviously not a Blynk account or server issue, as I’m using your account which lives on the SPG1 server. It’s not a code issue, as we’re running the same code.

That leaves hardware or internet as the culprit.
My money is on it being an issue with your internet, or a WAN issue that is local to you, and outside of Blynk’s control.

Pete I really do appriciate you taking the time to debug this issue with me. Your help has narrowed down things and brought us to 2 possible causes, hardware or ISP/router setup.

It has remained connected for much longer than when I attemped.

It is very unlikely to be hardware as I’ve tried the same sketch on some other D1 mini boards and ESP32s, same results, so I guess at this point all heads turn to either my ISP or router, as you mensioned.

Any changes I could make to my router’s settings that could help prevent such disconnections from occuring?
One thing I can try is connecting the board to a router with no other device connected. At this point anything is worth a try?

I suspect that the issue lies downstream from the router, probably with your ISP.

Pete.

It’s still running fine without any disconnections, so I’m going to take the Wemos offline because I think we’ve proven the point.
I’ll flash the Wemos with a blank sketch so that it doesn’t connect next time I plug it in, to avoid any confusion at your end.

Pete.

1 Like

Thank you Pete
I will try a couple of things on my router and if everything fails, I’ll speak to my ISP.

1 Like

A little bit of positive news,
My other D1 mini which was running my main sketch was online for the longest it has been for awhile!
Almost an entire day without a single disconnect. It unfortunately went offline 1 and a half hours ago.

I hope to be free this weekend to have a look at my router settings…

Edit: The Blynk protocol is non-edgent, port 80 sketch…

Update:
Still disconnecting from Blynk servers and SM output is continous “Connect to blynk.cloud:80”

My last idea is to continously check if the board is connected to blynk servers and if it is not, reboot the board.

if(!Blynk.connected())
{
    ESP.restart();
}

This code doesn’t seem to work as the board does automatically reboot when the “(!Blynk.connected()” is met…

What are options :confused:

I don’t understand this statement.

I think the bottom line is to establish what the primary cause of the issue is - and I suspect it’s your ISP - and fix that problem.

Pete.

Apologies for the typo.

I meant the board does not reboot when the “(!Blynk.connected())” condition is met. It appears to return “true” even though it’s attempting to reconnect to the server. I read another discussion of the same issue.

I spoke to my ISP, unsurprisingly the technician didn’t have a clue what Blynk is and I had to briefly explain it. After a good 10mins of on and off hold, they said there are no restrictions in place for Blynk and any other IoT platforms.
They then suggested the same old restart the router and try again….

I agree with you Pete about finding the root cause instead of taking a short cut. I am ashamed to come to a point where I still haven’t solved this and my last option being to add a line of code to patch the bug….

I’ve even thought of adding an arduino with a relay to reboot the wemos every “X” hours by interrupting the power…
I’m desperate to keep the device running and online continuously without me having to reset it.

This week I will try connecting the wemos to its own router (only device connected). Hoping for positive results….

You should probably post the code you are using.

It might be worth reading this, then having another chat with the technician…

Pete.

1 Like

Pete I made an interesting discovery.

I disconnected the fiber cable from the router to simulate a internet blackout and the wemos attempts to connect to blynk.cloud (as expected). However, when I reconnect the fiber cable back to the router and confirm on my phone that the internet connection as been restored, the wemos however still attemps to connect to blynk.cloud.

So what I believe is happening is that theres brief internet blackout, and the wemos gets stuck on a loop trying to establish a connection with the sever, even after the internet has been restored.
So this comfirms that it has nothing to do with my ISP blocking Blynk servers. The wemos is simply unable to reconnect to blynk server on its own after an internet blackout.

Any suggestion on how I can fix this?

Please see attached SM output and code below

At timestamp 17:52:47.361, the board has succefully connected to the server.
At timestamp 18:05:51.544, I unplugged the fiber line to simulate a internet blackout
At timestamp 18:07:03.074, I reconnected the fiber line and comfirmed internet is restored

17:52:47.327 -> 
17:52:47.327 -> [8533] Connecting to blynk.cloud:80
17:52:47.361 -> [8688] Ready (ping: 56ms).
18:05:51.544 -> [792882] Connecting to blynk.cloud:80
18:05:57.562 -> [798884] Connecting to blynk.cloud:8080
18:06:04.660 -> [805988] Connecting to blynk.cloud:80
18:06:10.659 -> [811989] Connecting to blynk.cloud:8080
18:06:17.775 -> [819093] Connecting to blynk.cloud:80
18:06:23.751 -> [825094] Connecting to blynk.cloud:8080
18:06:30.856 -> [832197] Connecting to blynk.cloud:80
18:06:36.875 -> [838199] Connecting to blynk.cloud:8080
18:06:43.977 -> [845302] Connecting to blynk.cloud:80
18:06:49.967 -> [851303] Connecting to blynk.cloud:8080
18:06:57.081 -> [858407] Connecting to blynk.cloud:80
18:07:03.074 -> [864408] Connecting to blynk.cloud:8080
18:07:10.175 -> [871512] Connecting to blynk.cloud:80
18:07:16.188 -> [877513] Connecting to blynk.cloud:8080
18:07:23.293 -> [884617] Connecting to blynk.cloud:80
18:07:29.305 -> [890618] Connecting to blynk.cloud:8080
18:07:36.404 -> [897721] Connecting to blynk.cloud:80
18:07:42.380 -> [903723] Connecting to blynk.cloud:8080
18:07:49.508 -> [910826] Connecting to blynk.cloud:80
18:07:55.506 -> [916828] Connecting to blynk.cloud:8080
18:08:02.606 -> [923931] Connecting to blynk.cloud:80
18:08:08.594 -> [929932] Connecting to blynk.cloud:8080
18:08:15.693 -> [937036] Connecting to blynk.cloud:80
18:08:21.711 -> [943037] Connecting to blynk.cloud:8080
18:08:28.807 -> [950141] Connecting to blynk.cloud:80
18:08:34.818 -> [956142] Connecting to blynk.cloud:8080
18:08:41.904 -> [963246] Connecting to blynk.cloud:80
18:08:47.928 -> [969247] Connecting to blynk.cloud:8080
18:08:55.015 -> [976351] Connecting to blynk.cloud:80
18:09:01.017 -> [982352] Connecting to blynk.cloud:8080

Code

#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME "Yamaha EF5500EFW"
#define BLYNK_AUTH_TOKEN ""
#define BLYNK_FIRMWARE_VERSION        "5.5"
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#define APP_DEBUG


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#define BLYNK_GREEN     "#23C48E"
#define BLYNK_RED       "#D3435C"
#define BLYNK_YELLOW    "#ED9D00"

int CEBsensor = 0;
int CEBstate = 0;
int Timerstate = 0;
int InvTimerstate = 0;
int inverterstate = 0;

//Voltage Sensor
//int Vsensor = A0;
float correctionfactor = 7.40;
float vout = 0.0;
float vin = 0.0;
float fuelcon = 0.0;

//float R1 = 30000;
//float R2 = 7500;
//int value = 0;


//Declare millis for timers
unsigned long msec = 0;
unsigned long msec2 = 0;
float times = 0.0;
float hourmeter = 0.0;

BlynkTimer timer;

//Blynk LED Widgets
WidgetLED led1(V3); //COIL LED
WidgetLED led2(V7); //FUEL LED
WidgetLED led3(V4); //STARTER LED
WidgetLED led13(V13); //GENERATOR SHUTOFF LED
WidgetLED led14(V14); //CEB STATUS LED
WidgetLED led15(V18); //INVERTER STATUS LED
WidgetLED led16(V20); //INVERTER SHUTOFF LED
WidgetLED led17(V24); //CHANGEOVER RELEASE INDICATOR

int newTimer = 1;

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";

String error;

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

  pinMode(D0, OUTPUT);  //STARTER Relay D0
  pinMode(D5, OUTPUT);  //FUEL Relay D5
  pinMode(D6, OUTPUT);  //COIL Relay D6
  pinMode(D7, OUTPUT);  //INVERTER Relay D7
  pinMode(D1, INPUT);   //CEB LDR Sensor D1
  //pinMode(Vsensor, INPUT); //Voltage Sensor A0
  {
    //(To prevent self-trigger during initial boot)
    digitalWrite(D0, HIGH); //D0
    digitalWrite(D5, HIGH); //D5
    digitalWrite(D6, HIGH); //D6
  }

  timer.setInterval(10000L, CEBsensor1);
  timer.setInterval(1000L, runtime);
  timer.setInterval(1000L, invertertime);
  //timer.setInterval(10000L,Voltagesensor1);
  //timer.setInterval(1000L, stats);
}

void loop()
{
  timer.run();

  if (WiFi.status() != WL_CONNECTED && !Blynk.connected())
  {
    ESP.restart();
  } else {
    Blynk.run();
  }
}

BLYNK_CONNECTED() {
  Blynk.syncVirtual(V10, V18); //Works, Doesn't get triggered when not on
}

/*
  void stats () {
  ESP.wdtFeed();

  if (WiFi.status() != WL_CONNECTED)
  {
    ESP.restart();
  }

  if (!Blynk.connected())
  {
    ESP.restart();
  }

  }
*/

void invertertime()
{
  if (CEBstate == LOW) {
    if (inverterstate == HIGH) {
      led15.on();
      Blynk.setProperty(V10, "color", "#23C48E");
      Blynk.setProperty(V18, "color", "#23C48E"); //Inverter Status (ON) GREEN
      digitalWrite(D7, HIGH); //INV RELAY ON D7
      delay(100);
      Blynk.setProperty(V2, "offLabel", "OFF Inverter Before Starting");
      Blynk.setProperty(V2, "onLabel", "OFF Inverter!");
    } else {
      Blynk.setProperty(V18, "color", "#ED9D00"); //Inverter Status (OFF) Yellow
      Blynk.setProperty(V10, "color", "#ED9D00");
      digitalWrite(D7, LOW); //INV RELAY OFF D7
      delay(100);
      Blynk.setProperty(V2, "offLabel", "Hold to Start");
      Blynk.setProperty(V2, "onLabel", "Release");
    }
  } else {
  }

  if (inverterstate == HIGH && CEBsensor == LOW) {
    led16.on(); //Inverter Shutoff Indicator ON
    yield();
  } else {
    led16.off(); //Inverter Shutoff Indicator OFF
    yield();
  }
}

void runtime()
{
  if (CEBstate == HIGH && Timerstate == HIGH) {
    times = ((millis() - msec));
    Blynk.setProperty(V16, "label", "Current Generator Run Time");
    Blynk.setProperty(V17, "label", "Current Fuel Consumption");
    {
      String readableTime;
      getReadableTime(readableTime);
      Blynk.virtualWrite(V16, readableTime);
      Blynk.virtualWrite(V17, 1.7 * ((millis() - msec) / 1000) / 3600);
      delay(500);
    }
  } else {
  }

  if (InvTimerstate == HIGH && CEBstate == LOW && Timerstate == LOW) {
    times = ((millis() - msec2));
    Blynk.setProperty(V16, "label", "Inverter Run Time");
    {
      String readableTime;
      getReadableTime(readableTime);
      Blynk.virtualWrite(V16, readableTime);
    }
    delay(500);
  } else {
  }
}

void getReadableTime(String & readableTime) {
  unsigned long currentMillis;
  unsigned long seconds;
  unsigned long minutes;
  unsigned long hours;
  unsigned long days;

  currentMillis = times;
  seconds = currentMillis / 1000;
  minutes = seconds / 60;
  hours = minutes / 60;
  days = hours / 24;
  currentMillis %= 1000;
  seconds %= 60;
  minutes %= 60;
  hours %= 24;

  if (days > 0) {
    readableTime = String(days) + " ";
  }

  if (hours > 0) {
    readableTime += String(hours) + "H:";
  }

  if (minutes < 10) {
    readableTime += "0";
  }
  readableTime += String(minutes) + "m:";

  if (seconds < 10) {
    readableTime += "0";
  }
  readableTime += String(seconds) + "s";
}

BLYNK_WRITE(V1)
//attach Button on virtual V1,
//it will control the Coil
{
  if (param.asInt() == 1) {
    delay(100);
    digitalWrite(D6, LOW); //COIL RELAY ON D6
    delay(100);
    led1.on();
    msec = millis();
    CEBstate = 1;
  }
  if (param.asInt() == 0) {
    delay(100);
    digitalWrite(D6, HIGH); //COIL RELAY OFF D6
    delay(100);
    led1.off();
    CEBstate = 0;
    Blynk.setProperty(V16, "label", "Previous Generator Run Time");
    Blynk.setProperty(V17, "label", "Previous Fuel Consumption");
    //Blynk.setProperty(V23, "isDisabled", true);
    delay(100);
    Blynk.logEvent("generator_off");
  }
}

BLYNK_WRITE(V2)
//attach Button on virtual V2,
//it will control the Starter
{
  if (param.asInt()) {
    newTimer = timer.setTimeout(2000, Starter); // button pressed for >2Sec
  }
  else {
    timer.disable(newTimer);
  }
}

void Starter()
{

  if (inverterstate == LOW) {
    led3.on();
    digitalWrite(D0, LOW); //STARTER CRANK ON D0
    delay(1200); //CRANK DURATION
    digitalWrite(D0, HIGH); //STARTER CRANK OFF D0
    led3.off();
    Blynk.logEvent("generator_on");
    //Blynk.setProperty(V23, "isDisabled", true);
  } else {
  }
}

BLYNK_WRITE(V9)
//attach Button on virtual V9,
//This will control the Fuel
{
  if (param.asInt() == 1) {
    delay(100);
    digitalWrite(D5, LOW); //FUEL RELAY ON D5
    delay(100);
    led2.on();
    Timerstate = 1;
  }
  if (param.asInt() == 0) {
    delay(100);
    digitalWrite(D5, HIGH); //FUEL RELAY OFF D5
    delay(100);
    led2.off();
    Timerstate = 0;
  }
}

BLYNK_WRITE(V10)
//attach Button on virtual V10,
//it will control the Inverter Relay
{
  if (param.asInt() == 1) {
    inverterstate = 1;
    msec2 = millis();
    InvTimerstate = 1;
    Blynk.logEvent("inverter_on");
    Blynk.setProperty(V22, "isDisabled", true);
    Blynk.setProperty(V23, "isDisabled", false);
  }
  if (param.asInt() == 0) {
    inverterstate = 0;
    InvTimerstate = 0;
    Blynk.logEvent("inverter_off");
    Blynk.setProperty(V22, "isDisabled", false);
  }
}


BLYNK_WRITE(V15)
//attach Button on virtual V15,
//This will update System Status
{
  if (param.asInt() == 1) {
    Blynk.virtualWrite(V8, map(WiFi.RSSI(), -110, -30, 30, 100));
  }
  if (param.asInt() == 0) {
  }
}

BLYNK_WRITE(V19)
//attach Button on virtual V19,
//This will reset Coil/Fuel Status
{
  if (param.asInt() == 1) {
    Blynk.virtualWrite(V1, 0);
    led1.off();
    Blynk.virtualWrite(V9, 0);
    led2.off();
    delay(100);
    Blynk.setProperty(V16, "label", "Previous Run Time");
    Blynk.setProperty(V17, "label", "Previous Fuel Consumption");
    delay(100);
    Blynk.logEvent("generator_off");
    Timerstate = 0;
    CEBstate = 0;
  }
  if (param.asInt() == 0) {
  }
}

void CEBsensor1()
//Run every second
{
  CEBsensor = digitalRead(D1); //LDR Sensor
  Blynk.virtualWrite(V12, CEBsensor);

  //If COIL ON and CEBsensor LOW, Trigger "Grid Restored" Blynk Automation
  if (CEBsensor == LOW && CEBstate == HIGH) {
    led13.on(); //Shutoff Indicator ON
    yield();
  } else {
    led13.off(); //Shutoff Indicator OFF
    yield();
  }

  //CEB STATUS LED
  if (CEBsensor == HIGH) {
    led14.on();
    Blynk.setProperty(V14, "color", "#D3435C"); //CEB Status (ON) RED
    Blynk.logEvent("grid_failure");
    Blynk.setProperty(V23, "isDisabled", false);
    Blynk.setProperty(V22, "isDisabled", false);
    yield();
  } else {
    Blynk.setProperty(V14, "color", "#23C48E"); //CEB Status (ON) GREEN
    Blynk.setProperty(V23, "isDisabled", true);
    Blynk.setProperty(V22, "isDisabled", true);
    yield();
  }

}
/*
  void Voltagesensor1()
  //Run every 10 sec
  {
  int sdata = 0;

  value = analogRead(Vsensor);
  vout = (value * 5.0) / 1024.0;
  vin = vout / (R2 / (R1 + R2));

  vin = vin - correctionfactor;

  Blynk.virtualWrite(V5, vin);
  yield();

  if (vin < 12.0) {
    Blynk.setProperty(V5, "color", "#D3435C"); //If UPS Voltage < 12.5v, Gauge RED
  } else {
    Blynk.setProperty(V5, "color", "#F7CE46"); //If UPS Voltage > 12.5v, Gauge ORANGE
  }
  }
*/

//BETA
BLYNK_WRITE(V22)
//attach Button on virtual V22,
//it will control the GENtoINV
{
  if (param.asInt()) {
    newTimer = timer.setTimeout(2000, GENtoINV); // button pressed for >2Sec
  }
  else {
    timer.disable(newTimer);
  }
}

void GENtoINV()
{

  if (inverterstate == LOW) {
    {
      led17.on();
      //FUEL
      Blynk.virtualWrite(V1, 0);
      led1.off();
      digitalWrite(D6, HIGH); //COIL RELAY OFF D6
      delay(100);
      CEBstate = 0;
      Blynk.setProperty(V16, "label", "Previous Generator Run Time");
      Blynk.setProperty(V17, "label", "Previous Fuel Consumption");
      delay(100);
      Blynk.logEvent("generator_off");
    }
    delay(1500);
    {
      //COIL
      Blynk.virtualWrite(V9, 0);
      led2.off();
      digitalWrite(D5, HIGH); //FUEL RELAY OFF D5
      delay(100);
      Timerstate = 0;
    }

    delay(2000);
    {
      //INV Relay
      Blynk.virtualWrite(V10, HIGH);
      inverterstate = 1;
      msec2 = millis();
      InvTimerstate = 1;
      Blynk.logEvent("inverter_on");
      led17.off();
    }

  } else {
  }
}

BLYNK_WRITE(V23)
//attach Button on virtual V23,
//it will control the INVtoGEN
{
  if (param.asInt()) {
    newTimer = timer.setTimeout(2000, INVtoGEN); // button pressed for >2Sec
  }
  else {
    timer.disable(newTimer);
  }
}

void INVtoGEN()
{

  {
    //INV RELAY OFF
    led17.on();
    inverterstate = 0;
    InvTimerstate = 0;
    Blynk.logEvent("inverter_off");
    {
      Blynk.virtualWrite(V10, 0);
      Blynk.setProperty(V10, "color", "#ED9D00");
      Blynk.setProperty(V18, "color", "#ED9D00"); //Inverter Status (OFF) Yellow
      digitalWrite(D7, LOW); //INV RELAY OFF D7
      delay(100);
      Blynk.setProperty(V2, "offLabel", "Hold to Start");
      Blynk.setProperty(V2, "onLabel", "Release");
    }
    Blynk.setProperty(V22, "isDisabled", false);
  }
  delay(3000);
  {
    //FUEL
    Blynk.virtualWrite(V9, 1);
    digitalWrite(D5, LOW); //FUEL RELAY ON D5
    led2.on();
    Timerstate = 1;
  }
  delay(1500);
  {
    //COIL
    Blynk.virtualWrite(V1, 1);
    digitalWrite(D6, LOW); //COIL RELAY ON D6
    led1.on();
    msec = millis();
    Blynk.setProperty(V23, "isDisabled", true);
    CEBstate = 1;
  }
  delay(2000);
  {
    //STARTER
    if (inverterstate == LOW) {
      led3.on();
      digitalWrite(D0, LOW); //STARTER CRANK ON D0
      delay(1200); //CRANK DURATION
      digitalWrite(D0, HIGH); //STARTER CRANK OFF D0
      led3.off();
      Blynk.logEvent("generator_on");
      led17.off();
    }
  }

}

You need to stop using Blynk.begin, and switch to managing your own WiFi connection and using Blynk.config and Blynk.connect.

You then need to have timed functions that check if you’re still connected to WiFi and to Blynk, and that re-connect where necessary.

Pete.

1 Like

Noted. I refered to this discussion and code and implemented certain parts for testing. So far so good, the board reboots when it detects a loss of connection to the servers. I will continue testing and hopefully the issue has been solved.

Good news!
The issue appears to be solved and the board has stayed online for 2 days. Within the 2 days it has lost connection to the server, but after implementing parts from the above attached discussion, the board automatically reboots and restores connection to the server, thus fixing the issue.

I am really happy with this result. My project is now online and everything is working as expected.
Its been a month of diagnosing this simple matter but I really appriciate your help Pete. Thank you.

Heres a summary for anyone new of the issue I faced.
My D1 mini would go offline multiple times a day and would not reconnect to the Blynk server automatically. After concluding that it wasn’t my code nor my ISP blocking Blynk, I discovered that my internet connection would have multiple black outs per day. Therefore when a blackout occurs, the board looses connection to the server (expected), however when the internet connection is restored, the board continues to “Connecting to Blynk.cloud:80” till I manually reboot it.

You do t need to reboot the server, just re-establish the Blynk and/or WiFi connection.

Pete.