Last active
November 20, 2022 14:55
-
-
Save bnapalm/9e53ba56f8b327dcc872e5da7a1db5b8 to your computer and use it in GitHub Desktop.
Danfoss Ally TRV room load balancing for Zigbee2MQTT
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: | |
domain: automation | |
name: Danfoss Ally Room Load Balancing | |
description: > | |
Calculate and send room mean load every 15min to | |
load balance TRVs in the same room, via zigbee2mqtt. | |
Uses Danfoss recommended calculation. | |
input: | |
ally_devices: | |
name: Danfoss Ally TRV Device | |
description: Select all Danfoss Ally TRVs located in the same room | |
selector: | |
device: | |
entity: | |
domain: climate | |
multiple: true | |
variables: | |
devices: !input ally_devices | |
devices_all_entities: "{{ devices|map('device_entities')|sum(start=[]) }}" | |
room_load_mean: > | |
{% set load_estimate_entities = devices_all_entities | |
|select('match', 'sensor.*_load_estimate$') %} | |
{% set valid_states = expand(load_estimate_entities) | |
|selectattr('last_changed', 'ge', now() - timedelta(minutes = 90)) | |
|map(attribute="state")|map("int",-8000)|select("ge",-500)|list %} | |
{% if valid_states|count == 0 %} | |
Unknown | |
{% else %} | |
{{ (valid_states|sum / valid_states|count) | round }} | |
{% endif %} | |
target_load_room_mean_entities: > | |
{{ | |
devices_all_entities | |
|select('match', 'number.*_load_room_mean$') | |
|list | |
}} | |
trigger: | |
- platform: time_pattern | |
minutes: /15 | |
condition: | |
- condition: template | |
value_template: "{{ is_number(room_load_mean) }}" | |
action: | |
- service: number.set_value | |
target: | |
entity_id: "{{ target_load_room_mean_entities }}" | |
data: | |
value: "{{ room_load_mean }}" | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment