I have several climate entities I control with Home Assistant. I have all of these entities broken down into 5 different groups (buildings). I control temperatures with the local calendar and a toggle. Both point to either an on (occupied) or off (away) script that sets temperature to a temp in the script.
My scripts work as expected without any problem. I am trying to be proactive and add a way to stop the script in the event a condition would cause the script to continue indefinitely. The devices are Filtrite 3M Radio thermostats. They are known for having poor wifi modules. They regularly will drop out. But the time is usually only a few seconds.
My script is set up to set a temperature depending on the state, heat or cool. In the event the entity is not reporting the state the option is to repeat until the entity comes back online.
I cannot figure a way to add a timer that would stop the running script in the event the entity didn’t return online for whatever reason. My thought was to let the script run for 10 - 15 minutes and then stop. Below is one of many scripts I use for this.
alias: "Script: Set Away Mode Vaughn Hall OFF (Occupied)"
sequence:
- choose:
- conditions:
- condition: device
device_id: 15da707ba9851ec60fb823aeb98d1db3
domain: climate
entity_id: 6964fed31739d10d76555519d092d40c
type: is_hvac_mode
hvac_mode: heat
- condition: and
conditions:
- condition: device
device_id: 69539ba123367307271982fd2496d101
domain: climate
entity_id: ef2af9463d538cba73857d2b706af2ef
type: is_hvac_mode
hvac_mode: heat
- condition: and
conditions:
- condition: device
device_id: b65139bcf2ba51e6e4ec8ffe91c76c69
domain: climate
entity_id: a869384e01a22013e855a692f31d91c1
type: is_hvac_mode
hvac_mode: heat
sequence:
- service: climate.set_temperature
metadata: {}
data:
temperature: 68
target:
entity_id:
- climate.thermostat_1a_08_51
- climate.vaughn_hall_s_e
- climate.thermostat_45_a8_c3
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.thermostat_1a_08_51_hold
- switch.vaughn_hall_s_e_hold
- switch.thermostat_45_a8_c3_hold
- conditions:
- condition: device
device_id: 15da707ba9851ec60fb823aeb98d1db3
domain: climate
entity_id: 6964fed31739d10d76555519d092d40c
type: is_hvac_mode
hvac_mode: cool
- condition: and
conditions:
- condition: device
device_id: 69539ba123367307271982fd2496d101
domain: climate
entity_id: ef2af9463d538cba73857d2b706af2ef
type: is_hvac_mode
hvac_mode: cool
- condition: and
conditions:
- condition: device
device_id: b65139bcf2ba51e6e4ec8ffe91c76c69
domain: climate
entity_id: a869384e01a22013e855a692f31d91c1
type: is_hvac_mode
hvac_mode: cool
sequence:
- service: climate.set_temperature
metadata: {}
data:
temperature: 68
target:
entity_id:
- climate.thermostat_1a_08_51
- climate.vaughn_hall_s_e
- climate.thermostat_45_a8_c3
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.thermostat_1a_08_51_hold
- switch.vaughn_hall_s_e_hold
- switch.thermostat_45_a8_c3_hold
- conditions:
- condition: template
value_template: "{{ not is_state('climate.thermostat_1a_08_51', ['cool','heat']) }}"
sequence:
- repeat:
sequence:
- choose:
- conditions:
- condition: device
device_id: 15da707ba9851ec60fb823aeb98d1db3
domain: climate
entity_id: 6964fed31739d10d76555519d092d40c
type: is_hvac_mode
hvac_mode: heat
sequence:
- service: climate.set_temperature
metadata: {}
data:
temperature: 68
target:
entity_id:
- climate.thermostat_1a_08_51
- climate.vaughn_hall_s_e
- climate.thermostat_45_a8_c3
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.thermostat_1a_08_51_hold
- switch.vaughn_hall_s_e_hold
- switch.thermostat_45_a8_c3_hold
- conditions:
- condition: device
device_id: 15da707ba9851ec60fb823aeb98d1db3
domain: climate
entity_id: 6964fed31739d10d76555519d092d40c
type: is_hvac_mode
hvac_mode: cool
sequence:
- service: climate.set_temperature
metadata: {}
data:
temperature: 68
target:
entity_id:
- climate.thermostat_1a_08_51
- climate.vaughn_hall_s_e
- climate.thermostat_45_a8_c3
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.thermostat_1a_08_51_hold
- switch.vaughn_hall_s_e_hold
- switch.thermostat_45_a8_c3_hold
until:
- condition: or
conditions:
- condition: state
entity_id: climate.thermostat_1a_08_51
state: heat
for:
hours: 0
minutes: 0
seconds: 10
- condition: and
conditions:
- condition: state
entity_id: climate.thermostat_1a_08_51
state: cool
for:
hours: 0
minutes: 0
seconds: 10
- conditions:
- condition: template
value_template: "{{ not is_state('climate.vaughn_hall_s_e', ['cool','heat']) }}"
sequence:
- repeat:
sequence:
- choose:
- conditions:
- condition: device
device_id: 69539ba123367307271982fd2496d101
domain: climate
entity_id: ef2af9463d538cba73857d2b706af2ef
type: is_hvac_mode
hvac_mode: heat
sequence:
- service: climate.set_temperature
metadata: {}
data:
temperature: 68
target:
entity_id:
- climate.thermostat_1a_08_51
- climate.vaughn_hall_s_e
- climate.thermostat_45_a8_c3
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.thermostat_1a_08_51_hold
- switch.vaughn_hall_s_e_hold
- switch.thermostat_45_a8_c3_hold
- conditions:
- condition: device
device_id: 69539ba123367307271982fd2496d101
domain: climate
entity_id: ef2af9463d538cba73857d2b706af2ef
type: is_hvac_mode
hvac_mode: cool
sequence:
- service: climate.set_temperature
metadata: {}
data:
temperature: 68
target:
entity_id:
- climate.thermostat_1a_08_51
- climate.vaughn_hall_s_e
- climate.thermostat_45_a8_c3
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.thermostat_1a_08_51_hold
- switch.vaughn_hall_s_e_hold
- switch.thermostat_45_a8_c3_hold
until:
- condition: or
conditions:
- condition: state
entity_id: climate.vaughn_hall_s_e
state: heat
for:
hours: 0
minutes: 0
seconds: 10
- condition: and
conditions:
- condition: state
entity_id: climate.vaughn_hall_s_e
state: cool
for:
hours: 0
minutes: 0
seconds: 10
- conditions:
- condition: template
value_template: "{{ not is_state('climate.thermostat_45_a8_c3', ['cool','heat']) }}"
sequence:
- repeat:
sequence:
- choose:
- conditions:
- condition: device
device_id: b65139bcf2ba51e6e4ec8ffe91c76c69
domain: climate
entity_id: a869384e01a22013e855a692f31d91c1
type: is_hvac_mode
hvac_mode: heat
sequence:
- service: climate.set_temperature
metadata: {}
data:
temperature: 68
target:
entity_id:
- climate.thermostat_1a_08_51
- climate.vaughn_hall_s_e
- climate.thermostat_45_a8_c3
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.thermostat_1a_08_51_hold
- switch.vaughn_hall_s_e_hold
- switch.thermostat_45_a8_c3_hold
- conditions:
- condition: device
device_id: b65139bcf2ba51e6e4ec8ffe91c76c69
domain: climate
entity_id: a869384e01a22013e855a692f31d91c1
type: is_hvac_mode
hvac_mode: cool
sequence:
- service: climate.set_temperature
metadata: {}
data:
temperature: 68
target:
entity_id:
- climate.thermostat_1a_08_51
- climate.vaughn_hall_s_e
- climate.thermostat_45_a8_c3
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.thermostat_1a_08_51_hold
- switch.vaughn_hall_s_e_hold
- switch.thermostat_45_a8_c3_hold
until:
- condition: or
conditions:
- condition: state
entity_id: climate.thermostat_45_a8_c3
state: heat
for:
hours: 0
minutes: 0
seconds: 10
- condition: and
conditions:
- condition: state
entity_id: climate.thermostat_45_a8_c3
state: cool
for:
hours: 0
minutes: 0
seconds: 10
mode: single
icon: mdi:script-outline