I’m thinking about an automation for my pool.
I’ve an wall mount thermostat wich controlls my heat pump in case of enough PV-produktion.
My Filterpump has to run 6 hours per day and also runs when the heat pump is on.
Is there any way to get a sensor or something else wich counts the running hours of the heat pump
an fill the time up to 6 hours by controlling an other switch/entity?
I have my pool-pump come on/off based on sunset/sunrise times and electricity rate triggers.
I used Stopwatch with start/stop/resume, lap and reset project as part of it, and this is my automation, should give you some ideas (there are some helper booleans used too, including one [input_boolean.utility_pool_pump_auto_control] which if set to off disables the auto-management).
No guarantee that the YAML is optimal, but it works for what I need and may give you a starting point.
alias: "Utility: Pool pump control"
description: ""
trigger:
- platform: sun
event: sunrise
offset: "03:00:00"
id: "1"
- platform: sun
event: sunset
offset: "-02:00:00"
id: "2"
- platform: state
entity_id:
- input_text.utility_current_electricity_tou_band
to: peak
id: "2"
- platform: time_pattern
minutes: /3
id: "3"
- platform: state
entity_id:
- input_boolean.utility_pool_pump_auto_control
to: "off"
id: "4"
- platform: time
at: "21:30:00"
id: "5"
- platform: state
entity_id:
- input_boolean.utility_pool_pump_auto_control
to: "off"
id: "6"
- platform: time
at: "03:00:00"
id: "7"
- platform: state
entity_id:
- switch.pool_pump_smart_switch
to: "off"
id: "8"
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: "1"
- condition: state
entity_id: input_boolean.utility_pool_pump_auto_control
state: "on"
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id:
- input_boolean.utility_pool_pump_triggered_on
- input_boolean.start_stopwatch
- service: switch.turn_on
data: {}
target:
entity_id: switch.pool_pump_smart_switch
- service: notify.notify_simon
data:
message: Pool pump turned on
title: Home Assistant
- choose:
- conditions:
- condition: trigger
id: "2"
- condition: state
entity_id: input_boolean.utility_pool_pump_auto_control
state: "on"
- condition: state
entity_id: input_boolean.utility_pool_pump_triggered_on
state: "on"
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id:
- input_boolean.utility_pool_pump_triggered_on
- input_boolean.start_stopwatch
- service: switch.turn_off
data: {}
target:
entity_id: switch.pool_pump_smart_switch
- service: notify.notify_simon
data:
message: Pool pump turned off
title: Home Assistant
- choose:
- conditions:
- condition: trigger
id: "3"
sequence:
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: zwave_js.refresh_value
data:
entity_id:
- sensor.pool_pump_smart_switch_electric_consumption_w
refresh_all_values: false
- choose:
- conditions:
- condition: trigger
id: "4"
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.pool_pump_smart_switch
- service: notify.notify_simon
data:
message: Pool pump set to manual control
title: Home Assistant
- choose:
- conditions:
- condition: trigger
id: "5"
- condition: state
entity_id: input_boolean.utility_pool_pump_auto_control
state: "off"
- condition: template
value_template: >-
{{ states('sensor.pool_pump_smart_switch_electric_consumption_w')
| float > 100 }}
sequence:
- service: notify.notify_s_k
data:
title: Home Assistant
message: >-
{{ now().strftime("%H:%M") }}: Pool pump is in manual mode and
still running
data:
actions:
- action: URI
title: Pump control
uri: /lovelace-minimalist/rooms
- choose:
- conditions:
- condition: trigger
id: "5"
- condition: state
entity_id: input_boolean.utility_pool_pump_auto_control
state: "on"
- condition: template
value_template: >-
{{ states('sensor.pool_pump_smart_switch_electric_consumption_w')
| float > 100 }}
sequence:
- service: notify.notify_s_k
data:
title: Home Assistant
message: Pool pump is in auto mode but still running
data:
actions:
- action: URI
title: Pump control
uri: /lovelace-minimalist/rooms
- choose:
- conditions:
- condition: trigger
id: "6"
sequence:
- service: notify.notify_simon
data:
message: Pool pump set to auto control
title: Home Assistant
- choose:
- conditions:
- condition: trigger
id: "7"
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id:
- input_boolean.reset_stopwatch
- choose:
- conditions:
- condition: trigger
id: "8"
- condition: state
entity_id: input_boolean.utility_pool_pump_auto_control
state: "on"
- condition: state
entity_id: input_boolean.start_stopwatch
state: "on"
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id:
- input_boolean.start_stopwatch
mode: queued
max: 3
The Z-Wave device I use to monitor if it is running (by tracking power throughput) is horribly sluggish to report changes, hence the ‘every 3 minutes’ trigger which refreshes the ZWave values. You likely won’t need those!