Smart Thermostat for deCONZ Climate devices (like external sensor and open window detection)

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

Currently some TVRs have a mode issue in deCONZ heat means often boost so feel free to change it or check [PR home-assistant/core #47767] and [Issue deconz-rest-plugin #1098]

The most deCONZ Zigbee TVR have an internal Temperature sensor.
The fact that this sensor ist located direct to the radiator will generated false measurements.
To fix this this blueprint uses an external temperature sensor and adjust the offset of the Thermostat to match the room temperature,
it also will be linkt to an External window sensor group to turn off the heating,
if a window is open. And also turns off if a specific outside temperature is reached to avoid heating in summer

blueprint:
  name: Smart Thermostat for deCONZ
  description: >-
    The most deCONZ Zigbee TVR have an internal Temperature sensor.
    The fact that this sensor ist located direct to the radiator will generated false measurements.
    To fix this this blueprint uses an external temperature sensor and adjust the offset of the Thermostat to match the room temperature,
    it also will be linkt to an External window sensor group to turn off the heating,
    if a window is open. And also turns off if a specific outside temperature is reached to avoid heating in summer
  domain: automation
  input:
    window_sensor:
      name: Window(s) / Door Sensor(s)
      selector:
        entity:
          domain: group
    weather:
      name: Weather
      description: "Specify your weather to get the current outside temperature from."
      selector:
        entity:
          domain: weather
    wintermode:
      name: Wintermode
      description: "The ouside temperature needs to be below this to activate wintermode. (Default = 16°C)"
      default: 16
      selector:
        number:
          step: 0.5
          min: 0
          max: 150
          unit_of_measurement: "°C or °F"
    wintermode_delay:
      name: Wintermode Delay
      description: "Time the outside temperature neeeds to stay above the wintermode temperature to turn the heating off."
      default: 30
      selector:
        number:
          mode: box
          min: 1
          max: 86400
          unit_of_measurement: minutes
    temperature:
      name: External Temperature Sensor
      selector:
        entity:
          domain: sensor
          device_class: temperature
    thermostat:
      name: Thermostat
      selector:
        entity:
          domain: climate

mode: queued
max_exceeded: silent
max: 10

variables:
  temperature: !input temperature
  thermostat: !input thermostat
  currenttempoffset: >-
    {{ ((states(temperature)|float - state_attr(thermostat, 'current_temperature')|float) * 100) }}
  offset_val:  >-
    {%- if (currenttempoffset != 0) %}
      {{ currenttempoffset + (state_attr(thermostat, 'offset')|int) }}
    {% elif (currenttempoffset == 0) %}
      {{ state_attr(thermostat, 'offset')|int }}
    {% endif %}
trigger_variables:
  temperature: !input temperature
  thermostat: !input thermostat
trigger:
  - platform: state
    entity_id: !input thermostat
    from: 'off'
    to: 'heat'
  - platform: template
    value_template: "{{ state_attr(thermostat, 'current_temperature') }}"
  - platform: state
    entity_id: 
      - !input temperature
      - !input window_sensor
  - platform: numeric_state
    entity_id: !input weather
    attribute: temperature
    below: !input wintermode
    for: !input wintermode_delay
  - platform: numeric_state
    entity_id: !input weather
    attribute: temperature
    above: !input wintermode
    for: !input wintermode_delay
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: !input window_sensor
                state: 'off'
              - condition: numeric_state
                entity_id: !input weather
                attribute: temperature
                below: !input wintermode
        sequence:
          - service: deconz.configure
            data:
              entity: !input thermostat
              field: /config
              data:
                offset: 0
          - service: deconz.configure
            data:
              entity: !input thermostat
              field: /config
              data:
                offset: >-
                  {{ offset_val }}
          - service: climate.set_hvac_mode
            data:
              hvac_mode: 'heat'
            entity_id: !input thermostat
          - delay: 00:00:05
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: !input window_sensor
                state: 'on'
              - condition: numeric_state
                entity_id: !input weather
                attribute: temperature
                above: !input wintermode
        sequence:
          - service: climate.set_hvac_mode
            data:
              hvac_mode: 'off'
            entity_id: !input thermostat
    default: []
7 Likes

Thanks for this. Is there a reason the window sensor is constrained to the group domain? I would have expected the binary_sensor domain here, since at least all MY window sensors use this entity type.
So I changed that on my install, but wanted to know your reasoning just so I don’t make a mistake.

EDIT:
Isn’t there a conflict here? Depending on what triggered the automation, it will either:

  • disable the thermostat or
  • generate a new offset AND enable the thermostat

That means if my window sensor triggers the flow, it causes the thermostat to be disabled. But if 2 minutes later, my room temperature sensor reports a new value, the automation will run again and re-enable the thermostat despite the window still being open. Am I seeing that correctly?
I will experiment a bit…

Do deconz support TVRs? Their documentation mentions only lights, switches and sensors… Recently I come by Eurotronic Zigbee TVR, that is relatively cheap vs its Zwave counterpart, and I’d be interesed in buying some of these. But do not even know if these can be somehow integrated via deconz? Phoscon UI does not even have functionality to add one…

I added my Danfoss Ally by pairing a new “Sensor”. Weird, I know, but everything seems to work out of the box. In Phoscon, you’ll only see a temperature sensor, but the climate entity is exposed to HA and works just fine.

(I recommend doing some research about the Eurotronic TVRs. After reading about issues with pairing and maintaining connection in deconz, I cancelled my order and ordered the aforementioned Danfoss Ally. YMMV of course)

1 Like

Thanks a lot Biont! I was really affraid going Zigbee route for thermostats, so I’ll probably reconsider, a bit more expensive, variant with Eurotronic Spirit Zwave variant…

Thx for that. I have Tuya/Moes TRV (TS0601) and problem heat / boost. As I understand I should change in your blueprint heat to auto and it should work?

          - service: climate.set_hvac_mode
            data:
              hvac_mode: 'auto'

yes thats right.

if you want more, i work currently on a custom component (HACS) GitHub - KartoffelToby/better_thermostat: This custom component for Home Assistant will add crucial features to your climate-controlling TRV (Thermostatic Radiator Valves) to save you the work of creating automations to make it smart. It combines a room-temperature sensor, window/door sensors, weather forecasts, or an ambient temperature probe to decide when it should call for heat and automatically calibrate your TRVs to fix the imprecise measurements taken in the radiator's vicinity.

its in alpha but i plan the release of 1.0 in Feb.

1 Like

Thx. I saw this component but I’m on deconz not z2m… Unless its working with deconz?

You can add toogle in blueprint to help others?

Would love to know this, too