Danfoss Ally TRV working with remote temp sensor

I did a script for the load but currently there is a bug in Z2M which will be fixed in the next update (sets the max load at 100)

first I create a sensor that calculates the average load

sensor:
  - platform: min_max
    entity_ids:
       - sensor.thermostat_salon_1_load_estimate
       - sensor.thermostat_salon_2_load_estimate
    name: salon_avg_load
    type: mean

and then I did a quick script to write the values:

sequence:
  - service: number.set_value
    target:
      entity_id:
        - number.thermostat_salon_1_external_measured_room_sensor
        - number.thermostat_salon_2_external_measured_room_sensor
    data:
      value: '{{ (states("sensor.temp_1_temperature") | float * 100) | round(0)}}'
  - service: number.set_value
    target:
      entity_id:
        - number.thermostat_salon_1_load_room_mean
        - number.thermostat_salon_2_load_room_mean
    data:
      value: '{{ (states("sensor.salon_avg_load") | float) | round(0)}}'
mode: single
alias: Update Thermostat Salon
icon: mdi:radiator

Now sometimes I am seeing some strange begaviour with one radiator at 100% and the other at 0% and sometimes the radiator load is -8000 which obviously gives a negative average. I cases where a radiator does not calcualte a load I am not sure what the default value in the script should be

Internal “opened window” sensor is working just fine, no needs additional one.
Regarding external sensor there is no way to use it directly. Only with additional script help (in HA) and even then TRV uses average temp between 2 sensors. It’s not very obvious and useful as for me.

I already read this issue, but would be fine for me.
Till yesterday I was using Danfoss Link system with 5 thermostats. It was showing 21C but for sure in the room it was colder. If I can average the TRV temperature and external sensor, it would be more comfortable - I hope :slight_smile:
Going back to the Danfoss Link the open window sensor was not working at all. In many cases, my wife opened window in the kitchen, and the radiator was fully open and extremely hot. When we closed the window in few minutes we got 24-25C in the room.
So now I’d like to have more comfort and less heat consumption. Now I’m waiting for devices to fully start the HA environment.
I had ordered ConBee II zigbee module and Xiaomi Aquara sensors

Your statement regarding external room sensor is not true. With firmware 1.18 there is a new attribute called “Radiator covered” which basically turns off usage of internal temperature sensor.
Look at my current bedroom trv. It is detecting temeprature over 30C with setpoint at 22,5 but valve is still opened at 90% because room temperature is still too low.
image

3 Likes

“Radiator covered” functionality appeared in latest release (yesterday) in mainline of z2m.

fair point. This is zha topic and you’re taling z2m and I’m talking deconz :wink: But still, 1.18 trv works with external temp sensor much better than before. Cheers!

I did a thermostat card to control my rooms with multiple radiators while still seeing the individual performance. External temperature is what is displayed as the thermostat measured temp. Let me know if you are interested and I can share the code.

image

Definitely interested @Charlie-R

Quite a neat way to monitor if the radiators are acting as intended.

On the left-hand side, is the temperature reading the on-board one, or an external, and the rotation value, what does that account for?

“Currently” is the reading of the external temp sensor
The loading icon is the projected load of that TRV, and the average is what I send to both TRV every 30mn as part of the group, so on that page I have the information that should be present (Sent) to each TRV, I guess you could also display the average load and temp coming from the TRV themselves.

1 Like

+1 here, definitely interested in this card :slight_smile:

+1 also interested…

Can you give me the card code?

Hi. Will this work with deconz? Or just zigbee2mqtt?

It says I have the version 01.12.0008 01.12 is that correct?

I did a pretty simple appdaemon app that controls Ally TRVs through zha, including the load balancing. Code is on github along with the config. There’s also a small module that periodically syncs an external temperature sensor to the TRVs.

I ran into an issue where the load_estimate was negative, but the zha quirk for Danfoss thinks it’s an unsigned int. To fix that I created a small custom quirk (which I put in /config/custom_quirks/__init__.py and then set zha/custom_quirks_path in configuration.yaml):

