I tried my hand at creating an automation blueprint for updating the external temperature for this TRV. This automation is meant to respect the Danfoss recommended intervals (at least every X, but not more often than Y), though these values have to be configured manually.
It uses the external sensor state change as the primary trigger, and additionally uses a timer to refresh the temperature after the required period, even if the temperature sensor did not change during this time. You have to manually create a timer for each TRV and set the timer interval accordingly - for uncovered mode it should be “at least every 3 hours” (I use 2h30m), and for covered it should be “at least every 30 minutes” because the covered mode will switch off if no reading is received for 35 minutes. I think it is safe to use max values for each timer as it is only a fallback. You should create a new timer for each TRV as it will be reset on each automation activation, so reusing one timer might cause some of the TRVs to go without a reading for a longer time (though technically I think it should be OK to reuse timer if you also use the same source temperature sensor, but I’d still create unique ones to be sure)
For the “Minimum update interval” input you should again use corresponding value depending on if the TRV is in covered or uncovered mode. By Danfoss documentation it should be 30 min for uncovered and 5min for covered.
Here is the blueprint you can put in your /config/blueprints/automation/
or a subdirectory within.
blueprint:
domain: automation
name: Ally Temp Update
description: Update Danfoss Ally TRV external temperature with min/max refresh rate
input:
ally_device:
name: Ally TRV Device
description: Temperature reading will be sent to this device
selector:
device:
manufacturer: Danfoss
entity:
domain: climate
min_update_minutes:
name: Minimum update interval
description: >
Updates will not be sent if time from last update is less than minimum interval.
Normally 30min for uncovered, 5min for covered.
selector:
number:
max: 360
min: 1
unit_of_measurement: minutes
mode: box
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 be (re)started on update.
Set this timer to slowest interval you want the device to update at.
Normally 3h for uncovered, 30m for covered.
Use separate timer for each automation.
selector:
entity:
domain: timer
variables:
device: !input ally_device
ieee: "{{(device_attr(device, 'identifiers')|list)[0][1]}}"
min_update_minutes: !input min_update_minutes
temp_sensor_id: !input temp_sensor_id
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)|int
> (60 * min_update_minutes) }}
action:
- service: zha.set_zigbee_cluster_attribute
data:
ieee: '{{ ieee }}'
endpoint_id: 1
cluster_id: 513
cluster_type: in
attribute: 16405
value: '{{ (states(temp_sensor_id) | float * 100) | round(0)}}'
- service: timer.start
target:
entity_id: !input max_update_timer_id
mode: single
I only tested it briefly so there could be some bugs, but I think it works. Do let me know if someone else tries this if it works for you or not.
edit: had to add default timestamp value, otherwise would fail to run the first time