Xiaomi Philips Light token problem

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

# configuration.yaml

  default: warn
    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 (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.

I did, after that tried 5.0.19 as someone had success with it, didnt work, then tried 5.0.6 for same reason, no luck :confused:

Sad news. I will try to reset & repair one of my lights soon just for testing.

Thnx, i managed to get tokens via packetsender reply, but havent been successfull to control them …

EDIT: nvm, had typo in ip address, they work now :slight_smile:

If anyone else have problems with mihome app, this is the other way from : https://github.com/jghaanstra/com.xiaomi-miio/blob/master/docs/obtain_token.md

During setup of Mi Home devices the device tokens an be retrieved by sending a ping command to the 
device. This method uses a tool called Packet Sender(https://packetsender.com/download) which you will need to download. Choose the portable 
version which does not require installation.

Download the portable version of Packet Sender.
Reset the device following the instructions from the device manual, this usually means holding one or two 
buttons for 10 seconds. This will reset all device settings including the Wi-Fi settings.
After reset the device will create a it's own Wi-Fi network. This network will have a name related to the device 
and is used for configuring the device but will also allow us to retrieve the token. Connect to this Wi-Fi network 
with your computer which has Packet Sender running.
Open Packet Sender and enter the following details.
HEX: 21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Port: 54321
Protocol dropdown: UDP
Click send and the device will respond with an answer which contains the unique device token. In the last 16 
bytes (32 characters) of the devices response is the device token. Copy and save it somewhere.
Disconnect your computer from the devices network, you can now use the Mi Home app to setup the device 
and connect it to your Wi-Fi network.

I tried the Packet Sender method with the Philips Zhirui Bedside lamp without success, did not get any reply from the lamp.

(Also tried it with MIJIA Smart Plug Enhanced the one with 2 USB, also without success)

Has it work for anyone else…?

I recommend this method: https://python-miio.readthedocs.io/en/latest/discovery.html#tokens-from-mi-home-logs

1 Like

Yes, that worked. :+1: