jacekk015 / zha_quirks

All quirks in one place
MIT License
134 stars 20 forks source link

_TZE200_aoclfnxz setting calibration does not "stick" #46

Closed vukisz closed 8 months ago

vukisz commented 10 months ago

Hello. I noticed, that calibration value does not "stick" most of the times. Example when trying to set it to -1.6 instead of -1 Tried 3x times: image

Calibration sensor id number.tze200_aoclfnxz_ts0601_number_temperature_calibration_4 Logs can be found in here: https://drive.google.com/file/d/12uP3gXMozHZBopZBaM-K7pJX3J2umsyw/view?usp=drive_link

EDIT: using this file: ts0601_thermostat_avatto.py

jacekk015 commented 8 months ago

Logs not available anymore. There were few times where TRV firmware had error when ZHA sends 1.6 it reported back only 1.0 If TRV sends to HA 1.0 then HA writes on the panel 1.0 - like the TRV responded

vukisz commented 8 months ago

Sorry. Restored the logs on same link. Should I research options of TRV FW update?

jacekk015 commented 8 months ago

The question is, is that supported by the TRV device? I would need to see debug level logs from situation where you set +0,5 or +0,3 on the TRV device. That could show us what is sent by the Zigbee to HA.

Right now that specific TRV is mapped to Integer directly, so it wont be decimal never.

vukisz commented 8 months ago

Alright so I did following I IRL thermostat: increased from 21.5 to 25.5 (it has 0.5 increments). HA TRV showed 25.0. then increased to 26.0 and HA TRV showed 26.0. Then decreased back to 25.5 and then to 25.0 and both were show as 25.0 in HA. Changed it back to initial 21.5 which again shows as 21.0. Logs included: https://drive.google.com/file/d/1wYQ86Qacf9H0bB5iPICC11tepTystCHU/view?usp=drivesdk

Thanks for all your help and support :-)

jacekk015 commented 8 months ago

But we've talked about temp calibration and you operating the target room temp, not calibration temp on TRV.

Even with that - your TRV by Zigbee sends to HA data as a degrees.

2024-03-10 08:09:53.160 DEBUG (MainThread) [zigpy.zcl] [0x58D8:1:0xef00] Decoded ZCL frame: AvattoManufCluster:get_data(param=Command(status=0, tsn=236, command_id=528, function=0, data=[4, 0, 0, 0, 26]))
2024-03-10 08:09:53.160 DEBUG (MainThread) [zigpy.zcl] [0x58D8:1:0xef00] Received command 0x01 (TSN 54): get_data(param=Command(status=0, tsn=236, command_id=528, function=0, data=[4, 0, 0, 0, 26]))
2024-03-10 08:09:53.160 DEBUG (MainThread) [zhaquirks.tuya] [0x58d8:1:0xef00] Received value [0, 0, 0, 26] for attribute 0x0210 (command 0x0001)
2024-03-10 08:09:53.160 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x58D8:1:0xef00]: cluster_handler[tuya_manufacturer] attribute_updated - cluster[Tuya Manufacturer Specicific] attr[target_temperature] value[26]
2024-03-10 08:09:53.160 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x58D8:1:0x0201]: Attribute report 'AvattoThermostat'[occupied_heating_setpoint] = 2600
2024-03-10 08:09:53.160 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x58D8:1:0x0201]: Attribute report 'AvattoThermostat'[occupied_heating_setpoint] = 2600

So you will never see any 0.5 stepping on the target temp. Chinese engineers made it like that in the firmware.

Opposite to that room temp comes like decidegree:

2024-03-10 08:10:06.603 DEBUG (MainThread) [zigpy.zcl] [0x210A:1:0xef00] Decoded ZCL frame: AvattoManufCluster:get_data(param=Command(status=1, tsn=212, command_id=536, function=0, data=[4, 0, 0, 0, 245]))
2024-03-10 08:10:06.603 DEBUG (MainThread) [zigpy.zcl] [0x210A:1:0xef00] Received command 0x01 (TSN 89): get_data(param=Command(status=1, tsn=212, command_id=536, function=0, data=[4, 0, 0, 0, 245]))
2024-03-10 08:10:06.603 DEBUG (MainThread) [zhaquirks.tuya] [0x210a:1:0xef00] Received value [0, 0, 0, 245] for attribute 0x0218 (command 0x0001)
2024-03-10 08:10:06.603 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x210A:1:0xef00]: cluster_handler[tuya_manufacturer] attribute_updated - cluster[Tuya Manufacturer Specicific] attr[temperature] value[245]
2024-03-10 08:10:06.603 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x210A:1:0x0201]: Attribute report 'AvattoThermostat'[local_temperature] = 2450
2024-03-10 08:10:06.603 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x210A:1:0x0201]: Attribute report 'AvattoThermostat'[local_temperature] = 2450

