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
775 stars 703 forks source link

[Device Support Request] Fantem 4-in 1 Sensor (_TZ3210_zmy9hjay TS0202) #1624

Closed wryandginger closed 1 year ago

wryandginger commented 2 years ago

Is your feature request related to a problem? Please describe. This is a motion sensor that exposes motion, temperature, humidity, and illuminance. Device pairs and 4 entities show, but temperature and humidity do not update unless you manually read the cluster. (See: Discussion Here )

Item link on AliExpress

Describe the solution you'd like I'd like the temperature and humidity to update automatically.

Device signature ```yaml { "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=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, 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": 260, "device_type": "0x0402", "in_clusters": [ "0x0000", "0x0001", "0x0500", "0xef00" ], "out_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": 260, "device_type": "0x0302", "in_clusters": [ "0x0001", "0x0402", "0x0405" ], "out_clusters": [] }, "3": { "profile_id": 260, "device_type": "0x0106", "in_clusters": [ "0x0001", "0x0400" ], "out_clusters": [] } }, "manufacturer": "_TZ3210_zmy9hjay", "model": "TS0202", "class": "zigpy.device.Device" } ```
Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.6.6", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.9.12", "docker": true, "arch": "x86_64", "timezone": "America/Los_Angeles", "os_name": "Linux", "os_version": "5.15.45", "supervisor": "2022.05.3", "host_os": "Home Assistant OS 8.2", "docker_version": "20.10.14", "chassis": "embedded", "run_as_root": true }, "custom_components": { "watchman": { "version": "0.5.1", "requirements": [ "prettytable==3.0.0" ] }, "smartthinq_sensors": { "version": "0.23.0", "requirements": [ "pycountry>=20.7.3", "xmltodict>=0.12.0", "chardet>=4.0.0" ] }, "dyson_local": { "version": "0.16.4-4", "requirements": [ "libdyson==0.8.11" ] }, "frigate": { "version": "2.3", "requirements": [] }, "zha_toolkit": { "version": "v0.8.11", "requirements": [] }, "dyson_cloud": { "version": "0.15.0", "requirements": [ "libdyson==0.8.7" ] }, "alexa_media": { "version": "4.0.2", "requirements": [ "alexapy==1.26.0", "packaging>=20.3", "wrapt>=1.12.1" ] }, "hacs": { "version": "1.25.5", "requirements": [ "aiogithubapi>=22.2.4" ] }, "govee": { "version": "0.2.2", "requirements": [ "govee-api-laggat==0.2.2", "dacite==1.6.0" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.30.0", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.75", "zigpy-deconz==0.16.0", "zigpy==0.45.1", "zigpy-xbee==0.14.0", "zigpy-zigate==0.7.4", "zigpy-znp==0.7.0" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "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" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" } ], "after_dependencies": [ "usb", "zeroconf" ], "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp" ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 19199, "manufacturer": "_TZ3210_zmy9hjay", "model": "TS0202", "name": "_TZ3210_zmy9hjay TS0202", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4098, "power_source": "Battery or Unknown", "lqi": 255, "rssi": -42, "last_seen": "2022-06-15T13:57:08", "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=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, 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": 260, "device_type": "0x0402", "in_clusters": [ "0x0000", "0x0001", "0x0500", "0xef00" ], "out_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": 260, "device_type": "0x0302", "in_clusters": [ "0x0001", "0x0402", "0x0405" ], "out_clusters": [] }, "3": { "profile_id": 260, "device_type": "0x0106", "in_clusters": [ "0x0001", "0x0400" ], "out_clusters": [] } } }, "entities": [ { "entity_id": "binary_sensor.office_multi_sensor_472dc4fe_ias_zone", "name": "_TZ3210_zmy9hjay TS0202" }, { "entity_id": "sensor.office_multi_sensor_472dc4fe_power", "name": "_TZ3210_zmy9hjay TS0202" }, { "entity_id": "sensor.office_multi_sensor_472dc4fe_temperature", "name": "_TZ3210_zmy9hjay TS0202" }, { "entity_id": "sensor.office_multi_sensor_472dc4fe_humidity", "name": "_TZ3210_zmy9hjay TS0202" }, { "entity_id": "sensor.office_multi_sensor_472dc4fe_illuminance", "name": "_TZ3210_zmy9hjay TS0202" } ], "neighbors": [], "endpoint_names": [ { "name": "IAS_ZONE" }, { "name": "TEMPERATURE_SENSOR" }, { "name": "LIGHT_SENSOR" } ], "user_given_name": "Office Multi Sensor", "device_reg_id": "fc666351aed22494518a5da989b48065", "area_id": "office" } } ```
When you manually update the sensors this error shows up in logs ``` [0xFB44:1:0xef00] Unknown cluster command 6 b'\x00\x00k\x02\x00\x04\x00\x00\x00\xd5' [0xFB44:1:0xef00] Unknown cluster command 6 b'\x00\x00l\x02\x00\x04\x00\x00\x00?' [0x05A7:1:0xef00] Unknown cluster command 6 b'\x00\x00n\x02\x00\x04\x00\x00\x00d' [0x05A7:1:0xef00] Unknown cluster command 6 b'\x00\x00k\x02\x00\x04\x00\x00\x00\xdf' [0x05A7:1:0xef00] Unknown cluster command 6 b'\x00\x00l\x02\x00\x04\x00\x00\x00=' ```

Additional context

Motion Event from home-assistant.log ``` 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] Device state changed response: [, 0] 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_indication (1, 1) 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] APS data indication response: [32, , , 1, , 1, 260, 1280, b'\t`\x00\x05\x00\x00\x00\x00\x00', 0, 175, 255, 112, 20, 19, 8, -45] 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy.zcl] [0x4AFF:1:0x0500] Received ZCL frame: b'\t`\x00\x05\x00\x00\x00\x00\x00' 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy.zcl] [0x4AFF:1:0x0500] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=, is_manufacturer_specific=0, is_reply=1, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), tsn=96, command_id=0, *is_reply=True) 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy.zcl] [0x4AFF:1:0x0500] Decoded ZCL frame: IasZone:status_change_notification(zone_status=, extended_status=, zone_id=0, delay=0) 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy.zcl] [0x4AFF:1:0x0500] Received command 0x00 (TSN 96): status_change_notification(zone_status=, extended_status=, zone_id=0, delay=0) 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy.zcl] [0x4AFF:1:0x0500] Sending reply header: ZCLHeader(frame_control=FrameControl(frame_type=, is_manufacturer_specific=False, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=96, command_id=, *is_reply=True) 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy.zcl] [0x4AFF:1:0x0500] Sending reply: Default_Response(command_id=0, status=) 2022-06-15 14:00:18 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x4AFF:1:0x0500]: Updated alarm state: ZoneStatus.Alarm_1 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.zigbee.application] Sending Zigbee request with tsn 96 under 211 request id, data: b'18600b0000' 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] 'aps_data_indication' response from , ep: 1, profile: 0x0104, cluster_id: 0x0500, data: b'096000050000000000' 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_request (20, 211, , , 260, 1280, 1, b'\x18`\x0b\x00\x00', , 0) 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] APS data request response: [2, , 211] 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] Device state changed response: [, 0] 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_confirm (0,) 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] APS data confirm response for request with id 211: 00 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] Request id: 0xd3 'aps_data_confirm' for , status: 0x00 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] Device state changed response: [, 0] 2022-06-15 14:00:18 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_indication (1, 1) ```
wryandginger commented 2 years ago

I was thinking this was going to be similar to the NEO NAS-PD07, so I looked there to see if I could just add this device to the model info, but that didn't work.

I'm not sure if this is any help, but looking at the clusters and some other quirks, I think this might be using class ZemismartTempHumidity(CustomDevice) for the temp and humidity since the clusters seem to line up.

I tried to make a custom quirk using just the ts0201_zemismart.py, replacing the model info -- nothing happened. I then tried my best to mash up the NAS-PD07 and Zemismart quirks, but that crashed ZHA because I clearly don't know what I'm doing.

harishvelli commented 2 years ago

Following. I have the same issue and when I use the automation from https://community.home-assistant.io/t/tuya-zigbee-multi-sensor-4-in-1-smart-pir-motion-humidity-light-temperature-sensor/409780/7 it ends up randomly triggering the motion detection to be detected eventho nothing has triggered it.

Fierydwarf commented 1 year ago

Following. Same issue using ZHA.

wryandginger commented 1 year ago

I checked my sensors and I'm not seeing any false triggers. Does that happen when only you're using my automation?

Are you on battery or USB? In one forum post somewhere -- zigbee2mqtt, probably? -- I read that certain battery voltages can cause false motion events. If you're using batteries, make sure they're new regular lithium batteries and not a rechargeable. Test with mains power (no batteries) to see if that does anything different.

Have you tried adjusting the sensitivity of the sensor? Go to Device Information --> Manage Zigbee Device --> IasZone (Endpoint 1m 0x0500 in) --> current_zone_sensitivity_level. Then you can read/write the value --1, 2, or 3. Level 2 seems to be what all mine are set to. Keep in mind, some electronic devices, heating devices, and other stuff in your house can be causing the motion to trigger.

It may be worthwhile testing the sensors by connecting them to a USB battery bank and putting in a closed cabinet. If they're still randomly tripping with no light/motion/automation then it may be a defective sensor.

MiguelLZPF commented 1 year ago

Following. Same issue using ZHA.

wryandginger commented 1 year ago

Just to add, this is a supported device in Z2M

I'm happy to test, but I don't have the skills to write a quirk from scratch.

I think I was close with looking at NAS-PD07, but I know the endpoints don't match up.

19jm81 commented 1 year ago

Sensor work really well with Z2M, support for ZHA would be awesome, I'd like to simplify my setup with ZHA, but no support for this sensors keeps me from doing that atm.

wryandginger commented 1 year ago

Additional info for developing a quirk -- I'll try to take a look at these more closely this weekend to tinker.

Here are some drivers that are written for other platforms:

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.