zigpy / zha-device-handlers

ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
Apache License 2.0
731 stars 673 forks source link

[Device Support Request] TS0601 _TZE204_upagmta9 Tuya outdoor temperature and humidity sensor #2694

Open raven4is opened 11 months ago

raven4is commented 11 months ago

Problem description

No values recognized

Device info TS0601 by _TZE204_upagmta9 Zigbee info IEEE: a4:c1:38:74:06:b0:2c:89 Nwk: 0x2aff Device Type: EndDevice LQI: 192 RSSI: -52 Last Seen: 2023-11-01T13:11:52 Power Source: Battery or Unknown

Solution description

How can i get or make a custom quirk for this device?

Screenshots/Video

zigbee_204

Screenshots/Video [Paste/upload your media here]

Device signature

Device signature ```json { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0051", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0xef00" ], "output_clusters": [ "0x000a", "0x0019" ] } }, "manufacturer": "_TZE204_upagmta9", "model": "TS0601", "class": "zigpy.device.Device" } ```

Diagnostic information

Diagnostic information ```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.10.5", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.5", "docker": true, "arch": "aarch64", "timezone": "Europe/Bucharest", "os_name": "Linux", "os_version": "6.1.21-v8", "supervisor": "2023.10.1", "host_os": "Home Assistant OS 11.1", "docker_version": "24.0.6", "chassis": "embedded", "run_as_root": true }, "custom_components": { "browser_mod": { "version": "2.3.0", "requirements": [] }, "hacs": { "version": "1.32.1", "requirements": [ "aiogithubapi>=22.10.1" ] }, "lovelace_gen": { "version": "0.1.1", "requirements": [ "jinja2" ] }, "fusion_solar_kiosk": { "version": "3.0.6", "requirements": [] }, "scheduler": { "version": "v0.0.0", "requirements": [] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "config_flow": true, "dependencies": [ "file_upload" ], "documentation": "https://www.home-assistant.io/integrations/zha", "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp", "universal_silabs_flasher" ], "requirements": [ "bellows==0.36.5", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.105", "zigpy-deconz==0.21.1", "zigpy==0.57.2", "zigpy-xbee==0.18.3", "zigpy-zigate==0.11.0", "zigpy-znp==0.11.6", "universal-silabs-flasher==0.0.14", "pyserial-asyncio-fast==0.11" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "1A86", "pid": "55D4", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus v2" ] }, { "vid": "10C4", "pid": "EA60", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus" ] }, { "vid": "10C4", "pid": "EA60", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*zigstar*", "known_devices": [ "ZigStar Coordinators" ] }, { "vid": "1CF1", "pid": "0030", "description": "*conbee*", "known_devices": [ "Conbee II" ] }, { "vid": "10C4", "pid": "8A2A", "description": "*zigbee*", "known_devices": [ "Nortek HUSBZB-1" ] }, { "vid": "0403", "pid": "6015", "description": "*zigate*", "known_devices": [ "ZiGate+" ] }, { "vid": "10C4", "pid": "EA60", "description": "*zigate*", "known_devices": [ "ZiGate" ] }, { "vid": "10C4", "pid": "8B34", "description": "*bv 2010/10*", "known_devices": [ "Bitron Video AV2010/10" ] } ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" }, { "type": "_uzg-01._tcp.local.", "name": "uzg-01*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 11007, "manufacturer": "_TZE204_upagmta9", "model": "TS0601", "name": "_TZE204_upagmta9 TS0601", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4417, "power_source": "Battery or Unknown", "lqi": 192, "rssi": -52, "last_seen": "2023-11-01T13:15:58", "available": true, "device_type": "EndDevice", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0051", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0xef00" ], "output_clusters": [ "0x000a", "0x0019" ] } }, "manufacturer": "_TZE204_upagmta9", "model": "TS0601" }, "active_coordinator": false, "entities": [ { "entity_id": "sensor.tze204_upagmta9_ts0601_rssi", "name": "_TZE204_upagmta9 TS0601" }, { "entity_id": "sensor.tze204_upagmta9_ts0601_lqi", "name": "_TZE204_upagmta9 TS0601" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "SMART_PLUG" } ], "user_given_name": null, "device_reg_id": "f617a18abfa66229233f67c4d981d85f", "area_id": null, "cluster_details": { "1": { "device_type": { "name": "SMART_PLUG", "id": 81 }, "profile_id": 260, "in_clusters": { "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0xef00": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} }, "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0001": { "attribute_name": "app_version", "value": 73 }, "0x0004": { "attribute_name": "manufacturer", "value": "_TZE204_upagmta9" }, "0x0005": { "attribute_name": "model", "value": "TS0601" } }, "unsupported_attributes": {} } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} } } } } } } ```

