Zone Switch Z2: operate a heating zone valve from a heat demand sensor [CLOSED]

Introduction

The Zone Switch Z2 blueprint offers a secure way of operating a heating zone control valve, or a boiler that needs a heat demand signal, from a heat demand sensor.

Zone Switch Z2 can stand alone or be used as part of the suite than includes Heating X2: Schedule thermostat by calendar, and Calendar switch Y2: switch a device using a calendar

The required helpers, timers, templates, automations etc. can be created by hand, or with the assistance of the Heating XYZ Code Generator.

Features

  • Zone control: can switch one or multiple heating zone valves, or a boiler that needs a heat demand switch, based on heat demand from a group of thermostats
  • Away mode: (optional) turns off there is no one at home
  • Notifications: if the valve switch does not respond to a new setting, goes offline, or comes back online
  • Logging: optional recording of key zone switching events into a log file
  • Robust: Graceful degradation when a zone switch or a heat demand sensor is unavailable
  • Battery-efficient: conserves swiycj battery life (is applicable) by only transmitting real changes

Ekran Resmi 2024-03-14 23.05.23

History

The Zone Switch Z2 blueprint is based on the code previously developed for Heating X2: Schedule thermostat by calendar, and Calendar switch Y2: switch a device using a calendar. It maintains constistent methods, style and robustness policies.

Installation


Get the Zone Switch Z2 Blueprint


Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or use this link to access the code manually in GitHub.


Get the Heating XYZ Log File Entry script

The blueprint requires a script that facilitates the formatting and writing of the log file(s). (More on logging below). It is mandatory, even if you do not want logging, because the test for logging required is included in the script to declutter the blueprint.

This is not a blueprint, just a script, so the recommended installation method is:


  1. Create the file scripts.yaml in /CONFIG/ if you do not already have it
  2. In configuration.yaml add the following line if you do not already have it
script: !include scripts.yaml
  1. Copy the heating_xyz_logfile_entry code from GitHub
  2. Paste the code into scripts.yaml

The same script is used by Heating X2, Calendar Switch Y2, and Zone Switch Z2, so you only need do this once.


Devices

Zone control valves

Zone Switch Z2-based automations can control anything with domain ‘switch’. This will normally be a smart switch connected to the zone control or boiler heat demand input. ‘On’ means the valve is open (hot water will circulate) and ‘off’ means it is closed.

Heat demand sensors

These will generally be built as a set of template sensors for each thermostat, to indicate when heat is required for that thermostat, grouped by the thermostats in the zone. Details below.

Helpers and Timers

The blueprint requires a number of helpers and timers, which are used as global variables. Create the helpers by hand for each automation (zone) that you are going to create with the blueprint.

Input Text

  • Setting reason – into which the automation writes the reason for the current setting for display on dashboards. Make the length 255 characters.

Input_boolean

  • Required state – into which the automation writes the state currently requşred for the zone (to optimise radio traffic and check responses).

Timers

  • Echoblock timer – which the automation uses to time the response from a zone valve switch before checking its setting.

Logging

Logging is optional, so skip this step if you do not want it. The default blank in the blueprint logging service name indicates that no logging is required.

To enable logging

  1. If you want to keep your log fles in a folder, then add the folder to /CONFIG/ – in my example it is called log_files.
  2. In configuration.yaml add an entry for each automation like this
      notify:
        - name: zone_2_valve_control_log 
          platform: file
          filename: log_files/zone_2_valve_control.log
          timestamp: true 
  1. Specify the service name (not the file name), exactly as defined, in the blueprint parameters (below). In my example the name is zone_2_valve_control_log

The Automations

Create one automation for each zone using the UI.

Select the Blueprint Zone switch Z2 and specify in the inputs the zone valve switch, heat demand sensor, helpers and timers described above. There are also some optional parameters…

Blueprint Parameters

Zone Control Principles

In some larger installations, the heating in rooms is divided over a number of zones through which hot water passes if an electric zone valve is open. Some boilers need the heating controller to tell it when heat is demanded. If the zone valves or boiler switch are connected to smart switches, then they can be controlled as follows. The code can be created by hand or using the Heating X2 Code Generator.

  1. Implement the heat demand template sensor for each thermostat – a ‘heat demand’ binary sensor that is ‘on’ when the set temperature is higher than the measured (ambient) temperature and off if it is not. This uses the set and measured temperatures, so actually you need all three for each thermostat.

  2. Create a binary sensor Group of all the heat demand sensors for the thermostats that belong to the same zone. This Zone Group will be ‘on’ if any one of the thermostats is demanding heat, and off only if none of them are.

  3. For each zone create an automation using the Zone Switch Z2 blueprint.

Heat demand sensor

To create by hand, use the following example for each thermostat. For a large installation, you might find it easier to use the Heating X2 Code Generator.


### Guest bedroom trv set temperature
- sensor: 
  - name: Guest bedroom trv set temperature
    unique_id: guest_bedroom_trv_set_temperature
    unit_of_measurement: 'C'
    icon: mdi:thermometer
    state: "{{ state_attr('climate.guest_bedroom_trv', 'temperature') }}"

### Guest bedroom trv measured temperature
- sensor:
  - name: Guest bedroom trv measured temperature
    unique_id: guest_bedroom_trv_smeasured_temperature
    unit_of_measurement: 'C'
    icon: mdi:thermometer
    state: "{{ state_attr('climate.guest_bedroom_trv', 'current_temperature') }}"

### Guest bedroom trv heat demand
- binary_sensor:
  - name: Guest bedroom trv heat demand
    unique_id: guest_bedroom_trv_heat_demand
    icon: mdi:heat-wave
    state: "{{ float(state_attr('climate.guest_bedroom_trv', 'temperature'),0) > float(state_attr('climate.guest_bedroom_trv', 'current_temperature'),99) }}" # false if either sensor is unavailable

Heat demand group

This can be created as a binary sensor group in the UI, or using YAML like the following example

###
### Zone 3 First Floor Heat Demand Group
###
- platform: group
  name: "Zone 3 First Floor Heat Demand Group"
  unique_id: zone_3_first_floor_heat_demand_group
  entities:
    - binary_sensor.dressing_room_trv_heat_demand
    - binary_sensor.guest_bedroom_trv_heat_demand
    - binary_sensor.landing_trv_heat_demand
    - binary_sensor.main_bathroom_trv_heat_demand
    - binary_sensor.master_bedroom_west_heat_demand
    - binary_sensor.master_bedroom_east_trv_heat_demand
    - binary_sensor.second_bedroom_north_heat_demand
    - binary_sensor.second_bedroom_south_trv_heat_demand

Starter Dashboard

Dashboards can be complex for a large heating installation. They having nothing to do with the Blueprint, but you might find is useful to have a zone control card (such as that illustrated above) for each zone, on the same view as the thermostats for the zone. This gives transparency that the zone switching is working correctly.

I use Mushroom Cards and the Better Thermostat card, so if you want to use this card design, you need to import both of them first from HACS or change the dashboard code to use standard cards.

The following is the code for one of my cards. Adapt the names as required.

type: vertical-stack
cards:
  - type: custom:mushroom-title-card
    title: Zone 3 Control
  - type: entities
    entities:
      - entity: binary_sensor.zone_3_first_floor_heat_demand_group
        icon: mdi:check-circle-outline
      - entity: switch.zone_valve_3_first_floor
    state_color: true
  - type: markdown
    content: '{{ states(''input_text.zone_3_setting_reason'') }}'

More details

The guide “Smart Heat Your Home with Heating XYZ”, with hardware and software configuration tips and detailed instructions for using the Heating XYZ Code Generator, is bundled with the Code Generator download.

Good Luck!

:+1:

Zone Switch Z2 has now been consolidated with related components of my Home Assistant smart heating system into the new topic Project HEATHER.

This topic is therefore closed; please make further comment in the new topic.