Other updates. Sorry if I do it long but I wanted to tell you this story that made me crazy.
I begin immediately to say that the main problem with this story is not having a computer at home, so I can’t read the serial. But it’s not a problem since I do everything in the office, I try the system for a few hours and then I take it and try it at home.
The title of this discussion is: “Esp8266 / Sonoff freeze after some hour or some days, randomly”. Obviously they all crashed after a few hours/minutes/days of testing at home (remember this “at home”). Having discovered the OTA update (wonderful!), I placed ESP8266 and the modified SONOFF in the final positions, then in the garage, modifying only the SSID being an access point different from the home one. I left the other ESP under the home SSID because I placed it in the boiler.
Thinking of a power problem and as suggested by someone the two ESPs I fed them with a power supply from a mobile phone instead of a “cheap” power supply. And nothing, after a few minutes or a few hours, the ESP of the boiler stops. But the other two in the garage work!! Strange…
Then I put (for testing) in all three devices a code that counts the minutes and I visualize them on a widget, and I discovered that when in the app the devices go offline (continuosly), the next reconnection the minute counter doesn’t reset but goes on. So I realized it was a wifi connection problem or a problem with cloud servers. Thanks to a code from @Gunner I entered a code found in “# 9 Basic” Keeps running without WiFi or Blynk Server connection, but soon as they are available." This code has also a counter in “seconds” and I left it active. To test these “seconds” I put them on widgets for all three devices, and from this I discovered that while for the two in the garage the seconds are advancing well, normally, that of the boiler counted for 5 seconds, then disconnected, then reconnected (sometimes 10 times in half a minute), then jumped seconds, stopped … etc etc … very very unstable!
So I resurrected an old computer and installed the arduino IDE to read the Serial. I realized that there were many problems with wifi, with Serial print: “MDNSResponder possible race-condition”, “login timeout”, some connection with “ping 2500ms”, continuous disconnections, and lots of strange messages, so I connected the esp to my cell’s hotspot, and everything perfect. Now I have added a temporary access point at home (waiting for my new fritz!box to arrive) and it has been working regularly since yesterday without disconnection.
The strange thing and that did not make me think of a router/wifi problem is that at home I have about twenty original sonoffs with ewelink, 5 alexa echo, 2 tablets, many phones, 4 wifi cameras, and I’ve never had any problems with these devices. But the Serial does not lie, as soon as I changed access points, everything went smoothly. Maybe Esp wifi is more sensitive? I do not know!
Sorry if I wrote a papyrus, but if the solution to my problem (which has been beating my head for months and months) is a router with a non-stable wifi, maybe it can be useful to someone who has my same symptoms and look for errors in the code, in the connections and in a thousand other things not thinking maybe about the most logical thing, the WiFi connection!
Ps: the sonoff device that I was testing “unfortunately” I was testing right in the garage in my small laboratory, then connected to the working wifi.
Thanks again to everyone (specially to @PeteKnight and to @wickedbeernut for help me here and to @Gunner for his useful examples page), look forward to the next developments