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
752 stars 688 forks source link

[BUG] After latest upgrades PIR triggers 2 motion events 1-minute apart instead of a single event #2075

Closed NdK73 closed 1 year ago

NdK73 commented 1 year ago

Describe the bug After one of the 2023 HA updates my PIR sensor triggers 2 motion events 1 minute apart. Previously it reported "motion" state for 1 minute then returned to normal.

To Reproduce Steps to reproduce the behavior:

  1. Add PIR sensor via ZHA and keep device page open
  2. trigger motion detector
  3. note on+off events followed after 1 minute by another couple of on+off events

Expected behavior I'd expect to see motion events only when something moves in front off the sensor, not when motion is over.

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", "0x0003", "0x0500" ], "out_clusters": [ "0x000a", "0x0019" ] } }, "manufacturer": "TUYATEC-h542kfah", "model": "RH3040", "class": "zigpy.device.Device" } ```
Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant Supervised", "version": "2023.1.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "x86_64", "timezone": "Europe/Rome", "os_name": "Linux", "os_version": "5.10.0-20-amd64", "supervisor": "2022.12.1", "host_os": "Debian GNU/Linux 11 (bullseye)", "docker_version": "20.10.22", "chassis": "vm", "run_as_root": true }, "custom_components": { "tasmota_irhvac": { "version": "2021.12.0", "requirements": [] }, "scheduler": { "version": "v0.0.0", "requirements": [] }, "nodered": { "version": "1.1.2", "requirements": [] }, "remote_homeassistant": { "version": "3.6", "requirements": [] }, "sonoff": { "version": "3.3.1", "requirements": [ "pycryptodome>=3.6.6" ] }, "shelly": { "version": "1.0.2", "requirements": [ "pyShelly==1.0.2", "paho-mqtt==1.6.1", "websocket-client" ] }, "hacs": { "version": "1.29.1", "requirements": [ "aiogithubapi>=22.10.1" ] }, "hisense_tv": { "version": "22.05.09", "requirements": [ "wakeonlan==2.0.1" ] }, "localtuya": { "version": "4.1.1", "requirements": [] }, "dual_smart_thermostat": { "version": "0.5.5", "requirements": [] }, "zha_toolkit": { "version": "v0.8.28", "requirements": [ "packaging>=20.8", "pytz" ] }, "aquaariston": { "version": "1.0.50", "requirements": [] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.34.5", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.90", "zigpy-deconz==0.19.2", "zigpy==0.52.3", "zigpy-xbee==0.16.2", "zigpy-zigate==0.10.3", "zigpy-znp==0.9.2" ], "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" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "dependencies": [ "file_upload" ], "after_dependencies": [ "onboarding", "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": 24858, "manufacturer": "TUYATEC-h542kfah", "model": "RH3040", "name": "TUYATEC-h542kfah RH3040", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4098, "power_source": "Battery or Unknown", "lqi": 91, "rssi": null, "last_seen": "2023-01-08T21:36:12", "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", "0x0003", "0x0500" ], "out_clusters": [ "0x000a", "0x0019" ] } } }, "active_coordinator": false, "entities": [ { "entity_id": "binary_sensor.zbpir01_iaszone", "name": "TUYATEC-h542kfah RH3040" }, { "entity_id": "button.zbpir01_identifybutton", "name": "TUYATEC-h542kfah RH3040" }, { "entity_id": "sensor.zbpir01_battery", "name": "TUYATEC-h542kfah RH3040" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "IAS_ZONE" } ], "user_given_name": "ZBPIR01", "device_reg_id": "4d734146ead7951758255d2b357dc259", "area_id": null, "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": "TUYATEC-h542kfah" }, "0x0005": { "attribute_name": "model", "value": "RH3040" } }, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0020": { "attribute_name": "battery_voltage", "value": 30 }, "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 200 } }, "unsupported_attributes": { "0x0031": { "attribute_name": "battery_size" }, "0x0033": { "attribute_name": "battery_quantity" } } }, "0x0500": { "endpoint_attribute": "ias_zone", "attributes": { "0x0001": { "attribute_name": "zone_type", "value": 13 }, "0x0010": { "attribute_name": "cie_addr", "value": "00:12:4b:00:25:90:6b:f1" } }, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
Additional logs ``` Paste any additional debug logs here. Don't remove the extra line breaks outside the ``` marks. ```

Additional context In december it worked as expected: on for 1 minute when detecting motion, then off.

TheJulianJES commented 1 year ago

There weren't any changes to motion or sensor related stuff.

  1. Is the sensor low on batteries maybe?
  2. Could it detect some other moving heat source?
  3. Do you have another motion sensor that's the same model? (How does that one behave?)
  4. Are the intervals of the other motion events always the same?
  5. Can you attach a screenshot of the HA logbook showing the events?
  6. Did you try re-pairing the sensor?
MattWestb commented 1 year ago

Im sorry TheJulianJES but i think its not one "tuya problem":

  "manufacturer": "TUYATEC-h542kfah",
  "model": "RH3040",
  "class": "zigpy.device.Device"
TheJulianJES commented 1 year ago

Wasn't sure. Some other issues in the deCONZ repo mentioned Tuya a lot (for TUYATEC stuff), so I thought it's an earlier Zigbee manufacturer ID used by Tuya.

MattWestb commented 1 year ago

Im sorry TheJulianJES but i think you is having . . . . right :-(((((( Very likely is one reference design from tuya tec then normally they is using customer manufacture and device IDs but i was not reading the manufacture string with my glasses on !!!

NdK73 commented 1 year ago

@TheJulianJES Sorry it took so long. I ordered another (identical) PIR and batteries. The sensor reported 100% battery (and it was actually quite new).

The "old" battery in the new sensor is still reported as 100%, and makes it work like the old sensor used to: 1 minute on then off.

When I placed new battery in old sensor it couldn't detect movements at all. Once re-paired it resumed "bad" behaviour: on-off-1 minute-on-off :(

NdK73 commented 1 year ago

After latest upgrades it resumed correct behaviour. Mah! Tks.