Obtain encryption key for Switchbot Locks
mainSwitchbot Locks require an encryption key and a Key ID for control. You can manually retrieve these using the provided helper script.
Usage:
python3 scripts/get_encryption_key.py MAC USERNAMEMAC: The MAC address of the lock.USERNAME: Your SwitchBot account username.- The script will prompt for your password.
Troubleshooting:
- Authentication failed:
- If 2FA is enabled, you must temporarily disable it to retrieve the key.
- If using Apple/Google Sign-in, ensure you have set a password in the SwitchBot app.
- Ensure the username matches your login identifier (email vs phone number).
- Status code 190 (
SwitchbotApiError): This indicates the account is not the device owner. Keys are only returned to the owning account, not shared/family members.
$ python3 scripts/get_encryption_key.py MAC USERNAME
# Key ID: XX
# Encryption key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX