[Solved] Need Help with Yeelight Binding Send Command

Hello everyone,
I run OH2 in Win 10 and i have Problems to send custom commands to my Yeelight Color Bulb.
Everything else works as expected.
Only my custom commands are not working.
The Bulb can do a “Color Flowing” through the Yeelight App.
I have tried several commands to controll the bulb without success.
I have tried to send the Custom command to all Items below

I have tried with:
Yeelight Binding
and
Xiaomi Mi IO Binding

My question is:
How can i send a custom command to use the Colorflow function?
How is the correct synthax?

Can someone give me a hint?

Thanks for Your help.

Here are my Items:

String  YeeDummy2 "YeeDummy" {channel="miio:basic:07CA58DB:actions#commands"}
Switch  YeeDummy "YeeDummy" {channel="yeelight:wonder:0x0000000007ca58db:command"}
Switch WohnzimmerYe1_power "Power"   {channel="miio:basic:07CA58DB:power"}
Number	WohnzimmerYeelight 		"Bright"	<light>			{channel="miio:basic:07CA58DB:brightness"}
Color	WohnzimmerYeelightColor "Color"	<colorwheel>	{channel="miio:basic:07CA58DB:rgbColor"}
Dimmer	Yee	"Color temperature"		{channel="yeelight:wonder:0x0000000007ca58db:colorTemperature"}

Rule

rule "TestYee"

when
				Item YeeDummy2 received command
then
YeeDummy.sendCommand("set_power;\"on\",\"smooth\",2000")

logInfo("TestRule", "++++++YEEEEEE :-) +++++   ")


end

Log

11:20:37.058 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command ON
11:20:37.060 [WARN ] [arthome.model.script.actions.BusEvent] - Cannot convert 'set_power;"on"' to a command type which item 'WohnzimmerYe1_power' accepts: [OnOffType, RefreshType].
11:20:37.060 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become ON
11:20:37.063 [INFO ] [lipse.smarthome.model.script.TestRule] - ++++++YEEEEEE+++++
11:20:37.065 [INFO ] [smarthome.event.ItemStateChangedEvent] - YeeDummy2 changed from OFF to ON```

When i trigger Colorflow through the Yeelight app i get following output:


```csv
13:07:47.540 [INFO ] [elight.internal.lib.device.DeviceBase] - status = DeviceStatus [isPowerOff=false, r=255, g=0, b=0, color=16711680, brightness=100, ct=4000, hue=359, sat=100, isFlowing=true, delayOff=-1, mFlowItems=[ColorFlowItem [duration=3000, mode=1, value=16711680, brightness=100], ColorFlowItem [duration=3000, mode=1, value=65280, brightness=100], ColorFlowItem [duration=3000, mode=1, value=255, brightness=100], ColorFlowItem [duration=3000, mode=1, value=16776960, brightness=100]], mode=MODE_COLOR, isMusicOn=false, name=]```

Hello Everyone,
there is an Update.
Now i changed my Rule and send the command to YeeDummy2.
Now my Logs are flooded with continuos commands to Yeelight and can only be stopped if i comment out the Item.
Whats that ?

RULE

rule "TestYee"

when
				Item YeeDummy2 received command
then
YeeDummy2.sendCommand("{\"id\":1,\"method\":\"start_cf\",\"params\":[ 4, 2, \"1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1\"]")

logInfo("TestRule", "++++++YEEEEEE :-) +++++   ")

end```





```csv
13:57:18.195 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.198 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.201 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.205 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.210 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.213 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.216 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.220 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.223 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.226 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.228 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.232 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.234 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.238 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.241 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.244 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.249 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.252 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.255 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.258 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.262 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.267 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.270 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.273 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.276 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.278 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.282 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.285 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.288 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'YeeDummy2' received command {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,
255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
13:57:18.290 [INFO ] [arthome.event.ItemStatePredictedEvent] - YeeDummy2 predicted to become {"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1,```

I don’t know this binding nor what ColorFlowing is but I suspect that unless there is a special Channel for it it is not something OH is going to support. Read the binding docs and if it doesn’t say anything about ColorFlowing it’s a good bet that it’s not supported.

