Xiaomi Smart Wifi Socket Mi Home - how to get the token? --> hex code too long?

Hi,

i found the guide: https://www.home-assistant.io/components/vacuum.xiaomi_miio/#retrieving-the-access-token

but I cannot go beyond step:

Click on the Execute SQL tab.
Input and run this query: SELECT ZTOKEN FROM ZDEVICE WHERE ZNAME = “Mi Robot Vacuum”

I know that Robot Vacuum is wrong because it is a socket I cannot figure out what to put instead? Wifi Socket does not work… any ideas??

Got it! it is “Mi Plug Mini”

22bbea40a4f94267b7fcd9f0c6007d320bc50d41b4ac508ba7e1a57f585302530143db63ee66b0cdff9f69917680151e

Hex code too long? and now? any ideas?

If you use this website you can decrypt the code into a 32 digit one: http://aes.online-domain-tools.com/

82 bd 75 eb ec 37 31 80 0d 2b ab 00 b5 d2 f2 e5
9e 5a e0 fd 69 03 97 7f 5c 75 06 92 70 d0 48 59
ff fc 98 25 69 22 47 6c a0 99 db 7e 8b f3 11 c3

I dont know which one is now my token?

Solved! I had to take the two lines on the right in the picture together and that was my code!

Together with this code in the configuration.yaml I was able to integrate the socket:

switch:
- platform: xiaomi_miio
name: Original Xiaomi Mi Smart WiFi Socket
host: [ip of my socket]
token: 10dc640977af575fd1c091ed44b77999
model: chuangmi.plug.m1

Hi Charlescherry,

Do you know of another website that can change this long code into the 32 digit one, http://aes.online-domain-tools.com/ isn’t working, there is an error on the page?

Richard

I’m learning to set up a few Xiaomi devices especially this wifi socket. I’ve already added the Xiaomi Gateway by looking up the API token using the Mi Home app way.

Reading https://www.home-assistant.io/integrations/xiaomi_miio#xiaomi-smart-wifi-socket, do I use that same token of the gateway to configure a wifi socket or should I follow https://www.home-assistant.io/integrations/xiaomi_miio#android-not-rooted?