Hi everyone!
I’m trying to create a script that can be triggered with a Button to set the target thermostat temperature to a specific value, in whatever current Hvac mode it’s in.
For example: Pressing button [22°C] executes the script that does the following:
- If thermostat is in Cool mode, set target cooling temp to 22°C
- If thermostat is in Heat mode, set target heating temp to 22°C
I created a simple script that (in my HA newbie thinking brain) is supposed to check what HVAC state the thermostat is currently in (heat or cool) and then set the target temperature to the predefined value in that given Hvac state.
The problem is, the script does not seem to trigger any action. I have tried the same syntax in an automation, and it does execute the first condition block but then exits.
I was wondering if anyone could point me in the right direction? I’m pasting the script below. Thank you
# Set the thermostat temperature to 22C in the currently selected HVAC mode
alias: '-Test-Temp_Preset_to_22C'
sequence:
- choose:
- conditions:
- condition: state
entity_id: climate.thermostat
state: cool
sequence:
- service: climate.set_temperature
target:
device_id: 1fd200229a2abbf611da089f3840d8
entity_id: climate.thermostat
data:
temperature: 22
hvac_mode: cool
- conditions:
- condition: state
entity_id: climate.thermostat
state: heat
sequence:
- service: climate.set_temperature
data:
temperature: 22
hvac_mode: heat
target:
device_id: 1fd200229a2abbf611da089f3840d8
entity_id: climate.thermostat
default: []
mode: single