Skip to main content

pysesame-ble

PyPI version License Python Versions

A fast, 100% local Python library for controlling CANDY HOUSE Sesame smart locks and accessories over Bluetooth Low Energy (BLE) using bleak and standard cryptography.

Supported Devices

  • Locks:
    • Sesame 3, Sesame 4
    • Sesame 5, Sesame 5 Pro, Sesame 5 USA
    • Sesame 6, Sesame 6 Pro, Sesame 6 Pro Sliding Door
    • Sesame Bike Lock 1, Bike Lock 2, Bike Lock 3
  • Keypads & Biometric Readers:
    • Sesame Touch, Sesame Touch Pro, Sesame Touch 2, Sesame Touch 2 Pro
    • Sesame Face, Sesame Face Pro, Sesame Face 2, Sesame Face 2 Pro
    • Passcode, RFID/NFC Card, Fingerprint, Face, and Palm recognition management
  • Accessories:
    • Sesame Bot (Switch pusher)
    • Sesame Open Sensor (Door/Window magnet sensor)

Features

  • 100% Local & Offline: Direct communication over BLE. No cloud, Wi-Fi bridge, or internet access required.
  • Modern Security: Hardware-accelerated cryptographic handshakes via cryptography.hazmat (AES-CCM encryption, AES-CMAC session signing, and NIST P-256 ECDH).
  • Setup & QR Code Parsing: Parse and generate official ssm:// QR code URLs exported from the CANDY HOUSE mobile app.
  • Direct BLE Onboarding: Claim and register reset devices directly over BLE without needing the mobile app.
  • Asynchronous Architecture: Built on asyncio, bleak, and bleak-retry-connector.

Installation

pip install pysesame-ble

Quick Start

1. Control a Smart Lock

import asyncio
from uuid import UUID
from bleak import BleakScanner
from pysesame_ble import SesameLock, SesameAdData, find_sesame_device


async def main():
    mac = "AA:BB:CC:DD:EE:FF"
    secret_key = "0123456789abcdef0123456789abcdef"  # 16-byte hex secret key

    # Locate BLE device
    result = await find_sesame_device(mac)
    if not result:
        print("Device not found nearby")
        return
    ble_device, ad_data = result

    lock = SesameLock(ble_device, ad_data=ad_data, secret_key=secret_key)
    await lock.connect()
    await lock.login()

    print(f"Lock Battery: {lock.battery_percentage}% ({lock.battery_voltage}V)")
    print(f"Current Angle: {lock.current_angle}°, Locked: {lock.is_locked}")

    # Unlock the door
    await lock.unlock(history_name="Python Script")

    await asyncio.sleep(3)

    # Lock the door
    await lock.lock(history_name="Python Script")

    await lock.disconnect()


asyncio.run(main())

2. Parse a Setup QR Code (ssm://)

from pysesame_ble import SesameQRCode

qr_url = "ssm://UI?t=sk&sk=...&l=0&n=Front%20Door"
qr = SesameQRCode.from_url(qr_url)

print(f"Device Name: {qr.device_name}")
print(f"Model ID: {qr.model_id}")
print(f"UUID: {qr.device_uuid}")
print(f"Secret Key (Hex): {qr.secret_key.hex()}")

3. Scan for Nearby Sesame Devices

import asyncio
from pysesame_ble import scan_sesame_devices


async def main():
    devices = await scan_sesame_devices(timeout=5.0)
    for address, (ble_dev, ad_data) in devices.items():
        reg_status = "Registered" if ad_data.is_registered else "Unregistered"
        print(
            f"[{address}] Model: {ad_data.model_id}, Status: {reg_status}, UUID: {ad_data.device_uuid}"
        )


asyncio.run(main())

License

This project is licensed under the Apache License 2.0. See LICENSE for details.

Metadata

Release files for pysesame-ble 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysesame-ble 0.1.0
File Size Uploaded
pysesame_ble-0.1.0.tar.gz 24.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysesame-ble 0.1.0
File Interpreter ABI Platform
pysesame_ble-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.5 kB

Release files / pysesame_ble-0.1.0.tar.gz

Download URL pysesame_ble-0.1.0.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e0e5b1f70988d348f9acae71850857f0eccd7fbb2fddf5a5b4dfc206c4c8e418
BLAKE2b-256 checksum
How to use checksums
01f6b16d28770e2a19f596eab6856bebd063b90cdd77f43d8d851a91ea7ea849
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / pysesame_ble-0.1.0-py3-none-any.whl

Download URL pysesame_ble-0.1.0-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc235c83e2debdc0298e38d48bea3fd1b67efb923e9adce1a83a235cc61b4c0a
BLAKE2b-256 checksum
How to use checksums
d29d26768d44df9081dd45c9d0533a0ef4fd98f1f5780e37bfade0f79a09fa56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page