Xiaomi Vima smart lock support?

Is this supported?
I have one, but HA dont detect it.
It says:

“The device with sid 158d000222b8b0 isn’t supported of the used gateway firmware. Please update the gateway firmware if possible! This is the only way the issue can be solved.”

I have this perfectly integrated in MiHome


It’s currently not integrated in HA. Maybe @syssi knows if there are plans to do so. Although I wonder what kind of functionality could be usefull to integrate. Isn’t the only “smart” thing about this lock you kan program different keys?

It’s quite useful if you don’t necessarily need to open/close the door from the phone’s bluetooth/fingerprint/etc.

Building HA support for the lock allows for determining when the door is locked/unlocked (versus a Z*/RF open door sensor which can only show if the door is open/close but not if locked or unlocked) then have a notification sent on phone/light turned on in the house (with a notification light that can be set at a different tone than the regular light) to remind you when the door is left unlocked, or have a notification when forgetting the keys on the outside.

Having the log with door events in HA also allows for monitoring which key was used and when (and start different automation for each person when opening the door).

1 Like

Hello Petrica.

I think that Vima smart lock can not detect if door is locked or not. It can detect when a Key is introduced, but seems that it doesnt manage the state of the cilinder (the turns over the lock).

The main features of this lock is not for automate/remote control. Its for security.
It can do:

  • Send a notification when a “strange” key is introduced. (this is the most important feature of this cheap lock, because it warn when i.e is begining to be forced).
  • Send a notification when an “authorized key” from 5 available is introduced. And see what key is. This can be useful for a really presence detector. But take into account that you cant distinguish between open/vs close the lock.
  • Send a notification when an “unauthorized key” (of the 5 available) is introduced.

You can authorize or disauthorize keys, or make it temporary keys (active i.e from 10:00 to 12:00 the key for the real human Home Assistant), and see battery level.

I think that could be great to integrate this in HA, because it adds a great funcionality in a DIY alarm system, and presence automations.

Hi @segalion,

Problem solved: I managed to get lock/unlock state for door (different from open/close which can be obtained from a regular open door sensor) but not with this lock.

This lock won’t report if locked or unlocked due to the fact that it can be used on either left or right opening doors. In fact, the interior knob doesn’t do anything “smart” as it can open/close the door without any log in the app. Adding these two is rather impossible with the current gear to identify if the door is locked or not (in fact “unlocked” in the app is misleading as it only describes that an event, either lock or unlock, occurred). In order to be able to determine if the door is locked or not then the device should have had left/right opening selector (then to check if movement is clockwise or counter-clockwise, etc) and the interior knob should also be accounted for.

Anyway, having HA support would still be great for the reasons you mentioned as it adds a quite nice security feature. Actually I haven’t been able authorize any key in the app as the pairing fails (I think that it is due to a server communication error).

The actual lock/unlock state can still be determined with an open door sensor sufficiently thin in order to be able to not interfere with the actual movement of the bolt. The sensor in the link easily fits inside the door frame and the magnet can be glued on the bolt. Actually a reel from a regular open door sensor can be used in a similar way (or a recessed magnetic sensor that would need a drill in the door) but this strip is the least intrusive as it doesn’t require any dismantle/drilling in the door frame.

With the remopte function are you able to actually OPEN the door, or just UNLOCK it?


This product cannot either unlock or open the door (actually in order to open the door you would need a piston to push it - similar to hatchback vehicles).

It can only:

  1. log when successful/unsuccessful cylinder motion occurred (it cannot retrieve whether the door is closed or opened due to the fact it can be mounted on either left or right side door so it can’t identify whether the key rolling is an actual lock or unlock). However, as mentioned above you can get the state of the door through a open door sensor (meaning additional costs).
  2. authorize/revoke keys;
  3. sound an alarm when unsuccessful unlock occurred (either when unauthorized key is introduced or when the genuine key is used upside-down);
  4. sound an alarm when successful unlock occurred (this sound can be deactivated in the Xiaomi app);
  5. use it as a trigger in the Xiaomi app to create automations.

This is basically a regular door cylinder with tighten security (as keys cannot be copied and the actual keys can be revoked by the app).

neither with the official app?

I don’t know if there’s an official app different than the Mi Home app (from Xiaomi). The manual is in Chinese however I think that Mi Home is the official app.

Anyway, regardless of whether Mi Home is the official app or not, the cylinder cannot be unlocked remotely:

  • as mentioned above, in order to be able to perform remote operations, the door needs to know if it is locked (in order to unlock it) or unlocked (in order to lock it); as the lock can be mounted on either right or left sided doors, it is not possible to identify the state;
  • second of all, a motor would be needed to move the cylinder and there isn’t one in the lock.

