Guru needed please:- multi-zone , multi-temp heating automation

Just make an input boolean for them. It can be the same one used in all places. I was under the impression that you needed one of these for

Not the individual thermostats.

Either way. Just make a fake input_boolean and use that as the heater.

Right
I will set about this later when I’m home.
thank you in advance.
I also looked at your GitHub to get a few ideas . I’m a Software Developer for a bluechip UK company here , 35yrs, Python is in my CV and I note I can use it here. Cool. I see you’re quite a guru on HA architecture and system modelling.
Will feedback in due course with screenshots

Many thanks
Daz

There’s about 100 ways to skin this cat, so this solution is not 100% full proof. If you know python, I recommend moving to appdaemon for this.

Python - I wrote a lot of code for Enigma2 if you know what that is?
AppDaemon; that’s a new one. Another area to explore. I’ve just searched in HA and bookmarked a page. Now that looks more my kind of thing than yaml based modelling, granted some will still be required to configure the apps. Is this a suitable learning base? https://appdaemon.readthedocs.io/en/stable/

Yep, that’s the docs. It suits me better too. While I know the automation system very well, I’m still more comfortable with appdaemon. You can do all sorts of logic and it’s easier to manage 1 app than it is to manage 10 separate yaml automations.

@petro All sorted. Cool! Many thanks. !!!

1 Like

Almost worked. However, what happens is that the thermostats continue to function irrespective of their state (idle, heating, off).

Issue

  1. If lounge temp is set to 20c and the ambient is 18c then the heating comes on - correct. But if the thermostat is turned off by touching the power icon on the thermostat card, the heating continues fire. This behavious is further compounded by the fact there is only one “dummy” heater entity for all three thermostats thus the heating is moded on the single thermostat that was the most recent to send its state.

  2. The generic_thermostat entity state attribute is always one of :-

  • heating =user wants heating system to mode on the thermostat values, and the thermostat is demanding heat,

  • idle =user wants heating system to mode on the thermostat values, but thermostat is reporting ambient temp >= target temp,

  • off = user does not want heating system to mode on the thermostat values

Thus the user has a way to disabe part or all of the heating system in a multi zoned thermostat controlled building - just what is needed. However, the automation modes on the “at_target” temp. It needs to mode on the thermostat’s heater state which - according to the docs - has to be a binary entity (switch, input_boolean, etc).

Fix

  1. Each thermostat requires its own “dummy” heater entity to resolve the “on/heating/idle” and “off” states.

  2. The automation needs to mode on each of the “dummy” heater entities to check if all 3 are “off”

So the following is appropriate:

# These need to be used as the entity_id for the **heater** attribute in each **generic_thermostat**
input_boolean:
  thermostat_dummy_heater_room1: 
input_boolean:
  thermostat_dummy_heater_room2: 
input_boolean:
  thermostat_dummy_heater_room3: 

- alias: Turn OFF heater
  trigger:
    platform: template
      value_template: >
        {% set therms = [
          states.input_boolean.thermostat_dummy_heater_room1
          states.input_boolean.thermostat_dummy_heater_room2
          states.input_boolean.thermostat_dummy_heater_room3
          ] %}
        {% set climates = namespace(heat_demand=[]) %}
        {% for therm in therms %}
        {% if therm.state != "heating" %}  #-- Test if a thermostat state is NOT heating ( IDLE or OFF )
        {% set climates.heat_demand = climates.heat_demand + [ therm.entity_id ] %} #-- Add thermostat to list of thermostats NOT demanding heat
        {% endif %}
        {% endfor %}
        {{ climates.heat_demand  | length == therms | length }} #-- Return TRUE if list contains all thermostats (all thermostats are NOT demanding heat
  condition:
    condition: state
      entity_id: switch.danfoss_rxz3_rf_relay_switch_2
      state: 'on'
    action:
      service: switch.turn_off
      entity_id: switch.danfoss_rxz3_rf_relay_switch_2

- alias: Turn ON heater
  trigger:
    platform: template
      value_template: >
        {% set therms = [
          states.input_boolean.thermostat_dummy_heater_room1
          states.input_boolean.thermostat_dummy_heater_room2
          states.input_boolean.thermostat_dummy_heater_room3
          ] %}
        {% set climates = namespace(heat_demand=[]) %}
        {% for therm in therms %}
        {% if therm.state == "heating" %}  #-- Test if heating demand from thermostat
        {% set climates.heat_demand = climates.heat_demand + [ therm.entity_id ] %} #-- Add thermostat to list of thermostats demanding heat
        {% endif %}
        {% endfor %}
        {{ climates.heat_demand | length > 0 }} #-- Return TRUE if list is not empty (at least one thermostat is demanding heat)
  condition:
    condition: state
      entity_id: switch.danfoss_rxz3_rf_relay_switch_2
      state: 'off'
    action:
      service: switch.turn_on
      entity_id: switch.danfoss_rxz3_rf_relay_switch_2

Now it works perfectly, in that any number of thermostats can control the overall heating:-
a) Turn heating ON if ANY thermostat IS demanding heat (target temp > ambient temp)
b) Turn heating OFF when ALL thermostats are NOT demanding heat.

I havent tested the code as I am not at home, but it looks reasonable.

1 Like

Hello ninjadog,

Sorry for interjecting. I’ve just picked up a couple of RXZ-2C dual channel Danfoss receivers, but am failing at the first hurdle of inclusion…The manufacturer “manual” that came with each of them is a 12 page A7 booklet with not a great deal of info.

Can you shed any light on how you included your RXZ-2C into your Z-Wave network? (what buttons did you press? What make/model of Z-Wave controller you have? do you have any Danfoss wall thermostats paired with wither of the two channels on the RXZ-2C?)

Any help you could give me would be much appreciated :slight_smile:

ATB,
bikefright.

there’s so many variables at play

have you debugged using log file entries?

If you don’t understand, then you need to read up on z-wave, home assistant, devices, logging, and etc

the topic is to lengthy , albeit not complex , to spoon food you

Thanks ninjadog - I don’t consider myself a n00b when it comes to HA, Z-Wave, ZHA etc. (others may disagree). I should have been more specific in my request :wink: I don’t need spoon feeding :wink: Just been scratching round in the dirt for info on how to actually get the things into inclusion mode in the first place.

This is all part of the planned removal of my Hive receivers (see here:my long winded thread)

In the meantime I’ve figured out how to factory reset the bloody things.

This at least gets me to a point where I can attempt an inclusion. However, it fails the node add. I’ll start looking at logs now.

I pulled open-zwave 1.6 into /config some time ago to take advantage of the manufacturer specific multi-level sensor support for my Eurotronic spirit Z-waves (of which I have 16 working perfectly for over a year now) which may be a difference between your setup and mine perhaps?