It’s doing what you told it to do. You trigger the Rule on received command. Inside that Rule you send command to that same Item which will trigger the Rule again.

1 Like

Thank you Rick,
this was my mistake (copy and paste) and blindness :wink:
Meanwhile it works a little bit. but i still do not understand the parameters to 100 %

You can send a command like this:

rule "TestYee"

when
				Item YeeDummy2 received command
then 
YeeDummy.sendCommand("set_scene [cf\",0,0,\"5000,1,500,100,900,1,16776960,70\"]")

end

the documentation of the command is not very helpfull for me.

,0,0 is not clear what it is

duration=5000, mode=1, value=500, brightness=100

duration=900, mode=1, value=16776960, brightness=70

Duration and brightness are clear
value is a color value but color does not change when i change the values
Mode is also not clear to me.

Thank you for beeing active in this community and for your posts

1 Like

I don’t know anything about this binding or Yeelights in general so I’m of very limited use. The answer to your questions is very much specific to Yeelight. Maybe there is a Yeelight forum or there might be answers posted on some other forum that can help, if a Yeelight expert doesn’t chime in to help on this thread.

OK. I did some test today and now i foud out that one value is the color as decimal type.
Now i works almost as expected.

To help others in the future, it would be helpful to post here which one. There will be others with the same question.

My last Rule was the solution.
I will post the complete Things and Rule

Switch  YeeDummy2 "YeeDummy" {channel="miio:basic:07CA58DB:actions#commands"}
String  YeeDummy "YeeDummy" {channel="yeelight:wonder:0x0000000007ca58db:command"}
Switch WohnzimmerYe1_power "Power"   {channel="miio:basic:07CA58DB:power"}
Number	WohnzimmerYeelight 		"Bright"	<light>			{channel="miio:basic:07CA58DB:brightness"}
Color	WohnzimmerYeelightColor "Color"	<colorwheel>	{channel="miio:basic:07CA58DB:rgbColor"}
Dimmer	Yee	"Color temperature"		{channel="yeelight:wonder:0x0000000007ca58db:colorTemperature"}

Rule

rule "TestYee"

when
				Item YeeDummy2 received command
then 
//YeeDummy.sendCommand("set_power [\"on\", \"smooth\",5500,3]")
//YeeDummy.sendCommand("start_cf [4,2,\"1000,2,2700,100,500,1,255,10,5000,7,0,0,500,2,5000,1\"]")
YeeDummy.sendCommand("set_scene [cf\",0,0,\"500,1,255,100,500,1,5292678,100,500,1,11673869,100,500,1,16776960,100,500,1,7733248,100\"]")
logInfo("TestRule", "++++++YEEEEEE :-) +++++   ")

end

If someone needs help i can try to give hints or advices.

1 Like

Hi,
I configured my bulbs and my led strips with the xiaomi miio binding with the tokens. I wrote the items and inserted everything in the sitemap. My problem is that I can not execute all the commands and after creating a rule that lights the bulbs or the LED strips from Xiaomi wireless switches with certain brightness and certain color does not work. Because of that, at the end I left them only for turning on and off. The problem is that sometimes the brightness is too much.
I have these models:
Yeelight YLDP02YL (Colour led bulb 1st generation)
Yeelight YLDP01YL (White led bulb 1st generation)
Yeelight YLDD01YL (Colour led lightstrip 1st generation)
Xiaomi Mi Smart Desk Lamp MJTD01YL
My things setup is:

Thing miio:basic:color1 "Lámapara mesita noche Naty dormitorio" @ "Yeelight" [ host="192.168.X.XX", token="XxXxXxXxXxXxXxXxXxXxXxXxXx", deviceId="XxXxXxXx" ]
Thing miio:basic:color2 "Lámapara mesita noche Juanma dormitorio" @ "Yeelight" [ host="192.168.X.XX", token="XxXxXxXxXxXxXxXxXxXxXxXxXx", deviceId="XxXxXxXx" ]
Thing miio:basic:mono1 "Farolillo terrado" @ "Yeelight" [ host="192.168.X.XX", token="XxXxXxXxXxXxXxXxXxXxXxXxXx", deviceId="XxXxXxXx" ]
Thing miio:basic:strip1 "Tira led mueble TV salón" @ "Yeelight" [ host="192.168.X.XX", token="XxXxXxXxXxXxXxXxXxXxXxXxXx", deviceId="XxXxXxXx" ]
Thing miio:basic:strip2 "Tira led sofá salón" @ "Yeelight" [ host="192.168.X.XX", token="XxXxXxXxXxXxXxXxXxXxXxXxXx", deviceId="XxXxXxXx" ]
Thing miio:basic:lamp3 "Lámpara escritorio despacho Naty" @ "Yeelight" [ host="192.168.X.XX", token="XxXxXxXxXxXxXxXxXxXxXxXxXx", deviceId="XxXxXxXx" ]
Thing miio:basic:color3 "Lámapara pie salón" @ "Yeelight" [ host="192.168.X.XX", token="XxXxXxXxXxXxXxXxXxXxXxXxXx", deviceId="XxXxXxXx" ]

My item setup is:

// Lámpara mesita noche Naty Dormitorio
Switch LMaparaMesitaNocheNatyDormitorio_Power "Está[MAP(luces.map):%s]" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) [ "Switchable" ] {channel="miio:basic:color1:power"}
Dimmer LMaparaMesitaNocheNatyDormitorio_Brightness "Brillo" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:brightness"}
String LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer "Temporizador apagado[:%.0f]" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:delayoff"}
Dimmer LMaparaMesitaNocheNatyDormitorio_ColorTemperature "Color Temperatura[%d %%]" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:colorTemperature"}
Dimmer LMaparaMesitaNocheNatyDormitorio_ColorMode "Modo de color" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:colorMode"}
Switch LMaparaMesitaNocheNatyDormitorio_Toggle "Conmutador" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:toggle"}
Color LMaparaMesitaNocheNatyDormitorio_RGBColor "Color RGB" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:rgbColor"}
String LMaparaMesitaNocheNatyDormitorio_Name "Lámpara mesita noche Naty" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:name"}

// Lámpara mesita noche Juanma Dormitorio
Switch LMaparaMesitaNocheJuanmaDormitorio_Power "Está[MAP(luces.map):%s]" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) [ "Switchable" ] {channel="miio:basic:color2:power"}
Dimmer LMaparaMesitaNocheJuanmaDormitorio_Brightness "Brillo" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color2:brightness"}
String LMaparaMesitaNocheJuanmaDormitorio_ShutdowmTimer "Temporizador apagado" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color2:delayoff"}
Dimmer LMaparaMesitaNocheJuanmaDormitorio_ColorTemperature "Color Temperatura[%d %%]" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color2:colorTemperature"}
Dimmer LMaparaMesitaNocheJuanmaDormitorio_ColorMode "Modo de color" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color2:colorMode"}
Switch LMaparaMesitaNocheJuanmaDormitorio_Toggle "Conmutador" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color2:toggle"}
Color LMaparaMesitaNocheJuanmaDormitorio_RGBColor "Color RGB" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color2:rgbColor"}
String LMaparaMesitaNocheJuanmaDormitorio_Name "Lámpara mesita noche Juanma" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color2:name"}

// Lámpara pie salón
Switch LMaparaPieSalN_Power "Está[MAP(luces.map):%s]" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) [ "Switchable" ] {channel="miio:basic:color3:power"}
Dimmer LMaparaPieSalN_Brightness "Brillo" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:color3:brightness"}
String LMaparaPieSalN_ShutdowmTimer "Temporizador apagado" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:color3:delayoff"}
Dimmer LMaparaPieSalN_ColorTemperature "Color Temperatura[%d %%]" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:color3:colorTemperature"}
Dimmer LMaparaPieSalN_ColorMode "Modo de color" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:color3:colorMode"}
Switch LMaparaPieSalN_Toggle "Conmutador" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:color3:toggle"}
Color LMaparaPieSalN_RGBColor "Color RGB" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:color3:rgbColor"}
String LMaparaPieSalN_Name "Lámpara pie salón" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:color3:name"}

// Tira led sofá salón
Switch TiraLedSofSalN_Power "Está[MAP(luces.map):%s]" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) [ "Switchable" ] {channel="miio:basic:strip2:power"}
Dimmer TiraLedSofSalN_Brightness "Brillo" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip2:brightness"}
String TiraLedSofSalN_ShutdowmTimer "Temporizador apagado" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip2:delayoff"}
Dimmer TiraLedSofSalN_ColorTemperature "Color Temperatura[%d %%]" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip2:colorTemperature"}
Dimmer TiraLedSofSalN_ColorMode "Modo de color" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip2:colorMode"}
Switch TiraLedSofSalN_Toggle "Conmutador" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip2:toggle"}
Color TiraLedSofSalN_RGBColor "Color RGB" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip2:rgbColor"}
String TiraLedSofSalN_Name "Lámpara pie salón" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip2:name"}

// Tira led mueble TV salón
Switch TiraLedMuebleTVSalN_Power "Está[MAP(luces.map):%s]" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) [ "Switchable" ] {channel="miio:basic:strip1:power"}
Dimmer TiraLedMuebleTVSalN_Brightness "Brillo" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip1:brightness"}
String TiraLedMuebleTVSalN_ShutdowmTimer "Temporizador apagado" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip1:delayoff"}
Dimmer TiraLedMuebleTVSalN_ColorTemperature "Color Temperatura[%d %%]" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip1:colorTemperature"}
Dimmer TiraLedMuebleTVSalN_ColorMode "Modo de color" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip1:colorMode"}
Switch TiraLedMuebleTVSalN_Toggle "Conmutador" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip1:toggle"}
Color TiraLedMuebleTVSalN_RGBColor "Color RGB" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip1:rgbColor"}
String TiraLedMuebleTVSalN_Name "Lámpara pie salón" (Home, FF_PrimeraPlanta, FF_Salon, FF_LucesSalon) {channel="miio:basic:strip1:name"}

// Lámpara escritorio despacho Naty
Switch LMparaEscritorioDespachoNaty_Power "Está[MAP(luces.map):%s]" (Home, FF_PrimeraPlanta, FF_Despacho_Naty, FF_LucesDespacho_Naty) [ "Switchable" ] {channel="miio:basic:lamp3:power"}
Dimmer LMparaEscritorioDespachoNaty_Brightness "Brightness" (Home, FF_PrimeraPlanta, FF_Despacho_Naty, FF_LucesDespacho_Naty) {channel="miio:basic:lamp3:brightness"}
String LMparaEscritorioDespachoNaty_ShutdowmTimer "Shutdowm Timer" (Home, FF_PrimeraPlanta, FF_Despacho_Naty, FF_LucesDespacho_Naty) {channel="miio:basic:lamp3:delayoff"}
Dimmer LMparaEscritorioDespachoNaty_ColorTemperature "Color Temperature[%d %%]" (Home, FF_PrimeraPlanta, FF_Despacho_Naty, FF_LucesDespacho_Naty) {channel="miio:basic:lamp3:colorTemperature"}
String LMparaEscritorioDespachoNaty_ColorMode "Color Mode" (Home, FF_PrimeraPlanta, FF_Despacho_Naty, FF_LucesDespacho_Naty) {channel="miio:basic:lamp3:colorMode"}
String LMparaEscritorioDespachoNaty_Name "Lámpara escritorio despacho Naty" (Home, FF_PrimeraPlanta, FF_Despacho_Naty, FF_LucesDespacho_Naty) {channel="miio:basic:lamp3:name"}

