Xiaomi Philips Light token problem

@pplucky Could you do me a favor? Are you able to extract the tokem from an iOS backup again and may be also from android device? If you don’t own a android device the received token from miio will work, too. I want to check they have something in common. The underlying cryptography expects a 32 char token so we cannot feed 96 chars by just loosen the limits.

npm not work with me did i need to install npm first? and if i install it did my HM work fine?
thnk you for reply to me

npm (node package manager) is part of nodejs. You should install version 8.

Device ID: 60636382
Model info: Unknown
Address: 192.168.31.56
Token: ???
Support: Unknown

:frowning: not work for me too

@Noor_Eldin_Shashtari Do you own an android device for testing? I received your sqlite file and you are totally right. Your ZToken column provides 96 character tokens. It looks like encryption with a common salt. All tokens are ending with the same (32) characters. If you split the 96 chars into 32 character pieces we could try the first two pieces as token. The android mi home application does no encryption up to now. This would be the second approach to retrieve a valid (32 char) token.

ok i will try to spilt the char and thene replay to you and if not work i need to use android apps thank you

If you are unsure what’s going on you can enable debugging of the component by:

# configuration.yaml

logger:
  default: warn
  logs:
    homeassistant.components.light.xiaomi_philipslight: debug

After a restart of HA the home-assistant.log should show something like this:

INFO:homeassistant.components.light.xiaomi_philipslight:Initializing with host 192.168.130.58 (token 6f3ce...)                                                                                                                                                                                     
INFO:homeassistant.components.light.xiaomi_philipslight:philips.light.bulb 1.3.0_0032 ESP8266 initialized                                                                                                                                                                                          
DEBUG:homeassistant.components.light.xiaomi_philipslight:Got new state: <CeilStatus power=on, brightness=47, color_temperature=100, scene=0, dv=0, smart_night_light=None, automatic_color_temperature=None>                                                                                       
DEBUG:homeassistant.components.light.xiaomi_philipslight:Response received from light: ['ok']                                                                                                                                                                                                      
DEBUG:homeassistant.components.light.xiaomi_philipslight:Got new state: <CeilStatus power=off, brightness=47, color_temperature=100, scene=0, dv=0, smart_night_light=None, automatic_color_temperature=None>                                                                                      

I understand your point, I’ll get back to you later tonight with that info, but I can confirm that all Wifi devices I have in Mi Home iOS had a 96 char token rather than 32. On the other hand, via miio, all these had 32 char instead.

I forgot to mention that, because I also have homebridge running on the same machine as Home Assistant, so I already had npm installed.

i tray this but nothing help and i tray to get backup from android but i did not know how so until now no chance to work

can you help us to make backup from android and extract it please i tray adb backup but i cant extract it and where the backup save after make it on adb??

Do you have root access on your android device?

Just sent you a message with this information, I hope it may be valuable.

Please let me know if you need any further help.

Yeay! I managed to decrypt the 96 character token into a 32 character one: Xiaomi Gateway Integration

1 Like

thank you very its work :slight_smile: :slight_smile: you are the best

I have this bulb https://www.gearbest.com/smart-lighting/pp_644095.html It works with MiHome apk but when I downloaded database token is empty here. Is it possible that something changed and token is not required in MiHome anymore ? What can I do to make it work under Hass ?

Use older version of MiHome app. The new one blocked the database.

A working/old version of the Mi Home app could be found here: https://www.home-assistant.io/components/vacuum.xiaomi_miio/#retrieving-the-access-token

Except it isnt working anymore, got my two zhiruis and am using 5.0.19 version of app, no token found with miio :confused:

Please try the version 5.0.30 of the mihome app.