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:
- When using
heat_cool
mode, the script can set either high or low target temp… not both. - While it can be targeted at multiple
climate
entities. It will not work if the entities in question use a mixture ofheat_cool
and single set-point actions.
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(s)
description: Select the thermostats being targeted. Do not mix devices that are using heat/cool mode with those that are not.
deg_change:
default: 1
name: Default Temperature Offset
description: This value will be used unless changed in the script action. Use negative numbers to decrease set point value.
selector:
number:
min: -15
max: 15
step: 0.1
hvac_action:
default: false
name: Heat/Cool Mode
description: Turn on if your thermostat is using heat/cool mode, otherwise leave off.
selector:
boolean:
low_high:
default: 'Low (heating)'
name: Temperature Target Type
description: Select which set point you want to adjust.
selector:
select:
options:
- High (cooling)
- Low (heating)
mode: queued
fields:
temp_offset:
default: !input deg_change
name: Temperature Offset
description: The number of degrees to adjust the set point. Use negative numbers to decrease set point value.
selector:
number:
min: -15
max: 15
step: 0.1
variables:
targets: !input climate_ent
deg_change: !input deg_change
offset: "{{ deg_change|float(0) if temp_offset is undefined else temp_offset|float(0) }}"
h_c: !input hvac_action
l_h: !input low_high
sequence:
- repeat:
for_each: "{{ targets }}"
sequence:
- variables:
temp_max: "{{ state_attr('repeat.item','max_temp') | float(90) }}"
temp_min: "{{ state_attr('repeat.item','min_temp') | float(0) }}"
- choose:
- conditions:
- condition: template
value_template: "{{ h_c }}"
sequence:
- variables:
orig_high: "{{ state_attr(repeat.item, 'target_temp_high')|float(0) }}"
orig_low: "{{ state_attr(repeat.item, 'target_temp_low')|float(0) }}"
- action: climate.set_temperature
target:
entity_id: "{{ repeat.item }}"
data:
target_temp_high: |
{{ ([orig_high + offset, temp_max] | min) if l_h == 'High (cooling)' else orig_high }}
target_temp_low: |
{{ orig_low if l_h == 'High (cooling)' else ([orig_low + offset, temp_min] | max) }}
hvac_mode: "heat_cool"
default:
- action: climate.set_temperature
target:
entity_id: "{{ repeat.item }}"
data:
hvac_mode: "{{ 'cool' if l_h == 'High (cooling)' else 'heat' }}"
temperature: "{{ ([temp_min, state_attr(repeat.item, 'temperature')|float(0) + offset, temp_max]|sort)[1] }}"
Update 2024-12-13:
- Added safeguards to avoid the script calling for temperatures beyond the min or max temperature limits set for each target entity.
- Added temperature offset field so that the script can be used more flexibly in automations, scripts, and dashboard actions.
- Added descriptions.