from zhaquirks.danfoss import DanfossThermostatCluster
import zigpy.types as t


DanfossThermostatCluster.manufacturer_attributes[0x4040] = ("load_radiator_room_mean", t.int16_t)

Now, I don’t know if all of this actually has the intended effect, but at least it seems to be doing the right thing :slight_smile:

1 Like

Hi Guys

Recently got an ally and got it integrated in z2m and running in covered mode with external temp sensor. This ally is on the kitchen radiator and the thing is, the radiator is really poorly placed. it is basically behind the counters with a open port over it.
When the room load is more or less constant the ally is able to track the temperature setpoint pretty but it over/undershoots quite a lot and you can also see on the valve opening (picture)

what are you guys experience with the Adaptation run control, as I understand it, the ally will try to “learn” the room and thereby better know how to control the temperature

I’ve seen in other comments that in ZHA people have enabled Adaptation run control by sending commands to the zigbee cluster ID, is there an equivalent way to do this in z2m and do you guys believe it will help ?

Control algorithm scale factor = 5

Control algorithm scale factor = 3

temp response with scale factor = 3 and setpoint = 21

+1 I’m also very interested of this card :slight_smile:

If anyone else has an example how to create a sensor for Danfoss Ally valve state (pi_heating_demand I guess) I would be interested :slight_smile:

1 Like

I was able to figure out myself how to get Danfoss Ally valve state by reading the PIHeatingDemand attribute periodically. I have updated the firmware of my Allys to version 1.18, haven’t tested this on earlier firmware versions. Here’s how I did it, hopefully someone else might find this useful:

First I installed zha-toolkit custom component: GitHub - mdeweerd/zha-toolkit: 🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant. This custom components allows (among other things) one to read Zigbee cluster attribute and write it to a state of a sensor: GitHub - mdeweerd/zha-toolkit: 🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant.

So as first step I created an automation that reads the PIHeatingDemand of my Danfoss Ally TRVs to sensors. Below is an example that creates a sensor called sensor.office_radiator_thermostat_valve_raw and writes PIHeatingDemand to it every 5 minutes

id: read_thermostat_values_to_sensors
alias: Read additional thermostat values and store them to sensors
trigger:
 - platform: time_pattern
   minutes: /5
condition: []
action:
 # Office radiator valve state
 - service: zha_toolkit.execute
   data:
     command: attr_read
     ieee: paste_your_trv_ieee_here
     endpoint: 1
     cluster: 0x0201
     attribute: 0x0008
     state_id: sensor.office_radiator_thermostat_valve_raw
     allow_create: True

Then I created a template sensor that follows the raw value and has a proper measurement unit and an icon set (I tried first customization for the raw sensor, but that didn’t work for some reason):

sensor:
  - name: "Office radiator thermostat valve"
    unique_id: office_thermostat_valve_wrapper
    unit_of_measurement: "%"
    icon: mdi:valve
    state: >
      {{ states('sensor.office_radiator_thermostat_valve_raw') | int(0) }}

This is jut one example how to create sensors from Ally TRV attributes. You can easily follow pretty much any attribute just by changing the cluster and attribute values of zha_toolkit.execute service call.

1 Like

Happy to see that this feature is used !

I think there is no need to create a separate sensor if no value conversion or default value is needed.
The sensor state can be updated directly from the zha_toolkit.

Also note that instead of the IEEE address you can provide the entity name, and if there’s only one cluster of type 0x0201 in the device you can even omit the endpoint (but when setting it, zha_toolkit does not have to spend time and energy on finding these values).

I just added a template sensor with:

- platform: template
  sensors:
    livingroom_heating:
      friendly_name: "Olohuone termostaatti ohjaus"
      unit_of_measurement: '%'
      value_template: "{{ state_attr('climate.danfoss_etrv0100_274b5ffe_thermostat', 'pi_heating_demand')}}"

Didn’t need the ZHA-toolkit

4 Likes