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
760 stars 698 forks source link

[BUG] Centralite 3325-S Not showing occupancy #2051

Closed aldalen closed 1 year ago

aldalen commented 1 year ago

Describe the bug The CentraLite 3325-S motion sensor quirk is not exposing motion/occupancy properly.

To Reproduce Steps to reproduce the behavior:

  1. Add CentraLite 3325-S to ZHA via SkyConnect

Expected behavior Occupancy is shown.

Screenshots If applicable, add screenshots to help explain your problem.

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=4174, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=0, 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", "0x0020", "0x0402", "0x0500", "0x0b05" ], "out_clusters": [ "0x0019" ] }, "2": { "profile_id": 49887, "device_type": "0x0107", "in_clusters": [ "0x0000", "0x0003", "0x0b05", "0xfc46" ], "out_clusters": [ "0x0003" ] } }, "manufacturer": "CentraLite", "model": "3325-S", "class": "zhaquirks.centralite.motion.CentraLiteMotionSensor" } ```
Diagnostic information ```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.12.8", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "x86_64", "timezone": "America/Los_Angeles", "os_name": "Linux", "os_version": "5.15.80", "supervisor": "2022.12.1", "host_os": "Home Assistant OS 9.4", "docker_version": "20.10.19", "chassis": "vm", "run_as_root": true }, "custom_components": { "fontawesome": { "version": "1.0.0", "requirements": [] }, "hacs": { "version": "1.29.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "mail_and_packages": { "version": "0.3.4-2", "requirements": [ "imageio>=2.9.0", "python-resize-image>=1.1.19" ] }, "hubitat": { "version": "0.8.3", "requirements": [ "hubitatmaker>=0.6.1,<0.7.0" ] }, "meross_cloud": { "version": "1.2.6", "requirements": [ "meross_iot==0.4.5.0" ] }, "unifiled_custom": { "version": "1.0.0", "requirements": [] }, "wyzeapi": { "version": "0.1.15", "requirements": [ "wyzeapy==0.5.14" ] }, "fordpass": { "version": "0.1.40", "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.89", "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*" } ], "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": 4407, "manufacturer": "CentraLite", "model": "3325-S", "name": "CentraLite 3325-S", "quirk_applied": true, "quirk_class": "zhaquirks.centralite.motion.CentraLiteMotionSensor", "manufacturer_code": 4174, "power_source": "Battery or Unknown", "lqi": 248, "rssi": -38, "last_seen": "2022-12-31T15:44:43", "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=4174, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=0, 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", "0x0020", "0x0402", "0x0500", "0x0b05" ], "out_clusters": [ "0x0019" ] }, "2": { "profile_id": 49887, "device_type": "0x0107", "in_clusters": [ "0x0000", "0x0003", "0x0b05", "0xfc46" ], "out_clusters": [ "0x0003" ] } } }, "active_coordinator": false, "entities": [ { "entity_id": "sensor.centralite_3325_s_battery", "name": "CentraLite 3325-S" }, { "entity_id": "sensor.centralite_3325_s_temperature", "name": "CentraLite 3325-S" }, { "entity_id": "binary_sensor.living_room_motion_sensor_iaszone", "name": "CentraLite 3325-S" }, { "entity_id": "button.living_room_motion_sensor_identify", "name": "CentraLite 3325-S" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "IAS_ZONE" }, { "name": "unknown 263 device_type of 0xc2df profile id" } ], "user_given_name": "Living Room Motion Sensor", "device_reg_id": "b08dda182dcab4018c68da96baca869f", "area_id": "8034f1bb050a46cb8b7052396cd286a5", "cluster_details": { "1": { "device_type": { "name": "IAS_ZONE", "id": 1026 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0020": { "attribute_name": "battery_voltage", "value": 26 }, "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 169 }, "0x0031": { "attribute_name": "battery_size", "value": 2 }, "0x0033": { "attribute_name": "battery_quantity", "value": 1 } }, "unsupported_attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining" } } }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0020": { "endpoint_attribute": "poll_control", "attributes": { "0x0000": { "attribute_name": "checkin_interval", "value": 13200 } }, "unsupported_attributes": {} }, "0x0402": { "endpoint_attribute": "temperature", "attributes": { "0x0000": { "attribute_name": "measured_value", "value": 2708 } }, "unsupported_attributes": {} }, "0x0500": { "endpoint_attribute": "ias_zone", "attributes": { "0x0000": { "attribute_name": "zone_state", "value": 1 }, "0x0001": { "attribute_name": "zone_type", "value": 13 }, "0x0002": { "attribute_name": "zone_status", "value": 38 } }, "unsupported_attributes": {} }, "0x0b05": { "endpoint_attribute": "diagnostic", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} } } }, "2": { "device_type": { "name": "unknown", "id": 263 }, "profile_id": 49887, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0b05": { "endpoint_attribute": "diagnostic", "attributes": {}, "unsupported_attributes": {} }, "0xfc46": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
Additional logs ``` Initial Discovery: [0x1137] Discovered basic device information for Device is initialized Checking quirks for CentraLite 3325-S (00:0d:6f:00:0b:c8:bb:b6) Considering Found custom device replacement for 00:0d:6f:00:0b:c8:bb:b6: 'binary_sensor' component -> 'IASZone' using ['ias_zone'] 'button' component -> 'ZHAIdentifyButton' using ['identify'] 'sensor' component -> 'Battery' using ['power'] 'sensor' component -> 'Temperature' using ['temperature'] 'sensor' component -> 'RSSISensor' using ['basic'] 'sensor' component -> 'LQISensor' using ['basic'] 'button' component -> 'ZHAIdentifyButton' using ['identify'] 'sensor' component -> 'RSSISensor' using ['basic'] 'sensor' component -> 'LQISensor' using ['basic'] device - 0x1137:00:0d:6f:00:0b:c8:bb:b6 entering async_device_initialized - is_new_join: True device - 0x1137:00:0d:6f:00:0b:c8:bb:b6 has joined the ZHA zigbee network [0x1137](3325-S): started configuration [0x1137:ZDO](3325-S): 'async_configure' stage succeeded [0x1137:1:0x0500] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=, is_manufacturer_specific=False, direction=, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True, *is_reply=False), tsn=204, command_id=, *direction=, *is_reply=False) [0x1137:1:0x0500] Sending request: Read_Attributes(attribute_ids=[1]) [0x1137] Extending timeout for 0xcc request [0x1137:1:0x0003]: Configuring cluster attribute reporting [0x1137:1:0x0003]: finished channel configuration [0x1137:1:0x0001]: Performing cluster binding [0x1137] Extending timeout for 0xce request [0x1137:1:0x0402]: Performing cluster binding [0x1137] Extending timeout for 0xd0 request [0x1137:1:0x0000]: Configuring cluster attribute reporting [0x1137:1:0x0000]: finished channel configuration [0x1137:1:0x0020]: Performing cluster binding [0x1137] Extending timeout for 0xd2 request [0x1137:1:0x0019]: finished channel configuration [0x1137:2:0x0003]: Configuring cluster attribute reporting [0x1137:2:0x0003]: finished channel configuration [0x1137:2:0x0000]: Configuring cluster attribute reporting [0x1137:2:0x0000]: finished channel configuration Error handling '_save_attribute' event with (00:0d:6f:00:0b:c8:bb:b6, 1, 0, 4, 'CentraLite') params: FOREIGN KEY constraint failed [0x1137:2:0x0003]: 'async_configure' stage succeeded [0x1137:2:0x0000]: 'async_configure' stage succeeded Error handling '_save_attribute' event with (00:0d:6f:00:0b:c8:bb:b6, 1, 0, 5, '3325-S') params: FOREIGN KEY constraint failed ```

Additional context The big giveaway seems to be unknown 263 device_type of 0xc2df profile id . I noticed the 3305-S quirk has the 3325-S model listed, but uses a different MFG specific key. The 3325-S seems to be using the the base CentraLite "motion" quirk.

Seems like some changes were made a while ago via https://github.com/zigpy/zha-device-handlers/issues/19 and https://github.com/zigpy/zha-device-handlers/issues/20.

javicalle commented 1 year ago

Devices in zhaquirks.centralite.motion.CentraLiteMotionSensor quirk are also defined on the zhaquirks.centralite.motion.CentraLite3305S, but they have diferent device signature. This can mean that they are different devices or that they have a different firmware.

Devices with the CentraLiteMotionSensor would have a IasZone cluster, that could be a motion sensor, but doesn't have any OccupancySensing cluster, so no occupancy for that devices.

If you are guessing if it is possible to add it, the answer is no, it is not possible to add the cluster if the device does not send the information.

It is true that the device signature is confussing because declares a occupancy device type, but not the cluster. Maybe is reporting some info trought the MANUFACTURER_SPECIFIC_CLUSTER_ID but no one has implemented that functionality, so hard to know.

aldalen commented 1 year ago

I was using this before with hubitat and it got motion/occupancy information just fine (using their "generic" driver too), so I doubt its an blocking issue with the device since software can workaround. So that leads me to believe this problem is the in the quirk.

I don't understand your last comment there... is there a way to modify the quirk to accept altered info?

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.