Zigbee2MQTT - Danfoss Ally send external temperature to TRV version 2

Hello together,

i updated the blueprint from @napalm to update danfoss ally valves with external temperature sensors over zigbee2mqqt. This version does not need any timers anymore and will update according to radiator mode minimum interval, 5 minutes for covered, 30 minutes for uncovered AND temperature change above 0.1K OR 30 minutes for covered, 180 minutes for uncovered).

Original blueprint link:
https://community.home-assistant.io/t/zha-zigbee2mqtt-danfoss-ally-send-external-temperature-to-trv/

Thanks to @napalm for his blueprint, many thanks to @TheFes who helped a lot with this at discord channel.

See post 8 for the updated automation-blueprint.

Hi,

I have been using this for some days now. and I have an issue.

I the them sensor have not changed for 3 hours, it does not refresh the value “External measured room sensor”, so after 3 hours, the TRV resets to -8000
image

Hello, i had the same issue with one of my TRV´s (i have 15 of them at my house) also. I had set radiator covered to “true”. I think this problem occured, because i rebooted home assistant and the 30 (35 to -8000 value) minutes timer was close the set the next action again. Because then it was not triggered it was set to radiator uncovered by itself then. Maybe that could be the issue for you also?

Sorry, had a test over night, where HA was running without reboot.

Have made an automation, that forces a restart of the automation, if not triggered in 165 min

I cant reproduce it actually. It works for 15 TRV´s without any problem for now. Do you also run the thermostats in covered mode? Because if i look at your screeshot, there are 2 hours difference from 11:25h to 13:25h which seems to be uncovered mode. Later then, we see 15 minutes difference, which seems to be covered mode. A second idea could be, that maybe the connection is not the best and maybe you have some packetloss?

I have same issue. As long as the temperature does not change script stops sending the temperature and Danfoss Ally cancel the external temperature input.
Maybe the script is not able to detect “covered mode” correctly in some cases.
For now I modified the script and set fixed values for min/max update time and waiting for results

min_update_minutes: 5
max_update_minutes: 10

I have new version of TRV with “G” before serial number if that matter

just quick update: it is not working even when I set min/max update intervals to fixed values.

Hi, it seems there are indeed sometimes problems with the automation. I had not really seen it. I updated the automation, see below. Please test this one which needs a timer. You also should make a new script.noop with this yaml code:

script.noop:

alias: noop
sequence:
  - delay: "00:00:00"

automation-blueprint:

blueprint:
  domain: automation
  name: Danfoss Ally Ext Temp Z2M v2
  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:
          entity:
          - domain:
            - climate
          multiple: false
    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
          multiple: false
    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
          multiple: false
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
    {% elif radiator_covered_state == 'on' %}
      5
    {% else %}
      script.noop
    {% endif %}
  max_update_minutes: |
    {% if radiator_covered_state == 'off' %}
      180
    {% elif radiator_covered_state == 'on' %}
      30
    {% else %}
      script.noop
    {% 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: and
    conditions:
      - condition: template
        value_template: "{{ states(temp_sensor_id) is not none }}"
      - condition: template
        value_template: "{{ states(temp_sensor_id) | float(0) > 0 }}"
      - condition: or
        conditions:
          - condition: and
            conditions:
              - condition: template
                value_template: >-
                  {% set number_entity = device_entities(device) |
                  select('search', 'number.*_external_measured_room_sensor') |
                  list | first %} {{ ((states(number_entity) | float(0) -
                  states(temp_sensor_id) | float * 100) | round(0)) | abs >=10
                  }}
              - condition: template
                value_template: >-
                  {% set last_trigger = state_attr(this.entity_id,
                  'last_triggered') %} {{ last_trigger is none or now() -
                  last_trigger > timedelta(seconds=min_update_minutes * 60) }}
          - condition: state
            entity_id: !input max_update_timer_id
            state: idle
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
max_exceeded: silent
1 Like

Using the blueprint for a few days now, seems to work as expected (uncovered mode). Thank you for this!!
One thing that is a bit annoying is that the external temperature reported by the Ally (“external_measured_room_sensor”) is not in °C so I cannot plot it against the value of the actual external temperature sensor. Anybody an idea what needs to be changed to get this provided? I think this could be done with some helper/automation, but preferably zigbee2mqtt could provide this out of the box for the Allys (maybe as a separate attribute for backwards compatibility)?

1 Like

Hi
Would anyone care to guide me making this timer with appropriate settings for this blueprint?

Settings → Automations & Scenes → Scripts → Add Script → Create new script → click on three dots in the top right corner and select YAML editor → paste the code there

1 Like

Is the value for external_measured_room_sensor in fahrenheit?
The default (aka off) value is -8000 what would be an external temp like 21°C as a value?

the value is in °C times 100, so 21.34°C will show up as a “raw integer” value of 2134

Why is version 2 not a blueprint? It is easyer to implement… Please make V2 as blueprint :slight_smile:

Thanks for the Blueprint. I have tested with 2 thermostats for 1 sensor and both in uncovered mode. They also have some load balancing enabled. It works great! The temperature of the external sensor stays close enough to the SP of the thermostat. Doing the period the SP was 16 °C.


Quick question, what will happen if the external sensor becomes unavailable eg. runs out of battery? The External_measured_room_sensor property will be disabled because of no temperature update?