Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # XIAOMI MI ROBOT -> HOME ASSISTANT TOKEN CONVERTER (PYTHON)
- #
- # Convert the Xiaomi Mi Robot 96 character iOS token to the 32 character token required
- # AES-ECB decrypt a 96 character iOS token -> valid 32 character token
- #
- # Thanks:
- # https://community.home-assistant.io/t/xiaomi-gateway-integration/8213/3052
- #
- # More info on using this:
- # http://www.diyfuturism.com/index.php/2017/11/28/config-setting-up-the-xiaomi-mi-robot-vacuum-in-home-assistant/
- from Crypto.Cipher import AES
- import binascii
- keystring = '00000000000000000000000000000000'
- iostoken = '96charactertokenfromsqlite'
- key = bytes.fromhex(keystring)
- cipher = AES.new(key, AES.MODE_ECB)
- token = cipher.decrypt(bytes.fromhex(iostoken[:64]))
- print(token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement