Xiaomi Mi IO Binding and Yeelight Color Bulb

Hi there,

I’ve got some of these Yeelight Color Bulbs (silver grey version)

After hours of try and error I finally managed to get the token with help of this
instruction with a Linux PC using the command line tool “miio”.

After adding the Bulb with the Yeelight App (Android / Version 3.1.73) it appeared in the OH paper UI and I was able to put in the token.

Unfortunately I’m now struggeling with the further setup :frowning:

VScode and Paper UI only shows the following channels:

// test.items
// Yeelight: Color #3
String   YeelightColor3_NetworkSsid       "SSID"                                            (Gxiaomiio)   {channel="miio:basic:XYZFEAFC:network#ssid"}
String   YeelightColor3_NetworkBssid      "BSSID"                                           (Gxiaomiio)   {channel="miio:basic:XYZFEAFC:network#bssid"}
Number   YeelightColor3_NetworkRssi       "RSSI"                                            (Gxiaomiio)   {channel="miio:basic:XYZFEAFC:network#rssi"}
Number   YeelightColor3_NetworkLife       "Life"                                            (Gxiaomiio)   {channel="miio:basic:XYZFEAFC:network#life"}
String   YeelightColor3_ActionsCommands   "Execute Command"                                 (Gxiaomiio)   {channel="miio:basic:XYZFEAFC:actions#commands"}

How can I use it?

Furthermore the log shows every minute a warning message:

2018-10-30 21:19:36.801 [WARN ] [nal.transport.MiIoAsyncCommunication] - Send command '{"id":1803,"method":"miIO.info","params":[]}'  -> (Device: XYZFEAFC) gave error Given final block not properly padded

Any help would be appreciated :slight_smile:

isn’t there a Color channel and colorTemperature channel?

Color   yeelight_color "RGB" <rgb>                 ( g_yeelight ) { channel="yeelight:wonder:0x000000000531fe78:color" }
Dimmer  yeelight_colortemperature "Temp" <rgb>     ( g_yeelight ) { channel="yeelight:wonder:0x000000000531fe78:colorTemperature" }

I have a yeelight color…but it’s white in appearance.

Unfortunately there aren’t such channels.

It seems that your Bulb has a different name than mine.

Which binding do you use?

The yeelight one. Not sure the mihome supports the yeelight lights.

I’m using the Mi IO Binding - not the Yeelight binding.
I’ve read somewhere that the Mi IO Binding would be the better choice. In my case it seems that it’s not.
Quite confusing :frowning:

So - I’ll give the Yeelight binding a try.

@Selter if you see only these, you have a new unsupported type.
Please give the following a try…
Change the model in the thing config to

This will give you the channels that belong to the the v1 version of the color bulb.
If that works well, let me know the original model and I can update the database with your model

Could you please provide an example for the yeelink.things?

Should it look like this?

Thing yeelink:light:color1:XYZFEAFC [ deviceId="XYZFEAFC" ]

Where should be the token?
And how do I define the items?

Sorry I was referring to the miio binding

Yes, I’ve installed the Mi IO Binding.

Could you please help me with the setup?

First thing: the hardest part: get the token from the mihome android app.
See the first post from the xiaomi vacuum topic, or for more elaborate see here

So, with the binding installed, run discovery. This should find your light. It may be there twice. Only one of the 2 should be enabled, it does not really matter which of the two.

Than enter the token and save.Give the binding a minute or 2 to configure itself.
If the token is correct and the your lamp is known… it should work and the light will be online and stays online. If after a minute or so it goes offline, it indicates a token issue.

In case your light is not yet supported (which could be the case based on your earlier email) than you can override the model by entering the yeelink.light.color1 string in the configuration as model. NB, you should already see a model there if it is empty, again it indicates a token issue.

hope this helps. If not, see the vacuum topic how to enable the debug logging, and send (PM) a log from the start of the binding to a minute or 2 later, including sending some on/offs and

Hi Marcel,

Thanks for your reply.

The bulb shows up in the inbox:

I’ve put in the token and the bulb is online.

That are the channels:

But I don’t know where I have to “override the model by entering the yeelink.light.color1 string in the configuration”

So, first question is if the token is right and communication is working. You can check that by looking in the thing use “show properties” is should be something similar to this

Than to override the model is, go to the thing configuration, and edit (use show more to make the model visible)
You can see in the device model string, you can there override it with one of the known models (you can try various ones and see which best matches your light)

Ok - my properties are different to yours:

Status is online BUT I’m getting these warnings every 30 seconds in the log:

 [WARN ] [nal.transport.MiIoAsyncCommunication] - Send command '{"id":89,"method":"miIO.info","params":[]}'  -> 192.168.XXX.XX (Device: XXXFEAFC) gave error Given final block not properly padded

Indeed, you don’t have working communication yet, that is the reason why the right channels are not showing up.

Most likely reason is that the token is wrong, otherwise indeed this needs to be debugged more thoroughly.

Although the status is online and the bulb can be switched with the yeelight app?

Yes, the online means that the light can be reached (networking is fine)
It does not mean the token is correct

Yeelight app communicates via the cloud, so indeed it is different path to the lamp.
Also the mihome app retreives the correct token each time from the cloud… so it will always match the token on the light. Note that each new inclusion will change the token, so if you reset it, or change network etc it will change the token again.

I had to reconfigure my devices, means no communication was possible and I reset my Yeelight bolor bulb (4pcs) and Xiaomi robot.
Mi Home (installed on mobile devie) was used to connect them again - control is possible.
Now I used tool “MiToolkit 1.4” to read new tokes from mobile device - but they are the same.

Before I have used MiServer “China Mainland” and tried to change to “Germay”.
Only vac cleaner was found, but when reading tokes, all have be shown and they are same as for China mainland server.
In additon no yeelight.has been found.

Those tokens did not work - any idea how to fix problem with old tokes / find new token ?
Thanks for your reply

Fixed it by using russian version of MiHome

Hi Marcel thank you for the really astonishing work with this binding, I can confirm that yeelight color bulb 2 is working with model string “yeelink.light.color2”.
I had some trouble at the begging, but was my bad, I pasted the wrong token and manually set the device model string that was blank and nothing was working than I read the post and your tip about checking “show properties”.
This drove me back to the right way, thank you again.
One last thing is there a way to extract the token from Yeelight app? The point is that Yeelight color bulb 2 seem to work only with MiHome china server and there is no straight way with this setting to use the light with Alexa

Yes it seems possible to read the token from the yeelight app as well. See here a pointer to more info