Skip to content

Conversation

@ouaibe
Copy link

@ouaibe ouaibe commented Oct 31, 2025

Proposed change

This is a quirks V2 configuration that allows reading of the proprietary/manufacturer power consumption (W) and Energy (Wh) attributes for Stelpro (identified as "Stello" by ZHA) Allia HT402 (Hilo-sold) thermostats.

Additional information

These attributes (0x4009 and 0x4008) have been identified from Koenkk/zigbee2mqtt#14651 (all works in Z2M flawlessly but not in ZHA).
The quirks makes them visible in HA as Power (immediate) and Energy (cumulative) sensors for every HT402 Thermostats connected.
image

Device diagnostics

2025-10-26 08:57:48.048 DEBUG (MainThread) [zha.zigbee.cluster_handlers] [**REDACTED**]: cluster_handler[thermostat] attribute_updated - cluster[Thermostat] attr[16392] value[846]
2025-10-26 08:57:48.048 DEBUG (MainThread) [zha] Emitting event cluster_handler_attribute_updated with data ClusterAttributeUpdatedEvent(attribute_id=16392, attribute_name=16392, attribute_value=846, cluster_handler_unique_id='**REDACTED**', cluster_id=513, event_type='cluster_handler_event', event='cluster_handler_attribute_updated') (8 listeners)
2025-10-26 08:57:48.049 DEBUG (MainThread) [zha.zigbee.cluster_handlers] [**REDACTED**]: cluster_handler[thermostat] attribute_updated - cluster[Thermostat] attr[16393] value[59]
2025-10-26 08:57:48.049 DEBUG (MainThread) [zha] Emitting event cluster_handler_attribute_updated with data ClusterAttributeUpdatedEvent(attribute_id=16393, attribute_name=16393, attribute_value=59, cluster_handler_unique_id='**REDACTED**', cluster_id=513, event_type='cluster_handler_event', event='cluster_handler_attribute_updated') (8 listeners)

zha-8fdbbba0cd6c61f53202f4f5a2f05d82-Stello HT402-708e916b645a299a90a9f1b6289e1505.json

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works
  • Device diagnostics data has been attached

ouaibe and others added 7 commits October 30, 2025 08:03
@charlesp-l
Copy link

charlesp-l commented Nov 12, 2025

+1 to get this added! I know there is also a way to expose a field to display the exterior temperature

It seems trivial in the Zigbee2MQTT world, I don't know what it would look like in the ZHA world.
https://github.com/Koenkk/zigbee-herdsman-converters/blob/cfe8de84ca6f0d40c5a1cdf3f95fb3b6bdd5346e/src/devices/stelpro.ts#L290C1-L290C55

@ouaibe
Copy link
Author

ouaibe commented Nov 12, 2025

Yes I actually have a local working version of that external temperature display - it's perfectible (as the sensor created on the HA devices is off by x100C because of the Stelpro format), but the display on the termostats themselves works fine.

It allows you to read from a temperature readout anywhere and update it accordingly on the termostats in your home.

I will commit these additional options to the PR later.

ouaibe and others added 2 commits November 11, 2025 21:22
Add the outdoor temperature support with the caveat that it is off by x100C as it is the necessary format for the thermostat to display it properly and QuirksV2 don't seem to support inline lambda  to_value/from_value in ZCLAttributeDef.
@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.25%. Comparing base (aa7b32d) to head (91df952).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4453      +/-   ##
==========================================
+ Coverage   92.24%   92.25%   +0.01%     
==========================================
  Files         369      370       +1     
  Lines       12088    12110      +22     
==========================================
+ Hits        11150    11172      +22     
  Misses        938      938              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ouaibe
Copy link
Author

ouaibe commented Nov 12, 2025

Using the code newly pushed to the PR, here's an HA automation you can use to update the external temperature every 15min:

  • Reads the temperature from sensor.openweathermap_temperature
  • Creates a list of ieee addresses for all your thermostats
  • Pushes the new attribute to them using zha.set_zigbee_cluster_attribute
alias: Push outdoor temp to Allia thermostats (every 15 min, ZHA)
triggers:
  - minutes: /15
    trigger: time_pattern
conditions:
  - condition: template
    value_template: "{{ temp_c_x100 is not none }}"
  - condition: template
    value_template: "{{ thermostats | count > 0 }}"
actions:
  - repeat:
      for_each: "{{ thermostats }}"
      sequence:
        - data:
            ieee: "{{ repeat.item }}"
            endpoint_id: 25
            cluster_id: 513
            cluster_type: in
            attribute: 16385
            value: "{{ temp_c_x100 }}"
          action: zha.set_zigbee_cluster_attribute
variables:
  temp_c: "{{ states('sensor.openweathermap_temperature') | float(0) }}"
  temp_c_x100: "{{ (temp_c * 100) | round(0) | int }}"
  thermostats: >
    {% set pattern = '^sensor\.thermostat_.*_outdoor_temperature$' %} {% set out
    = namespace(list=[]) %} {% for e in states.sensor |
    selectattr('entity_id','match',pattern) %}
      {% set did = device_id(e.entity_id) %}
      {% set ieee = (device_attr(did, 'identifiers')
                     | selectattr(0, 'equalto', 'zha')
                     | map('last') | list | first) %}
      {% if ieee %}{% set out.list = out.list + [ieee] %}{% endif %}
    {% endfor %} {{ out.list }}

Proof that it works:

image image

@charlesp-l
Copy link

It (mostly) works on my installation. Power and energy seem to work as expected! The outdoor temperature does have some issues...

  1. The writable outdoor temperature isn't shown as outdoor_temperature, but as sensor.basement_thermostat_temperature:
image image (The device diagnostic does show the `allia_outdoor_temperature`, but the HA UI doesn't, not sure exactly why.)
  1. As you can guess, the automation therefore fails as the thermostats template doesn't get any sensor that matches '^sensor\.thermostat_.*_outdoor_temperature$'.
  2. (Suggestion) Maybe the outdoor_temperature could be set as writable only, instead of readable/write, as it's not a sensor per se. I don't know if there something else than a sensor to describe this? But that's not very important.

Thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants