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 }}"