Recognize successful unlock (actually unlock is an incorrectly used term, it should be “cylinder rotated”)
I say even more correctly:
authorized key inserted (identifying the key)
another thing inserted for more than 3 secs.
2.1. unauthorized key inserted: a system key marked as unauthorized (lost) or temporary outside the authorized time (identifying the key)
2.2. other thing inserted (other key, a picklock atack, or even an system key trying to be inserted at wrong position)
@ Kiagio:
You are correct: presence doesnt work multiple people entering/outgoing
Unfortunately in the Mi Home app the automation (first option for trigger, they’re all in Chinese however I used Google Translate app) doesn’t differentiate between keys as it uses the unlock event as trigger. The second option for trigger in the app is unsuccessful try (again, no difference between revoked key/wrong position for valid key/pick lock).
So for the complete integration a native HA component would be needed that emulates the Mi Home functionality.
As several persons can enter/exit in the same time I consider Tile integration is better for presence detection compared to door key tracking even if both are on the same keyring (actually Tile could be used with BLE room component however it works only when it is not connected to phone).
Some other presence monitoring I’ve tried:
BLE however for phones is tricky (especially for iOS devices which are spoofing their MAC);
wifi tracking (requires phone to be connected and not asleep);
iOS HA app although sends accurate data I found that it needs to be manually triggered in order to push data to HA.
A reliable presence detection is really the base of a good Home Automation system, and it is really dificult to reach. I have tried gpslogger, ping, snmp, nmap, and bluetooth tracker, and I am not absolutely satisfied (maybe gpslogger is the best).
Now I am trying a new method that seems to be the best of all, based on active reporting from mobile with post service device_tracker.see on api. With this I could reach maximum realiability and minimum battery. When I have finished I would report on “sharing succesfully projects”
Bad news: automation triggered when unlocking with the key works, however gateway needs internet connection.
I’ve set two actions for successful unlock (turn on the gateway light and play a sound). When the gateway has internet access both of them are ok.
After blocking the internet access to the gateway on the router only the sound is playing.
It is unclear whether a HA component for the lock would be able to use it without internet (as mentioned, for most Xiaomi components there is no need to use the app or to have internet access to the gateway).
Please, could you post how you are integrating this?
I dont understand very well how the trigger works and the info inside the trigger. It is true you cannot trigger about an specific key, but the info has to be there as you can see witch key has unlocked.
In the Mi Home app I created an automation, for the trigger selected the lock and then the screen has several options in Chinese (first is successful unlock and the second is unsuccessful try; I don’t remember now what are the others ; anyway, in the first place I’ve done a screenshot and then used the Google Translate app).
For the action part I’ve used turning on light and designated ringtone of the gateway. Ringtone plays even if I block the internet access to the gateway however the light turns on only when it is connected to the Chinese servers. As the gateway is blocked from accessing internet, it appears as if broken (same happens even when I’m in LAN).
Only using HA is not currently possible as the lock has no native support.
However, the automation mentioned before (in Mi Home) can set the light on the gateway to on. As the Xiaomi gateway is integrated into HA, the turning of the light can be used as trigger by HA into its own automation.
- alias: door lock
trigger:
platform: state
entity_id: light.gateway_light_7811xxxxx
to: 'on'
Hi, I bought a Xiaomi Vima Smart Lock but I cannot pair with my Gateway (Zigbee version) within my Mi Home app…
After click the “Add device” on the Gateway menu, and press and hold the white (sand) button for 5 sec until I hear a long “beep” I didn’t receive any confirmation of the pairing process by the Gateway… I’ve tried almost 30 times but with no luck… I’ve also try to take off the batteries and replace them (hoping in a reset) but without results… Did someone face my same problem and solve it? Is there a reset procedure to follow? Thanks in advanced
Adding devices fails sometimes for long periods due to Mainland China server outages.
However, you can try adding it from Home Assistant (doesn’t even require internet access for the gateway): in Developer Tools use Services then search for xiaomi_aqara.add_device. In the Service Data input {“gw_mac”:“MAC of the gateway”} and then press call service.
It should start the pairing process from the gateway’s side, but doesn’t use internet access or Mi Home app.
Hi, I bought a Xiaomi Vima Smart Lock but I cannot able to make “key management”.
I added it succesfully in Mi Home.
All my 5 keys open/close my lock.
When I go to in Door Lock Setup" > Key management > and click on +
It ask me if I heard double beep… I answer OK
Put in the key… countdown of 15 seconds start but do not recognize any key… and show “Failed to add”.
This happens with all 5 key