I am trying my best to make a boiler switch with a timer in HA and I'm really struggling.
What I want is to have a timer and I've mapped it all out with a flowchart:
- If the boiler switch is turned on but the timer is at 0 then change the timer to be 120 minutes (and send a notification to my phone)
- If the timer changes from 0 and the boiler is off then turn on the boiler
- If the timer reaches 0 then turn off the boiler (and send a notification to my phone)
Here are the automations I've made:
Number 1:
description: ""
triggers:
- trigger: state
entity_id:
- switch.bot_4b2a
to: "on"
conditions:
- condition: numeric_state
entity_id: input_number.boiler_timer
above: -0.1
below: 0.1
actions:
- action: input_number.set_value
metadata: {}
data:
value: 120
target:
entity_id: input_number.boiler_timer
- action: notify.mobile_app_pixel_9_pro_xl
data:
message: >-
The boiler has been turned on and will turn off automatically after 2
hours.
title: Boiler Control
data:
actions:
- action: ADD_30
title: Add 30 Minutes
- action: ADD_60
title: Add 1 Hour
- action: SUB_30
title: Subtract 30 Minutes
- action: SUB_60
title: Subtract 1 Hour
mode: single
Number 2:
description: ""
triggers:
- trigger: state
entity_id:
- input_number.boiler_timer
from: "0"
- trigger: homeassistant
event: start
conditions:
- condition: state
entity_id: switch.bot_4b2a
state: "off"
- condition: numeric_state
entity_id: input_number.boiler_timer
above: 0.1
actions:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.bot_4b2a
mode: single
```