Using Node Red and Big Timer with frequent power failures

I have been trying to get my head around how to compensate for missed sessions due to load shedding/power outages/power failures.

I have Home Assistant running on a PC which is connected to a UPS/Inverter so is running 24/7 (unless Microsoft decides to bollocks things up by doing an upgrade and then I have to reload Home Assistant again)

I use Node Red and Big Timer via a Sonoff POW Elite 20a connected to the mains electricity at the pool pump which is not on any form of Electricity back up.

Big Timer triggers the Pool Pump on and off each morning and each afternoon at the set times.

With the extreme load shedding we are experiencing, too many of the scheduled triggers are being missed resulting in a Green pool. The Electricity will get turned off for 2 to 4 hours at a time at different times of the day and night and that time changes all the time so can be different times each day.

My Question is, Is there a way to compensate for that. i.e. if pool pump is unavailable, wait an hour and try again, or can someone suggest a better way of programming to make this work. I am not that clever at trying to work out how to program without node red but could probably work something out …eventually if someone has any ideas for me to try if not using node red, or a different way of timing without the Big Timer.

There is nothing fancy, just on and off every day for 2 hours in the morning and 2 hours in the afternoon. Every day, every month the same.

I tried using the “Repeat Output” option in Big Timer, but then the pool could not be triggered for more than a minute when I needed to turn it on manually to clean the pool so I had to turn that off to use the button on the POW Elite.

Any ideas would be greatfully received.

You might want to add the Node-Red tag so that other node-red users can see this too.

I am assuming you can check the state of the Sonoff (on, off, unavailable). The unavailable state could be used to assume a power outage. You can also use statistics to track how many hours the Sonoff was on for each day.

This is a very crude example (needs to be refined through testing and actual usage):

You could use a wait until node to check the Sonoff state is not unavailable before switching the pump on/off. If the Sonoff is unavailable (assume power outage), it will wait until it is available then call the service node to switch pump on/off.

This would allow the pump to run 2 hours if bigtimer went on during a power outage.

There are a few problems with this (how to recover from a power outage when the pump is on):

  1. Tracking that the pump actually ran for two hours in the morning and afternoon.
  2. What is the state of the Sonoff when power is restored (always off)?

This is where the Sonoff statistics would need to be worked into the flow to ensure the two hour run times but it might not be needed if the above is good enough for all practical purposes.

Good Morning Max.

Thank you for taking the trouble to reply.

I will give your suggestion a try and report back.

One thing I neglected to mention is that I flashed the POW Elite as my preference is ESPHome on all my ESP32 devices and I thought I would use it on the Sonoff as well. (Sonoff POW Elite 20a (POWR320D) | devices.esphome.io)

The Sonoff is always off as the default and you are quite correct, the Home Assistant reports the Sonoff as ‘Unavailable’ when the power is off, which is where I got the idea of using that as an indicator.


platform: gpio
    restore_mode: ALWAYS_OFF
    internal: true

Regrettably though, it did mess up the Statistics side of things. Its all good while the power is on, but is lost each power outage and I have also lost the display on the switch as well. I tried 3, lost 1 in the process which has failed completely and I am unable to recover for some reason.

Thank you again and I will report back once I have tried it as it will hopefully help others in the same situation.