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

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.3
File Size Uploaded Provenance Actions
pysesame_ble-0.1.3.tar.gz 25.4 kB With provenance Details for pysesame_ble-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 52.7 kB

Release files / pysesame_ble-0.1.3.tar.gz

Download URL pysesame_ble-0.1.3.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
56af157f75ef4e66a9ea4f43d0d128c0beec4cd3b34df0a902b8b88df2c23181
BLAKE2b-256 checksum
How to use checksums
a716034f0d06d8a66d49ca3f70ba9955ad1fbd2bec31af1fd169c8d59ade920a
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 17, 2026.

Transparency log

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

Download URL pysesame_ble-0.1.3-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04db0aea7375c5b9bbfa0cca3e71292ced4a39aae47242301b08555500911e73
BLAKE2b-256 checksum
How to use checksums
652a788e8782dbf9349977f2e5f64ddc3865905d7cb2f465d845288b1ac60c90
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 17, 2026.

Transparency log

Security for pysesame-ble 0.1.3

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.3.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 17, 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