Logs

Logs ```python Logger: zigpy.zcl Source: runner.py:186 First occurred: 13:05:38 (5 occurrences) Last logged: 13:13:56 [0x2AFF:1:0xef00] Unknown cluster command 17 b'\x00\x03@' ```

Custom quirk

Custom quirk ```python [Paste your custom quirk here] ```

Additional information

https://www.aliexpress.com/item/1005005627336725.html Zigbee Version I tried some quirks but with no help. Can someone help me?

benoitm974 commented 11 months ago

It seems not the be working either on zigbeeMQTT, there might be some aspect of the protocol missing at pairing, trying to get element from snifing protocol here : https://github.com/Koenkk/zigbee2mqtt/issues/19137

raven4is commented 11 months ago

@benoitm974 Seems lit a batch that beside the problems with zigbee information transmission, they have huge problems with battery time, or maybe because it tries to send information to gateway to often, the battery just goes dead in 12h.

benoitm974 commented 11 months ago

No in fact the device uses tuya specific protocol, the device works well when use with their gateway and Tuya app and don't have battery issue. The problem exists in both zigbee2mqtt and ZHA where the current code doesn't follow the tuya protocol after pairing the device stay "locked" in a waiting for answer state where it doesn't update the screen info nor send any data and consume all the battery in 12 to 24h... In the zigbee2mqtt forum I attached a capture of the tuya sequence, where we can see:

darknessblade commented 10 months ago

I have a similar issue with a device that has the same specification/ID

_TZE204_upagmta9 TS0601 Aliexpress Item page [ordered the item trough the 3=5.99$ sale] https://aliexpress.com/item/1005006030373016.html?

For me it does not show ANY entities at all

raven4is commented 10 months ago

Hello! For this sensors as a temporary sollution i added a wifi zigbee gateway and used tuya integration for them.

They do eat batteries if not communicating good with ha integration.

I wait for news when they cand be integrated locally. :(

darknessblade commented 10 months ago

Hello! For this sensors as a temporary sollution i added a wifi zigbee gateway and used tuya integration for them.

They do eat batteries if not communicating good with ha integration.

I wait for news when they cand be integrated locally. :(

Soo they are worse than "for example" https://aliexpress.com/item/1005005352101380.html? If all you would need is the temperature+ humidity

I bought one as a test, but might return/see if I can get a refund for it, if there is no probable fix in the next few days.

Since its a choice store getting a refund is quite easy.

raven4is commented 10 months ago

I wanted with display, i suppose will be a while until this model will be added to the fully supported devices, I saw some people had luck with zigbee2mqtt. So they are not worse, they are not yet supported but they have the capability to be as good.

thubalek commented 10 months ago

It looks like devs from zigbee2mqtt made it working (https://github.com/Koenkk/zigbee2mqtt/issues/19137#issuecomment-1811953885)

benoitm974 commented 10 months ago

Indeed after sniffing zigbee traffic and debuging @koenkk found the race condition preventi the 0xef00 / 0x03 command sent just after the sensors join the network which was keeping the device in a loop mode... If any one with experience on zha code can point in the right directtion for sending command when sensor joint I'm open to try/look into it.

dhruvinsh commented 10 months ago

I manage to get something on dashboard for ZTH05

If any one with experience on zha code can point in the right directtion for sending command when sensor joint I'm open to try/look into it.

correct file path would be, zhaquirks/tuya/ts0601_sensor.py, more specifically line 248 code. Not entirely sure, everything is fairly new for me.

image
benoitm974 commented 10 months ago

The question is not which definition to use, since either V03 or V04 would work, the issue is how to have ZHA to send a custom tuya command on joining to get the sensor to start sending data on regular interval and to sleep in between.

phormix commented 10 months ago

Sounds like I should just pull the battery from mine until this is resolved.

Can anyone recommend a temperature sensor that does work properly?

benoitm974 commented 10 months ago

I use these working ok but no screen, and you need to provide the 2 AAA batteries. https://fr.aliexpress.com/item/1005006022905558.html?spm=a2g0o.order_list.order_list_main.97.21ef5e5bIqwGzC&gatewayAdapt=glo2fra

tokkeherfst commented 10 months ago

I also have a couple of these that are quite useless in ZHA... is anyone working on a fix please?

slimninja commented 9 months ago

Adding my support to merge the same fix from zigbee2mqtt which looks like it will be deployed Jan 1st: https://github.com/Koenkk/zigbee2mqtt/issues/19137

JordanAco1 commented 8 months ago

Anyone please? Would be nice to have them in ZHA because they are cheap, have a display and natively have zigbee. The people who buy these are mostly the ones who have bricked a LYWSD03MMC and are looking for something with native zigbee.

sapstar commented 8 months ago

I have the same one and can't get it working.

eddietheeagle7 commented 8 months ago

Same for me, can't get it working.

VitalyKVV commented 8 months ago

Same for me. I have such devices and they don't work with ZHA.

marcoaureliovaz commented 8 months ago

Hello! The correct model for this device seems to be ZTH05 317738231-751844634

I'm having same issues. Identified as a different device and no entities.

Screenshot_20240121-212037

RoboKaren commented 8 months ago

Hello! The correct model for this device seems to be ZTH05 317738231-751844634

I'm having same issues. Identified as a different device and no entities.

Screenshot_20240121-212037

I suppose the question is whether there is a way to force the real identity onto devices that list a fake identity.

sweetpants commented 8 months ago

@marcoaureliovaz, i'm seeinig the exact same on my ZHA installation

marcoaureliovaz commented 8 months ago

Screenshot_20240123-104301

I tried some time with ZHA but it didn't work and the "pairing" seemed not to conclude... (After pairing, the logs were always bringing new messages and at the device, low battery icon active)

ZigBee2MQTT Then I flashed my Sonoff Dongle-E to MultiPAN with that Webflasher, installed Mosquitto, Z2M Edge and now it's correctly recognized and working great. Frequent updates during increase/decrease of temperature/humidity. Battery info is reliable.

TheJulianJES commented 8 months ago

With the next HA version 2024.2.0 beta (releasing 2024/01/31), you can try to send the "Tuya query data" command through the clusters menu UI if the manufacturer cluster is added using a quirk.

Copying my answer from Discord: https://github.com/zigpy/zha-device-handlers/pull/2940 and https://github.com/zigpy/zha-device-handlers/pull/2888 added support for the "query data" command (0x03). So, with the next HA version, it should be relatively simple to make a quirk for that device. You can likely use zigpy/quirk-generator to generate a stub quirk, replace CustomDevice with the Tuya EnchantedDevice implementation. That'll send Tuya specific commands during pairing. But you'll also need to set tuya_spell_data_query = True to send the new 0x03 / query data command (like seen in #2940) during pairing/reconfiguration (and then pair/reconfigure).

That way, no manual command sending would be involved.

benoitm974 commented 8 months ago

With the next HA version 2024.2.0 beta (releasing 2024/01/31), you can try to send the "Tuya query data" command through the clusters menu UI if the manufacturer cluster is added using a quirk.

Copying my answer from Discord: #2940 and #2888 added support for the "query data" command (0x03). So, with the next HA version, it should be relatively simple to make a quirk for that device. You can likely use zigpy/quirk-generator to generate a stub quirk, replace CustomDevice with the Tuya EnchantedDevice implementation. That'll send Tuya specific commands during pairing. But you'll also need to set tuya_spell_data_query = True to send the new 0x03 / query data command (like seen in #2940) during pairing/reconfiguration (and then pair/reconfigure).

That way, no manual command sending would be involved.

Thanks @TheJulianJES so much! So it means from the existing quirks https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py

We could on create a new 05 variation and then

A Add the import "EnchantedDevice" -> from zhaquirks.tuya.mcu import DPToAttributeMapping, TuyaMCUCluster, EnchantedDevice

B Add the variation this way`

` class TuyaTempHumiditySensorVar05(EnchantedDevice): """Tuya temp and humidity sensor (variation 05).""" tuya_spell_data_query = True

signature = {
    # "profile_id": 260,
    # "device_type": "0x0051",
    # "in_clusters": ["0x0000","0x0004","0x0005","0xef00"],
    # "out_clusters": ["0x000a","0x0019"]
    MODELS_INFO: [
        ("_TZE204_upagmta9", "TS0601"),
    ],
    ENDPOINTS: {
        1: {
            PROFILE_ID: zha.PROFILE_ID,
            DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
            INPUT_CLUSTERS: [
                Basic.cluster_id,
                Groups.cluster_id,
                Scenes.cluster_id,
                TemperatureHumidityManufCluster.cluster_id,
            ],
            OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
        }
    },
}

replacement = {
    SKIP_CONFIGURATION: True,
    ENDPOINTS: {
        1: {
            DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
            INPUT_CLUSTERS: [
                Basic.cluster_id,
                Groups.cluster_id,
                Scenes.cluster_id,
                TemperatureHumidityBatteryStatesManufCluster,
                TuyaTemperatureMeasurement,
                TuyaRelativeHumidity,
                TuyaPowerConfigurationCluster2AAA,
            ],
            OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],
        }
    },
}`
domusonline commented 8 months ago

With the next HA version 2024.2.0 beta (releasing 2024/01/31), you can try to send the "Tuya query data" command through the clusters menu UI if the manufacturer cluster is added using a quirk. Copying my answer from Discord: #2940 and #2888 added support for the "query data" command (0x03). So, with the next HA version, it should be relatively simple to make a quirk for that device. You can likely use zigpy/quirk-generator to generate a stub quirk, replace CustomDevice with the Tuya EnchantedDevice implementation. That'll send Tuya specific commands during pairing. But you'll also need to set tuya_spell_data_query = True to send the new 0x03 / query data command (like seen in #2940) during pairing/reconfiguration (and then pair/reconfigure). That way, no manual command sending would be involved.

Thanks @TheJulianJES so much! So it means from the existing quirks https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py

We could on create a new 05 variation and then

A Add the import "EnchantedDevice" -> from zhaquirks.tuya.mcu import DPToAttributeMapping, TuyaMCUCluster, EnchantedDevice

B Add the variation this way`

Sorry.... But I have the same issue and after looking at this thread I got the quirk indicated and made the suggested changes. It picked up that quirk and I get the identities for humidity and temperature which I didn't have before. But they have no values. Am I missing some step or will this just work in the upcoming versions?

Thank you.

benoitm974 commented 8 months ago

With the next HA version 2024.2.0 beta (releasing 2024/01/31), you can try to send the "Tuya query data" command through the clusters menu UI if the manufacturer cluster is added using a quirk. Copying my answer from Discord: #2940 and #2888 added support for the "query data" command (0x03). So, with the next HA version, it should be relatively simple to make a quirk for that device. You can likely use zigpy/quirk-generator to generate a stub quirk, replace CustomDevice with the Tuya EnchantedDevice implementation. That'll send Tuya specific commands during pairing. But you'll also need to set tuya_spell_data_query = True to send the new 0x03 / query data command (like seen in #2940) during pairing/reconfiguration (and then pair/reconfigure). That way, no manual command sending would be involved.

Thanks @TheJulianJES so much! So it means from the existing quirks https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_sensor.py We could on create a new 05 variation and then A Add the import "EnchantedDevice" -> from zhaquirks.tuya.mcu import DPToAttributeMapping, TuyaMCUCluster, EnchantedDevice B Add the variation this way`

Sorry.... But I have the same issue and after looking at this thread I got the quirk indicated and made the suggested changes. It picked up that quirk and I get the identities for humidity and temperature which I didn't have before. But they have no values. Am I missing some step or will this just work in the upcoming versions?

Thank you.

Only changing the quirk will not be enough until this is relaeased or you ensure to get the beta version install and test the new quirk...

domusonline commented 8 months ago

Only changing the quirk will not be enough until this is relaeased or you ensure to get the beta version install and test the new quirk...

Thank you very much for the promptly reply. I'll wait until this is changed... I don't usually install beta versions of HA because I don't have a "test" system. But I'll keep an eye on this. Regards.

benoitm974 commented 8 months ago

So new beta is out with EnchantedDevice type.

Install brand new beta home assistant in docker connected to clean sonOff zigbee 3.0v2 Added zha quirks, they get picked up by homeassistant, tried 2 quirks variation ... But seems the spell 'get data 0x0003 command doesn't work

var 05: `class TuyaTempHumiditySensorVar05(EnchantedDevice):
"""Tuya temp and humidity sensor (variation 05)."""
tuya_spell_data_query = True

signature = {                                                                                 
    # "profile_id": 260,                                                                      
    # "device_type": "0x0051",                                                                
    # "in_clusters": ["0x0000","0x0004","0x0005","0xef00"],                                   
    # "out_clusters": ["0x000a","0x0019"]                                                     
    MODELS_INFO: [                                                                            
        ("_TZE204_upagmta9", "TS0601"),                                                   
    ],                                                                                        
    ENDPOINTS: {                                                                              
        1: {                                                                                  
            PROFILE_ID: zha.PROFILE_ID,                                                       
            DEVICE_TYPE: zha.DeviceType.SMART_PLUG,                                           
            INPUT_CLUSTERS: [                                                                 
                Basic.cluster_id,                                                             
                Groups.cluster_id,                                                            
                Scenes.cluster_id,                                                            
                TemperatureHumidityManufCluster.cluster_id,                                   
            ],                                                                                
            OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],                               
        }                                                                                     
    },                                                                                        
}                                                                                             

replacement = {                                                                               
    SKIP_CONFIGURATION: True,                                                                 
    ENDPOINTS: {                                                                              
        1: {                                                                                  
            DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,                                   
            INPUT_CLUSTERS: [                                                                 
                Basic.cluster_id,                                                             
                Groups.cluster_id,                                                            
                Scenes.cluster_id,                                                            
                TemperatureHumidityBatteryStatesManufCluster,                                 
                TuyaTemperatureMeasurement,                                                   
                TuyaRelativeHumidity,                                                         
                TuyaPowerConfigurationCluster2AAA,                                            
            ],                                                                                
            OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],                               
        }                                                                                     
    },                                                                                        
}`

var 06: `class TuyaTempHumiditySensorVar06(EnchantedDevice):
"""Custom device representing tuya temp and humidity sensor with e-ink screen."""

# RelativeHumidity multiplier                                                                 
RH_MULTIPLIER = 10                                                                            
tuya_spell_data_query = True                                                                  
signature = {                                                                                 
    # <SimpleDescriptor endpoint=1, profile=260, device_type=81                               
    # device_version=1                                                                        
    # input_clusters=[4, 5, 61184, 0]                                                         
    # output_clusters=[25, 10]>                                                               
    MODELS_INFO: [                                                                            
        ("_TZE204_upagmta9", "TS0601"),                                                       
    ],                                                                                        
    ENDPOINTS: {                                                                              
        1: {                                                                                  
            PROFILE_ID: zha.PROFILE_ID,                                                       
            DEVICE_TYPE: zha.DeviceType.SMART_PLUG,                                           
            INPUT_CLUSTERS: [                                                                 
                Basic.cluster_id,                                                             
                Groups.cluster_id,                                                            
                Scenes.cluster_id,                                                            
                TemperatureHumidityManufCluster.cluster_id,                                   
            ],                                                                                
            OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],                               
        }                                                                                     
    },                                                                                        
}                                                                                             

replacement = {                                                                               
    SKIP_CONFIGURATION: True,                                                                 
    ENDPOINTS: {                                                                              
        1: {                                                                                  
            PROFILE_ID: zha.PROFILE_ID,                                                       
            DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,                                   
            INPUT_CLUSTERS: [                                                                 
                TemperatureHumidityManufCluster,  # Single bus for temp, humidity, and battery
                TuyaTemperatureMeasurement,                                                   
                TuyaRelativeHumidity,                                                         
                TuyaPowerConfigurationCluster2AAA,                                            
            ],                                                                                
            OUTPUT_CLUSTERS: [Ota.cluster_id, Time.cluster_id],                               
        }                                                                                     
    },                                                                    
} `

Screenshot_2024-02-01_09-17-04 Screenshot_2024-02-01_09-16-52 Screenshot_2024-02-01_09-16-20

benoitm974 commented 8 months ago

So new beta is out with EnchantedDevice type.

Install brand new beta home assistant in docker connected to clean sonOff zigbee 3.0v2 Added zha quirks, they get picked up by homeassistant, tried 2 quirks variation ... But seems the spell 'get data 0x0003 command doesn't work

var 05: `class TuyaTempHumiditySensorVar05(EnchantedDevice): """Tuya temp and humidity sensor (variation 05).""" tuya_spell_data_query = True

Also tried to add a inheritance from TuyaEnchentableCluster as mention in the documentation (if I understood it correctly), and added it to the Device definition ... But no luck so far

class TemperatureHumidityBatteryStatesManufClusterSpell(TuyaEnchantableCluster, TemperatureHumidityBatteryStatesManufCluster): """Tuya which needs spell query_data """

atus42 commented 8 months ago

I didn't read this thread lately, so I made my dirty hack in the weekend to finaly get my devices working. As you all noticed, this didn't solve the problem completelly. :( without the 0x03 command sent to the 0xef00 endpoint the commands arriving from it was unknown to the ZCL handler:

Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 1, 27, 14, 20, 45, 394485, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x47D8), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=61184, data=Serialized[b'\tE\x11\x00\x06@'], tx_options=<TransmitOptions.NONE: 0>, radius=28, non_member_radius=0, lqi=99, rssi=None) [0x47D8:1:0xef00] Received ZCL frame: b'\tE\x11\x00\x06@' [0x47D8:1:0xef00] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), tsn=69, command_id=17, *direction=<Direction.Client_to_Server: 1>) [0x47D8:1:0xef00] Unknown cluster command 17 b'\x00\x06@' [0x47D8:1:0xef00] Received command 0x11 (TSN 69): b'\x00\x06@' [0x47D8:1:0xef00] No explicit handler for cluster command 0x11: b'\x00\x06@'

However after sending the magic packet I got these answers:

Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 2, 4, 21, 5, 18, 154777, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x6853), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=61184, data=Serialized[b'\t\xd0\x11\x00\x06@'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=55, rssi=None) [0x6853:1:0xef00] Received ZCL frame: b'\t\xd0\x11\x00\x06@' [0x6853:1:0xef00] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), tsn=208, command_id=17, *direction=<Direction.Client_to_Server: 1>) [0x6853:1:0xef00] Decoded ZCL frame: TemperatureHumidityBatteryStatesManufCluster:mcu_version_response(version=MCUVersion(status=0, tsn=6, version_raw=64, *version='1.0.0')) [0x6853:1:0xef00] Received command 0x11 (TSN 208): mcu_version_response(version=MCUVersion(status=0, tsn=6, version_raw=64, *version='1.0.0')) [0x6853:1:0xef00] MCU version: 1.0.0 [0x6853:1:0xef00] Sending reply header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=208, command_id=<GeneralCommand.Default_Response: 11>, *direction=<Direction.Client_to_Server: 1>) [0x6853:1:0xef00] Sending reply: Default_Response(command_id=17, status=<Status.SUCCESS: 0>)

Unfortunatelly no measurement data arrives from the node besides this 'TemperatureHumidityBatteryStatesManufCluster' self report.

Anyone has any idea what shoud we do next?

rodvlopes commented 7 months ago

I am having the same issue here. Just bought two of these ZTH05 and they pair but can't send any temp ou humidity to ZHA. The display of the device never updates. Using the latest docker image (2024.2.1).

michelgre commented 7 months ago

Hello I am confused by all this thread but I understand that a change in HA would make it possible to configure a workaround (quirk) for this protocol issue. I installed the latest version now, 2024.2.1, and I wonder if:

  1. This version includes the necessary change for that ?
  2. How/where to install this workaround, and which one (var 06 ?) ? It would be helpful for many people who got these sensors and who will come here but never installed ZHA quirks to have a small guide to explain that... Thank you !

Note: whatever I do, I get no change and this in the diagnostic: "manufacturer": "_TZE204_upagmta9", "model": "TS0601", "name": "_TZE204_upagmta9 TS0601", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "quirk_id": null,

Last thing i tried was to copy ts0601_sensor.py in a zhaquirks directory, add the import and the class, and add in configuration.yaml:

zha: enable_quirks: true custom_quirks_path: /config/zhaquirks/

Talixme commented 7 months ago

Same here, i have 5 of them. They work great on zigbee2mqtt but nothing on ZHA

FranzTen commented 6 months ago

have the same problem with them, i hope they will work some day with HA out of the box

jacekk015 commented 6 months ago

Quirk code is already in ZHA. Only device ID was missing: _TZE204_upagmta9 https://github.com/zigpy/zha-device-handlers/pull/3036

slimninja commented 6 months ago

Quirk code is already in ZHA. Only device ID was missing: _TZE204_upagmta9 #3036

Does this mean we just need to wait for the next ZHA release for the ZigPy update and this sensor will work out of the box?

jacekk015 commented 6 months ago

@slimninja go to

https://github.com/zigpy/zha-device-handlers/blob/6a1638b0e55811dff1f5061758b9836a7cc22b93/zhaquirks/tuya/ts0601_sensor.py

Use 3-dot menu to download RAW file Enable custom quirks settings in HA

https://github.com/jacekk015/zha_quirks?tab=readme-ov-file#usage

Test it and let us all know. You will use my patched quirk. Later, after update, you just disable Custom Quirks or delete that file.

domusonline commented 6 months ago

@slimninja go to

https://github.com/zigpy/zha-device-handlers/blob/6a1638b0e55811dff1f5061758b9836a7cc22b93/zhaquirks/tuya/ts0601_sensor.py

Use 3-dot menu to download RAW file Enable custom quirks settings in HA

https://github.com/jacekk015/zha_quirks?tab=readme-ov-file#usage

Test it and let us all know. You will use my patched quirk. Later, after update, you just disable Custom Quirks or delete that file.

I tried it without success. It recognizes the device and it uses the quirk but I have no entities... I have downloaded the diagnostic data. Will attach it here.

zha-08a1cb49e83dff14adee605b1b9800f1-_TZE204_upagmta9 TS0601-94a3e23b5027bb5c9b04c2c7d6a8f882.json

jacekk015 commented 6 months ago

Diagnostic data doesn't contain any usable info. Debug level LOG is needed.

  1. Enable debug log level
    logger:
    default: info
    logs:
    homeassistant.components.zha: debug
    zigpy: debug
    zhaquirks: debug
  2. Remove one device from HA
  3. Restart Home Assistant!!!
  4. Pair device like a brand new - only then there's a full initialization process
  5. Wait for another, minimum, 5 minutes!!!
  6. Download Home Assistant log [Setting ->System->Log] - attach it here as a file
domusonline commented 6 months ago

Diagnostic data doesn't contain any usable info. Debug level LOG is needed.

1. Enable debug log level
logger:
  default: info
  logs:
    homeassistant.components.zha: debug
    zigpy: debug
    zhaquirks: debug
2. Remove one device from HA

3. Restart Home Assistant!!!

4. Pair device like a brand new - only then there's a full initialization process

5. Wait for another, minimum, 5 minutes!!!

6. Download Home Assistant log [Setting ->System->Log] - attach it here as a file

Here it is. I hope you can understand something from it. Feel free to suggest any test you may think is useful. Regards. home-assistant_2024-03-13T22-00-01.396Z.log

domusonline commented 6 months ago

I see a few messages in the log mentioning "FOREIGN KEY constraint failed"... But I am not able to understand what that means in this context.... seems like it interacts well with the device but can't save something into a database?...

domusonline commented 6 months ago

Another update.... if I restart HA I do get the entities, although with no values.... weird

jacekk015 commented 6 months ago

"FOREIGN KEY constraint failed"

That's normal.

For the rest. Device didn't respond properly.

You did pair it like a brand new 2024-03-13 21:53:37.238 DEBUG (MainThread) [homeassistant.components.zha.core.gateway] device - 0x28B9:a4:c1:38:96:a0:72:6b:9a entering async_device_initialized - is_new_join: True

Spell has been executed

2024-03-13 21:53:37.269 DEBUG (MainThread) [zigpy.zcl] [0x28B9:1:0x0402] Executing attribute read spell on Tuya device a4:c1:38:96:a0:72:6b:9a
2024-03-13 21:53:37.506 DEBUG (MainThread) [zigpy.zcl] [0x28B9:1:0x0402] Executed attribute read spell on Tuya device a4:c1:38:96:a0:72:6b:9a

Data query spell also executed

2024-03-13 21:53:37.507 DEBUG (MainThread) [zigpy.zcl] [0x28B9:1:0x0402] Executing data query spell on Tuya device a4:c1:38:96:a0:72:6b:9a
2024-03-13 21:53:37.737 DEBUG (MainThread) [zigpy.zcl] [0x28B9:1:0x0402] Executed data query spell on Tuya device a4:c1:38:96:a0:72:6b:9a

Temp cluster has been bound

2024-03-13 21:53:37.738 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x28B9:1:0x0402]: bound 'temperature' cluster: Status.SUCCESS
2024-03-13 21:53:37.738 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x28B9:1:0x0402]: Configuring cluster attribute reporting
2024-03-13 21:53:37.740 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x28B9:1:0x0402]: Successfully configured reporting for '{'measured_value': (30, 900, 50)}' on 'temperature' cluster: [ConfigureReportingResponseRecord(status=<Status.SUCCESS: 0>)]

@TheJulianJES Any thoughts on that?? Everything were done properly. He's been using my patched version using custom quirks https://github.com/zigpy/zha-device-handlers/blob/6a1638b0e55811dff1f5061758b9836a7cc22b93/zhaquirks/tuya/ts0601_sensor.py#L246-L298

https://github.com/zigpy/zha-device-handlers/blob/6a1638b0e55811dff1f5061758b9836a7cc22b93/zhaquirks/tuya/ts0601_sensor.py#L32-L33

Kerber0ss commented 6 months ago

Same issue, with quirks - sensors adds to HA but not displaying data from it.

jacekk015 commented 6 months ago

Bought one from the Ali link above. 9 days delivery. I will try to debug it deeper after delivery

adaniels21487 commented 5 months ago

"FOREIGN KEY constraint failed"

That's normal.

For the rest. Device didn't respond properly.

You did pair it like a brand new 2024-03-13 21:53:37.238 DEBUG (MainThread) [homeassistant.components.zha.core.gateway] device - 0x28B9:a4:c1:38:96:a0:72:6b:9a entering async_device_initialized - is_new_join: True

Spell has been executed

---- SNIP ----

Can confirm I am seeing the same log entries upon discovery and have the same result. Happy to help troubleshoot.

Also, since I applied this, the sensor seems to be continually rebooting. I have gone through a battery in < 24 hours. I have backed out the custom_quirk for now, but happy to test if someone has instructions they would like me to follow, or pointers on somthing to read to get me up to speed myself.

go-pro-v commented 5 months ago

Hello, I have the same problem. I try again every time there's an update from HA, but it still doesn't work. And I can confirm that the sensor battery drains quickly.

CaptainMalu commented 4 months ago

Any news on this topic. I got one of this sensors today. I'm some shocked that it isn't working out of the box like every other zigbee device I got.

I use ZHA with my home assistant but never heard of quirks. Do I have to use them or is a solution on its way? And if I have to use them: could someone help me find a step by step guide?

Dexter0007 commented 2 months ago

Hi, I also bought these sensors, but it turned out that after integration there is no temperature and humidity entity. Only after a few hours of searching, I found this thread. Is any working solution?