After some tedious debugging I've discovered that the detection of the wake-up port is unreliable. When this happens (wakeupStatus == 0) the script checks if either of the ports is (still) HIGH.
I've also added retry functions that are useful when WiFi or MQTT broker are unreliable or temporarily down. The script saves the state, sets a (configurable) time-based deep-sleep and tries to send the message again.
DHCP can now be configured (true/false) for people that do not want to reserve a static IP address.
I've been using this code for a few months now and have not had any issues since.
After some tedious debugging I've discovered that the detection of the wake-up port is unreliable. When this happens (wakeupStatus == 0) the script checks if either of the ports is (still) HIGH.
I've also added retry functions that are useful when WiFi or MQTT broker are unreliable or temporarily down. The script saves the state, sets a (configurable) time-based deep-sleep and tries to send the message again.
DHCP can now be configured (true/false) for people that do not want to reserve a static IP address.
I've been using this code for a few months now and have not had any issues since.