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.2

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.2
File Size Uploaded Provenance Actions
pysesame_ble-0.1.2.tar.gz 25.3 kB With provenance Details for pysesame_ble-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 52.6 kB

Release files / pysesame_ble-0.1.2.tar.gz

Download URL pysesame_ble-0.1.2.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c02638a4743225570754f458eaeb51339646e20ef99c314e0583e68716fb320b
BLAKE2b-256 checksum
How to use checksums
1e03e71dd21b19086b7b80d8490e1a5a3833fc71dcac62e6ebfec5165e5c6b30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

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

Download URL pysesame_ble-0.1.2-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb07fd60446f3aed147a9f4024519fe07b2f7c6afb413d7e6216667caec44b95
BLAKE2b-256 checksum
How to use checksums
c7c92eff073bfbc6c5febd6fcbc6af2d4aee00387a44a104ccf57fa0be0a2f0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

Security for pysesame-ble 0.1.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pysesame_ble-0.1.2.tar.gz

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 Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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