This script covers a missing function to change the value of a thermostat’s setting relative to it’s current value instead of changing it to a static value.
In order to keep setup simple for the new user this script is intended for, it has a few built-in limitations:
- Setting
hvac_mode
in the same action is not supported. - When using
heat_cool
or similar modes, the script can set either high or low target temp… not both.
Please post any issues you discover, I will happily attempt to correct them. However, please do not post requests to add features such as being able to use entities to provide the value for the temperature change or doing away with the limitations noted above. As stated, one of the primary goals of this blueprint is to keep the setup simple.
Blueprint YAML
blueprint:
name: Increase or Decrease Target Temperature (Relative)
description: Increase or decrease the temperature a given number of degrees relative to the current setting
domain: script
input:
climate_ent:
selector:
entity:
filter:
domain: climate
multiple: true
name: Thermostat
deg_change:
default: 1
name: Number of degrees
selector:
number:
min: -15
max: 15
step: 0.1
hvac_action:
default: false
name: Using Heat/Cool Mode
selector:
boolean:
low_high:
default: 'Not using Heat/Cool'
name: Temperature Target Type
selector:
select:
options:
- High
- Low
- Not using Heat/Cool
mode: queued
variables:
targets: !input climate_ent
offset: !input deg_change
h_c: !input hvac_action
l_h: !input low_high
sequence:
- repeat:
for_each: "{{ targets }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{ h_c }}"
- condition: template
value_template: "{{ l_h == 'High' }}"
sequence:
- action: climate.set_temperature
target:
entity_id: "{{ repeat.item }}"
data:
target_temp_high: |
{{ state_attr(repeat.item, 'target_temp_high')|float(0) + offset|float(0) }}
target_temp_low: "{{ state_attr(repeat.item, 'target_temp_low')|float(0) }}"
hvac_mode: heat_cool
- conditions:
- condition: template
value_template: "{{ h_c }}"
- condition: template
value_template: "{{ l_h == 'Low' }}"
sequence:
- action: climate.set_temperature
target:
entity_id: "{{ repeat.item }}"
data:
target_temp_low: |
{{ state_attr(repeat.item, 'target_temp_low')|float(0) + offset|float(0) }}
target_temp_high: "{{ state_attr(repeat.item, 'target_temp_high')|float(0) }}"
hvac_mode: heat_cool
default:
- action: climate.set_temperature
target:
entity_id: "{{ repeat.item }}"
data:
temperature: "{{ state_attr(repeat.item, 'temperature')|float(0) + offset|float(0) }}"