-
-
Save Basanites/094e140c29ead05e92de31aaef5312a6 to your computer and use it in GitHub Desktop.
Home Assistant Automation Blueprint for syncing the setpoint of multiple TRVs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Sync TRV setpoints | |
| description: Sync the temperature setpoints of two TRVs. If one of them is changed, | |
| the other one gets updated automatically to the new value. Can also be used to | |
| sync the setpoint of a versatile thermostat valve opening entity to its physical | |
| counterpart. | |
| domain: automation | |
| input: | |
| trvs: | |
| name: TRVs + climate | |
| description: TRVs and climate objects to sync the setpoint temperature for | |
| selector: | |
| entity: | |
| filter: | |
| domain: climate | |
| multiple: true | |
| variables: | |
| trvs: !input trvs | |
| trigger: | |
| - platform: state | |
| entity_id: !input trvs | |
| attribute: temperature | |
| condition: | |
| - condition: template | |
| value_template: > | |
| {% set temps = states | selectattr('entity_id', 'in', trvs) | map(attribute='attributes.temperature') | map('float') | list %} | |
| {{ temps | max != temps | min }} | |
| action: | |
| - service: climate.set_temperature | |
| data: | |
| temperature: '{{ trigger.to_state.attributes.temperature | float }}' | |
| target: | |
| entity_id: > | |
| {{ trvs | reject('eq', trigger.entity_id) | list }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It should. Now I'm confused, too. I tried quite a few different scripts yesterday. Looks like I shared not the one I wanted to share. My previous version contained a condition like this:
So my reasoning was that
trigger.to_state.attributes.temperatureinstead of usingstate_attrtwice prevents the race condition.As I didn't actually include that change in the version I sent to you, I don't have an explanation why it may have fixed the problem... I'll double check which variant I'm actually using again.
Maybe it's just that...