// Farolillo terrado
Switch FarolilloTerrado_Power "Está[MAP(luces.map):%s]" (Home, SF_SegundaPlanta, SF_Caseton, SF_LucesCaseton) [ "Switchable" ] {channel="miio:basic:mono1:power"}
Dimmer FarolilloTerrado_Brightness "Brightness" (Home, SF_SegundaPlanta, SF_Caseton, SF_LucesCaseton) {channel="miio:basic:mono1:brightness"}
String FarolilloTerrado_ShutdowmTimer "Shutdowm Timer" (Home, SF_SegundaPlanta, SF_Caseton, SF_LucesCaseton) {channel="miio:basic:mono1:delayoff"}
Dimmer FarolilloTerrado_ColorTemperature "Color Temperature[%d %%]" (Home, SF_SegundaPlanta, SF_Caseton, SF_LucesCaseton) {channel="miio:basic:mono1:colorTemperature"}
String FarolilloTerrado_ColorMode "Color Mode" (Home, SF_SegundaPlanta, SF_Caseton, SF_LucesCaseton) {channel="miio:basic:mono1:colorMode"}
String FarolilloTerrado_Name "Farolillo puerta casetón" (Home, SF_SegundaPlanta, SF_Caseton, SF_LucesCaseton) {channel="miio:basic:mono1:name"}

My sitemap:

Group item=FF_LucesDormitorio
            {     
                Frame label="Lámpara Naty"
                Default item=LMaparaMesitaNocheNatyDormitorio_Power
                Setpoint item=LMaparaMesitaNocheNatyDormitorio_Brightness label="" icon="light" minValue=1 maxValue=100 step=1
                Selection item=LMaparaMesitaNocheNatyDormitorio_Brightness label="" icon="light" mappings=[1="1",5="5",10="10",30="30",50="50",80="80",100="100"]
                Slider item=LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer
                Default item=LMaparaMesitaNocheNatyDormitorio_ColorTemperature
                Default item=LMaparaMesitaNocheNatyDormitorio_ColorMode
                Default item=LMaparaMesitaNocheNatyDormitorio_Toggle
                Default item=LMaparaMesitaNocheNatyDormitorio_RGBColor
                Default item=LMaparaMesitaNocheNatyDormitorio_Name
                Frame label="Lámpara Juanma"
                Default item=LMaparaMesitaNocheJuanmaDormitorio_Power
                Default item=LMaparaMesitaNocheJuanmaDormitorio_Brightness
                Default item=LMaparaMesitaNocheJuanmaDormitorio_ShutdowmTimer
                Default item=LMaparaMesitaNocheJuanmaDormitorio_ColorTemperature
                Default item=LMaparaMesitaNocheJuanmaDormitorio_ColorMode
                Default item=LMaparaMesitaNocheJuanmaDormitorio_Toggle
                Default item=LMaparaMesitaNocheJuanmaDormitorio_RGBColor
                Default item=LMaparaMesitaNocheJuanmaDormitorio_Name
            }
Group item=FF_LucesSalon
            {
                Frame label="Lámpara pie"
                Default item=LMaparaPieSalN_Power
                Default item=LMaparaPieSalN_Brightness
                Default item=LMaparaPieSalN_ShutdowmTimer
                Default item=LMaparaPieSalN_ColorTemperature
                Default item=LMaparaPieSalN_ColorMode
                Default item=LMaparaPieSalN_Toggle
                Default item=LMaparaPieSalN_RGBColor
                Default item=LMaparaPieSalN_Name
                Frame label="Tira led sofá"
                Default item=TiraLedSofSalN_Power
                Default item=TiraLedSofSalN_Brightness
                Default item=TiraLedSofSalN_ShutdowmTimer
                Default item=TiraLedSofSalN_ColorTemperature
                Default item=TiraLedSofSalN_ColorMode
                Default item=TiraLedSofSalN_Toggle
                Default item=TiraLedSofSalN_RGBColor
                Default item=TiraLedSofSalN_Name
                Frame label="Tira led mueble TV"
                Default item=TiraLedMuebleTVSalN_Power
                Default item=TiraLedMuebleTVSalN_Brightness
                Default item=TiraLedMuebleTVSalN_ShutdowmTimer
                Default item=TiraLedMuebleTVSalN_ColorTemperature
                Default item=TiraLedMuebleTVSalN_ColorMode
                Default item=TiraLedMuebleTVSalN_Toggle
                Default item=TiraLedMuebleTVSalN_RGBColor
                Default item=TiraLedMuebleTVSalN_Name
             }
Group item=FF_LucesDespacho_Naty
            {
                Frame label="Lámpara escritorio"
                Default item=LMparaEscritorioDespachoNaty_Power
                Default item=LMparaEscritorioDespachoNaty_Brightness
                Default item=LMparaEscritorioDespachoNaty_ShutdowmTimer
                Default item=LMparaEscritorioDespachoNaty_ColorTemperature
                Default item=LMparaEscritorioDespachoNaty_ColorMode
                Default item=LMparaEscritorioDespachoNaty_Name
            }
Group item=SF_LucesCaseton
            {     
                Frame label="Farolillo terrado"
                Default item=FarolilloTerrado_Power
                Default item=FarolilloTerrado_Brightness
                Default item=FarolilloTerrado_ShutdowmTimer
                Default item=FarolilloTerrado_ColorTemperature
                Default item=FarolilloTerrado_ColorMode
                Default item=FarolilloTerrado_Name
            }

I put here the rule that I have for each bulb-lightstrip-desklamp / wireless switch:

 // Pulsador entrada dormitorio

// Pulsador entrada dormitorio

rule "Pulsador entrada dormitorio encender/apagar luz lámpara Juanma"
when
    Channel "mihome:86sw2:XxXxXxXxXxXxXx:ch1" triggered SHORT_PRESSED
then
        if(LMaparaMesitaNocheJuanmaDormitorio_Power.state == ON) {
        sendCommand(LMaparaMesitaNocheJuanmaDormitorio_Power, "OFF")
        }
        if(LMaparaMesitaNocheJuanmaDormitorio_Power.state == OFF) {
        sendCommand(LMaparaMesitaNocheJuanmaDormitorio_Power, "ON")
        }
end

rule "Pulsador entrada dormitorio encender/apagar luz lámpara Naty"
when
    Channel "mihome:86sw2:XxXxXxXxXxXxXx:ch2" triggered SHORT_PRESSED
then
        if(LMaparaMesitaNocheNatyDormitorio_Power.state == ON) {
        sendCommand(LMaparaMesitaNocheNatyDormitorio_Power, "OFF")
        }
        if(LMaparaMesitaNocheNatyDormitorio_Power.state == OFF) {
        sendCommand(LMaparaMesitaNocheNatyDormitorio_Power, "ON")
        }
end

I have tried and read a lot but I can not create rules for brightness or color. If someone could give me a hand I would be very grateful. Thank you so much for everything.

Hi Maednix!
I can’t make my Yeelight Smart Led Bulb (color) work from rules.
I tried your settings but nothing.

Log always says:
YeeDummy2 predicted to become NULL

Everything instead works fine from sitemap.
I’m going mad…

/------------/
My .things file:
Thing yeelight:wonder:1 [ deviceId=“0x000000000xxxxxxxx”, duration=1000 ]
/------------/
My .items file:
/* Yeelight Items*/
Color YeelightLEDColor “Colore RGB” ( g_yeelight ){ channel=“yeelight:wonder:1:color” }
/* Switch YeelightLEDSwitch ( g_yeelight ) { channel=“yeelight:wonder:1:color” } */

Switch YeelightLEDSwitch “On / Off” ( g_yeelight ) { channel=“yeelight:wonder:1:set_power” }
String YeelightLEDCommand “Comando” ( g_yeelight ) { channel=“yeelight:wonder:1:command” }
Dimmer YeelightLEDColorTemperature “Temperatura Colore” ( g_yeelight ) { channel=“yeelight:wonder:1:colorTemperature” }

