Open sashimanu-san opened 6 years ago
If the unit reboots due to a watchdog reset or a bug there is the chance to write to EEPROM before existing. If it reboots due to a power loss or hard disconnection there is no way unless what you suggest, which I wouldn't do.
I think I've found a solution for this case:
If the unit is restarting for reasons suspicious and time unknown and the stored relay state is ON then wait for the delay to expire however if the relay is commanded ON by a button press or network request during this period, power on immediately.
Some mains AC loads require a cool down period of several minutes after shutting down before powering on again, e.g. high intensity discharge lamps won't reignite, and a refrigerator unit may overheat.
Since the firmware has a software clock and NTP support, it is possible to cover some cases pretty easily:
A tough case is the following:
Any thoughts?