Open rafaelreis-r opened 2 years ago
Well. Now you have G3 and Integration from Niceboy. But only one button exposed from lock?
Oh, Sorry @AlexxIT I might have not explained myself enough.
I've paired both the https://www.aqara.com/en/product/smart-door-lock-a100-zigbee and a regular known device, an Aqara Mini Switch - WXKG12LM to the rooted G3 hub.
Output from /data/zigbee # cat device.info
over telnet shows 2 devices paired.
{"devInfo":[{"mac":"0x54ef4410004c5112","shortId":"0x63f4","manuCode":"0x115f","model":"aqara.lock.acn001","did":"lumi.54ef4410004c5112","devType":0,"appVer":1,"hardVer":0,"devID":65520,"status":0,"model_ver":1,"preLeave":0},{"mac":"0x158d00067925ee","shortId":"0x7d91","manuCode":"0x115f","model":"lumi.remote.b1acn01","did":"lumi.158d00067925ee","devType":0,"appVer":2,"hardVer":0,"devID":0,"status":1,"model_ver":2,"preLeave":0}]}
Only the remote (switch, button, pick any name) shows up in the integration. The lock, although paired, does not.
I was wondering if you could shed a light on how to get support for the A100 over integration. I have various Zigbee resources available (sniffer, coordinators, etc), due to the reverse engineering attempts I did with Z2M devs
I don't research G3 yet
@rafaelreis-r
Can you try the master branch of AqaraGateway?
@rafaelreis-r
Can you try the master branch of AqaraGateway?
Just did. Checked out master branch. Deleted the Integration Restarted HA Readded the Integration Connected to G3 Hub (telnet)
No change. It does not show the lock.
Where can I find logs? I've enabled MQTT and debug logs but nothing was logged to main HA logger.
Your model is "aqara.lock.acn001"
you can add the blew to here
'aqara.lock.acn001': ["Aqara", "Door Lock A100", "ZNMS02ES"],
You shall got basic support of this lock.
@niceboygithub
Got an Error:
2022-09-13 23:45:40.805 ERROR (Thread-2) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/config/custom_components/aqara_gateway/core/gateway.py", line 138, in run
self.setup_devices(devices)
File "/config/custom_components/aqara_gateway/core/gateway.py", line 342, in setup_devices
self.setups[domain](self, device, attr)
File "/config/custom_components/aqara_gateway/sensor.py", line 82, in setup
add_entities([GatewayLockSensor(gateway, device, attr)])
File "/config/custom_components/aqara_gateway/sensor.py", line 345, in __init__
self._features = DEVICE_MAPPINGS[self.device['model']]
KeyError: 'aqara.lock.acn001'
Please paste your modification.
Full file: utils.py.zip
The easy modification.
}, {
'aqara.lock.eicn01': ["Aqara", "Door Lock A100", "ZNMS02ES"],
'aqara.lock.acn001': ["Aqara", "Door Lock A100", "ZNMS02ES"],
'params': [
The easy modification.
}, { 'aqara.lock.eicn01': ["Aqara", "Door Lock A100", "ZNMS02ES"], 'aqara.lock.acn001': ["Aqara", "Door Lock A100", "ZNMS02ES"], 'params': [
It doesn't work, because lock_data.py
does not have a DEVICE_MAPPINGS definition for either of the locks:
I've added to lock_data.py:
DEVICE_MAPPINGS = {
"lumi.lock.aq1": SUPPORT_ALARM,
"lumi.lock.acn02": SUPPORT_ALARM | SUPPORT_DOORBELL,
"lumi.lock.acn03": SUPPORT_ALARM | SUPPORT_DOORBELL,
"aqara.lock.wbzac1": (
WITH_LI_BATTERY | SUPPORT_ALARM |
SUPPORT_DOORBELL | SUPPORT_WIFI | SUPPORT_CAMERA),
"aqara.lock.bzacn3": (
SUPPORT_ALARM | SUPPORT_DOORBELL),
"aqara.lock.bzacn4": (
SUPPORT_ALARM | SUPPORT_DOORBELL),
"aqara.lock.dacn03": (
WITH_LI_BATTERY | SUPPORT_ALARM |
SUPPORT_DOORBELL | SUPPORT_WIFI | SUPPORT_CAMERA),
"aqara.lock.acn001": (
SUPPORT_ALARM | SUPPORT_DOORBELL)
}
Lock shows! Very basic communication. Only 2 entities reporting.
You can enable , mqtt logs. With lock activities, you shall get lots of logs. Please paste the logs.
like this
2022-09-15 07:22:49 DEBUG gateway 10.0.1.27: MQTT on_message: zigbee/send {"cmd":"report","id":58717,"did":"lumi.158d0002497cf6","time":1663197769079,"rssi":-57,"zseq":106,"params":[{"res_name":"4.1.85","value":0}],"dev_src":"0"}
@niceboygithub Could you please clarify?
I beleive I should enable mqtt logs in the G3 hub, right?
I see that the binary is in 4004 1 root S 2220 1.8 1 0.0 /data/bin/mosquitto -d
Is there a mosquitto.conf somewhere? Or a script that calls the binary? Please let me know so I can adjust accordinly.
@niceboygithub Could you please clarify?
I beleive I should enable mqtt logs in the G3 hub, right? I see that the binary is in
4004 1 root S 2220 1.8 1 0.0 /data/bin/mosquitto -d
Is there a mosquitto.conf somewhere? Or a script that calls the binary? Please let me know so I can adjust accordinly.
From Alex great work. it is very easy to got mqtt log Please use method 1
Hey @niceboygithub
I have a very long and rich log. It includes:
I collected the debug logs + Aqara app logs so you can correlate the name of the actions to the codes in mqtt logs.
mqtt log.zip Aqara Actions log.zip
Edit: A few more actions and codes: more codes.zip
Hey @niceboygithub
I have a very long and rich log. It includes:
- Unpairing
- Repairing
- Adding User
- Various actions (lock, unlock, inside, outside, with fingerprint, with homekit, with passcode, with key, from inside, from outside etc etc). I only don't have NFC to test.
I collected the debug logs + Aqara app logs so you can correlate the name of the actions to the codes in mqtt logs.
mqtt log.zip Aqara Actions log.zip
Edit: A few more actions and codes: more codes.zip
I try my best to analyze the logs. It is not easy to analyze offline. For example, when you unlock by emergency key, this action contains several activities, unlock, open door, close door, door not close etc.
Line 15: 2022-09-15 12:47:32 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003016,"did":"lumi.54ef4410004c5112","time":1663256852937,"rssi":-73,"zseq":116,"params":[{"res_name":"13.88.85","value":6}],"dev_src":"0"}
Line 17: 2022-09-15 12:47:32 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003016,"did":"lumi.54ef4410004c5112","time":1663256852937,"rssi":-73,"zseq":116,"params":[{"res_name":"13.88.85","value":6}],"dev_src":"0"}
Line 21: 2022-09-15 12:47:38 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003017,"did":"lumi.54ef4410004c5112","time":1663256858531,"rssi":-74,"zseq":117,"params":[{"res_name":"13.88.85","value":7}],"dev_src":"0"}
Line 23: 2022-09-15 12:47:38 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003017,"did":"lumi.54ef4410004c5112","time":1663256858531,"rssi":-74,"zseq":117,"params":[{"res_name":"13.88.85","value":7}],"dev_src":"0"}
Line 28: 2022-09-15 12:48:05 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003018,"did":"lumi.54ef4410004c5112","time":1663256885367,"rssi":-76,"zseq":118,"params":[{"res_name":"13.88.85","value":6}],"dev_src":"0"}
Line 30: 2022-09-15 12:48:05 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003018,"did":"lumi.54ef4410004c5112","time":1663256885367,"rssi":-76,"zseq":118,"params":[{"res_name":"13.88.85","value":6}],"dev_src":"0"}
Line 33: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003019,"did":"lumi.54ef4410004c5112","time":1663256887165,"rssi":-79,"zseq":119,"params":[{"res_name":"13.45.85","value":0},{"res_name":"13.18.85","value":3}],"dev_src":"0"}
Line 35: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003019,"did":"lumi.54ef4410004c5112","time":1663256887165,"rssi":-79,"zseq":119,"params":[{"res_name":"13.45.85","value":0},{"res_name":"13.18.85","value":3}],"dev_src":"0"}
Line 39: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003020,"did":"lumi.54ef4410004c5112","time":1663256887268,"rssi":-77,"zseq":120,"params":[{"res_name":"13.31.85","value":0}],"dev_src":"0"}
Line 43: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003021,"did":"lumi.54ef4410004c5112","time":1663256887360,"rssi":-77,"zseq":121,"params":[{"res_name":"13.88.85","value":8}],"dev_src":"0"}
Line 45: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003021,"did":"lumi.54ef4410004c5112","time":1663256887360,"rssi":-77,"zseq":121,"params":[{"res_name":"13.88.85","value":8}],"dev_src":"0"}
Line 49: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003022,"did":"lumi.54ef4410004c5112","time":1663256887479,"rssi":-78,"zseq":122,"params":[{"res_name":"13.33.85","value":0}],"dev_src":"0"}
Line 51: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003022,"did":"lumi.54ef4410004c5112","time":1663256887479,"rssi":-78,"zseq":122,"params":[{"res_name":"13.33.85","value":0}],"dev_src":"0"}
Line 55: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003023,"did":"lumi.54ef4410004c5112","time":1663256887571,"rssi":-80,"zseq":123,"params":[{"res_name":"13.88.85","value":2}],"dev_src":"0"}
Line 57: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003023,"did":"lumi.54ef4410004c5112","time":1663256887571,"rssi":-80,"zseq":123,"params":[{"res_name":"13.88.85","value":2}],"dev_src":"0"}
Line 61: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003024,"did":"lumi.54ef4410004c5112","time":1663256887675,"rssi":-77,"zseq":124,"params":[{"res_name":"13.17.85","value":0},{"res_name":"13.19.85","value":0}],"dev_src":"0"}
Line 63: 2022-09-15 12:48:07 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003024,"did":"lumi.54ef4410004c5112","time":1663256887675,"rssi":-77,"zseq":124,"params":[{"res_name":"13.17.85","value":0},{"res_name":"13.19.85","value":0}],"dev_src":"0"}
Line 67: 2022-09-15 12:48:15 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003025,"did":"lumi.54ef4410004c5112","time":1663256896088,"rssi":-74,"zseq":125,"params":[{"res_name":"13.88.85","value":3}],"dev_src":"0"}
Line 69: 2022-09-15 12:48:15 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003025,"did":"lumi.54ef4410004c5112","time":1663256896088,"rssi":-74,"zseq":125,"params":[{"res_name":"13.88.85","value":3}],"dev_src":"0"}
Line 73: 2022-09-15 12:48:16 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003026,"did":"lumi.54ef4410004c5112","time":1663256896190,"rssi":-73,"zseq":126,"params":[{"res_name":"13.17.85","value":1},{"res_name":"13.19.85","value":1}],"dev_src":"0"}
Line 75: 2022-09-15 12:48:16 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003026,"did":"lumi.54ef4410004c5112","time":1663256896190,"rssi":-73,"zseq":126,"params":[{"res_name":"13.17.85","value":1},{"res_name":"13.19.85","value":1}],"dev_src":"0"}
Line 79: 2022-09-15 12:48:17 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003027,"did":"lumi.54ef4410004c5112","time":1663256898067,"rssi":-77,"zseq":127,"params":[{"res_name":"13.88.85","value":4}],"dev_src":"0"}
Line 81: 2022-09-15 12:48:17 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003027,"did":"lumi.54ef4410004c5112","time":1663256898067,"rssi":-77,"zseq":127,"params":[{"res_name":"13.88.85","value":4}],"dev_src":"0"}
Line 85: 2022-09-15 12:48:17 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003028,"did":"lumi.54ef4410004c5112","time":1663256898160,"rssi":-77,"zseq":128,"params":[{"res_name":"13.31.85","value":1}],"dev_src":"0"}
Line 87: 2022-09-15 12:48:17 DEBUG gateway 192.168.1.144: MQTT on_message: zigbee/send {"cmd":"report","id":2000003028,"did":"lumi.54ef4410004c5112","time":1663256898160,"rssi":-77,"zseq":128,"params":[{"res_name":"13.31.85","value":1}],"dev_src":"0"}
@niceboygithub Let me know if I can help in any way. Maybe slowing down the actions.
I can also provide a complete wireshark pcap sniff of the zigbee communications if it helps in any way.
The slow down actions will help a lots.
And every actions can be five minutes apart.
I'm looking into buying one of the lock too. I'm wondering if you end up getting it to work in z2m?
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!
@niceboygithub I was checking the logs I sent you and noticed the actions from N100 lock line up perfectly with A100. I tried N100 configuration with A100 and all of it worked.
There is probably more actions in the A100 but is decent support so far:
{
'aqara.lock.eicn01': ["Aqara", "Door Lock A100", "ZNMS02ES"],
'aqara.lock.acn001': ["Aqara", "Door Lock A100", "ZNMS02ES"],
'params': [
['8.0.2148', None, 'timestamp', None],
['13.17.85', 'lock_state', 'lock', 'sensor'],
['13.18.85', None, 'key_type', None],
['13.31.85', None, 'lock_event', None],
['13.32.85', None, 'verification failed', None],
['13.33.85', None, 'latch_state', None],
['13.41.85', None, 'unlock from inside', None],
['13.42.85', None, 'unlock by fringprint', None],
['13.43.85', None, 'unlock by password', None],
['13.44.85', None, 'unlock by nfc', None],
['13.45.85', None, 'unlock by homekit', None],
['13.46.85', None, 'unlock by temporary password', None],
['13.49.85', None, 'open in away mode', None],
['13.54.85', None, 'away mode', None],
[None, None, 'key_id', 'sensor'],
['13.55.85', 'voltage', 'voltage', None],
['13.56.85', 'battery', 'battery', 'sensor'],
['13.57.85', None, 'battery notify', None],
['13.60.85', None, 'verification failed', None],
['13.62.85', None, 'timestamp', None],
['13.63.85', None, 'user added', None],
['13.64.85', None, 'user removed', None],
['13.65.85', None, 'all user removed', None],
['13.66.85', None, 'nfc added', None],
['13.67.85', None, 'nfc removed', None],
['13.68.85', None, 'homekit reset', None],
['13.88.85', None, 'door', None],
['14.83.85', None, 'bluetooth', None],
[None, None, 'lock_event', 'sensor'],
]
},
Perfect. You can create PR to AqaraGateway integration.
@rafaelreis-r works! Big thanks! Don't forget to just add the lock to lock_data.py
@rafaelreis-r is the A100 lock working well on HA now with your Aqara gateway? Based on your latest message it does look like it, but I'm thinking about buying one and wanted to double check if it's fully working now. Thanks!
Hey @rsieiro it is stable and working fine with the following entities:
There is a lot more available to be supported though, but I'm at my technical limit. Wish I could do more.
I also didn't do the PR for that same reason. My git skills are limited to git clone
.
Awesome! Just ordered one. I'll do a bit of research once it arrives, maybe I can find additional useful entities :)
Is the above working on both Pro and International version?
I've only tested it in the Pro version. It should work on International.
@rafaelreis-r could you help me clarify the following points?
1- do you use AlexxIT or niceboygithub integration in HA to add your Aqara hub?
2- if you use niceboygithub integration, did you have to manually flash the hub fw before being able to add it to HA?
3- if you use niceboygithub integration, did you have to go through MiHome mode/app to get a Token, and then back to Aqara mode to add it to HA through "Aqara Gateway Integration"?
4- finally, how do you pair the lock to the hub, using mihome or aqara home? and after adding the hub to HA or before?
Thanks a lot for your help!!
Hey @rafaelreis-r, your feedback on the above questions would be very much appreciated 😀
@sulliwane Aqara A100 doesn't supported by Xiaomi gateway, so he using niceboygithub's integration.
@sulliwane
1 - niceboy 2 - yes, to the supported fw version 3 - no. It uses telnet 4 - Aqara home. It doesn't matter when you add it to HA.
HI @niceboygithub I also have a Aqara A100 Lock with G3 but my device model looks diff Output from /data/zigbee # cat device.info over telnet shows
{"devInfo":[{"mac":"0x54ef44100044aa66","shortId":"0x036b","manuCode":"0x115f","model":"aqara.lock.agl002","did":"lumi.54ef44100044aa66","devType":0,"appVer":1,"hardVer":0,"devID":65520,"status":0,"model_ver":1,"preLeave":0}]}/data/zigbee #
Try add
'aqara.lock.agl002': ["Aqara", "Door Lock A100", "ZNMS02ES"],
@niceboygithub ya i added the same as above and everything working with the steps above
Hi guys, bit of a newbie to Zigbee and such. I have an A100 and am keen on getting it into HA.
@Ampig
You need an aqara G3 camera hub for A100 to get into HA. Away mode sensor works with https://github.com/niceboygithub/AqaraGateway integration.
aqara G3 camera hub
Thanks for the info @weising26!
Just to clarify...
Thank you.
i only found this aqara G3 camera hub working with enabling telnet by https://github.com/Wh1terat/aQRootG3
Do you know if this integration works similar in d100 smart locks as well?
@rafaelreis-r @niceboygithub
Now how am I supposed to pair the Hub E1 to my Aqara A100 doorlock?
Thanks for your help!
Since there is no pairing button on the A100, you have to trigger the pairing with the official Aqara app.
Details in the Pairing section here: https://github.com/Koenkk/zigbee2mqtt/issues/13087#issue-1299761012
thanks @rafaelreis-r for your help! I'm a bit lost though...
👉 I thought that the A100 would eventually be controlled by HA through the Aqara E1 HUB.
What you are actually saying is that I can connect to the A100 directly using z2m? (The Aqara Hub being only used to trigger the pairing).
If yes, then I don't understand the point of installing this integration https://github.com/niceboygithub/AqaraGateway (see screenshots below)
Hey @rafaelreis-r, I would really appreciate if you could clarify the above...I'm a bit lost ^^ Thanks
Ok, so for those like me who needed clarification:
By actionning the door lock, you will get a value for Key ID, Lock and Lock event.
Using the "Lock event", you will be able to detect the "away from home" mode!
HI @waterdrop01 did you use the A100 Pro (CN Version) or the International Version? And could you confirm that the lock can be controlled via Home assistant (e.g. to lock and unlock)?
@afghifariii I use the CN version.
No the lock can't be locked/unlocked by Home Assistant. Here is what it looks like in HA: In my setup, pressing the "away from home" button on the lock will switch off all lamps and activate the camera mode "away from home". This is what the automation looks like:
Regarding remotely locking/unlocking, my undertanding (but needs to verify) is that because there is a Aqara Hub, using the Aqara application (Android for me), then I can generate a one time password: That's my E1 Hub (I enabled Telnet by first switching it to Mijia mode by pressing the buttons, then followed this guide to enable Telnet, then switched back to Aqara mode pressing the buttons)
In Aqara App, I added my E1 hub + associated A100 lock to the hub: By pressing the "one time password" button, even if away from home (without being directly connected to the lock using Bluetooth) then I can generate a pin code and give it to someone remotely:
Hope this answers your questions :)
@sulliwane Hi, thanks for the detailed explanation. It seems if I want to control the lock remotely I need to have the Zigbee or International version by creating virtual switch and export it to homekit, then create an automation in homekit. I guess it is what it is. no other door lock that suit my needs more than the A100 or D100 hahaha
Yes, I think what you describe would most probably work (leveraging the homekit integration...).
It's the first smart lock I've used, but it's been living up to my expectations (remote lock/unlock would have been nice, let us know if your setup eventually works! Good luck).
Hey @AlexxIT! First of all, amazing work you've done with this repo.
I'm on a quest to integrate Aqara A100 locks to Home Assistant somehow.
I first started to work with Zigbee2Mqtt devs to see if we could add it there. It turns out there is some encrypted communication going on between Aqara hubs coordinators and the lock, so we reached a stall. Very interesting issue thread loaded with sniffs and pcap analysis here. I kindly ask you to take a look if you can.
Next, I tried to downgrade fw and root my G3 Camera hub to use niceboygithub/AqaraGateway which is derived from your work. It was tricky but I got it (here is the thread in case you're interested)
I did get it working. However, despite having the lock paired to the hub, as well as a regular Aqara button, only the button shows up in the HA entities. The lock does not show up. I'm using telnet for the integration.
Would you have any input regarding how can I approach this quest further? I'm a competent sysadmin, engineer, but zigbee and embedded devices / firmware reverse engineering are a bit out of my reach.
Thanks!