# pySwitchbot [](https://travis-ci.org/sblibs/pySwitchbot)
Library to control Switchbot IoT devices https://www.switch-bot.com/bot
## Obtaining locks encryption key
Using the script `scripts/get_encryption_key.py` you can manually obtain locks encryption key.
Usage:
```shell
$ python3 get_encryption_key.py MAC USERNAME
Key ID: xx
Encryption key: xxxxxxxxxxxxxxxx
```
Where `MAC` is MAC address of the lock and `USERNAME` is your SwitchBot account username, after that script will ask for your password.
If authentication succeeds then script should output your key id and encryption key.
Examples:
- WoLock
```python
import asyncio
from switchbot.discovery import GetSwitchbotDevices
from switchbot.devices import lock
async def main():
wolock = await GetSwitchbotDevices().get_locks()
await lock.SwitchbotLock(wolock['32C0F607-18B8-xxxx-xxxx-xxxxxxxxxx'].device, "key-id", "encryption-key").get_lock_status()
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": "https://github.com/sblibs/pySwitchbot/",
"name": "PySwitchbot",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": null,
"author": "Daniel Hjelseth Hoyer",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/68/6a/f6a016cd249cf7f2ffb218fba3817f48db9c22f46674599b92afe5a4816a/pyswitchbot-0.56.0.tar.gz",
"platform": null,
"description": "# pySwitchbot [](https://travis-ci.org/sblibs/pySwitchbot)\n\nLibrary to control Switchbot IoT devices https://www.switch-bot.com/bot\n\n## Obtaining locks encryption key\n\nUsing the script `scripts/get_encryption_key.py` you can manually obtain locks encryption key.\n\nUsage:\n\n```shell\n$ python3 get_encryption_key.py MAC USERNAME\nKey ID: xx\nEncryption key: xxxxxxxxxxxxxxxx\n```\n\nWhere `MAC` is MAC address of the lock and `USERNAME` is your SwitchBot account username, after that script will ask for your password.\nIf authentication succeeds then script should output your key id and encryption key.\n\nExamples:\n\n- WoLock\n\n```python\nimport asyncio\nfrom switchbot.discovery import GetSwitchbotDevices\nfrom switchbot.devices import lock\n\n\nasync def main():\n wolock = await GetSwitchbotDevices().get_locks()\n await lock.SwitchbotLock(wolock['32C0F607-18B8-xxxx-xxxx-xxxxxxxxxx'].device, \"key-id\", \"encryption-key\").get_lock_status()\n\n\nasyncio.run(main())\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library to communicate with Switchbot",
"version": "0.56.0",
"project_urls": {
"Homepage": "https://github.com/sblibs/pySwitchbot/"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bb9862659d05048093861800d2ba46822d8c4a27712e81f0a0b355c10dfa9666",
"md5": "0f70adf402d79e4ebe70218d46022dff",
"sha256": "82079d642a1b53793e062c247c5a154159328da712fc49bd0a50f9f88b716f3c"
},
"downloads": -1,
"filename": "PySwitchbot-0.56.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0f70adf402d79e4ebe70218d46022dff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 45674,
"upload_time": "2025-01-30T20:08:34",
"upload_time_iso_8601": "2025-01-30T20:08:34.245852Z",
"url": "https://files.pythonhosted.org/packages/bb/98/62659d05048093861800d2ba46822d8c4a27712e81f0a0b355c10dfa9666/PySwitchbot-0.56.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "686af6a016cd249cf7f2ffb218fba3817f48db9c22f46674599b92afe5a4816a",
"md5": "c26cb2fe8ed206c0256eb1a5992ddc23",
"sha256": "e4c0aae60cf31c458a367732605060d027a8aa3743915a3a0603dd5074a8c89d"
},
"downloads": -1,
"filename": "pyswitchbot-0.56.0.tar.gz",
"has_sig": false,
"md5_digest": "c26cb2fe8ed206c0256eb1a5992ddc23",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 35673,
"upload_time": "2025-01-30T20:08:35",
"upload_time_iso_8601": "2025-01-30T20:08:35.873560Z",
"url": "https://files.pythonhosted.org/packages/68/6a/f6a016cd249cf7f2ffb218fba3817f48db9c22f46674599b92afe5a4816a/pyswitchbot-0.56.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-30 20:08:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sblibs",
"github_project": "pySwitchbot",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohttp",
"specs": [
[
">=",
"3.9.5"
]
]
},
{
"name": "bleak",
"specs": [
[
">=",
"0.17.0"
]
]
},
{
"name": "bleak-retry-connector",
"specs": [
[
">=",
"2.9.0"
]
]
},
{
"name": "cryptography",
"specs": [
[
">=",
"38.0.3"
]
]
}
],
"lcname": "pyswitchbot"
}