Skip to content

Instantly share code, notes, and snippets.

@bnapalm
Created September 25, 2022 15:41
Show Gist options
  • Save bnapalm/eab265100029aa7f035ad29ef89708df to your computer and use it in GitHub Desktop.
Save bnapalm/eab265100029aa7f035ad29ef89708df to your computer and use it in GitHub Desktop.
Danfoss Ally TRV send external temperature (zigbee2mqtt)
blueprint:
domain: automation
name: Danfoss Ally Ext Temp Z2M
description: Update Danfoss Ally TRV external temperature with min/max refresh rate, via zigbee2mqtt
input:
ally_device:
name: Ally TRV Device
description: Temperature reading will be sent to this device
selector:
device:
manufacturer: Danfoss
entity:
domain: climate
temp_sensor_id:
name: Temperature Sensor
description: External sensor from which the temperature will be read. Expects data format 12.3
selector:
entity:
domain: sensor
device_class: temperature
max_update_timer_id:
name: Timer entity
description: >
Timer that will trigger at maximum update interval
if source sensor has not changed.
Sets automatically to 30min for covered, 3h for uncovered
Use separate timer for each automation.
selector:
entity:
domain: timer
variables:
device: !input ally_device
temp_sensor_id: !input temp_sensor_id
radiator_covered_state: >
{{ states(
device_entities(device)
|select('match', '.*radiator_covered$')|first) }}
min_update_minutes: >
{% if radiator_covered_state == 'off' %}
30
{% else %}
5
{% endif %}
max_update_minutes: >
{% if radiator_covered_state == 'off' %}
180
{% else %}
30
{% endif %}
trigger:
- platform: state
entity_id: !input temp_sensor_id
- platform: event
event_type: timer.finished
event_data:
entity_id: !input max_update_timer_id
condition:
- condition: template
value_template: >
{{ as_timestamp(now())
- as_timestamp(state_attr(this.entity_id,'last_triggered'),0)
> 60 * min_update_minutes }}
action:
- service: mqtt.publish
data:
topic: "zigbee2mqtt/{{ device_attr(device, 'name') }}/set/external_measured_room_sensor"
payload_template: "{{ (states(temp_sensor_id) | float * 100) | round(0) }}"
- service: timer.start
target:
entity_id: !input max_update_timer_id
data:
duration: "{{ max_update_minutes * 60 }}"
mode: single
@lakesider
Copy link

In my setup with your very helpful blueprint, I've noticed that:
received changes in room temperature within the 30min minimum update interval are not passed on for up to 3 hours with uncovered trv state (5/30 min with covered trv state).
As this can slow down the trv's response a lot, could this delay be reduced from 180/30 to max. 30/5 minutes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment