Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nevesenin/b875af76de99a287ff3834b988edcd4c to your computer and use it in GitHub Desktop.
Save nevesenin/b875af76de99a287ff3834b988edcd4c to your computer and use it in GitHub Desktop.
blueprint:
name: Target temperature adjustment depending on second temperature sensor (Fahrenheit)
description: >
Sets target temperature depending on second temperature sensor.
This blueprint is inspired by this blueprint https://community.home-assistant.io/t/tado-set-offset-using-separate-temperature-sensor/288515
created by Sanderma. Since not all thermostat devices have an configurable
offset, this blueprint sets the target temperature of the thermostat device
depending on a given target temperature and a second temperature sensor.
domain: automation
input:
temperature_sensor:
name: Temperature sensor
description: This sensor will be used as the source.
selector:
entity:
domain: sensor
device_class: temperature
thermostat:
name: Thermostat
description: The thermostat to set target temperature
selector:
entity:
domain: climate
target_temperature:
name: Target temperature
description: Target temperature of the thermostat
selector:
number:
min: 45
max: 95
step: 1
unit_of_measurement: "°F"
default: 70
variables:
thermostat: !input thermostat
temperature_sensor: !input temperature_sensor
target_temperature: !input target_temperature
actual_temperature: "{{ states(temperature_sensor) | float }}"
calculated_adjustment: "{{ target_temperature - actual_temperature }}"
calculated_target_temperature: "{{ ( target_temperature + calculated_adjustment ) | round }}"
trigger:
- platform: state
entity_id: !input thermostat
attribute: "{{ current_temperature_attribute }}"
- platform: state
entity_id: !input temperature_sensor
condition: "{{ calculated_adjustment != 0 }}"
action:
- service: system_log.write
data:
message: >
{{ thermostat }} has temp difference of {{ calculated_adjustment }}. Setting target temperature to {{ calculated_target_temperature }}
level: info
logger: blueprints.nevesenin.target_temperature_adjustment_fahrenheit
- service: system_log.write
data:
message: >
thermostat: {{ thermostat }},
temperature_sensor: {{ temperature_sensor }},
target_temperature: {{ target_temperature }},
actual_temperature: {{ actual_temperature }},
calculated_adjustment: {{ calculated_adjustment }},
calculated_target_temperature: {{ calculated_target_temperature }}
level: debug
logger: blueprints.nevesenin.target_temperature_adjustment_fahrenheit
- service: climate.set_temperature
data:
temperature: "{{ calculated_target_temperature }}"
entity_id: "{{ thermostat }}"
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment