xoseperez / espurna

Home automation firmware for ESP8266-based devices
http://tinkerman.cat
GNU General Public License v3.0
2.99k stars 636 forks source link

Power cycle delay for HID lamps and motors #634

Open sashimanu-san opened 6 years ago

sashimanu-san commented 6 years ago

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?

xoseperez commented 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.

sashimanu-san commented 6 years ago

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.