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 666 forks source link

[Device Support Request] TS0202 by _TZ3000_mg4dy6z6 - Motion Sensor #2651

Open iRapsody opened 11 months ago

iRapsody commented 11 months ago

Problem description

I bought this motion sensor from Aliexpress. It seems to be detected and "successfully" configured by ZHA but it does not detect any movement. I don't know why there are two sensors detected ( Motion and Opening ) because in product description says that it only has motion detection. Screenshot 2023-10-16 104814

Solution description

Make sensor available for automations.

Screenshots/Video

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": "0x0402", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0500" ], "output_clusters": [ "0x0006", "0x000a", "0x0019", "0x1000" ] } }, "manufacturer": "_TZ3000_mg4dy6z6", "model": "TS0202", "class": "zigpy.device.Device" } ```

Diagnostic information

Diagnostic information ```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.10.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.5", "docker": true, "arch": "x86_64", "timezone": "Europe/Bucharest", "os_name": "Linux", "os_version": "6.1.45", "supervisor": "2023.10.0", "host_os": "Home Assistant OS 10.5", "docker_version": "23.0.6", "chassis": "vm", "run_as_root": true }, "custom_components": { "sonoff": { "version": "3.5.1", "requirements": [ "pycryptodome>=3.6.6" ] }, "xiaomi_airfryer": { "version": "0.0.1", "requirements": [ "construct==2.10.56", "micloud==0.4", "python-miio>=0.5.7" ] }, "xiaomi_cloud_map_extractor": { "version": "v2.2.0", "requirements": [ "pillow", "pybase64", "python-miio", "requests", "pycryptodome" ] }, "samsungtv_smart": { "version": "0.11.6", "requirements": [ "websocket-client!=1.4.0,>=0.58.0", "wakeonlan>=2.0.0", "aiofiles>=0.8.0", "casttube>=0.2.1" ] }, "hacs": { "version": "1.32.1", "requirements": [ "aiogithubapi>=22.10.1" ] }, "midea_ac_lan": { "version": "v0.3.17", "requirements": [] }, "smartir": { "version": "1.17.7", "requirements": [ "aiofiles>=0.6.0" ] }, "nodered": { "version": "2.2.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.104", "zigpy-deconz==0.21.1", "zigpy==0.57.2", "zigpy-xbee==0.18.3", "zigpy-zigate==0.11.0", "zigpy-znp==0.11.5", "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": 13074, "manufacturer": "_TZ3000_mg4dy6z6", "model": "TS0202", "name": "_TZ3000_mg4dy6z6 TS0202", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4417, "power_source": "Battery or Unknown", "lqi": 255, "rssi": -11, "last_seen": "2023-10-16T09:33:41", "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": "0x0402", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0500" ], "output_clusters": [ "0x0006", "0x000a", "0x0019", "0x1000" ] } }, "manufacturer": "_TZ3000_mg4dy6z6", "model": "TS0202" }, "active_coordinator": false, "entities": [ { "entity_id": "binary_sensor.tz3000_mg4dy6z6_ts0202_motion", "name": "_TZ3000_mg4dy6z6 TS0202" }, { "entity_id": "binary_sensor.tz3000_mg4dy6z6_ts0202_opening", "name": "_TZ3000_mg4dy6z6 TS0202" }, { "entity_id": "button.tz3000_mg4dy6z6_ts0202_identify", "name": "_TZ3000_mg4dy6z6 TS0202" }, { "entity_id": "sensor.tz3000_mg4dy6z6_ts0202_battery", "name": "_TZ3000_mg4dy6z6 TS0202" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "IAS_ZONE" } ], "user_given_name": null, "device_reg_id": "9615bc645da854b2f2d58e87c0a74008", "area_id": null, "cluster_details": { "1": { "device_type": { "name": "IAS_ZONE", "id": 1026 }, "profile_id": 260, "in_clusters": { "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 200 }, "0x0020": { "attribute_name": "battery_voltage", "value": 30 } }, "unsupported_attributes": { "0x0031": { "attribute_name": "battery_size" }, "0x0033": { "attribute_name": "battery_quantity" } } }, "0x0500": { "endpoint_attribute": "ias_zone", "attributes": { "0x0010": { "attribute_name": "cie_addr", "value": [ 163, 101, 136, 254, 255, 141, 121, 224 ] }, "0x0013": { "attribute_name": "current_zone_sensitivity_level", "value": 1 }, "0x0000": { "attribute_name": "zone_state", "value": 1 }, "0x0002": { "attribute_name": "zone_status", "value": 0 }, "0x0001": { "attribute_name": "zone_type", "value": 13 } }, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "_TZ3000_mg4dy6z6" }, "0x0005": { "attribute_name": "model", "value": "TS0202" } }, "unsupported_attributes": {} } }, "out_clusters": { "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x0000": { "attribute_name": "on_off", "value": 0 } }, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} } } } } } } ```

Logs

Logs ```python [Paste the logs here] ```

Custom quirk

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

Additional information

Also, "Last seen: 2023-10-16T09:33:41", even if current time is 10:56 and the red LED of the device does not light up on movement.

iRapsody commented 10 months ago

Found this in zigbee2mqtt git, maybe will help someone to figure it out

Nemesis24 commented 9 months ago

the same for me

MichalLytek commented 9 months ago

I have the same issue with my unit. It's reported as TS0202 by _TZ3000_6ygjfyll.

When connected to Alexa via Zigbee bridge in Echo 4, it works correctly and detects movement.

logan893 commented 8 months ago

I too have this sensor, but for me the motion detection works even though it does not list any specific quirk being used. It's treated as a generic zigpy.device.Device. I'm using Home Assistant Core 2023.12.3.

It detects motion quickly, and reset time is approximately 67 seconds after it stops detecting motion.

I don't know why there is a "Opening" sensor for this unit, but it remains always "Closed".

{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *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": "0x0402",
      "input_clusters": [
        "0x0000",
        "0x0001",
        "0x0003",
        "0x0500"
      ],
      "output_clusters": [
        "0x0006",
        "0x000a",
        "0x0019",
        "0x1000"
      ]
    }
  },
  "manufacturer": "_TZ3000_6ygjfyll",
  "model": "TS0202",
  "class": "zigpy.device.Device"
}

image

jonathh21 commented 8 months ago

I have a few of these devices and they are all over the place.

Sometimes they work ok for ages, then they just stop.

Today I had several stop and had to restart just the zigbee2mqtt service and they all started working again.

Sometimes I see the light flash to indicate it has seen up me no packet arrives and the last seen isn't updated.

The only thing that is consistent is how unreliable these devices are.

MacDada commented 7 months ago

I've just installed it yesterday -> detection works for me with no problems.

I also have the Opening sensor entity, that is constantly Closed. And the Identify diagnostic entity, that does nothing upon pressing. Those two I think are a mistake to be present, but not a big issue -> I just disabled them.

Screenshot 2024-01-25 at 12 05 15

image

itsolon commented 7 months ago

Im facing similar issues with TS0202 "group" and at the moment im trying to write a quirk.

I was able to remove that unneccessary sensor. Further steps planned but help needed.

https://community.home-assistant.io/t/tz3000-kmh5qpmb-ts0202-information-on-how-to-tell-what-each-attribute-of-entity-does/670243

zeppu commented 6 months ago

Has anyone managed to successfully change the off wait time for this? I've tried several quirks with no luck.

wsegatto commented 5 months ago

Has anyone been able to make it work with ZHA?

MacDada commented 5 months ago

Has anyone been able to make it work with ZHA?

https://github.com/zigpy/zha-device-handlers/issues/2651#issuecomment-1909931515 ??

wsegatto commented 5 months ago

Has anyone been able to make it work with ZHA?

https://github.com/zigpy/zha-device-handlers/issues/2651#issuecomment-1909931515 ??

Yeah, I got confused. So your "Opening" is at a fixed value but your detection does work? Mine is always stuck at "Detected". And this happens for two units I own. 😕

MacDada commented 5 months ago

your detection does work?

It used to work back when I was using ZHA. It's still working, now that I'm using Zigbee2MQTT. It does not have the opening entity anymore, looks like this: Screenshot 2024-04-14 at 23 01 54

i-segura commented 1 week ago

Hello, I have two of these same devices. Also reports as described here.

Is there a way to change the "keep time" or "wait time" at least manually via device ZHA administration? I've tried reading several zigbee attributes but they all give me an error.