Open rafaelreis-r opened 2 years ago
Would really like to see support for this lock!
+1
I'm from Brazil and BRL to USD exchange rates are atrocious, but I'm able to provide a 40 USD bounty to get this working.
@Koenkk maybe you would be able to take a look at this or point me out on a direction?
@rafaelreis-r could you make a sniff when pairing the device to the original hub? https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html#with-cc2531
+1
@rafaelreis-r could you make a sniff when pairing the device to the original hub? https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html#with-cc2531
Just received the CC2531 today. Flashed it and compiled whsniff. Files are attached below. I've also added the pairing process to a known device (Aqara Mini Switch - WXKG12LM) for reference.
Attachements:
Notes:
@rafaelreis-r
No.
in wireshark?)@Koenkk
Could you also provide me a sniff when pairing it to z2m?
I tried using a converter based on lumi.lock.acn02, since the A100 reports itself as lumi.lock.acn01
, but didn't seem to work (I don't discard having screwed up somewhere).
I had to spin up a separate Z2M instance since my network is very busy atm, and I needed to be close to the lock. All I had was a windows laptop, so the logs will reflect that.
What command is send when the lock is locked/unlocked? (can you indicate the No. in wireshark?)
This is the sequence of events reported in the door lock log. Note that it is from new to old, so reverse of what wireshark logged. "Me"
refers to me. It reports the user which did the action. If it was my wife for instance, it would say her Name
instead of "Me"
Unfortunately I'm unable to align No.
with time
. I could do a new dump paying attention to the No.
if you need.
So the first issue that needs to be tackled is that the device leaves almost immediately after pairing it to z2m (packet 71 in A100 Z2M Pairing.pcapng.gz
). I've compared the z2m vs the xiaomi gateway sniff and everything is the same until the Node Descriptor Response
(packet 117/67). In the z2m sniff the device leaves 2 seconds after this. In the Xiaomi sniff some encrypted commands are send after this (it seems Xiaomi uses a custom encryption key for this). My first suspicion is that the small differences in the node descriptor response may cause this but unfortunately I cannot change the adapter the node descriptor response because the Conbee firmware is not opensource. Do you also have access to a Texas Instruments based adapter?
@Koenkk
I only own the Conbee-II and the CC2531 flashed for sniffing. Electronics are highly tariffed and expensive in Brazil. I usually import them directly from China (which is what I did with the door lock) but it takes 45 to 60 days for customs clearance.
I could purchase another TI device. The only options I could find in stock atm are:
What would you technically recommend?
The SONOFF Zigbee 3.0 USB Dongle Plus (CC2652P)
Hey @Koenkk
Device arrived. It came preloaded with Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20210708,"transportrev":2},"type":"zStack3x0"}'
Let me know if it requires updating (I still have to learn the update process).
I took a sniff and debug logs from the pairing process to this device:
Interesting to note this time the lock looped trying to pair to the coordinator until it gave up after 4 or 5 attempts, as you will be able to see in the dump.
Let me know what else you need me to do!
So it seems the device stays connected for a bit longer and z2m is able to retrieve some data from it. It is important to use the latest firmware on your adapter; otherwise the node descriptor returns an incorrect manufacturer code for Xiaomi devices. There are some instructions on how to flash the fw here: https://www.zigbee2mqtt.io/guide/adapters/#notes (on this page you can also find the correct coordinator firmware).
What worries me a bit is that the device now leaves after it doesn't receive a reply to the encrypted magic command. With the Xiaomi gateway you see the the gateway replies:
With z2m it doesn't (which of course we cannot do since we cannot encrypt this message):
I think this causes the device to leave. Seems Xiaomi doesn't want this to be device to be used with other gateways. If the coordinator firmware update doesn't solve the issue I'm quite certain this is the reason the device leaves. So in order to be able to continue we need the encryption key. I see 2 scenarios to obtain this:
Hey @Koenkk,
Updated the firmware to Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20220219,"transportrev":2},"type":"zStack3x0"}'
and redid the sniffs / logs. For some reason, z2m and zigbee-herdsman debug logs were very verbose this time.
It looks like the sniff is void of the bad FCS packets!
I hope we aren't locked out due to the encryption key. There is a 3rd way to get them, similar to what this engineer did recently with the embedded linux embedded os fw in his car. We might be able to find the key inside the source files / update files to Aqara's hubs.
Strangely enough I don't see the magic commands anymore in this sniff but the device still leaves. What I find interesting is that the Transport key
message when paired with the Xiaomi gateway uses the non-standard TC link key (at least I guess this is the transport key
because it comes right after the assocation response
and there are not any other transport key
messages).
I guess that we need the Xiaomi encryption key to continue further with this.
Would love to see support for this device
@Koenkk I was able to root my G3 hub after a bit of work, and dump some zigbee info from it. I'm working with the Aqara GW rooted HA integration devs on their rep. Thread is here
They have good knowledge of many Aqara hubs rootfs, and also stock and modified fw dumps for various hubs. They have coordinator fw for the Aqara hubs dumped there as well. I just asked them if they were able to extract a coordinator fw to any of those hubs. We might have luck finding something there.
Would love to use this device with z2m...
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
Would love to use this device with z2m...
Same for me.
I encourage anyone interested into solving this issue to report it on the Aqara support page => https://static-resource.aqara.com/html/feedback.html,
Asking them to share the encryption key. Here is a message example:
Dear Aqara team,
Looking at the comments in this youtube video (https://www.youtube.com/watch?v=LBAfbBE9-Bo), you can see that A LOT of people WILL NOT BUY the Aqara A100 because it is NOT SUPPORTED by zigbee2mqtt.
The issue is that Aqara A100 firmware is using en encryption key to communicate over zigbee (see details about the issue here => https://github.com/Koenkk/zigbee2mqtt/issues/13087) and WITHOUT this encryption key, it's nearly impossible to support the A100 into zigbee2mqtt.
Could you please consider working out a solution to add support for the A100 into zigbee2mqtt? (like sharing the key with z2m devs)
Having an open system will definitely boost your sales ;)
Thanks!
Thank you @waterdrop01, I just sent the ticket.
I have another questione for who already own the Aqara A100: what about the integration in Home Assistant over HomeKit Controller? Is that possible?
Thank you @waterdrop01, I just sent the ticket.
I have another questione for who already own the Aqara A100: what about the integration in Home Assistant over HomeKit Controller? Is that possible?
It is VERY limited in HomeKit. Not a viable solution. Best path so far has been AqaraGateway + rooted hub.
Thank you @waterdrop01, I just sent the ticket.
I have another questione for who already own the Aqara A100: what about the integration in Home Assistant over HomeKit Controller? Is that possible?
It is VERY limited in HomeKit. Not a viable solution. Best path so far has been AqaraGateway + rooted hub.
I'll probably go with that solution.
What's the benefits using the Rooted gateway instead of the stock one?
I think that it allows custom HomeAssistant AqaraGateway integration to take control over Aqara gateway connected Zigbee devices ? https://github.com/niceboygithub/AqaraGateway
I got the AqaraGateway M1S-CN myself for other purposes (to register some Mi BLE sensors and get BLE encryption key once registered to use with passive BLE monitor integration)
The M1S-CN is listed as compatible so I think it would possibly allow A100 Zigbee control ...?
@IamMattM it should be. However, if you see https://github.com/AlexxIT/XiaomiGateway3/issues/808 we still have to map out actions to create a handler for the A100 in the integration code. Logs are there but it is quite a bit of work to separate each action and map it to its id. I haven't had the time yet.
So, currently, lock shows up in HA, but I can only get locked / unlocked status.
@Koenkk
You should take a look at https://github.com/AlexxIT/XiaomiGateway3/issues/808#issuecomment-1246169859 and the logs attached here: https://github.com/AlexxIT/XiaomiGateway3/issues/808#issuecomment-1248235091
Since the Gateway is rooted, they get Zigbee information from within the gateway OS itself, past the encryption keys. You might be able to work backwards, since we have: Sniffs, network keys from within the gateway, and that action map which I believe refers to the encrypted payload we see in the sniffs.
@Koenkk to simplify things, I collected, grouped and cleaned up the information for you.
I did a new sniff of G3 hub (rooted) to A100 lock. Unpaired, Paired, did some door lock / unlocking actions. The difference is that now we have a debug log from mqtt installed from the root in the G3.
a100-g3hub.pcapng.zip nwkey: 0c97780090155ca7b40c4881835b3145
Check out this section in particular:
2022-10-04 15:47:46 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/recv {"cmd":"write","did":"lumi.0","id":73,"params":[{"res_name":"8.0.2085","value":"efbebc24a46e03d18f51fd7bf12f15daCC45"}]}
2022-10-04 15:47:46 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/recv {"cmd":"write","did":"lumi.0","id":74,"params":[{"res_name":"8.0.2109","value":60}]}
2022-10-04 15:47:46 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"write_rsp","id":73,"time":1664909266756,"did":"lumi.0","zseq":0,"results":[{"res_name":"8.0.2085","value":"efbebc24a46e03d18f51fd7bf12f15daCC45","error_code":0}]}
2022-10-04 15:47:46 DEBUG gateway 192.168.1.144: gateway <= [{'res_name': '8.0.2085', 'value': 'efbebc24a46e03d18f51fd7bf12f15daCC45', 'error_code': 0}]
2022-10-04 15:47:46 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/commands {"commands":[{"command":"lumi open-with-install-code 0x3c {efbebc24a46e03d18f51fd7bf12f15dacc45} {ffffffffffffffff}","postDelayMs":0}]}
2022-10-04 15:47:46 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"write_rsp","id":74,"time":1664909266757,"did":"lumi.0","zseq":0,"results":[{"res_name":"8.0.2109","value":60,"error_code":0}]}
2022-10-04 15:47:46 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/executed {"command":"lumi open-with-install-code 0x3c {efbebc24a46e03d18f51fd7bf12f15dacc45} {ffffffffffffffff}"}
2022-10-04 15:47:51 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/devicejoined {"nodeId":"0x63F4","deviceState":16,"deviceType":"0x00FF","timeSinceLastMessage":0,"deviceEndpoint":{"eui64":"0x54EF4410004C5112","endpoint":0,"clusterInfo":[]},"firstjoined":1}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/MessageReceived {"sourceAddress":"0x63F4","eui64":"0x54EF4410004C5112","destinationEndpoint":"0x01","clusterId":"0x0000","profileId":"0x0104","sourceEndpoint":"0x01","APSCounter":"0x9E","APSPlayload":"0x184B0A01002001","rssi":-74,"linkQuality":104}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/commands {"commands":[{"commandcli":"zcl mfg-code 0x0000"},{"commandcli":"zcl global read 0x0000 0x0001"},{"commandcli":"send 0x63f4 1 1","postDelayMs":0}]}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/executed {"command":"zcl mfg-code 0x0000"}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/executed {"command":"zcl global read 0x0000 0x0001"}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/MessagePreSentCallback {"eui64":"0x54EF4410004C5112","destinationEndpoint":"0x01","clusterId":"0x0000","profileId":"0x0104","sourceEndpoint":"0x01","APSCounter":"0x79","APSPlayload":"0x1054000100"}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/executed {"command":"send 0x63f4 1 1"}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/MessageReceived {"sourceAddress":"0x63F4","eui64":"0x54EF4410004C5112","destinationEndpoint":"0x01","clusterId":"0x0000","profileId":"0x0104","sourceEndpoint":"0x01","APSCounter":"0x9F","APSPlayload":"0x184C0A0500421161716172612E6C6F636B2E61636E303031","rssi":-74,"linkQuality":104}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/MessageReceived {"sourceAddress":"0x63F4","eui64":"0x54EF4410004C5112","destinationEndpoint":"0x01","clusterId":"0x0000","profileId":"0x0104","sourceEndpoint":"0x01","APSCounter":"0xA0","APSPlayload":"0x1854010100002001","rssi":-74,"linkQuality":104}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003389,"did":"lumi.0","dev_src":"0","zseq":0,"params":[{"res_name":"8.0.2084","value":{"did":"lumi.54ef4410004c5112","mac":"54ef4410004c5112","model":"aqara.lock.acn001","version":"0.0.0_0001","zb_ver":"3.0","joined_type":1}}]}
2022-10-04 15:47:52 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/MessageReceived {"sourceAddress":"0x63F4","eui64":"0x54EF4410004C5112","destinationEndpoint":"0x01","clusterId":"0xFCC0","profileId":"0x0104","sourceEndpoint":"0x01","APSCounter":"0xA1","APSPlayload":"0x1C5F114D0AF3FF41413E86A6879DAB55D293E7947CD188A350F68A3B104B68D0A879FE0409846D6BEDF20D95DAA19921C3905C3352A7D668D103D0CA4341295E8585645345EDFE693546","rssi":-73,"linkQuality":108}
2022-10-04 15:47:53 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003390,"did":"lumi.54ef4410004c5112","time":1664909272956,"rssi":-73,"zseq":77,"params":[{"res_name":"20.8.85","value":"{\"encry\":\"1eeebfe53ee5438344ca1242692c6aff827d1105288ff1bee180a0e653ddf8e6540c5548fbf9a5b3531ea6469e226d450c18d03e0ea0a8db06c45f2184d14b89\",\"devcry\":\"86a6879dab55d293e7947cd188a350f68a3b104b68d0a879fe0409846d6bedf20d95daa19921c3905c3352a7d668d103d0ca4341295e8585645345edfe693546\"}"}],"dev_src":"0"}
2022-10-04 15:47:53 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/recv {"cmd":"write","did":"lumi.0","id":75,"params":[{"res_name":"8.0.2109","value":0}]}
2022-10-04 15:47:53 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/commands {"commands":[{"command":"plugin network-creator-security close-network","postDelayMs":0}]}
2022-10-04 15:47:53 DEBUG gateway 192.168.1.144: MQTT on_message: gw/54EF44100025A4E4/executed {"command":"plugin network-creator-security close-network"}
2022-10-04 15:47:53 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"write_rsp","id":75,"time":1664909272990,"did":"lumi.0","zseq":0,"results":[{"res_name":"8.0.2109","value":0,"error_code":0}]}
This is the APS handshake during pairing. Maybe you can line it up with the packets in the sniff.
It is way beyond my knowledge, but I was wondering there is any useful info in there? Maybe the APS Key?
@Koenkk more discovery:
It is clear to me that the devices are communicating over ZigBee Smart Energy Standard (pdf).
Smart Energy profile uses the same network layer security mechanism as HA, but has further APS layer security which uses a key transferred with certicom certificates which are very secure (as it is typically utility companies using this for metering and do not want the meter reading tampered with).
Meaning, it is indeed a completely different endeavor.
https://www.wireshark.org/lists/wireshark-dev/201107/msg00438.html
It looks like part of the problem is that the Smart Energy Key Establishment cluster (0x0800) is not implemented yet in the packet-zbee-aps dissector (shows up as "Unknown" in APS data). Is anyone working on this? Alternatively, does anyone know of a reference implementation of CBKE for the SE Profile?
After learning this, do you think the TC is on Aqara's / Xiaomi servers? My suspicion was raised because I can only trigger the paring / unpairing process via Aqara App, and both my phone with the app and the hub have to be online for it to work. Remember that there is no pairing button in the A100.
If that is the case, we are probably done. Aqara will never provide their private certs to us, rendering @waterdrop01 suggestion potentially useless.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
@Koenkk can we destale this?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
Could this be reopened and pinned please?
@Koenkk
I assume there's nothing to update on this yet, eh? :(
Zigbee Smart Energy is an entirely different standard as compared to standard Zigbee protocol. It would take:
Another way would be to have the community develop a custom firmware for the A100 (N100 and other locks in that family) that supports standard zigbee.
Zigbee Smart Energy is an entirely different standard as compared to standard Zigbee protocol. It would take:
- Adding support to ZSE in Z2M
- Find a workaround to obtain root certificates from manufacturer, be it shared by them or obtained by reverse engineering. Without those certificates, there is no way to derive the link key for the device.
Another way would be to have the community develop a custom firmware for the A100 (N100 and other locks in that family) that supports standard zigbee.
And I assume the custom firmware path is not currently being worked on by anyone? Shame if not.
The lack of support for HA stops me from buying their product, LOL. Shame on you, Aqara!
The lack of support for HA stops me from buying their product, LOL.
Shame on you, Aqara!
At the end of all I went for a very classical electromechanical lock. I'll connect it to a Shelly 1 soon and to an UPS. Afrer that with an ESP i will manage the fingerprint sensor.
All managed by HA.
Yes, this isn't the same prpduct but imho it will work even better.
Is there any update on this?
A100 Bluetooth integration on HA seems to be stable now. Requires Bluetooth range.
Pairing it to HomeKit controller also works.
Over zigbee the only way is through AqaraGateway on supported gateways.
A100 Bluetooth integration on HA seems to be stable now. Requires Bluetooth range.
Pairing it to HomeKit controller also works.
Over zigbee the only way is through AqaraGateway on supported gateways.
May I ask what type of sensors do you get with Bluethooth connection? Here is what I have using Aqara Gateway:
Also, what does the pairing method look like when using bluetooth? (My HA supports bluetooth so it may be more reliable than the Aqara Gateway integration that sometimes does not start properly).
Thanks :)
A100 Bluetooth integration on HA seems to be stable now. Requires Bluetooth range.
Does that mean I can now use the lock with all functionality on my HA? Any more info on how to set this up, or is it automatic?
same question here guys, can we integrate the doorlock to HA now ? I have a D200I what about this one ?
A100 Bluetooth integration on HA seems to be stable now. Requires Bluetooth range.
Pairing it to HomeKit controller also works.
Over zigbee the only way is through AqaraGateway on supported gateways.
which Bluetooth integration can integrate a100?
A100 Bluetooth integration on HA seems to be stable now. Requires Bluetooth range. Pairing it to HomeKit controller also works. Over zigbee the only way is through AqaraGateway on supported gateways.
which Bluetooth integration can integrate a100?
@JustAnotherPU @mainmind83 https://github.com/niceboygithub/AqaraGateway
Link
https://www.aqara.com/en/product/smart-door-lock-a100-zigbee
Database entry
"definition":null,"friendly_name":"0x54ef4410004c5112","ieee_address":"0x54ef4410004c5112","status":"successful","supported":false},"type":"device_interview"
Comments
Hey all. I just got my hands on a Aqara A100 Pro smart lock. Although I'm a competent sysadmin, I've never worked with zigbee devices. Wondering if I could provide info / be guided to dump information in order to add support to this family of door locks.
Hardware I own:
I'm willing to purchase a CC2531 sniffer if necessary.
What have I done so far:
lumi.lock
entries on Xiaomi.jsPairing Process
The A100 series do not have a physical Zigbee pairing button / process. You need a compatible Aqara Hub to trigger the pairing on the lock. I figured out a way to do it:
A100 Pro vs A100 Zigbee
I read that both have Zigbee functionality, Pro version lacking remote unlock and remote passcode setup as compared to the Zigbee version. I couldn't find the Zigbee version at the time of purchase. Details here
Logs I collected over the pairing procedure
External converter
No response
Supported color modes
No response
Color temperature range
No response