I have a script that sets the state of several HVAC units based on the value of a couple of helpers (script itself is below).
The integrations for the units (1 uses Honeywell TCC and 3 use Cielo Home) are sometimes shaky at best, so I’d like to build something in where if any of the units aren’t set successfully, the script automatically runs again after, say, 15 minutes.
To give an example of a case where this would be helpful, see the trace timeline from when the script ran overnight:
With the nursery unit, the timeline doesn’t indicate any issues, but about 15 minutes after the script ran there’s simply a “unit turned off” in the logbook. My best guess is that something went weird on the integration (or, more likely, Cielo’s) end, since I don’t see any evidence in Cielo’s logs that there was ever a command to turn the unit on. Ideally, the script would have caught that and re-run a few minutes later.
Here’s the script itself, and I appreciate any ideas. Thanks!
alias: Apply HVAC Settings
sequence:
- alias: Set Bedroom
continue_on_error: true
if:
- condition: state
entity_id: input_select.hvac_bedroom_mode
state: "off"
then:
- service: climate.turn_off
metadata: {}
data: {}
target:
entity_id: climate.bedroom_thermostat
else:
- service: climate.set_temperature
metadata: {}
data:
temperature: "{{ states('input_number.hvac_bedroom_setpoint') }}"
hvac_mode: "{{ states('input_select.hvac_bedroom_mode') }}"
target:
entity_id: climate.bedroom_thermostat
- alias: Set Nursery
continue_on_error: true
if:
- condition: or
conditions:
- condition: state
entity_id: input_select.hvac_nursery_mode
state: "off"
- condition: state
entity_id: binary_sensor.hvac_nursery_shutdown
state: "on"
enabled: true
then:
- service: climate.turn_off
metadata: {}
data: {}
target:
entity_id: climate.nursery_thermostat
else:
- service: climate.set_temperature
metadata: {}
data:
temperature: "{{ states('input_number.hvac_nursery_setpoint') }}"
hvac_mode: "{{ states('input_select.hvac_nursery_mode') }}"
target:
entity_id: climate.nursery_thermostat
- alias: Set Main Floor
continue_on_error: true
if:
- condition: state
entity_id: input_select.hvac_main_floor_mode
state: "off"
then:
- service: climate.turn_off
metadata: {}
data: {}
target:
entity_id: climate.main_floor_thermostat
else:
- service: climate.turn_on
metadata: {}
data: {}
target:
entity_id: climate.main_floor_thermostat
- service: climate.set_temperature
metadata: {}
data:
temperature: "{{ states('input_number.hvac_main_floor_setpoint') }}"
target:
entity_id: climate.main_floor_thermostat
- service: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: "{{ states('input_select.hvac_main_floor_mode') }}"
target:
entity_id: climate.main_floor_thermostat
- alias: Set Office
continue_on_error: true
if:
- condition: or
conditions:
- condition: state
entity_id: input_select.hvac_office_mode
state: "off"
- condition: state
entity_id: binary_sensor.hvac_office_shutdown
state: "on"
enabled: true
then:
- service: climate.turn_off
metadata: {}
data: {}
target:
entity_id: climate.office_thermostat
else:
- service: climate.set_temperature
metadata: {}
data:
temperature: "{{ states('input_number.hvac_office_setpoint') }}"
hvac_mode: "{{ states('input_select.hvac_office_mode') }}"
target:
entity_id: climate.office_thermostat
mode: single
icon: mdi:hvac