Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jonasled/ac0942f77cb6c9022dd664ad542ae191 to your computer and use it in GitHub Desktop.

Select an option

Save jonasled/ac0942f77cb6c9022dd664ad542ae191 to your computer and use it in GitHub Desktop.
blueprint:
name: Sync TRV temperature
description: Sync external temperature sensor with TRV temperature
domain: automation
input:
external_temp:
name: external temp sensor
description: This will be your external temp sensor
selector:
entity:
domain: sensor
device_class: temperature
offset_entity:
name: offset temperature entity
description: This will be your temperature offset entity
selector:
entity:
domain: number
climate_name:
name: Climate entry
description: This will be the TRV it self in home assistant
selector:
entity:
domain: climate
alias: Calibrate Thermostat
description: ''
variables:
external_temp: !input 'external_temp'
climate_device: !input 'climate_name'
external_temperature: !input 'external_temp'
adjust: "{{state_attr(climate_device, 'current_temperature')}}"
trigger:
- platform: state
entity_id: !input 'external_temp'
for:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- platform: state
entity_id: !input 'climate_name'
for:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
condition:
condition: and
conditions:
- condition: template
value_template: "{{ states(external_temperature) != 'unavailable' }}"
- condition: template
value_template: "{{ states(external_temperature) != 'unknown' }}"
- condition: template
value_template: "{{ state_attr(climate_device,'local_temperature_calibration')|float(0) | round(0) !=( states(external_temperature)|float(0) | round(1) - state_attr(climate_device,'local_temperature')|float(0) | round(0)) }}"
- condition: or
conditions:
- condition: template
value_template: "{{ state_attr(climate_device,'local_temperature_calibration')|float(0) | round(0) >-9 }}"
- condition: template
value_template: "{{ (states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'local_temperature')|float(0) | round(0)) >-9 }}"
action:
- service: number.set_value
target:
entity_id: !input offset_entity
data:
value: >-
{{(states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'local_temperature')|float(0) | round(0))*((states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'local_temperature')|float(0) | round(0))>=-9)+((states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'local_temperature')|float(0) | round(0)) <-9)*-9}}
- delay: 5
mode: single
max_exceeded: silent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment