I’ve been using Sesame Lock for the past 1.5 years. At around ¥10,000 which also includes the Wifi Module and Sesame Bot (IoT button), it is a great option for those interested in a smart lock without breaking the bank. In addition, one could control it with a web API, opening up possibilities to integrate with any setup.
While I relied on iOS shortcuts to unlock my doors, I came across a great post by Tats Shibata on how to integrate the new Sesame Locks with Home Assistant. As the official Home Assistant integration only support models before Sesame 3, it took some effort to make the new Sesame locks work with Home Assistant.
Obtaining API key, Device UUID and Secret Key
The easiest way to integrate Sesame into Home Assistant is via their web API. Do note the web API is only free up to 30,000 calls a month, which I think is sufficient for day-to-day use. There are libraries such as pysesameos2 that controls Sesame via Bluetooth communication, but I won’t be exploring these method for now.
To obtain an API key, go to Sesame API portal and login with the email that you used to login into the mobile app.
In the API portal, click on the user icon circled in red. You’ll see your devices appear on the right. You might need to click on the icon a couple of times for all of the devices that you own to appear. Then, click on the device that you want to control. The device UUID and secret key fields will be populated. Add these values to your secrets.yaml file.
Getting Device Status
Getting the device status is as easy as issuing a HTTP GET request:
Unfortunately sending commands to the device is not as easy as getting the status. The secret key needs to be encrypted before sending, which is not achievable via the YAML config. Home Assistant’s Python Script integration isn’t good enough as you’ll need to import modules to encrypt the secret key. But it is simple enough to make a standalone script like so:
Save this file somewhere in your Home Assistant config and make it executable:
$ chmod +x sesame.py
You can then call the script like so via the command line:
If all goes well, you should be able to invoke commands by using scripts:lock_sesame and scripts:unlock_sesame service.
Bringing them all together in a single device
We can finally combine the sensor and controls into a single entity using the Template Lock integration:
All done! You can now integrate the Sesame lock into your Home Assistant using lock.sesame_lock. My Sesame Lock config can be found in my Home Assistant config Github repository.
Adwin Ying
Self-taught full-stack web dev based in Tokyo.
Occasionally wrecks servers through
self-hosting
and
homelab-ing.