Xiaomi Mi IO Binding - ColorMode Channel

Hi,

I am running OpenHab in version 2.5.0~S1669-1 and was trying to configure my Yeelight Color Bulb (yeelink.light.color1) using the Xiaomi Mi IO Binding. I have successfully configured the thing and some items (power, rgbColor, brightness) which work fine from PaperUI and from BasicUI.

Here is my configuration.

Thing miio:basic:color6  "Yeelight Color Bulb" @ "Sonstiges"  [ host="192.168.43.130", token="xxx", deviceId="xxx", refreshInterval="1" ]
Switch  FF_Guestroom_Standlamp_Power                "Power"            	{channel="miio:basic:color6:power"}
Number  FF_Guestroom_Standlamp_Brightness           "Brightness"       	{channel="miio:basic:color6:brightness"}
String  FF_Guestroom_Standlamp_Delayoff             "Shutdowm Timer"   	{channel="miio:basic:color6:delayoff"}
Number  FF_Guestroom_Standlamp_ColorTemperature     "Color Temperature"	{channel="miio:basic:color6:colorTemperature"}
String  FF_Guestroom_Standlamp_ColorMode            "Color Mode [%s]"  	{channel="miio:basic:color6:colorMode"} 
Switch  FF_Guestroom_Standlamp_Toggle               "toggle"           	{channel="miio:basic:color6:toggle"}
Color   FF_Guestroom_Standlamp_RgbColor             "RGB Color"        	{channel="miio:basic:color6:rgbColor"}
String  FF_Guestroom_Standlamp_Name                 "Name"             	{channel="miio:basic:color6:name"}

My problem now is about the item FF_Guestroom_Standlamp_ColorMode. I can change the color mode in the Yeelight App and see that the values changes in the OH2 log.

2019-08-27 16:20:01.933 [vent.ItemStateChangedEvent] - FF_Guestroom_Standlamp_ColorMode changed from 1 to 2
2019-08-27 16:20:02.975 [vent.ItemStateChangedEvent] - FF_Guestroom_Standlamp_ColorMode changed from 2 to 1

When I want to change the value from PaperUI or BasicUI, the following appears in the log.

2019-08-27 16:09:47.427 [ome.event.ItemCommandEvent] - Item 'FF_Guestroom_Standlamp_ColorMode' received command 2
2019-08-27 16:09:47.432 [nt.ItemStatePredictedEvent] - FF_Guestroom_Standlamp_ColorMode predicted to become 2
2019-08-27 16:09:47.470 [vent.ItemStateChangedEvent] - FF_Guestroom_Standlamp_ColorMode changed from 1 to 2
2019-08-27 16:09:47.572 [vent.ItemStateChangedEvent] - FF_Guestroom_Standlamp_ColorMode changed from 2 to 1

I have played around with the item type (number, number:dimensionless), but did not have any success.

While having the item configured as String the Yeelight App changes are showed in the OH2 log. When having configured the item as Number, the App doesn’t change the value in OH2 anymore.

So I got a bit stuck at this point and need some help.

Update #1:

I was thinking about the problem an was playing a bit around. When removing the [%s] from the label and looking at the logs, I see the following line.

Exception while formatting value '2' of item FF_Guestroom_Standlamp_ColorMode with format '%.0f': f != java.lang.String

looks like that item is not supposed to be manually changed, it changes to the correct mode according to what command you send to the lamp. when setting a color temp it changes to colormode=2, when changing the light to a specific color it changes to colormode=1.
so its just displaying the state, and cant be changed by you.

i do have a problem with the lights: mine randomly change color_mode to 1, while i only use colortemp commands. i always have it set to colortemp 3800, but after any random time the light suddenly changes t bright red! (=colormode1).

I have the same problem. I’d very much like to use my Yeelight-RGB bulbs as truly color devices, not warm/cold (1800K…6500K) lights. Nothing I tried works. I even tried sending commands directly, via thing-commands interface, still no luck.

Excuse me, if I misunderstood you, my English is very bad, maybe you need to try this?

YeeC_03_cmd.sendCommand("set_rgb [16713736,\"smooth\",15000]")
1 Like

Indeed this works, thank you!

Still, I’d much prefer if if was as straightforward as setting color temp in Kelvins.