Metadata-Version: 2.2
Name: PySwitchbot
Version: 0.57.1
Summary: A library to communicate with Switchbot
Home-page: https://github.com/sblibs/pySwitchbot/
Author: Daniel Hjelseth Hoyer
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Other Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Home Automation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.9.5
Requires-Dist: bleak>=0.19.0
Requires-Dist: bleak-retry-connector>=3.4.0
Requires-Dist: cryptography>=39.0.0
Requires-Dist: pyOpenSSL>=23.0.0
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# pySwitchbot [![Build Status](https://travis-ci.org/sblibs/pySwitchbot.svg?branch=master)](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())

```