Switch YeeDummy2 “YeeDummy2” ( g_yeelight ){channel=“miio:basic:07CA58DB:actions#commands”}
String YeeDummy “YeeDummy” ( g_yeelight ) { channel=“yeelight:wonder:1:command” }
/-------------------------/

.rules
rule “TestYee”
when
Item YeeDummy2 received command
then
//YeeDummy.sendCommand(“set_power [“on”, “smooth”,5500,3]”)
//YeeDummy.sendCommand(“start_cf [4,2,“1000,2,2700,100,500,1,255,10,5000,7,0,0,500,2,5000,1”]”)
YeeDummy.sendCommand(“set_scene [“cf”,0,0,“500,1,255,100,500,1,5292678,100,500,1,11673869,100,500,1,16776960,100,500,1,7733248,100”]”)
logInfo(“TestRule”, "++++++YEEEEEE :slight_smile: +++++ ")
end
/----------------------------------------------/

In my sitemap I have:
/--------------------------------------/
Frame label=“LAMPADINA - TEST” {
Group item=g_yeelight
}

Frame label="Oggi" {
	Switch item=YeelightLEDSwitch label="Lampadina Bula" icon="colorpicker"
	}

/------------------/
LOGS:

/-------------------/
Sitemap Switch
/-------------------/

2019-07-22 22:52:44.082 [ome.event.ItemCommandEvent] - Item ‘YeelightLEDSwitch’ received command ON
==> /var/log/openhab2/openhab.log <==

2019-07-22 22:52:44.096 [INFO ] [light.internal.lib.device.DeviceBase] - ######### this is control command response, don’t need to notify status change!
==> /var/log/openhab2/events.log <==

2019-07-22 22:52:44.097 [nt.ItemStatePredictedEvent] - YeelightLEDSwitch predicted to become ON
==> /var/log/openhab2/openhab.log <==

2019-07-22 22:52:44.107 [INFO ] [light.internal.lib.device.DeviceBase] - status = DeviceStatus [isPowerOff=false, r=133, g=81, b=255, color=8737279, brightness=100, ct=2660, hue=359, sat=100, isFlowing=false, delayOff=-1, mFlowItems=null, mode=MODE_COLOR, isMusicOn=false, name=]
==> /var/log/openhab2/events.log <==

2019-07-22 22:52:44.122 [vent.ItemStateChangedEvent] - YeelightLEDSwitch changed from OFF to ON
2019-07-22 22:52:46.106 [ome.event.ItemCommandEvent] - Item ‘YeelightLEDSwitch’ received command OFF
2019-07-22 22:52:46.123 [nt.ItemStatePredictedEvent] - YeelightLEDSwitch predicted to become OFF
2019-07-22 22:52:46.151 [vent.ItemStateChangedEvent] - YeelightLEDSwitch changed from ON to OFF
==> /var/log/openhab2/openhab.log <==

2019-07-22 22:52:46.157 [INFO ] [light.internal.lib.device.DeviceBase] - ######### this is control command response, don’t need to notify status change!
2019-07-22 22:52:46.164 [INFO ] [light.internal.lib.device.DeviceBase] - status = DeviceStatus [isPowerOff=true, r=133, g=81, b=255, color=8737279, brightness=100, ct=2660, hue=359, sat=100, isFlowing=false, delayOff=-1, mFlowItems=null, mode=MODE_COLOR, isMusicOn=false, name=]
==> /var/log/openhab2/events.log <==

/----------------/
“ON” from rules
/----------------/
2019-07-22 22:52:49.179 [ome.event.ItemCommandEvent] - Item ‘YeeDummy2’ received command ON
2019-07-22 22:52:49.189 [nt.ItemStatePredictedEvent] - YeeDummy2 predicted to become NULL
==> /var/log/openhab2/openhab.log <==

2019-07-22 22:52:49.208 [INFO ] [ipse.smarthome.model.script.TestRule] - ++++++YEEEEEE :slight_smile: +++++
==> /var/log/openhab2/events.log <==

2019-07-22 22:52:49.210 [ome.event.ItemCommandEvent] - Item ‘YeeDummy’ received command set_scene [“cf”,0,0,“500,1,255,100,500,1,5292678,100,500,1,11673869,100,500,1,16776960,100,500,1,7733248,100”]
2019-07-22 22:52:49.218 [nt.ItemStatePredictedEvent] - YeeDummy predicted to become NULL
/----------------------------------------------/

thanks for any kind of help !!
Alex

Hi @scarpy,

Didn’t see this until now, was this resolved?

It would be great help for others if you put your config etc in code fence.

At any rate, for the Yeelight binding command channel, there is a specific format that needs to be followed.

rule "Yeelight Custom Command"
when
        Time is noon
then
        YeelightLEDCommand.sendCommand("set_power;\"on\",\"smooth\",2000")
end

Note that set_power is the command, then a separator ; must be used. \"on\",\"smooth\",2000 are the parameters.

In your case:

YeeDummy.sendCommand(“set_scene [“cf”,0,0,“500,1,255,100,500,1,5292678,100,500,1,11673869,100,500,1,16776960,100,500,1,7733248,100”]”)

You are missing the ; after set_scene, and all the escape characters \ required by Java.

So maybe this would work.

YeeDummy.sendCommand("set_scene;[\"cf\",0,0,\"500,1,255,100,500,1,5292678,100,500,1,11673869,100,500,1,16776960,100,500,1,7733248,100\"]")

Cheers,
Joe

Hi @goodfore!
Sorry for being soooo late!!
Not having been successful with Yeelight binding, I solved with yeecli command line program.
Now I’m back and after a few tries, I can say that the right sintax for parameters is without square brackets like this:

YeeDummy.sendCommand("set_scene;\"cf\",0,0,\"500,1,255,100,500,1,5292678,100,500,1,11673869,100,500,1,16776960,100,500,1,7733248,100\"")

This command will make Yeelight color flowing.
Absolutely wonderful.
Now I’m in trouble trying to read answer of a property request in my rule:

Yeedummy.sendCommand("get_prop;\"power\",\"not_exist\",\"bright\"")
How can I display it in a sitemap ?

Thanks,
Scarpy

Hi @scarpy,

The square bracket was used in the manual Yeelight has, so maybe they changed their API? At any rate, as long as it works :slight_smile:

If I remember correctly (it’s been soooo long lol), the sendCommand was not designed to return any values, so there won’t be a way to read any return from it. Doesn’t brightness mapped to another channel?

Thanks,
Joe

1 Like

if i install the jar ther is this error:

2020-10-28 13:21:18.731 [ERROR] [org.openhab.binding.yeelight ] - bundle org.openhab.binding.yeelight:2.4.0.201901201725 (225)BundleComponentActivator : Unexpected failure enabling component holder org.openhab.binding.yeelight.internal.discovery.YeelightDiscoveryService

Hi @lucas512,

Are you using the official yeelight binding? I think the official one is just 2.4.0

Thanks,
Joe

yes i do use this version:

Hello Guys! Thanks for the information provided in this thread, I was able to make the lights flowing.

I wonder if anyone had luck with implementing the ”Sunset” scene from the yeelight app trough Openhab. Its going from white to red and lowering the brightess during the change, nice for ending the day.

My first thought was to read out the recieved commands from the log, but did not help. Also, I can not ”monitor” the HSB values within Openhab, they are not updated during the scene if initiated from the Yeelight app.

Is it possible to trigger the built-in scenes with the command chanel? Could not find this in the Yeelight API documentation.

OR

If anyone did something similar, can share the code for the yeelight command?

Thanks in advance!
Balint

Hi again!

In case someone is looking after a similar solution, here are the yeelight commands I started to use. (Openhab 3.0, Openhabian, Yeelight binding, Rule DSL script)

Flash notify, 5 changes between 1% and 100% brightness on 5000K, 500 ms each:
LivingroomlampYeelightColorLEDBulb1_Command.sendCommand("set_scene;\"cf\",5,0,\"700,2,5000,100, 700,2,5000,1\"")

Sunset: change from 4300K on 100% brightness to red, 10% brightness within 10 mins and then off.
YeelightColorLEDStripeLivingroom_Command.sendCommand("set_scene;\"cf\",2,2,\"1000,2,4300,100,600000,1,16711680,10\"")