@@ -10,26 +10,60 @@ Usage:
1010
1111``` shell
1212$ python3 get_encryption_key.py MAC USERNAME
13- Key ID: xx
14- Encryption key: xxxxxxxxxxxxxxxx
13+ Key ID: XX
14+ Encryption key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1515```
1616
1717Where ` MAC ` is MAC address of the lock and ` USERNAME ` is your SwitchBot account username, after that script will ask for your password.
1818If authentication succeeds then script should output your key id and encryption key.
1919
2020## Examples:
2121
22- #### WoLock
22+ #### WoLock (Lock-Pro)
23+
24+ Unlock:
2325
2426``` python
2527import asyncio
2628from switchbot.discovery import GetSwitchbotDevices
2729from switchbot.devices import lock
30+ from switchbot.const import SwitchbotModel
31+
32+ BLE_MAC = " XX:XX:XX:XX:XX:XX" # The MAC of your lock
33+ KEY_ID = " XX" # The key-ID of your encryption-key for your lock
34+ ENC_KEY = " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # The encryption-key with key-ID "XX"
35+ LOCK_MODEL = SwitchbotModel.LOCK_PRO # Your lock model (here we use the Lock-Pro)
36+
37+
38+ async def main ():
39+ wolock = await GetSwitchbotDevices().get_locks()
40+ await lock.SwitchbotLock(
41+ wolock[BLE_MAC ].device, KEY_ID , ENCRYPTION_KEY , model = LOCK_MODEL
42+ ).unlock()
43+
44+
45+ asyncio.run(main())
46+ ```
47+
48+ Lock:
49+
50+ ``` python
51+ import asyncio
52+ from switchbot.discovery import GetSwitchbotDevices
53+ from switchbot.devices import lock
54+ from switchbot.const import SwitchbotModel
55+
56+ BLE_MAC = " XX:XX:XX:XX:XX:XX" # The MAC of your lock
57+ KEY_ID = " XX" # The key-ID of your encryption-key for your lock
58+ ENC_KEY = " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # The encryption-key with key-ID "XX"
59+ LOCK_MODEL = SwitchbotModel.LOCK_PRO # Your lock model (here we use the Lock-Pro)
2860
2961
3062async def main ():
3163 wolock = await GetSwitchbotDevices().get_locks()
32- await lock.SwitchbotLock(wolock[' 32C0F607-18B8-xxxx-xxxx-xxxxxxxxxx' ].device, " key-id" , " encryption-key" ).get_lock_status()
64+ await lock.SwitchbotLock(
65+ wolock[BLE_MAC ].device, KEY_ID , ENCRYPTION_KEY , model = LOCK_MODEL
66+ ).lock()
3367
3468
3569asyncio.run(main())
0 commit comments