Here is the background to the project.
We have solar panels and a saline pool. The pool circulation pump should go x hrs a day and more if the pool is used.
I would like to start the poolpump for an hour with start at 9am if we are exporting more than 1700Watt (ie if sensor.grid_active_power > 1700 ). Then it should rest for about an half hour and then start again if we export more than 1700W to the grid.
I would also turn of if we export less than 1700W (so we do not drain the battery on the poolpump)
The problem is that I want a delay in the action for about 5 minutes ie we export more than 1700W 5 minutes go and we still do that - Fine start the pool pump.
And also if the export less than 1700W five minutes ago and still export less - Turn off the pump.
This so we could make a Coffee without turning of the pump
Time Trigger at 09:00
Numeric State Trigger when sensor.grid_active_power is above 1700 for 5 minutes
Numeric State Trigger when sensor.grid_active_power is below 1700
Several conditions will also be needed to ensure the pump’s operation complies with your requirements.
There are some aspects of your requirements that are unclear. For example, let’s say the pump starts at 09:00 because power production is above 1700. You said it should rest afterwards for a half hour. However, how long should the pump run before the rest period? Should it be allowed to run until power production decreases below 1700?
Do you mean it should run for a fixed duration of 1 hour, even if power production decreases below 1700? Or can it stop earlier, if power production decreases below 1700?
No if power export to the grid is under 1700w for 5 minutes it should turn of and then not start until 30 minutes has passed and the power export has been over 1700w for 5 minutes
That automation doesn’t support most of the requirements you listed. In addition, if it triggers when the pump hasn’t been off for a half hour yet, it won’t trigger again until power production first decreases below 1700 then increases above it (that’s how a Numeric State Trigger works; it only triggers when the value crosses the threshold). That means power production might be above 1700 but the pump will not be started after a half hour’s rest.
Home Assistant is event-based so you need to translate the loops in the flowchart into an event-based model.
The following example demonstrates how to implement your requirements as an event-based system. it may require further adjustments to meet all of your requirements. There is no 5-minute “waiting time” because this is exclusively event-based.