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
696 stars 641 forks source link

[Device Support Request] Aqara Motion Sensor P1 (lumi.motion.ac02) #1498

Closed madface303 closed 2 years ago

madface303 commented 2 years ago

Is your feature request related to a problem? Please describe. The Sensor is recognized by ZHA but there is no motion sensor (only power, lqi and rssi, power and rssi have state unknown)

Link to product https://www.aqara.com/en/product/motion-sensor-p1

Describe the solution you'd like Use it with home assistant ;)

Device signature - this can be acquired by removing the device from ZHA and pairing it again from the add devices screen. Be sure to add the entire content of the log panel after pairing the device to a code block below this line.

[0x0000:zdo] ZDO request ZDOCmd.Mgmt_Permit_Joining_rsp: [<Status.SUCCESS: 0>]
[0x0000:zdo] No handler for ZDO request:ZDOCmd.Mgmt_Permit_Joining_rsp([<Status.SUCCESS: 0>])
[0x36FE:1:0x0400] Received ZCL frame: b'\x18\xE9\x0A\x00\x00\x21\x78\x53'
[0x36FE:1:0x0400] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=233, command_id=10, *is_reply=True)
[0x36FE:1:0x0400] Decoded ZCL frame: IlluminanceMeasurement:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=uint16_t, value=21368))])
[0x36FE:1:0x0400] Received command 0x0A (TSN 233): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=uint16_t, value=21368))])
[0x36FE:1:0x0400] Attribute report received: measured_value=21368
[0x8A98:1:0x0500]: Updated alarm state: 0
New device 0x703f (54:ef:44:10:00:43:e9:2c) joined the network
[0x703f] Scheduling initialization
Received frame on uninitialized device <Device model=None manuf=None nwk=0x703F ieee=54:ef:44:10:00:43:e9:2c is_initialized=False> from ep 0 to ep 0, cluster 19: b'f?p,\xe9C\x00\x10D\xefT\x80'
[0x703f:zdo] ZDO request ZDOCmd.Device_annce: [0x703F, 54:ef:44:10:00:43:e9:2c, 128]
Tries remaining: 3
[0x703f] Requesting 'Node Descriptor'
Tries remaining: 2
[0x703f] Extending timeout for 0x50 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x703F ieee=54:ef:44:10:00:43:e9:2c is_initialized=False> from ep 0 to ep 0, cluster 32770: b'P\x00?p\x02@\x80_\x11\x7fd\x00\x00,d\x00\x00'
[0x703f] Got 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=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=11264, maximum_outgoing_transfer_size=100, 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)
[0x703f] Discovering endpoints
Tries remaining: 3
[0x703f] Extending timeout for 0x51 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x703F ieee=54:ef:44:10:00:43:e9:2c is_initialized=False> from ep 0 to ep 0, cluster 32773: b'Q\x00?p\x01\x01'
[0x703f] Discovered endpoints: [1]
[0x703f] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>]
[0x703f:1] Discovering endpoint information
Tries remaining: 3
[0x703f] Extending timeout for 0x52 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x703F ieee=54:ef:44:10:00:43:e9:2c is_initialized=False> from ep 0 to ep 0, cluster 32772: b'R\x00?p\x16\x01\x04\x01\x07\x01\x01\x04\x00\x00\x01\x00\x03\x00\xc0\xfc\x03\x03\x00\x19\x00\xc0\xfc'
[0x703f:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=263, device_version=1, input_clusters=[0, 1, 3, 64704], output_clusters=[3, 25, 64704])
[0x703F:1:0x0000] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=0, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True), tsn=83, command_id=<GeneralCommand.Read_Attributes: 0>, *is_reply=False)
[0x703F:1:0x0000] Sending request: Read_Attributes(attribute_ids=[4, 5])
[0x703f] Extending timeout for 0x53 request
[0x703F:1:0x0000] Received ZCL frame: b'\x18\x00\x0A\x01\x00\x20\x05\x05\x00\x42\x10\x6C\x75\x6D\x69\x2E\x6D\x6F\x74\x69\x6F\x6E\x2E\x61\x63\x30\x32'
[0x703F:1:0x0000] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=0, command_id=10, *is_reply=True)
[0x703F:1:0x0000] Decoded ZCL frame: Basic:Report_Attributes(attribute_reports=[Attribute(attrid=0x0001, value=TypeValue(type=uint8_t, value=5)), Attribute(attrid=0x0005, value=TypeValue(type=CharacterString, value='lumi.motion.ac02'))])
[0x703F:1:0x0000] Received command 0x0A (TSN 0): Report_Attributes(attribute_reports=[Attribute(attrid=0x0001, value=TypeValue(type=uint8_t, value=5)), Attribute(attrid=0x0005, value=TypeValue(type=CharacterString, value='lumi.motion.ac02'))])
[0x703F:1:0x0000] Attribute report received: app_version=5, model='lumi.motion.ac02'
Error handling '_save_attribute' event with (54:ef:44:10:00:43:e9:2c, 1, 0, 1, 5) params: FOREIGN KEY constraint failed
[0x703F:1:0x0000] Received ZCL frame: b'\x18\x53\x01\x04\x00\x00\x42\x04\x4C\x55\x4D\x49\x05\x00\x00\x42\x10\x6C\x75\x6D\x69\x2E\x6D\x6F\x74\x69\x6F\x6E\x2E\x61\x63\x30\x32'
[0x703F:1:0x0000] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=83, command_id=1, *is_reply=True)
[0x703F:1:0x0000] Decoded ZCL frame: Basic:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0004, status=<Status.SUCCESS: 0>, value=TypeValue(type=CharacterString, value='LUMI')), ReadAttributeRecord(attrid=0x0005, status=<Status.SUCCESS: 0>, value=TypeValue(type=CharacterString, value='lumi.motion.ac02'))])
[0x703f] Read model 'lumi.motion.ac02' and manufacturer 'LUMI' from <Endpoint id=1 in=[basic:0x0000, power:0x0001, identify:0x0003, manufacturer_specific:0xFCC0] out=[identify:0x0003, ota:0x0019, manufacturer_specific:0xFCC0] status=<Status.ZDO_INIT: 1>>
[0x703f] Discovered basic device information for <Device model='lumi.motion.ac02' manuf='LUMI' nwk=0x703F ieee=54:ef:44:10:00:43:e9:2c is_initialized=True>
Device is initialized <Device model='lumi.motion.ac02' manuf='LUMI' nwk=0x703F ieee=54:ef:44:10:00:43:e9:2c is_initialized=True>
Checking quirks for LUMI lumi.motion.ac02 (54:ef:44:10:00:43:e9:2c)
Considering <class 'zhaquirks.xbee.xbee_io.XBeeSensor'>
Fail because endpoint list mismatch: {232, 230} {1}
Considering <class 'zhaquirks.xbee.xbee3_io.XBee3Sensor'>
Fail because endpoint list mismatch: {232, 230} {1}
Considering <class 'zhaquirks.smartthings.tag_v4.SmartThingsTagV4'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.smartthings.multi.SmartthingsMultiPurposeSensor'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.netvox.z308e3ed.Z308E3ED'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.gledopto.soposhgu10.SoposhGU10'>
Fail because endpoint list mismatch: {11, 13} {1}
Considering <class 'bellows.zigbee.application.EZSPCoordinator'>
Fail because device_type mismatch on at least one endpoint
Error handling '_save_attribute' event with (54:ef:44:10:00:43:e9:2c, 1, 0, 5, 'lumi.motion.ac02') params: FOREIGN KEY constraint failed
'button' component -> 'ZHAIdentifyButton' using ['identify']
'sensor' component -> 'Battery' using ['power']
'sensor' component -> 'RSSISensor' using ['basic']
'sensor' component -> 'LQISensor' using ['basic']
device - 0x703F:54:ef:44:10:00:43:e9:2c entering async_device_initialized - is_new_join: True
device - 0x703F:54:ef:44:10:00:43:e9:2c has joined the ZHA zigbee network
[0x703F](lumi.motion.ac02): started configuration
[0x703F:ZDO](lumi.motion.ac02): 'async_configure' stage succeeded
Error handling '_save_attribute' event with (54:ef:44:10:00:43:e9:2c, 1, 0, 4, 'LUMI') params: FOREIGN KEY constraint failed
[0x703f] Extending timeout for 0x54 request
[0x703F:1:0x0003]: finished channel configuration
[0x703F:1:0x0000]: finished channel configuration
[0x703f] Extending timeout for 0x55 request
[0x703F:1:0x0019]: finished channel configuration
Error handling '_save_attribute' event with (54:ef:44:10:00:43:e9:2c, 1, 0, 5, 'lumi.motion.ac02') params: FOREIGN KEY constraint failed
[0x703F:1:0x0001]: bound 'power' cluster: Status.SUCCESS
[0x703F:1:0x0001] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=0, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True), tsn=86, command_id=<GeneralCommand.Configure_Reporting: 6>, *is_reply=False)
[0x703F:1:0x0001] Sending request: Configure_Reporting(config_records=[AttributeReportingConfig(direction=0, attrid=0x0020, datatype=32, min_interval=3600, max_interval=10800, reportable_change=1), AttributeReportingConfig(direction=0, attrid=0x0021, datatype=32, min_interval=3600, max_interval=10800, reportable_change=1)])
[0x703f] Extending timeout for 0x56 request
[0x703F:1:0xfcc0]: bound 'manufacturer_specific' cluster: Status.SUCCESS
[0x703F:1:0xfcc0]: finished channel configuration
[0x703F:1:0x0001] Received ZCL frame: b'\x18\x56\x07\x8C\x00\x20\x00\x86\x00\x21\x00'
[0x703F:1:0x0001] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=86, command_id=7, *is_reply=True)
[0x703F:1:0x0001] Decoded ZCL frame: PowerConfiguration:Configure_Reporting_rsp(status_records=[ConfigureReportingResponseRecord(status=140, direction=0, attrid=32), ConfigureReportingResponseRecord(status=134, direction=0, attrid=33)])
[0x703F:1:0x0001]: Successfully configured reporting for 'set()' on 'power' cluster
[0x703F:1:0x0001]: Failed to configure reporting for '['battery_voltage', 'battery_percentage_remaining']' on 'power' cluster: [ConfigureReportingResponseRecord(status=140, direction=0, attrid=32), ConfigureReportingResponseRecord(status=134, direction=0, attrid=33)]
[0x703F:1:0x0001]: finished channel configuration
[0x703F:1:0x0001]: 'async_configure' stage succeeded
[0x703F:1:0x0003]: 'async_configure' stage succeeded
[0x703F:1:0x0000]: 'async_configure' stage succeeded
[0x703F:1:0xfcc0]: 'async_configure' stage succeeded
[0x703F:1:0x0019]: 'async_configure' stage succeeded
[0x703F](lumi.motion.ac02): completed configuration
[0x703F](lumi.motion.ac02): stored in registry: ZhaDeviceEntry(name='LUMI lumi.motion.ac02', ieee='54:ef:44:10:00:43:e9:2c', last_seen=1650036917.3284822)
[0x703F:1:0x0003] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=False, is_reply=0, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), tsn=87, command_id=64, *is_reply=False)
[0x703F:1:0x0003] Sending request: trigger_effect(effect_id=<EffectIdentifier.Okay: 2>, effect_variant=<EffectVariant.Default: 0>)
[0x703f] Extending timeout for 0x57 request
[0x703F:1:0x0003] Received ZCL frame: b'\x18\x57\x0B\x40\x00'
[0x703F:1:0x0003] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=87, command_id=11, *is_reply=True)
[0x703F:1:0x0003] Decoded ZCL frame: Identify:Default_Response(command_id=64, status=<Status.SUCCESS: 0>)
[0x703F:1:0x0003]: executed 'trigger_effect' command with args: '(2, 0)' kwargs: '{}' result: Default_Response(command_id=64, status=<Status.SUCCESS: 0>)
[0x703F](lumi.motion.ac02): started initialization
[0x703F:ZDO](lumi.motion.ac02): 'async_initialize' stage succeeded
[0x703F:1:0x0001]: initializing channel: from_cache: False
[0x703F:1:0x0001] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=0, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True), tsn=88, command_id=<GeneralCommand.Read_Attributes: 0>, *is_reply=False)
[0x703F:1:0x0001] Sending request: Read_Attributes(attribute_ids=[32, 33])
[0x703f] Extending timeout for 0x58 request
[0x703F:1:0x0003]: initializing channel: from_cache: False
[0x703F:1:0x0003]: finished channel initialization
[0x703F:1:0x0000]: initializing channel: from_cache: False
[0x703F:1:0x0000]: finished channel initialization
[0x703F:1:0xfcc0]: initializing channel: from_cache: False
[0x703F:1:0xfcc0]: finished channel initialization
[0x703F:1:0x0019]: initializing channel: from_cache: False
[0x703F:1:0x0019]: finished channel initialization
[0x703F:1:0x0001] Received ZCL frame: b'\x18\x58\x01\x20\x00\x00\x20\x1F\x21\x00\x86'
[0x703F:1:0x0001] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=88, command_id=1, *is_reply=True)
[0x703F:1:0x0001] Decoded ZCL frame: PowerConfiguration:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0020, status=<Status.SUCCESS: 0>, value=TypeValue(type=uint8_t, value=31)), ReadAttributeRecord(attrid=0x0021, status=<Status.UNSUPPORTED_ATTRIBUTE: 134>)])
[0x703F:1:0x0001] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=0, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True), tsn=89, command_id=<GeneralCommand.Read_Attributes: 0>, *is_reply=False)
[0x703F:1:0x0001] Sending request: Read_Attributes(attribute_ids=[49, 51])
[0x703f] Extending timeout for 0x59 request
[0x703F:1:0x0001] Received ZCL frame: b'\x18\x59\x01\x31\x00\x86\x33\x00\x86'
[0x703F:1:0x0001] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=89, command_id=1, *is_reply=True)
[0x703F:1:0x0001] Decoded ZCL frame: PowerConfiguration:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0031, status=<Status.UNSUPPORTED_ATTRIBUTE: 134>), ReadAttributeRecord(attrid=0x0033, status=<Status.UNSUPPORTED_ATTRIBUTE: 134>)])
[0x703F:1:0x0001]: finished channel initialization
[0x703F:1:0x0001]: 'async_initialize' stage succeeded
[0x703F:1:0x0003]: 'async_initialize' stage succeeded
[0x703F:1:0x0000]: 'async_initialize' stage succeeded
[0x703F:1:0xfcc0]: 'async_initialize' stage succeeded
[0x703F:1:0x0019]: 'async_initialize' stage succeeded
[0x703F](lumi.motion.ac02): power source: Battery or Unknown
[0x703F](lumi.motion.ac02): completed initialization
[0x36FE:1:0x0400] Received ZCL frame: b'\x18\x08\x0A\x00\x00\x21\xD6\x52'
[0x36FE:1:0x0400] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=8, command_id=10, *is_reply=True)
[0x36FE:1:0x0400] Decoded ZCL frame: IlluminanceMeasurement:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=uint16_t, value=21206))])
[0x36FE:1:0x0400] Received command 0x0A (TSN 8): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=uint16_t, value=21206))])
[0x36FE:1:0x0400] Attribute report received: measured_value=21206
Tropaion commented 2 years ago

@madface303 Can you post the device signature? Without it, we can't really help much.

madface303 commented 2 years ago

Oh sorry, i'm really new to this.

{
  "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=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=11264, maximum_outgoing_transfer_size=100, 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": 260,
      "device_type": "0x0107",
      "in_clusters": [
        "0x0000",
        "0x0001",
        "0x0003",
        "0xfcc0"
      ],
      "out_clusters": [
        "0x0003",
        "0x0019",
        "0xfcc0"
      ]
    }
  },
  "manufacturer": "LUMI",
  "model": "lumi.motion.ac02",
  "class": "zigpy.device.Device"
}

Is it that what you need?

Tropaion commented 2 years ago

Yes, that's what I need 😄. Your device is a bit weird, may need a bit of testing. Try if this custom quirk works for your device: motion_ac02.zip How to install custom quirk: https://github.com/zigpy/zha-device-handlers/discussions/693#discussioncomment-857274

madface303 commented 2 years ago

Thank you very much. Just tried but it doesn't work. I have to pair it twice (the first time it hangs at the initialize stage in HA). There are now 2 new sensors (ias_zone and occupancy, i know the from my old aqara motion sensors), but non of them changes if there is motion.

Tropaion commented 2 years ago

Did you check if the quirk applies? Did you get some error in the logs?

Tropaion commented 2 years ago

@madface303 Does the battery status work? @MattWestb Do you know something about this? The device is very weird, it doesn't have a OccupancySensing input cluster, could it be the information is handled via the manufacturer cluster 0xFCC0?

MattWestb commented 2 years ago

Xiaomi / Aquara is having there own protocol they is using for some functions but i have dot digging in it but you can looking in the xiaomi and aquara quirk folder and i think you is finding most in the init and also in other devices how they have doing all things we knowing (Xiaomi was one large PITA before tuya was taking over with there MCU devices).

madface303 commented 2 years ago

@Tropaion No, there is a battery sensor but it's state is unknown. I attached a picture of the entities in HA. I think the quirk applied because in ZHA Interface i can see 'motion_ac02.MotionT1' Debug Logs of the pairing process is attached too

lumi_ac02

zha_log.zip .

Tropaion commented 2 years ago

@madface303 I looks like this will be trial and error. Since this device is similar to an already existing one, lets try this first: motion_ac02.zip

madface303 commented 2 years ago

Thank you very much, but unfortunately it is also not working. Now i have another sensor with illumance which has 302lx and is not changing like other sensors.

Screenshot 2022-04-17 101857

I found another thread for this device for Zigbee2MQTT. I do not know much about zigbee behind the scenes, maybe it can help you? https://github.com/Koenkk/zigbee2mqtt/issues/11990

And do you need logfiles from me again? Thanks for your help!

ScottG489 commented 2 years ago

Btw, this devices is working with zigbee2mqtt. Hopefully this issue can provide some information you'll find helpful: https://github.com/Koenkk/zigbee2mqtt/issues/11990

sklosinski commented 2 years ago

Noob question... How does this update get pulled in to zha?

TheJulianJES commented 2 years ago

The sensor isn't supported yet. If it's supported eventually, the update will arrive through a normal Home Assistant Core update.

(It's also possible to temporarily install a custom quirk when it's done, but that can break stuff too.)

MrRagga- commented 2 years ago

Hi, what is the status? I've just bought the device and I am also familar with python. I could help develop it further, if needed?

dmulcahey commented 2 years ago

There is a or open in draft. Everything works except the configuration

MrRagga- commented 2 years ago

My signature looks a bit different, so I am posting it, too:

{
  "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=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=11264, maximum_outgoing_transfer_size=100, 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": 260,
      "device_type": "0x0107",
      "in_clusters": [
        "0x0000",
        "0x0001",
        "0x0003",
        "0x0400",
        "0x0406",
        "0x0500",
        "0xfcc0"
      ],
      "out_clusters": [
        "0x0003",
        "0x0019",
        "0xfcc0"
      ]
    }
  },
  "manufacturer": "LUMI",
  "model": "lumi.motion.ac02",
  "class": "motion_ac02.LumiMotionAC02"
}
dmulcahey commented 2 years ago

Hrm… there must be a mode setting for these then. I tried the well known one and it didn’t work… maybe I did something wrong. Does yours just work??

MrRagga- commented 2 years ago

I added the motion_ac02.pyfrom your draft PR and added it to the /config/custom_zha_quirks/ folder, changed the configuration.yaml to load it and restarted hass.

zha:
  custom_quirks_path: /config/custom_zha_quirks/

See the screenshot in the PR. ias_zone, illuminance and occupancy looks ok, but the battery is not displayed properly. Sensors are looking good and seem to work.

dmulcahey commented 2 years ago

My quirk won’t apply to your device. So that means yours works ootb.

dmulcahey commented 2 years ago

Never mind… you posted the signature after the quirk was applied

MrRagga- commented 2 years ago

I am a bit confused now. Did I apply your quirk now or not?

MrRagga- commented 2 years ago

Btw, battery is also displayed now. Looks good.

dmulcahey commented 2 years ago

Yes you did.

LCMilstein commented 2 years ago

FWIW, I installed the custom quirk, which is getting picked up by ZHA, and the device pairs, but doesn't work. I see the following:

And this happens even if I press the physical button to wake it up, and no matter what I waive in front of the sensor itself. There's also "Identify: Press" which does nothing, and 2 unshown diagnostic entities. I've paired and re-paired a few times with the same results. I have NOT cleared pycache as I'm not sure if that will mess up the working devices, but will try if that's necessary.

dmulcahey commented 2 years ago

FWIW, I installed the custom quirk, which is getting picked up by ZHA, and the device pairs, but doesn't work. I see the following:

  • Power: unknown
  • ias_zone: Clear
  • Occupancy: Clear

And this happens even if I press the physical button to wake it up, and no matter what I waive in front of the sensor itself. There's also "Identify: Press" which does nothing, and 2 unshown diagnostic entities. I've paired and re-paired a few times with the same results. I have NOT cleared pycache as I'm not sure if that will mess up the working devices, but will try if that's necessary.

What is your coordinator? For TI / Conbee you NEED to be on the latest firmwares or the device will not communicate w/ the network

LCMilstein commented 2 years ago

@dmulcahey I'm using the Nortek HubZ USB stick (HUSBZB-1). It's not perfect, but I have a lot of other Aqara devices paired with it successfully.

dmulcahey commented 2 years ago

And what version of HA?

LCMilstein commented 2 years ago

And what version of HA?

2022.4.7

dmulcahey commented 2 years ago

Have you done anything with custom deps or anything wacky? I’m also using a Nortek stick and it just works once quirked. I’m out of ideas…

LCMilstein commented 2 years ago

Nope. Nothing. I'm running Home Assistant in Docker on Synology, and have HACS with some repositories, but nothing that should impact ZHA. This is the ONLY custom quirk I have installed. I have been trying to figure out if the Nortek is on the latest firmware, but I've only had it a handful of months and it said it was the latest when I got it... Should I be trying to update that... would I use the instructions here ( https://github.com/walthowd/husbzb-firmware)?

On Mon, May 2, 2022 at 5:28 PM David F. Mulcahey @.***> wrote:

Have you done anything with custom deps or anything wacky? I’m also using a Nortek stick and it just works once quirked. I’m out of ideas…

— Reply to this email directly, view it on GitHub https://github.com/zigpy/zha-device-handlers/issues/1498#issuecomment-1115387904, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB74P7CUIZ2CM5UEGEWYW7DVIBCJJANCNFSM5TQSSGQQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Lee Milstein | @.*** | 917-509-9237

LCMilstein commented 2 years ago

UPDATE: I deleted the custom quirk and folder along with the reference to the zha folder in the config. Then restarted ha twice. Then downloaded the quirk again and started fresh with install and pairing... It worked! It never reached the screen with the yellow and green icons, but the sensors are working when I look at the device or entities in developer tools or configuration devices.

I can't set sensitivity levels, but this is already fantastic!

LCMilstein commented 2 years ago

@dmulcahey Amazing work you're doing. Do you have a new zip of the custom quirk you'd like us to test?

Korni22 commented 2 years ago

The quirk from @Tropaion looks pretty good to me as well.

Even the illuminance sensor seems to work for me.

Just like @LCMilstein the sensitivity levels would be amazing, no idea what that takes to get to work though.

dmulcahey commented 2 years ago

@dmulcahey Amazing work you're doing. Do you have a new zip of the custom quirk you'd like us to test?

The linked PR has the current code. This device may require a HA change for the custom interval support… I have it working just not sure if I like it

LCMilstein commented 2 years ago

@dmulcahey Amazing work you're doing. Do you have a new zip of the custom quirk you'd like us to test?

The linked PR has the current code. This device may require a HA change for the custom interval support… I have it working just not sure if I like it

Apologies for the dumb question, but I am only somewhat technical and not super familiar with the capabilities here on GitHub... I have gone to your pull request, but when I click on the second link, it just takes me to a description page; there's no file there to download. Am I supposed to copy the code and save it to a file using my editor directly? Has the .zip file you linked to above been updated so I can just download that again (even though it has the same name it did before your latest additions)? OR should I just wait until it gets incorporated into HA's update in a future release?

MollyrH commented 2 years ago

I installed the linked P1 quirk and was successfully using the P1 to trigger LED lights when entering a room. This was with HA OS 7.6 installed.

This morning, I upgraded to HA OS 8.0 and now the P1 will not initiate the automations. The P1 still shows correctly detecting motion, but the automations no longer start. Nothing else in the system changed other than allowing the OS upgrade.

If I trigger the P1 such that it shows "detected", I can manually run the automations and they function properly. However, as mentioned above, the P1 will not trigger the automations "automatically". I edited the automations to re-search/reconnect with the P1 but no joy.

Any thoughts?

dmulcahey commented 2 years ago

I installed the linked P1 quirk and was successfully using the P1 to trigger LED lights when entering a room. This was with HA OS 7.6 installed.

This morning, I upgraded to HA OS 8.0 and now the P1 will not initiate the automations. The P1 still shows correctly detecting motion, but the automations no longer start. Nothing else in the system changed other than allowing the OS upgrade.

If I trigger the P1 such that it shows "detected", I can manually run the automations and they function properly. However, as mentioned above, the P1 will not trigger the automations "automatically". I edited the automations to re-search/reconnect with the P1 but no joy.

Any thoughts?

Nothing on our end can cause that.

Anto79-ops commented 2 years ago

hi, watching this thread closely cause I have a few of the P1s in the box, and waiting for the official integration in ZHA (sorry, I know that doesn't help). But have you tried checking automation trace to be sure if it’s a trigger or condition issue? Also, check the HA logs at around the time where the automation sould have worked.

MollyrH commented 2 years ago

Anto79-ops - good suggestions on trace and David was correct, there was not anything in the update that caused the problem - just something dumb I did. So much to learn - thank you both for responding so quickly.

Anto79-ops commented 2 years ago

quick question for those using the quirk, there was a request for the light detection (lux) part to operate without the motion. Is this working in the quirk and if so, how often does the light sensor report? thanks!

MollyrH commented 2 years ago

As of this time, the light detection seems tied to the motion sensor. When motion is detected, the lux value updates. I could not see any lux updates in my system between motion detection occurrences.

LCMilstein commented 2 years ago

After over a week of usage, I'm finding 2 challenges with the version of the device so far:

  1. In my office, if I use this device to control lights, the lights go out no matter how much I'm moving in my seat, and I have to approach the device (get within a few feet) for the lights to be triggered to go back on. I'm assuming this has to do with the update interval and/or the range. I do NOT have this issue when using a Lutron Caseta Motion Sensor; and
  2. In my hallway, I am seeing occupancy "detected" for a LONG time after I've left the hall, which I also assume has to do with the update interval (I guess they're different for motion and occupancy?).
diederik-maes commented 2 years ago

I got 2 of these today. Added 1 to ZHA without issues but indeed it shows nothing, no motion and battery status unknown. Looking forward to seeing this been added to ZHA and configurable.

Jeppedy commented 2 years ago

I removed and readded this device after the official release. There are entities called opple_cluster, which I've rather determined what they are, but detection time doesn't seem to do anything, I don't know what the "switch" does (it auto resets after a fixed period of time) and no lux indictator. Whassup?

TheJulianJES commented 2 years ago

@Jeppedy There seems to be a bug where the lux sensor currently doesn't initialize, so it won't work for now.

Regarding changing the settings: you'll need to change the setting (detection interval, sensitivity or the trigger LED) and then immediately press the button on the motion sensor once, so it updates the setting.

You'll find out what configuration entity does what at the end of the entity name/id by default.

karthik-krishnan commented 2 years ago

I found a workaround for the detection interval setting change not taking effect. If I use the developer setting page to change the setting it stays. Yet to test if it’s taking effect or not.

Best regards, Karthik. https://karthiks.in Sent from my iPhone

On Jun 3, 2022, at 1:28 AM, TheJulianJES @.***> wrote:

 @Jeppedy There seems to be a bug where the lux sensor currently doesn't initialize, so it won't work for now.

Regarding changing the settings: you'll need to change the setting (detection interval, sensitivity or the trigger LED) and then immediately press the button on the motion sensor once, so it updates the setting.

You'll find out what configuration entity does what at the end of the entity name/id by default.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

TheJulianJES commented 2 years ago

It should also work that way. I'm able to properly use the configuration setting for the detection interval. Just have to press the button on the sensor shortly after hitting enter/clicking out of the field/changing the number.

MollyrH commented 1 year ago

Yup - you’re correct. Something dumb on my part…. 😞. So much to learn….

Sorry for the false alarm and thanks for all the effort you are putting into HA. It’s a STEEP learning curve, but so much better than others products in the market.

Best regards, Bobby Hobbs

On May 16, 2022, at 11:46 AM, David F. Mulcahey @.***> wrote:



I installed the linked P1 quirk and was successfully using the P1 to trigger LED lights when entering a room. This was with HA OS 7.6 installed.

This morning, I upgraded to HA OS 8.0 and now the P1 will not initiate the automations. The P1 still shows correctly detecting motion, but the automations no longer start. Nothing else in the system changed other than allowing the OS upgrade.

If I trigger the P1 such that it shows "detected", I can manually run the automations and they function properly. However, as mentioned above, the P1 will not trigger the automations "automatically". I edited the automations to re-search/reconnect with the P1 but no joy.

Any thoughts?

Nothing on our end can cause that.

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzigpy%2Fzha-device-handlers%2Fissues%2F1498%23issuecomment-1127959693&data=05%7C01%7C%7C81d610c758874dd6ac7708da37640d6d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637883200105181905%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=vXtKjlUxauOdi7R9KFQtMoT1HT%2BmHMwob7K2bOpgiOM%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAEDOGIEGULHXXPEGLLXCVWLVKKCYRANCNFSM5TQSSGQQ&data=05%7C01%7C%7C81d610c758874dd6ac7708da37640d6d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637883200105181905%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fWNDd29JXVfFfEfacSP6GVycia%2FEgrORteUfKMikXDI%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>

karthik-krishnan commented 1 year ago

Kind of defeats the purpose of having it use a web Ui without having to be physically next to the device when changing config

Best regards, Karthik. https://karthiks.in Sent from my iPhone

On Jun 3, 2022, at 6:18 AM, TheJulianJES @.***> wrote:

 It should also work that way. I'm able to properly use the configuration setting for the detection interval. Just have to press the button on the sensor shortly after hitting enter/clicking out of the field/changing the number.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

aagit commented 1 year ago

Hi,

Latest HA ZHA stock uses "Quirk: zhaquirks.xiaomi.aqara.motion_ac02.LumiMotionAC02" and everything worked fine with the original fw ver 6 that the device come with.

There was only a GUI issue where the GUI shows the led indicator off in the GUI, but it's always on after ZHA pairing.

Writing "0" by hand in the motion indicator attribute in the "manage zigbee device" menu works around the led GUI issue.

Then I had the idea to test ZHA OTA, sending the update request from zha-toolkit made ZHA upload the fw version 10, but with version 10 the whole OppleCluster seem to have stopped working so I cannot turn off the led indicator on motion anymore.

I had to commit the qcow2 image into its base, restart the VM with a new qcow2 cow, edit this file in /mnt/merged/ like this:

diff --git a/zigpy/zcl/clusters/general.py b/general.py
index 5cf05dc..a4d1b9f 100644
--- a/zigpy/zcl/clusters/general.py
+++ b/general.py
@@ -1873,6 +1873,7 @@ class Ota(Cluster):
             should_update = img.should_update(
                 manufacturer_id, image_type, current_file_version, hardware_version
             )
+            should_update=True
             self.debug(
                 "OTA image version: %s, size: %s. Update needed: %s",
                 img.version,
@@ -1887,7 +1888,7 @@ class Ota(Cluster):
                     foundation.Status.SUCCESS,
                     img.key.manufacturer_id,
                     img.key.image_type,
-                    img.version,
+                    11,
                     img.header.image_size,
                     tsn=tsn,
                 )
@@ -1933,7 +1934,7 @@ class Ota(Cluster):
         img = await self.endpoint.device.application.ota.get_ota_image(
             manufacturer_id, image_type, model
         )
-        if img is None or img.version != file_version:
+        if img is None:
             self.debug("OTA image is not available")
             await self.image_block_response(foundation.Status.ABORT, tsn=tsn)
             return

ha core restart

Then issue the ZHA Toolkit: ota_notify again.

Finally shutdown the VM and delete the qcow2 cow, create a new fresh cow from the untouched base, and start the VM,( to rollback the above patch).

The OppleCluster works again now on the fw ver 6, so I could turn off the led again which I really don't like to flash by night, the sensitivity setting also works again.

I guess one should be more careful with the OTA updates, but at least I managed to downgrade.