First of all, I am new to the topic of HA and the automations are also new to me.
I would like to create an automation that is started every evening at 7pm and starts my pool pump depending on the time it has already run. For this I have created a sensor that measures the time the pool pump has already run today. The goal is that the pool pump runs for a maximum of 3 hours per day. So if the pump has already been running for >= 3 hours at 7 pm, the automation should not start. However, if the time is < 3 hours, then the pump should only run for the difference between the sensor and 3 hours.
It’s certainly not easy, but maybe someone has an idea.
trigger:
- platform: numeric_state
entity_id: sensor.pool_pump_run_hours
above: 3
condition:
- condition: time
after: "19:00:00" # allows pool pump to run for longer than 3 hours during the day.
action:
- service: switch.turn_off
target:
- entity_id: switch.pool_pump
A “standard” automation is also not the problem. However, I have a PV system (without battery) and a script runs here which starts the pool pump when there is a surplus. Now it can also happen in summer that it is cloudy. I therefore need to be able to check how long the pump has been running during the day in order to decide whether I need to switch it on in the evening or not.