Ohh I see no motor inside, now I understand the product better. I was looking more for a remote unlock/ioopen feature. I guess this product is just for security , not for convenience

Overall you like the security features?

I only have basic knowledge (I understand the concepts of public and private keys and some of the encryption protocols) so I cannot provide a full security audit.

However, as remote opening is not possible, there won’t be a risk that someone will open the door just by getting hold of your Xiaomi account or your phone. However it can be nagging if you ever loose your phone (and if there’s no password set for phone to unlock) as an attacker will be able to revoke all your keys and you then need to get a locksmith or Rambo to blow up your door :smiley:

Manufacturer claims 128 bit encryption is used for the keys so even if anyone manages to get a hold on your key and makes a 1:1 physical copy of it, the door lock won’t accept it.

The lock uses Zigbee to connect to Xiaomi gateway so any protocol weakness (during Zigbee setup or during communication) will inherently transfer to the lock. And then there’s the communication between gateway and the Xiaomi servers in order to be able to use the app on mobile data connection. The good news is that the Xiaomi gateway can be completely locked on the LAN by the router so it will not be able to access internet, decreasing the security issues generated from the fact most Chinese devices are phone calling. The issue with this would be loosing remote app access in the process, however if HA would add support for the lock there would not be any need for using the app.

At the moment Home Assistant can call the pair function on the Xiaomi gateway without internet, so the gateway doesn’t need internet access in the first place if using HA (if trying to pair any device from the app itself then you need internet access, so I think this is a high mark for HA).

If a key is lost/don’t recall where it was left, then you don’t need to replace the cylinder which is the case for regular door locks, just revoke the key. If subsequently found, a revoked key can be re-authorized.

However the encryption actually raises a problem for families with more than 5 persons :slight_smile: as an additional door lock set with cylinder and 5 keys needs to be purchased even if the additional cylinder won’t be used (haven’t found single keys to buy).

I have fully tested this cylinder and this is my considerations:

  1. Its a great and really cheap security system: The first line of security is premature detection, and here, the lock produces an alarm if something is inserted (even a picklock) for more than 3 secs that is not an authorized key. Its really cheap because it has similar cost as similar “not smart” lock+5 keys.
  2. The keys seems to have some NFC mechanism
  3. Battery after 3 months (low use) down 3%, so I suppose it can reach more than 2 years (in my case)
  4. If battery is down, the lock works as any not-smart lock: authorized and not-authorized keys can open. and no alarm, manage, etc. is possible.
  5. If gateway is down (i.e. shutdown all electricty due to an atack), smartlock has all the configuration and a timer inside, so authorized and and even temporary authorized keys can open, not-authorized cannot, indepedent of gateway state. Alarms are sended but nobody can receive them. For this reason is so important to has a UPS or battery system to the gateway…
    6.The hardware security is like other cylinder. and a tipical force attack can destroy it (as the most robust cylinder) so you need a god external shield to become really secure. See this brute atack here https://www.youtube.com/watch?v=wqfEd-WGL10

In general, the system seem with enough quality, and the keys are really robust (at least until now).

And as Petrica say, cannot be buyed sepparately, so its no easy get a system with more than 5 keys (at least until now).

I suppose that with an additional 7€ xiaomi door sensor, only one door and a few rules in HA can be possible to make a robust presence sensor (device_tracker) depending on the key that is inserted, and if open the door is before of after this event.

But, for this, we need to has support in HA for this smartlock.

What is the component that has to be improved in order to have support for the smart lock? Probably we can accelerate adding support if we open an issue in the corresponding github

I suppose xiaomi_aqara (the gateway) because it is zeegbee and in the xiomi mihome apperar inside the gateway (as other sensors and switches)…

Actually I think that HA support can be circumvented and still integrate the lock in HA.

The Basic functions of the gateway related to the lock are as following:

  1. Recognize successful unlock (actually unlock is an incorrectly used term, it should be “cylinder rotated”);
  2. Recognize unsuccessful unlock attempt;
  3. Add new key;
  4. Authorize key;
  5. Revoke key.

Mi Home app has the option to create automations which are saved on the gateway. No. 1 and 2 can be achieved by setting automations to turn on gateway’s light with specific color and set a HA automation based on the gateway’s light (I know this as I tried something similar when Aqara cube did not yet worked with HA).

For last three functions the app would still be required.

did not think about that, that is really cool though.

EDIT: Problem for me is my wife and child often enter together (one key used)

I think its easy to do, for whom wrote the component or who is familiar with these kind of coding … not me unfortunately

I think 1 and 2 are important to implement in HASS, the other 3-4-5 you can use the mi app (once in a while when needed)

The open door sensor I have mentioned above can complete the door lock by showing if the door is locked/unlocked.

The presence sensor however is a little more difficult to use as more persons can enter/exit at a time.

Very clever solution!