I’ve tried them both on a separate SystronicsRF RPi based system I’m beta testing at the moment (https://www.systronicsrf.com/) with the same model Everspring SA413 USB stick (I’ve got three of theses USB sticks, so one spare for testing), but that platform is “hands-off” log wise, so I’m none the wiser other than it didn’t work there either. Pretty sure therefore that I don’t have two broken receivers.

I’m running HA in Docker under ubuntu - which again could be a difference.

There must be something fundamental I’m missing - If I get nowhere tomorrow, I’ll make a fresh post for help and provide a bunch of logs.

Obvious question: is your Z-Wave network exclusively secure, exclusively insecure or a combination?
I ask because on the face of it, these RXZ-2C receivers are Z-Wave 4.28, so are not Z-Wave Plus. All my other devices are both Z-Wave Plus and secure.

Cheers,
bikefright.

I have no idea what your problem is. State it , clearly.
Neither am I going to read all those links.
And you still have not provided any logs.
And don’t confude openhab with HA. Two completely different architectures and models.
You’re not helping yourself - so why should I ?

My Danfoss RX2 works perfectly.

I hijacked your thread. For that I Apologise (again). Not to worry. I am figuring things out for myself.

Read them, dont’ read them. Either way, the measure of the man is not down to two posts on a single thread (yours) on one forum - specific to one home automation platform. If I ask what seems a simple question you assume I need to be spoon fed.

Pointelss providing logs in my first post that show nothing but me clicking and the z-wave controller timing out/not finding anything to add. 'cos the RXZ-2C is not in inclusion mode. No nodes to find/add…

I am well aware of the differences between automation platforms. z-wave is z-wave regardless of platform.

When hunting for things like supported command classes, feature set and inclusion mode (secure/insecure) for a new device I check all home automation forums - home-assistant, openHAB, smarththings etc. The same device is likely to present similar issues on other automation platforms. This was the case here.

My aim is always to help myself and to try and help others if I can. I reach out if I hit a problem I can’t resolve myself - as I did here.

In my first post for help, I specifically asked what buttons you pressed for inclusion. Perhaps I though it was obvious that I was:

  1. talking about the RXZ-2C.
  2. asking which specific button sequence you used to get the RXZ-2C into inclusion mode.

I’ve re-read my first post and you could be forgiven for thinking I was also asking which in HA you pressed to include a node. That was not the case.

I worked out for myself (actually by reading an openHAB thread!) what the button sequence was to factory reset the RXZ-2C which is a pre-cursor to inculsion mode - which I then documented here on your post to help others who might have the same problem with lack of useful instructions like me. The links out are therefore also for others who may read this forum who have the same problem.

To be specific, the “instructions” that came with my units state:

  • If the RXZ is to be installed into a pre-existing network, the user should carry out the following steps:
    • Ensure the RXZ is in its factory reset state (programme LED flashing green).
    • if the RXZ is not factory reset, the user should follow the method given in the factory reset procedure in this leaflet.

There are no instructions in the two leaflets I received on how to factory reset the RXZ-2C (so it is not a misprint or page missing in one of them).

My problem has moved on now as I stated in my second post. I also stated I was going to look at logs and make a fresh post (rather than continue here). Feel free to chime in and help out there too.

Glad yours works perfectly.

don’t like your attitude at second to last para. You were doing ok upto then.

BYE!

FYI, all 3 use different protocols. You absolutely cannot compare functionality between the 3 and expect the same results. SmartThings has their own proprietary protocol. OpenHab uses something odd, can’t find the name for it. And HomeAssistant uses OpenZWave. Also, HomeAssistants ZWave platform is 3 years old and hasn’t been updated. SO Command classes and other features are not available without heavy configuration editing (this is changing in the next 3 months).

Don’t forget you can also search the issues both open and closed at the openhab GitHub Zwave at link below. Openhabs Zwave works very well and is very actively updated so if there is an issue there is probably some info on what the solution is there.

For any HA members finding this from a search, here is my [again] recoded functionality based on @petro contribution above.

Notes

  • Subtle changes to the therms list and use of is_state_attr , the post/suffix notation a.b.c is not recommended according to the docs - and so I brought the function is_state_attr into play. This could be improved further by checking state values but I thought that was an overkilll.

  • Generic Thermostats have three hvac modes of operation: heating , idle and off. These are moded internally by HA so need to check temps, but rather use the hvac modes - stored in the hvac_action attribute.

  • This is a package file under packages in the config directory - so note the filepath/name. If you dont use packages [which I do and are really useful] then remove the hvac_controller: line, the automation: lines, and place the rest into your automations.yaml file .

CREDIT to @petro

# filepath: ~/.homeassistant/packages/hvac/controller.yaml
# This is a 3 zone config - replace zone1, zone2 etc with your entity_IDs
#
hvac_controller:
  # Thermostat UI will be one of:
  #   - heating (demand heat)
  #   - idle (at temp)
  #   - off (selected off by user)
  automation:
    - alias: Turn off zones that are NOT 'heating'
      trigger:
        platform: template
        value_template: >
          {% set therms = [
            'climate.zone1',
            'climate.zone2',
            'climate.zone3',
            ] %}
          {% set climates = namespace(no_demand=[]) %}
          {% for therm in therms %}
            {% if not is_state_attr(therm, 'hvac_action', 'heating') %}
             {% set climates.no_demand = climates.no_demand + [ therm.entity_id ] %}
            {% endif %}
          {% endfor %}
          {{ climates.no_demand | length == therms | length }}
      condition:
        condition: state
        entity_id: switch.danfoss_rxz3_rf_relay_switching_unit_switch_2
        state: 'on'
      action:
        service: switch.turn_off
        entity_id: switch.danfoss_rxz3_rf_relay_switching_unit_switch_2

    - alias: Turn on zones that are demanding 'heating'
      trigger:
        platform: template
        value_template: >
          {% set therms = [
            'climate.zone1',
            'climate.zone2',
            'climate.zone3',
          ] %}
          {% set climates = namespace(demand=[]) %}
          {% for therm in therms %}
            {% if is_state_attr(therm, 'hvac_action', 'heating') %}
              {% set climates.demand = climates.demand + [ therm.entity_id ] %}
            {% endif %}
          {% endfor %}
          {{ climates.demand | length > 0 }}
      condition:
        condition: state
        entity_id: switch.danfoss_rxz3_rf_relay_switching_unit_switch_2
        state: 'off'
      action:
        service: switch.turn_on
        entity_id: switch.danfoss_rxz3_rf_relay_switching_unit_switch_2

Jumping in late.

You can simplify and extend this a bit.

The objective is to support multiple zones with multiple sensors and thermostats in each zone.

  1. Put all the multi-zone demand inputs in to a group.

Homogeneous groups are OR-groups by default - so iff if any one demand input is ON the group is ON. Trigger the boiler off the group status.

  1. Replace all uses of input_boolean with mqtt switches. These are easier to debug and have manual control of the demand if you need it.
  1. Group all temperature sensors in a room in a min_max sensor (which also supports ‘last’, ‘mean’ and ‘median’ modes).
  1. Group all thermostats in a room and synchronize set-points and modes with an automation

Service calls on homogeneous groups are sent to all members of the group.

In the example above I happen to use a single automation with a mapping (by name) of the room generic (virtual) thermostat to the (real) thermostat group (climate.x_temperature -> group.g_x_thermostat) but a per-room automation may be more flexible:

2 Likes

I needed something similar and i created this component

1 Like

My trvs don’t have an target set point. They are showing up as an climate. How can I use your component ? To have multi zone heating.

I’m about to set up my heating automation. Any particular smart TRV that you could suggest? (Preferably wifi or zigbee) Or any that you would advise against?