Quirk code just divide it by 10

I don't see any 0x021B attribute commands for calibration temp changes

vukisz commented 8 months ago

Oh okay. I got your point. Sadly my TRV does not expose calibration via TRV. As I read through manuals and online forums only wifi versions support that. I guess I am stuck here then :-/ ?

jacekk015 commented 8 months ago

One user showed some advanced menu. Maybe your device have it too. There's temperature compensation. Device have it for sure, because older log has that attribute sent to HA https://github.com/zigpy/zha-device-handlers/issues/2755#issuecomment-1840747103

vukisz commented 8 months ago

Thanks. Turns out that I tested this advanced menu with a defective thermostat as it just don't open on it. Tried another and got inside. Changed a bit enabled debugging and restarted. Then after restart changed quite a lot of times but at the begining those changes were not reflecting in ha. But after a while they started to sync in between advanced menu and temperature calibration. Temperature calibration step is 1.0 and range [-9;9] in thermostat advanced menu. Attaching the log: https://drive.google.com/file/d/1McKyHENajS5kHKfMGeEAcDkNgcMpQECl/view?usp=drivesdk

Also just noticed this: Screenshot_2024-03-11-07-40-04-03_c3a231c25ed346e59462e84656a70e50 Are those new standard zha (or climate control) settings and offset one could be used as calibration?

jacekk015 commented 8 months ago

The firmware inside device decide when to send any data. HA cannot force device - it's wait and read approach.

Who know's what ZHA devs will add - those are a 10 months old, added by commit https://github.com/zigpy/zigpy/commit/a4300b171862bfdd561cedbdfd70ebd8dc251607

That's the code:

        local_temperature_calibration: Final = ZCLAttributeDef(
            id=0x0010, type=t.int8s, access="rw"
        )

As you see that's an Signed Integer ;-), so anyone with decimal calibration device will complain about it. There are plenty of radiator TRV's that support 0.5 stepping, including my all Maxsmart TRV's - so that's a no-go for me. Even your thermostat clones with ID's _TZE200_2ekuz3dz and _TZE200_g9a3awaj support 0.1 calibration setting, so I'm not touching that.

vukisz commented 8 months ago

Alright. Then I have following options

Another interesting finding. If I try to adjust _TZE200_aoclfnxz TS0601 Local temperature offset the I am getting this error:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 07:50:19 (9 occurrences)
Last logged: 14:04:37

[140223478867648] 'NoneType' object is not iterable
[140222810363456] 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 111, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/usr/src/homeassistant/homeassistant/components/zha/number.py", line 459, in async_set_native_value
    await self._cluster_handler.write_attributes_safe(
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 540, in write_attributes_safe
    res = await self.write_attributes(attributes, manufacturer=manufacturer)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 83, in wrapper
    return await RETRYABLE_REQUEST_DECORATOR(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/util.py", line 131, in retry
    return await func()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zhaquirks/tuya/__init__.py", line 762, in write_attributes
    manufacturer_attrs.update(new_attrs)
TypeError: 'NoneType' object is not iterable
jacekk015 commented 8 months ago

If your device allows 1.0 stepping for temp calibration there's no possibility to change that. It's device specific, not ZHA.

implement time sync

Don't know what you talking about. Time is synced whenever device ask for it. You can't force device to sync. Device needs to request time sync, and then ZHA code responds. That's how Zigbee protocol is made.

If I try to adjust

Nothing interesting. It just means that the sliders isn't connected to any ZHA code - there's no code for serve that action.

vukisz commented 8 months ago

Alright thank you for support then. Case closed I guess.