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
720 stars 667 forks source link

[Device Support Request] Tuya ZG-204ZM PIR 24Ghz human presence sensor #3303

Closed lscorcia closed 4 weeks ago

lscorcia commented 4 weeks ago

Problem description

A new Tuya combined sensor appeared on AliExpress: https://smarthomescene.com/reviews/zigbee-battery-powered-presence-sensor-zg-204zm-review/ . It is promising and quite unique as it has luminance, PIR and radar all on 2 AA-batteries power.

I just received one and I noticed that in ZHA support is very basic. There is no access to configuration in ZHA and the sensor readings are very basic (on/off) while the sensor provides different values: none, small, large, static.

Solution description

I'd like to have a device quirk for this device.

Screenshots/Video

No response

Device signature

Device signature ```json { "node_descriptor": { "logical_type": 2, "complex_descriptor_available": 0, "user_descriptor_available": 0, "reserved": 0, "aps_flags": 0, "frequency_band": 8, "mac_capability_flags": 128, "manufacturer_code": 4742, "maximum_buffer_size": 66, "maximum_incoming_transfer_size": 66, "server_mask": 10752, "maximum_outgoing_transfer_size": 66, "descriptor_capability_field": 0 }, "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0402", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0400", "0x0500" ], "output_clusters": [] } }, "manufacturer": "_TZE200_kb5noeto", "model": "TS0601", "class": "zigpy.device.Device" } ```

Diagnostic information

Diagnostic information ```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2024.8.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.12.4", "docker": true, "arch": "x86_64", "timezone": "America/New_York", "os_name": "Linux", "os_version": "6.6.44-haos", "supervisor": "2024.08.0", "host_os": "Home Assistant OS 13.0", "docker_version": "26.1.4", "chassis": "vm", "run_as_root": true }, "custom_components": { "hacs": { "documentation": "https://hacs.xyz/docs/configuration/start", "version": "1.34.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "battery_notes": { "documentation": "https://andrew-codechimp.github.io/HA-Battery-Notes/", "version": "2.4.1", "requirements": [] }, "zha_toolkit": { "documentation": "https://github.com/mdeweerd/zha-toolkit", "version": "v1.1.19", "requirements": [ "aiofiles>=0.4.0", "pytz>=2016.10" ] }, "robovac": { "documentation": "https://github.com/codefoodpixels/robovac", "version": "1.0.0", "requirements": [] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "dmulcahey", "adminiuga", "puddly", "TheJulianJES" ], "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", "zha", "universal_silabs_flasher" ], "requirements": [ "universal-silabs-flasher==0.0.22", "zha==0.0.30" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "10C4", "pid": "EA60", "description": "*slzb-07*", "known_devices": [ "smlight slzb-07" ] }, { "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": "0403", "pid": "6015", "description": "*conbee*", "known_devices": [ "Conbee III" ] }, { "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*" }, { "type": "_xzg._tcp.local.", "name": "xzg*" }, { "type": "_czc._tcp.local.", "name": "czc*" } ], "is_built_in": true }, "setup_times": { "null": { "setup": 0.00014807799999516646 }, "8c998556828d480af71dd2ce5a3266ee": { "wait_import_platforms": -1.7172623189999854, "wait_base_component": -0.0017749990000197613, "config_entry_setup": 23.972946982999986 } }, "data": { "ieee": "**REDACTED**", "nwk": 24042, "manufacturer": "_TZE200_kb5noeto", "model": "TS0601", "name": "_TZE200_kb5noeto TS0601", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "quirk_id": null, "manufacturer_code": 4742, "power_source": "Battery or Unknown", "lqi": 255, "rssi": -61, "last_seen": "2024-08-16T20:21:53", "available": true, "device_type": "EndDevice", "signature": { "node_descriptor": { "logical_type": 2, "complex_descriptor_available": 0, "user_descriptor_available": 0, "reserved": 0, "aps_flags": 0, "frequency_band": 8, "mac_capability_flags": 128, "manufacturer_code": 4742, "maximum_buffer_size": 66, "maximum_incoming_transfer_size": 66, "server_mask": 10752, "maximum_outgoing_transfer_size": 66, "descriptor_capability_field": 0 }, "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0402", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0400", "0x0500" ], "output_clusters": [] } }, "manufacturer": "_TZE200_kb5noeto", "model": "TS0601" }, "active_coordinator": false, "entities": [ { "entity_id": "binary_sensor.tze200_kb5noeto_ts0601_movimento", "name": "_TZE200_kb5noeto TS0601" }, { "entity_id": "button.tze200_kb5noeto_ts0601_identifica", "name": "_TZE200_kb5noeto TS0601" }, { "entity_id": "sensor.tze200_kb5noeto_ts0601_batteria", "name": "_TZE200_kb5noeto TS0601" }, { "entity_id": "sensor.tze200_kb5noeto_ts0601_illuminamento", "name": "_TZE200_kb5noeto TS0601" }, { "entity_id": "sensor.presence_sensor_batteria", "name": "_TZE200_kb5noeto TS0601" }, { "entity_id": "button.presence_sensor_identifica", "name": "_TZE200_kb5noeto TS0601" }, { "entity_id": "sensor.presence_sensor_illuminamento", "name": "_TZE200_kb5noeto TS0601" }, { "entity_id": "binary_sensor.presence_sensor_movimento", "name": "_TZE200_kb5noeto TS0601" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "IAS_ZONE" } ], "user_given_name": "Presence sensor", "device_reg_id": "4d86919c0990337af6349e9b17e62eb2", "area_id": "studio_luca", "cluster_details": { "1": { "device_type": { "name": "IAS_ZONE", "id": 1026 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "_TZE200_kb5noeto" }, "0x0005": { "attribute_name": "model", "value": "TS0601" } }, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0500": { "endpoint_attribute": "ias_zone", "attributes": { "0x0010": { "attribute_name": "cie_addr", "value": [ 177, 81, 90, 23, 0, 111, 13, 0 ] }, "0x0000": { "attribute_name": "zone_state", "value": 0 }, "0x0002": { "attribute_name": "zone_status", "value": 0 }, "0x0001": { "attribute_name": "zone_type", "value": 13 } }, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 10 }, "0x0020": { "attribute_name": "battery_voltage", "value": 17 } }, "unsupported_attributes": { "0x0031": { "attribute_name": "battery_size" }, "0x0033": { "attribute_name": "battery_quantity" } } }, "0x0400": { "endpoint_attribute": "illuminance", "attributes": { "0x0000": { "attribute_name": "measured_value", "value": 31572 } }, "unsupported_attributes": {} } }, "out_clusters": {} } } } } ```

Logs

No response

Custom quirk

Custom quirk The seller provides a Z2M adapter file at https://doc.szalarm.com/zg-205ZL/cntop_zigbee_sensor.js . It might turn useful as a blueprint for a custom quirk.

Additional information

According to reports on the internet, this sensor has different variations and depending on the seller some units are more functional than others. In my case I seem to have received a working unit, at least judging from these few hours of testing.

lscorcia commented 4 weeks ago

Duplicate of #3125 .