[SOLVED] Xiaomi miio and yeelight, missing tokens

miio
Tags: #<Tag:0x00007f014c8f9b08>

(Vitor Marques) #1

Xiaomi home automation devices are good!.. Zigbee implementations work fine, their mobile app is comprehensive, and in general is good value for the money.

In my tests with openhab, keeping in mind that all the devices where set via their corresponding apps, this is what I found so far:

3 bindings:
(mihome) Xiaomi MI Smart Home, the gateway acting as a bridge and the ZigBee devices.
(miio) Xiaomi MI IO, All other devices, Wifi.
(yeelight) Yeelight Binding

mihome
:grinning: Everything work fine at installation, all devices are detected and operable
:grin: Low latency and reliable
:confused: No way to control the chanels of the gateway, whatever I do can’t get them to respond (light, sounds)
:open_mouth: When the gateway changes IP, all devices loose communication. Only soluiton is to remove and reinstall the gateway binding. No way to set a fixed IP at the gateway (naturally, wifi).

miio
:face_with_raised_eyebrow: Binding missing in the downloadable package and its a nightmare to install teh add-on. Happily on the openhabian, it is included.
:expressionless: Got the mi wifi plugs working, erratically. They loose communication often. But at least can comunicate with them most of the time.
:unamused: Yeelight lamps, which land on the Inbox was never able to get them working.

yeelight
:roll_eyes: The binding seems to be redundant with miio?!?!
:tired_face:

  1. I can’t get the bulbs to comunicate with openhab.
  2. It seems that we need tokens that are not reported by the lamps.
  3. Tried to used the miiojs tool for and miio discover reports no token,
    Device ID: 56221500
    Model info: Unknown
    Address: 192.168.1.102
    Token: ???
    Support: Unknown
  4. At the end of the day, it seems that the tokens change regularly, so even if I could find them - which I can’t - and insert them manually, on first change will lost them.

Tried everything and so far, the miio binding seems to be highly unreliable, difficult or impossible to get working.

Any hints?


(Vitor Marques) #2

Ok, After some hours of digging…

Yes, yeelight binding is redundant, and worst, i suspect its not not usable due to the fact that there is no known way to get the needed tokens to set the thing.

Using Xiami smarthome application, the only wat I could get the tokens - the most well kept secret in the Xiami kingdom - was via iPhone backup viewer, extract the mihome sqllite and from there, with the ip of the bulb, query the token.

The db name is (your mi id)_mihome.sqlite in IOS, and not miio2.db, as in the andriod app.

Tried to get the db via Android, found it very dificult, file seems to be in /data/data/com.xiami.smarthome, but to access it, you need to root the phone, which is not very clear and depends a lot on your phone brand and the android distro on it.

Also tried miio tool (npm install miio), great tool, but does not get the tokens for Yeelight bulb or Xiami vacuum cleaner. Also tried yeeeligh.py tools, and a lot other stuff, at the end of the day, no way to see the light without the damn token.

The origin and role of these tokens is still a mistery. It seems that is originated (and stored) in Xiaomi app, but never displayed in the last versions of the app (shown in previous versions in device, settings, network) as it should. Its role, could be security at a first glance, excessive in my opinion.

At the end of the day, i would buy any other bulb brand less complicated…

After getting comms with the bulb, bumpec into one other issue, the color is named RGBColor and it seems to fail getting a profile for the channel… any hint?..


(marcel) #3

I think nowadays the easiest for getting a token is to use the hacked mihome app.
search for mihome_5.4.50_vevs.apk (wwww.kapiba.ru)
You can go to the device network info tab to get access to the token (last line on the page)

As I can’t confirm this app’s origin/safety, I do suggest to de-install after getting the token and use the regular app.

btw… what is the model of the yeelight you are using? (you can see in the device tab… something like yeelight.xx.xxx and do you have a debug log, than I can take a look what is the issue with the color channel


(Vitor Marques) #4

Hi Marcel,

Yeap, that was a path to get it, but I found it easier (and you can get there again if token changes) to read it from the App DB Backups.

In the Xiaomi app, at the bottom I can see
Version: 140_44.

The bulb itself, printed,
MODEL: YLDP01TYL
CMIIT: 2015DP4838


(marcel) #5

Ah, I mean the model Id like you can see in OH in paperUI.
Click show properties. as in below example


(Vitor Marques) #6

Ahh… Ok, here: