CLI for CANDY HOUSE Sesame smart locks via the public Web API
Project description
candyhouse-sesame-cli
A small CLI + Python library for controlling CANDY HOUSE Sesame smart locks via the public Web API (app.candyhouse.co/api/sesame2).
Scope
Works with any SesameOS2/OS3 smart lock that is reachable from the CANDY HOUSE cloud (i.e. paired with a WiFi Module 2 or a Sesame Hub 3).
- Tested: Sesame 4
- Expected to work (same API, same command codes, not yet verified): Sesame 3, 5, 5 Pro
- Out of scope: Matter-only flows (Sesame 5 Pro + Hub 3 via Matter local control), Sesame Touch / Bot / Bike-specific operations
If you have a Sesame 5 Pro + Hub 3, the Matter path is a better fit than this CLI — it runs locally with lower latency.
Install
pipx install candyhouse-sesame-cli
Or directly from GitHub:
pipx install git+https://github.com/valda/candyhouse-sesame-cli.git
Requires Python 3.9 or newer. The only runtime dependency is pycryptodome for AES-CMAC signing.
Credentials
Obtain the following three values from the CANDY HOUSE business developer portal:
- API key — per-account, unchanged between devices
- Device UUID — per-device (one Sesame = one UUID)
- Device secret key — per-device, 32-character hex string (AES-128 key)
Export them to the environment:
export SESAME_API_KEY="..."
export SESAME_UUID="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
export SESAME_SECRET_KEY="0123456789abcdef0123456789abcdef"
Usage
$ sesame status
{"isRechargeBattery":0,"batteryPercentage":100,"batteryVoltage":6.116,"position":265,"CHSesame2Status":"locked","timestamp":1776966159,"wm2State":true}
$ sesame lock
{"statusCode":200}
$ sesame unlock
{"statusCode":200}
$ sesame toggle
{"statusCode":200}
A 200 response from lock/unlock/toggle only means the command was accepted by the cloud — it does not guarantee the physical lock moved. If the WM2 or Hub 3 is offline, the command is silently dropped. Always re-check sesame status a few seconds later to confirm.
Use as a library
from candyhouse_sesame import SesameClient
client = SesameClient(api_key="...", secret_key="...", device_uuid="...")
print(client.status())
client.command("lock")
Integration with Home Assistant
You can wire this CLI into HA via shell_command + a template lock. Example configuration.yaml:
command_line:
- sensor:
name: "Sesame Status"
unique_id: sesame_status
command: "sesame status"
scan_interval: 30
value_template: "{{ value_json.CHSesame2Status }}"
json_attributes:
- batteryPercentage
- batteryVoltage
- position
shell_command:
sesame_lock: "sesame lock"
sesame_unlock: "sesame unlock"
template:
- lock:
- name: "Sesame"
unique_id: sesame_frontdoor
lock:
- action: shell_command.sesame_lock
unlock:
- action: shell_command.sesame_unlock
optimistic: true
state: "{{ is_state('sensor.sesame_status', 'locked') }}"
Pass SESAME_API_KEY, SESAME_SECRET_KEY, and SESAME_UUID into the HA container via Docker env.
Disclaimer
This project uses the CANDY HOUSE public Web API. It is not affiliated with or endorsed by CANDY HOUSE, Inc. The API is used at your own risk; response shapes and command codes may change without notice.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file candyhouse_sesame_cli-0.1.1.tar.gz.
File metadata
- Download URL: candyhouse_sesame_cli-0.1.1.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fabadc8b913d9d095135adbe539fdfe704708059b11ae0b3374c3663bd73ab4e
|
|
| MD5 |
990bf6fddcd4c85bdb7adc60dd06e215
|
|
| BLAKE2b-256 |
aba5bf8a7fe283ed798aaf09040da542bf79afd4792acdf9bc1f61e56a699554
|
File details
Details for the file candyhouse_sesame_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: candyhouse_sesame_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b39fe91485a6a7152a3fa6bff73c80bbab89e3f0c153d5a7348252aa60a1b9b
|
|
| MD5 |
219eef43fa4679ce634199a494027d98
|
|
| BLAKE2b-256 |
6559dfe41c29b865f77d1ab2a19d8337b77eb832502c8ca04ccdc96060f71b70
|