i test it as i add one more time interval from 5-5:30 pm, but the automation did not start so that is why i run it manually to see what will happen. Now i tried to make it with IF-Else statement but again it is not working and in the Logbook i did not see the schedule to be triggered. Very strange …
alias: Water heater turns on when someone is in Sofia
description: ""
trigger:
- platform: state
entity_id:
- schedule.water_heater_schedule
condition:
- condition: numeric_state
entity_id: zone.in_sofia
above: 0
action:
- if:
- condition: state
entity_id: schedule.water_heater_schedule
state: "on"
then:
- type: turn_on
device_id: 503857c51fe1e6affa87f28476dcc045
entity_id: switch.water_heater_switch_1
domain: switch
else:
- type: turn_off
device_id: 503857c51fe1e6affa87f28476dcc045
entity_id: switch.water_heater_switch_1
domain: switch
mode: single
If you come home after the schedule turns on then the automation won’t fire. The following handles that:
alias: Water heater turns on when someone is in Sofia
description: ""
trigger:
- platform: state
entity_id: schedule.water_heater_schedule
to:
- platform: numeric_state
entity_id: zone.in_sofia
above: 0
condition:
- condition: numeric_state
entity_id: zone.in_sofia
above: 0
action:
- if:
- condition: state
entity_id: schedule.water_heater_schedule
state: "on"
then:
- type: turn_on
device_id: 503857c51fe1e6affa87f28476dcc045
entity_id: switch.water_heater_switch_1
domain: switch
else:
- type: turn_off
device_id: 503857c51fe1e6affa87f28476dcc045
entity_id: switch.water_heater_switch_1
domain: switch
mode: single
Will handle that - though you still don’t have the case handled of what happens if you leave the zone. It’s quite possible for this automation to leave the heat on.
I’ve tried that automation which is working for now ( turns on the water heater in the specified time) and i will see if it will turned off in 6:30 pm. I make some changes in the conditions so no matter if we are at home zome or in sofia zone the automation will run.
alias: Water heater turns on when someone is in Sofia
description: ""
trigger:
- platform: state
entity_id:
- schedule.water_heater_schedule
condition:
- condition: or
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
- condition: numeric_state
entity_id: zone.in_sofia
above: 0
action:
- if:
- condition: state
entity_id: schedule.water_heater_schedule
state: "on"
then:
- type: turn_on
device_id: 503857c51fe1e6affa87f28476dcc045
entity_id: switch.water_heater_switch_1
domain: switch
else:
- type: turn_off
device_id: 503857c51fe1e6affa87f28476dcc045
entity_id: switch.water_heater_switch_1
domain: switch
mode: single
After that test i will try again Tinkerer code with Taras suggestions, something like that
alias: Water heater turns on when someone is in Sofia
description: ""
trigger:
- platform: state
entity_id:
- schedule.water_heater_schedule
condition:
- condition: or
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
- condition: numeric_state
entity_id: zone.in_sofia
above: 0
action:
- service: - service: "switch.turn_{{ trigger.to_state.state }}"
target:
entity_id: switch.water_heater_switch_1
mode: single
Hello, how can I make this automation to wait specific time before triggering again. Now it is happening to turn on twice in 30 min or hour, because temp is below the desired temp.
You can add a delay as the last action, which when the automation is in single mode (the default), will stop further runs from happening for that time.