Closed Ming-A closed 1 year ago
@Ming-A Normally it should work without a quirk since the device uses standard zigbee clusters but try if it works with the quirk I created for it: custom_quirks.zip
@Ming-A Normally it should work without a quirk since the device uses standard zigbee clusters but try if it works with the quirk I created for it: custom_quirks.zip
sorry for the late reply, thanks for helping with creating a quirk, currently I'm just looking around on how to add custom quirks and i see that I have to add
zha:
enable_quirks: true
custom_quirks_path: /config/zha_quirks
into my config and put the custom quick into the folder path, will give it a try and see how it goes
@Ming-A Normally it should work without a quirk since the device uses standard zigbee clusters but try if it works with the quirk I created for it: custom_quirks.zip
I have added the file into my ha config but have been looking around and I'm still not sure how to apply the custom quirk to a device?
Maybe this helps: https://github.com/zigpy/zha-device-handlers/discussions/693 After a reboot the quirk should automatically apply.
Maybe this helps: #693 After a reboot the quirk should automatically apply.
thanks for sharing, i think i was able to pair the quirk since it says quirk here but the power is still under mains instead of battery
Ok, thats weird, I'm pretty sure there isn't a problem with the code. Can you manually read the cluster? If it returns Mains, it's definitely a problem with the device. If you have a Tuya Gateway, then you can look if there is a update for it. But maybe @javicalle can tell more about it.
Need patching the node description then the device is saying its main powered. One example https://github.com/zigpy/zha-device-handlers/pull/989 making it battery powered in ZHA GUI.
Ok, thats weird, I'm pretty sure there isn't a problem with the code. Can you manually read the cluster? If it returns Mains, it's definitely a problem with the device. If you have a Tuya Gateway, then you can look if there is a update for it. But maybe @javicalle can tell more about it.
mine is blank for some reason, tried clicking get zigbee attribute and its seems to not do anything (might be lag? not sure)
Yes that is the false node description. Can you reading the:
Clusters
PowerConfiguration1CRCluster (Endpoint id: 1, Id: 0x0001, Type: in)
Cluster Attribute
battery_percentage_remaining (id: 0x0021)
I dont knowing if the new Aqara is reporting battery on Zigbee standard cluster or in "Xiaomi" way.
HA is not showing battery icon because device declares to be `MainsPowered:
mac_capability_flags=<MACCapabilityFlags.AllocateAddress|MainsPowered: 132>
Try modifyng in your quirk just the node descriptor like:
replacement = {
NODE_DESCRIPTOR: zigpy.zdo.types.NodeDescriptor(
logical_type=2,
complex_descriptor_available=0,
user_descriptor_available=0,
reserved=0,
aps_flags=0,
frequency_band=8,
mac_capability_flags=128,
manufacturer_code=4718,
maximum_buffer_size=127,
maximum_incoming_transfer_size=100,
server_mask=11264,
maximum_outgoing_transfer_size=100,
descriptor_capability_field=0,
),
}
@javicalle Didn't know that, learned something new today π Do you mean like this? agl01.zip Is there no need to import some external library?
I believe that the ENDPOINTS
part isn't needed (don't have any difference).
Is there no need to import some external library?
I don't think, but not tested π
@javicalle Ok^^. Didn't know it was allowed to leave ENDPOINTS
empty.
For @Ming-A, you can try this quirk:
EDIT: agl01.zip
Didn't know it was allowed to leave
ENDPOINTS
empty.
Yes it's. usually you need to change it, but not seem this case.
Not empty, remove completly.
Maybe if some cluster must be 'quirked' we will put in again.
If you donβt want to change it make sure to omit the key entirely.
@Tropaion I dont see the replacement part now...
I dont have looked all the problem/resolution but I means something like:
Edit: not a good example.
@javicalle I followed this quirk which @MattWestb posted which had the same problem: https://github.com/marciogranzotto/zha-device-handlers/blob/0daea0320571c185e423e203c9da7c73d4cbb90c/zhaquirks/tuya/ts0201_zemismart.py
It uses __init__
to clear the Mains bit, I thought this is a bit better since it only clears one bit from the provided NODE_DESCRIPTOR
and doesn't "replace" it entirely.
It uses
__init__
to clear the Mains bit, I thought this is a bit better since it only clears one bit from the providedNODE_DESCRIPTOR
and doesn't "replace" it entirely.
Ah! Ok now I see what you say. You're right, it's another way to achieve the same thing.
Which way would you use/recommend?
Which way would you use/recommend?
There is no best or recommended way, it's a matter of programmer preference.
replacement
is a more 'declarative' way, while the other is more 'programmatic'.
Each has its advantages and disadvantages. The important thing is that it is clear to understand (and to maintain). The way you've proposed is much clearer, but requires setting 'more places' (__init__
& get_node_descriptor
).
The more things we learn, the more ability to fix broken things π€·π»ββοΈ
Here again, like you said, also added two missing imports: agl01.zip
I have tried it again and this time Illuminance shows up as unavailable without any battery percentage as well
Did you repair?
Did you repair?
so far i have only tried to reconfigure it but ill try to re-pair it again and see if it works :)
really weird, I have tried repairing it and also restarted and updated my HA to 2022.4.7, now it just shows unavailable and no battery status despite the power source being on battery or unknown.
Any error logs in your traces?
error logs in your traces
how do you check for the traces error logs? i checked the normal HA logs and so far i don't see any that's related to ZHA
Usually there are in HA logs. You can try to enable the debug level and repair again:
Usually there are in HA logs. You can try to enable the debug level and repair again:
I have enabled debug and it doesn't seem to show anything related to zha, here's the logs tho i got while repairing it (sorry for the long screenshot, i paired it using my phone HA app)
)
Are you using the Sonoff stick, too? For me connecting to Xiaomi Illumination Sensor (same as yours? https://www.amazon.de/gp/product/B08NZBJLP1/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1) doesn't even show LQI.
https://community.home-assistant.io/t/cannot-connect-mi-light-detection-sensor-to-zha/413702
Are you using the Sonoff stick, too? For me connecting to Xiaomi Illumination Sensor (same as yours? https://www.amazon.de/gp/product/B08NZBJLP1/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1) doesn't even show LQI.
https://community.home-assistant.io/t/cannot-connect-mi-light-detection-sensor-to-zha/413702
I'm using the Tubes ZB CC2652P2 cordinator. for me it works fine on default, the only problem is it shows up as mains instead of battery power without any battery % indication.
Your traces seems normal to me and there is no device info.
Can you remove the battery (if possible) and attach the logs when you put the battery in?
According to Z2M, device reports voltage
and battery
:
That is the same device as yours?
yes, it should be this one, using ZHA instead of Z2M though. I have removed and placed the battery back in again, along with removing it and repairing it didn't work either.
the logs:
[0x0000:zdo] No handler for ZDO request:ZDOCmd.Mgmt_Permit_Joining_rsp([<Status.SUCCESS: 0>])
[0x44FF:1:0x0006] Received ZCL frame: b'\x18\x30\x0A\x00\x00\x10\x01'
[0x44FF:1:0x0006] 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=48, command_id=10, *is_reply=True)
[0x44FF:1:0x0006] Decoded ZCL frame: OnOff:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.true: 1>))])
[0x44FF:1:0x0006] Received command 0x0A (TSN 48): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.true: 1>))])
[0x44FF:1:0x0006] Attribute report received: on_off=<Bool.true: 1>
New device 0x236e (04:cf:8c:df:3c:8d:d0:f1) joined the network
[0x236e] Scheduling initialization
Received frame on uninitialized device <Device model=None manuf=None nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=False> from ep 0 to ep 0, cluster 19: b'\xd3n#\xf1\xd0\x8d<\xdf\x8c\xcf\x04\x84'
[0x236e:zdo] ZDO request ZDOCmd.Device_annce: [0x236E, 04:cf:8c:df:3c:8d:d0:f1, 132]
Tries remaining: 3
[0x236e] Requesting 'Node Descriptor'
Tries remaining: 2
[0x236e] Extending timeout for 0x54 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=False> from ep 0 to ep 0, cluster 32770: b'T\x00n#\x02@\x84n\x12\x7fd\x00\x00,d\x00\x00'
[0x236e] 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|MainsPowered: 132>, manufacturer_code=4718, 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=True, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)
[0x236e] Discovering endpoints
Tries remaining: 3
[0x236e] Extending timeout for 0x55 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=False> from ep 1 to ep 1, cluster 0: b'\x18\x00\x0A\x05\x00\x42\x12\x6C\x75\x6D\x69\x2E\x73\x65\x6E\x5F\x69\x6C\x6C\x2E\x61\x67\x6C\x30\x31\x01\x00\x20\x1B'
[0x236e] Received ZCL while uninitialized on endpoint id 1, cluster 0x0000 id, hdr: 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), payload: b'\x05\x00B\x12lumi.sen_ill.agl01\x01\x00 \x1b'
[0x236e] Uninitialized device command '10' params: Report_Attributes(attribute_reports=[Attribute(attrid=0x0005, value=TypeValue(type=CharacterString, value='lumi.sen_ill.agl01')), Attribute(attrid=0x0001, value=TypeValue(type=uint8_t, value=27))])
Received frame on uninitialized device <Device model=None manuf=None nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=False> from ep 1 to ep 1, cluster 1024: b'\x18\x01\x0A\x00\x00\x21\x8D\x4A'
[0x236e] Received ZCL while uninitialized on endpoint id 1, cluster 0x0400 id, hdr: 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=1, command_id=10, *is_reply=True), payload: b'\x00\x00!\x8dJ'
[0x236e] Uninitialized device command '10' params: Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=uint16_t, value=19085))])
Received frame on uninitialized device <Device model=None manuf=None nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=False> from ep 1 to ep 1, cluster 64704: b'\x1C\x5F\x11\x02\x0A\xF7\x00\x41\x27\x01\x21\x2D\x0C\x03\x28\x19\x04\x21\xA8\x01\x05\x21\x1E\x00\x06\x24\x03\x00\x00\x00\x00\x08\x21\x1B\x01\x0A\x21\x00\x00\x0C\x20\x01\x64\x23\x51\x00\x00\x00'
[0x236e] Received ZCL while uninitialized on endpoint id 1, cluster 0xfcc0 id, hdr: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=True, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), manufacturer=4447, tsn=2, command_id=10, *is_reply=True), payload: b"\xf7\x00A'\x01!-\x0c\x03(\x19\x04!\xa8\x01\x05!\x1e\x00\x06$\x03\x00\x00\x00\x00\x08!\x1b\x01\n!\x00\x00\x0c \x01d#Q\x00\x00\x00"
[0x236e] Uninitialized device command '10' params: Report_Attributes(attribute_reports=[Attribute(attrid=0x00F7, value=TypeValue(type=LVBytes, value=b'\x01!-\x0c\x03(\x19\x04!\xa8\x01\x05!\x1e\x00\x06$\x03\x00\x00\x00\x00\x08!\x1b\x01\n!\x00\x00\x0c \x01d#Q\x00\x00\x00'))])
[0xF8FE:1:0x000a] Received ZCL frame: b'\x00\x57\x00\x07\x00'
[0xF8FE:1:0x000a] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=0, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True), tsn=87, command_id=0, *is_reply=False)
[0xF8FE:1:0x000a] Decoded ZCL frame: Time:Read_Attributes(attribute_ids=[7])
[0xF8FE:1:0x000a] Received command 0x00 (TSN 87): Read_Attributes(attribute_ids=[7])
[0xF8FE:1:0x000a] Sending reply header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=87, command_id=<GeneralCommand.Read_Attributes_rsp: 1>, *is_reply=True)
[0xF8FE:1:0x000a] Sending reply: Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0007, status=<Status.SUCCESS: 0>, value=TypeValue(type=LocalTime, value=705357195))])
Received frame on uninitialized device <Device model=None manuf=None nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=False> from ep 1 to ep 1, cluster 64704: b'\x1C\x5F\x11\x03\x0A\xF7\x00\x41\x27\x01\x21\x20\x0C\x03\x28\x19\x04\x21\xA8\x01\x05\x21\x1E\x00\x06\x24\x01\x00\x00\x00\x00\x08\x21\x1B\x01\x0A\x21\x00\x00\x0C\x20\x01\x64\x23\x51\x00\x00\x00'
[0x236e] Received ZCL while uninitialized on endpoint id 1, cluster 0xfcc0 id, hdr: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=True, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), manufacturer=4447, tsn=3, command_id=10, *is_reply=True), payload: b"\xf7\x00A'\x01! \x0c\x03(\x19\x04!\xa8\x01\x05!\x1e\x00\x06$\x01\x00\x00\x00\x00\x08!\x1b\x01\n!\x00\x00\x0c \x01d#Q\x00\x00\x00"
[0x236e] Uninitialized device command '10' params: Report_Attributes(attribute_reports=[Attribute(attrid=0x00F7, value=TypeValue(type=LVBytes, value=b'\x01! \x0c\x03(\x19\x04!\xa8\x01\x05!\x1e\x00\x06$\x01\x00\x00\x00\x00\x08!\x1b\x01\n!\x00\x00\x0c \x01d#Q\x00\x00\x00'))])
Tries remaining: 2
[0x236e] Extending timeout for 0x56 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=False> from ep 0 to ep 0, cluster 32773: b'V\x00n#\x01\x01'
[0x236e] Discovered endpoints: [1]
[0x236e] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>]
[0x236e:1] Discovering endpoint information
Tries remaining: 3
[0x236e] Extending timeout for 0x57 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=False> from ep 0 to ep 0, cluster 32772: b'W\x00n#\x12\x01\x04\x01\x06\x01\x01\x04\x00\x00\x00\x04\x03\x00\x01\x00\x01\x03\x00'
[0x236e:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=262, device_version=1, input_clusters=[0, 1024, 3, 1], output_clusters=[3])
[0x236E: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=88, command_id=<GeneralCommand.Read_Attributes: 0>, *is_reply=False)
[0x236E:1:0x0000] Sending request: Read_Attributes(attribute_ids=[4, 5])
[0x236e] Extending timeout for 0x58 request
[0x236E:1:0x0000] Received ZCL frame: b'\x18\x58\x01\x04\x00\x00\x42\x04\x4C\x55\x4D\x49\x05\x00\x00\x42\x12\x6C\x75\x6D\x69\x2E\x73\x65\x6E\x5F\x69\x6C\x6C\x2E\x61\x67\x6C\x30\x31'
[0x236E: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=88, command_id=1, *is_reply=True)
[0x236E: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.sen_ill.agl01'))])
[0x236e] Read model 'lumi.sen_ill.agl01' and manufacturer 'LUMI' from <Endpoint id=1 in=[basic:0x0000, illuminance:0x0400, identify:0x0003, power:0x0001] out=[identify:0x0003] status=<Status.ZDO_INIT: 1>>
[0x236e] Discovered basic device information for <Device model='lumi.sen_ill.agl01' manuf='LUMI' nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=True>
Device is initialized <Device model='lumi.sen_ill.agl01' manuf='LUMI' nwk=0x236E ieee=04:cf:8c:df:3c:8d:d0:f1 is_initialized=True>
Checking quirks for LUMI lumi.sen_ill.agl01 (04:cf:8c:df:3c:8d:d0:f1)
Considering <class 'agl01.IlluminanceSensor'>
Found custom device replacement for 04:cf:8c:df:3c:8d:d0:f1: <class 'agl01.IlluminanceSensor'>
device - 0x236E:04:cf:8c:df:3c:8d:d0:f1 entering async_device_initialized - is_new_join: True
device - 0x236E:04:cf:8c:df:3c:8d:d0:f1 has joined the ZHA zigbee network
[0x236E](lumi.sen_ill.agl01): started configuration
[0x236E:ZDO](lumi.sen_ill.agl01): 'async_configure' stage succeeded
[0x236E](lumi.sen_ill.agl01): completed configuration
[0x236E](lumi.sen_ill.agl01): stored in registry: ZhaDeviceEntry(name='LUMI lumi.sen_ill.agl01', ieee='04:cf:8c:df:3c:8d:d0:f1', last_seen=1652013217.855469)
[0x236E](lumi.sen_ill.agl01): started initialization
[0x236E:ZDO](lumi.sen_ill.agl01): 'async_initialize' stage succeeded
[0x236E](lumi.sen_ill.agl01): power source: Battery or Unknown
[0x236E](lumi.sen_ill.agl01): completed initialization
Error handling '_save_attribute' event with (04:cf:8c:df:3c:8d:d0:f1, 1, 0, 4, 'LUMI') params: FOREIGN KEY constraint failed
Error handling '_save_attribute' event with (04:cf:8c:df:3c:8d:d0:f1, 1, 0, 5, 'lumi.sen_ill.agl01') params: FOREIGN KEY constraint failed```
whats weird now is its not even showing the entity of the device anymore
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.
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I have paired the device about 3 times and have also updated my coordinator (Tubes ZB CC2652P2) to the latest firmware, but the device still shows up as mains power instead of battery (the light sensor is working fine though)
Describe the solution you'd like A clear and concise description of what you want to happen.
Shows battery with the battery level instead of showing as mains power
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.
Additional context Add any other context or screenshots about the feature request here.