A Python library for controlling Sesame smart locks over Bluetooth Low Energy.
Project description
gomalock
SesameスマートロックをBluetooth Low Energyで操作するPythonライブラリ
機能説明
- Sesame 5 (Pro)の施錠、開錠
- 施錠状態、電池残量などの変化をリアルタイムで受信
- Sesame Touchの電池電圧、残量の変化をリアルタイムで受信
- 周囲のSesameデバイスをスキャンして情報を取得
- 新規Sesameデバイスの登録
- 施錠、開錠角度の設定
- オートロック秒数の設定
- 共有用QRコードの作成
- 自動再接続
インストール
通常のインストール
pip install gomalock
最新のソースからインストール
pip install git+https://github.com/meronepy/gomalock.git
使用方法
開錠例
import asyncio
import gomalock
MAC_ADDRESS = "XX:XX:XX:XX:XX:XX"
SECRET_KEY = "0123456789abcdef0123456789abcdef"
async def main():
async with gomalock.Sesame5(MAC_ADDRESS, SECRET_KEY) as sesame5:
await sesame5.unlock("gomalock")
if __name__ == "__main__":
asyncio.run(main())
MAC_ADDRESSはdiscover.pyで周囲のSesameをスキャンして取得できます。SECRET_KEYはmochipon様作成のQR Code Reader for SESAMEを使用して、マネージャー権限以上のQRコードから抽出できます。- 詳細な使用方法はexamplesおよびdocsをご覧ください。
MQTTとブリッジするサンプルコード
https://github.com/meronepy/ssm2mqtt
注意事項
-
Raspberry Pi OSはデフォルトでBluetoothをブロックしていることがあります。
bleak.exc.BleakBluetoothNotAvailableErrorのようなエラーが出る場合は以下のコマンドでブロックを解除してください。sudo rfkill unblock bluetooth
-
Linuxで動作させる場合、 BlueZ 5.82以降が必要です。 Raspberry Pi OS BookwormのBlueZ 5.66では、Sesame 5のGATT Serviceが取得できず正常に動作しません。
-
履歴機能は公式アプリとの連携が困難であるため実装しておりません。
-
非公式のライブラリです。動作保証はありません。自己責任でご使用ください。
開発環境
- Windows 11 24H2, Python 3.13.3
- Raspberry Pi Zero 2W, Raspberry Pi OS Trixie (64bit), Python 3.13.3
- Sesame 5, 3.0-5-18a8e4
- Sesame 5 Pro, 3.0-7-848a2d
対応機種
| 対応状況 | 機種 |
|---|---|
| ✅ | Sesame 5 |
| ✅ | Sesame 5 Pro |
| ⚠️ | Sesame 5 USA (未検証) |
| ❌ | Sesame 4以前 |
| 対応状況 | 機種 |
|---|---|
| ✅ | Sesame Touch |
| ⚠️ | Sesame Touch Pro (未検証) |
| ❌ | Sesame Face |
| ❌ | Sesame Face Pro |
対応環境
OS
| 対応状況 | OS |
|---|---|
| ✅ | Windows 11 version 22000 以降 |
| ✅ | Linux with BlueZ 5.82 以降 |
| ⚠️ | macOS 10.15 以降 (未検証) |
Python
Python 3.12以降が必要です。
Project details
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 gomalock-1.1.2.tar.gz.
File metadata
- Download URL: gomalock-1.1.2.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64650c4e885f0a81815f62b9f3aa5dac7fea8308c749af85d029a1361da3ff1f
|
|
| MD5 |
72e3923f438fc2bf82edc7511478a8ce
|
|
| BLAKE2b-256 |
2648c42c856b69d6fad7f52e10d1f8bf6e7e883ba14c1e031d9243af57e53e0e
|
File details
Details for the file gomalock-1.1.2-py3-none-any.whl.
File metadata
- Download URL: gomalock-1.1.2-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b40cbfaada65b1953df4900faa93b941a86652f0c59228436fe3b16e3497427
|
|
| MD5 |
52a03e8f16188137b8c0eb59a45ad000
|
|
| BLAKE2b-256 |
030c2a97c39576a0a4a828e6b36ccbccb8d352a998a6da4e0459e4181f916f43
|