Sometimes I have the problem that my NodeMCU-V3 seems stops working. But I'm not sure whether it really completly stops or only the wifi connection is broken and the devise itself continues running. This happens sometimes after days or even weeks, sometimes after hours. So my idea is to give a reboot command inside the rules sets. Simples one can be to general reset after the main action of the NodeMCU-V3 (watering the garden in the night), more complicate it shall reboot if the wifi connection is broken.

Is something like that possible? The other way will be to do this from outside like I do with other devices; Ping it from my FHEM and if there is no answers break the voltage for some seconds by another FHEM-device. This is not the elegantes way, I prefer the method inside the NodeMCU-V3.

The reboot was done last night. But just now my NodeMCU-V3 stops to send me information and I can't connect. So I have to wait until 00:55 next night to see if it reboots again. Next I'll try the "Connection Failure Threshold".

Giving the "wifidisconnect" command will let the router/access point know that you (the unit) is going away from the network. Thus you will be sure that the network will greet the unit welcome once it returns online.

Hmmm, now I saw that the "Reboot-Rule" is done 7 times this night, because there are 7 events while this process between 00:55 and 00:56.
On the other side I understand that the "Connection Failure Threshold" does the restart in any case if the number 30 of connection failures is reached, even if there in the meantime are successful connections. I thought that this only happens if the failures are direct one after the other and counter will be set to 0 if there is a successful connection. Not bad, but good to know.

Of cause, all this measures are workarounds and not really the best solution, so it's okay so.

On the other side I understand that the "Connection Failure Threshold" does the restart in any case if the number 30 of connection failures is reached, even if there in the meantime are successful connections. I thought that this only happens if the failures are direct one after the other and counter will be set to 0 if there is a successful connection. Not bad, but good to know.

I would appreciate if the logic behind the "Connection Failure Threshold" could be modified to something like this:

On Clock#Time=All,3:25 do
timerSet 3,55
Endon
on Rules#Timer=3 do
Reboot
endon

That means. At 3:55 AM run timer for 55 seconds and after that reboot unit. After reboot it takes several seconds do sync NTP and after that, sys time is 3:26, so the rule will not run again at the same minute.

Yes, I understand your priniple: delay the reboot until 5 seconds before the next full minute. That's a good idea.

I use this NodeMCU for controlling my watering sytstem in the gartden and for this control I use all possible timers. So I must rearrange my rules to use your idea. But this needs some time. Now the watering season is over and some other projects are in the foreground....
My system seems to work and the many reboots while this minute are not really a problem. But anyway it shall be changed.

Are they all used at the same time or can you use one for more than one assignment? I mean, you don't need to use separate timers if they are not running in parallel.

No, they are not used the same time. But I have to learn how to avoid the triggered action in the unused part, perhaps something like if ... else

But of cause, I have to learn much more about the language of the rules.

@mackowiakp: Thanks for the tip. Up to now I never used the test-FW, perhaps I shoud do so. Last weekend I had a lot of time used to test several FW-versions, but with some ESP8266-01 - that's another story....

Giving the "wifidisconnect" command will let the router/access point know that you (the unit) is going away from the network. Thus you will be sure that the network will greet the unit welcome once it returns online.

If it is recommendable to do a WifiDisconnect before the reboot, then why not build this into the ESPEasy core? Every Reboot command would then imply a WifiDisconnect done before the actual reboot takes place.

I have used "On Clock#Time=Sun,04:00 do " to trigger a reboot once a week, in order to prevent the 49 day crash. It is working well, but I think I want to change this into a reboot once a month.
How can I do this? I've looked at the wiki, looking for something like "Clock#Date", but somehow can't find it.
Can someone point me in the right direction?

You could add a counter which is adding +1 each day at a given time. Once the timer hit 30 you do a reboot.

Sounds like a workaround... does this mean that "date" is not available in rules in the same way as "time"?

When I use this method, the unit will reboot every 30 days, not every month. Perhaps not a big deal in this situation.

Alternative is to control the reboots from Domoticz. But I would rather keep things local, if I can.

You can use the sysday variable if you want to. But I thought you wanted to do it after a given number of days.

Not after a given number of days. Ideally I would want to reboot on the first day of the month, at a specific time. This way I can synchronize the reboot of all of my ESPs, and in Domoticz I can see their uptime all being the same. Makes it easy to spot any abnormalities.

on %sysday% = 1 do
on Clock#Time=All,03:30 do
timerSet 8,59
endon
endon
on Rules#Timer=8 do
WifiDisconnect
Reboot
endon

This will reboot the unit at the first day of the month, at 03:30 to minimize impact.
The delay of 59 seconds is there to prevent multiple reboots, since the ESP can be back up-and-running quite quickly, and would then reboot again.

Great, just my luck. I use a mix of Mega and B147. I could upgrade, but some units are hidden away and I don't feel like digging them out for this reason. Upgrading OTA does not always work from B147 to Mega, I found out the hard way. Needs a physical USB connection to get things right.

So, I am back to the "uptime" method, have changed the rules in all of my units.Now to wait and see if they reboot.

Great, just my luck. I use a mix of Mega and B147. I could upgrade, but some units are hidden away and I don't feel like digging them out for this reason. Upgrading OTA does not always work from B147 to Mega, I found out the hard way. Needs a physical USB connection to get things right.

So, I am back to the "uptime" method, have changed the rules in all of my units.Now to wait and see if they reboot.

sorry for asking a litte bit off topic, but there is a way to update ESP with 1mb with new firmware using OTA ?
i see that there are the two step bin file but how to use it? thanks