From 3de96fbdc58dc99ea80c5467f83952eb8d5d2c63e81c59870e5658a89f5b7c21 Mon Sep 17 00:00:00 2001 From: Rune Juhl Jacobsen Date: Mon, 14 Apr 2025 08:52:18 +0200 Subject: [PATCH] Fix another bug in Danfoss Ally blueprint This time we default to resetting the external temperature if the trigger state is not numeric. --- .../danfoss_ally_trv_external_sensor.yaml | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/blueprints/danfoss_ally_trv_external_sensor.yaml b/blueprints/danfoss_ally_trv_external_sensor.yaml index ba1ab38..62e792f 100644 --- a/blueprints/danfoss_ally_trv_external_sensor.yaml +++ b/blueprints/danfoss_ally_trv_external_sensor.yaml @@ -2,11 +2,11 @@ blueprint: author: runejuhl homeassistant: min_version: 2025.2.4 - name: Radiator external temperature sensor control (0.0.3-alpha) + name: Radiator external temperature sensor control (0.0.4-alpha) description: |- ## Radiator external temperature sensor control - Version `0.0.3-alpha`. + Version `0.0.4-alpha`. Sets the `external_measured_room_sensor` value on Danfoss Ally TRV, enabling the TRV to adjust the valve based on an external sensor. @@ -73,16 +73,19 @@ actions: # which case we pull the temperature from the sensor instead of the trigger # state. external_temperature: |- - {% if (trigger.id is not defined) or (trigger.to_state.state in ['unavailable', 'unknown']) %} - {{ states(temperature_entity) }} + {%- if (trigger.id is not defined) -%} + {%- set new_temp = states(temperature_entity) | float(-1.0) %} {% else %} - {{ trigger.to_state.state | float }} + {%- set new_temp = (trigger.to_state.state | float(-1.0)) -%} {% endif %} + {%- if new_temp <= 0.0 -%} + -8000.0 + {%- else -%} + {{ new_temp * 100 | int }} + {%- endif -%} + - action: number.set_value target: entity_id: number.{{ states[climate_entity].object_id }}_external_measured_room_sensor data: - value: |- - {{ - (external_temperature * 100) | int - }} + value: "{{ external_temperature }}"