Fix Danfoss Ally TRV blueprint for recent HASS

This commit is contained in:
Rune Juhl Jacobsen 2025-02-20 15:01:20 +01:00
parent 5f3e30522a
commit 74d34e3d32

View file

@ -1,13 +1,12 @@
---
blueprint: blueprint:
author: runejuhl author: runejuhl
homeassistant: homeassistant:
min_version: 2024.6.0 min_version: 2025.2.4
name: Radiator external temperature sensor control (0.0.1-alpha) name: Radiator external temperature sensor control (0.0.2-alpha)
description: |- description: |-
## Radiator external temperature sensor control ## Radiator external temperature sensor control
Version `0.0.1-alpha`. Version `0.0.2-alpha`.
Sets the `external_measured_room_sensor` value on Danfoss Ally TRV, enabling Sets the `external_measured_room_sensor` value on Danfoss Ally TRV, enabling
the TRV to adjust the valve based on an external sensor. the TRV to adjust the valve based on an external sensor.
@ -20,7 +19,9 @@ blueprint:
selector: selector:
entity: entity:
filter: filter:
- domain: climate - domain:
- climate
multiple: false
climate_sensor: climate_sensor:
name: Climate sensor temperature entity name: Climate sensor temperature entity
selector: selector:
@ -28,7 +29,7 @@ blueprint:
filter: filter:
- device_class: - device_class:
- temperature - temperature
multiple: false
mode: queued mode: queued
variables: variables:
@ -37,44 +38,43 @@ variables:
triggers: triggers:
- entity_id: !input climate_sensor - entity_id: !input climate_sensor
attribute: temperature
trigger: state trigger: state
conditions: conditions:
# We only want to execute the action if the temperature has changed by at # We only want to execute the action if the temperature has changed by at least
# least 0.1 degress C, according to the Zigbee2MQTT documentation for the # 0.1 degress C, according to the Zigbee2MQTT documentation for the device:
# device: https://www.zigbee2mqtt.io/devices/014G2461.html # https://www.zigbee2mqtt.io/devices/014G2461.html
# #
# `external_measured_room_sensor` defaults to `-8000`, so this will work in # `external_measured_room_sensor` defaults to `-8000`, so this will work in all
# all cases. # cases.
- condition: template - condition: template
value_template: >- value_template: |-
{% if state_attr(climate_entity, 'external_measured_room_sensor') == None %}
True
{% else %}
{{ {{
( ( (state_attr(climate_entity, 'external_measured_room_sensor')
( - (trigger.to_state.state | float) * 100) | abs)
state_attr(climate_entity, 'external_measured_room_sensor') -
trigger.to_state.attributes.temperature * 100)
| abs)
>= 10 >= 10
}} }}
{% endif %}
actions: actions:
- variables: - variables:
# If we don't have a trigger ID the automation has been run manually, in # If we don't have a trigger ID the automation has been run manually, in
# which case we pull the temperature from the sensor instead of the # which case we pull the temperature from the sensor instead of the trigger
# trigger state. # state.
external_temperature: >- external_temperature: |-
{% if trigger.id is not defined %} {% if trigger.id is not defined %}
{{ state_attr(temperature_entity, 'temperature') }} {{ state_attr(temperature_entity, 'temperature') }}
{% else %} {% else %}
{{ trigger.to_state.attributes.temperature }} {{ trigger.to_state.state | float }}
{% endif %} {% endif %}
- action: number.set_value - action: number.set_value
target: target:
entity_id: |- entity_id: number.{{ states[climate_entity].object_id }}_external_measured_room_sensor
number.{{ states[climate_entity].object_id }}_external_measured_room_sensor
data: data:
value: >- value: |-
{{ {{
(external_temperature * 100) | int (external_temperature * 100) | int
}} }}