Page 15 of 18
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Sunday 19 February 2017 21:52
by LouiS22
bertbigb wrote:LouiS22 wrote:Is it possible to control groups (for ex: 4 bulbs simultaneously) with the script posted on domoticz wiki?
I do that with something like:
Code: Select all
--YEELIGHT
-- port number for the yeelights
PORT = '55443'
--IP adresses of the bulbs involved,
local IPs = {'192.168.2.80', '192.168.2.81', '192.168.2.82', '192.168.2.83', '192.168.2.84', '192.168.2.85'}
function YeelightOff()
--command Yeelight Off
for n,IP in pairs(IPs) do
runcommandYeelight = "sudo echo -ne '{\"id\":"..n..",\"method\":\"set_power\", \"params\":[\"off\", \"smooth\", 500]}\\r\\n' | /opt/bin/nc -w1 " ..IP.." " ..PORT.."";
os.execute(runcommandYeelight)
end
end
function YeelightTemperature(WhiteYee, DimYee, DurationYee)
--Yeelight part
for n,IP in pairs(IPs) do
--runcommandYeelight = "sudo echo -ne '{\"id\":1,\"method\":\"set_scene\",\"params\":[\"ct\", " .. WhiteYee .. "," .. DimYee .. "]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
--runcommandYeelight = "sudo echo -ne '{\"id\":1,\"method\":\"set_ct_abx\",\"params\":[" .. WhiteYee .. ",\"smooth\","..DurationYee.."]}\\r\\n' | nc -w1 " ..IP.." " ..PORT.."";
runcommandYeelight ="sudo echo -ne '{\"id\":"..n..",\"method\":\"start_cf\",\"params\":[1,1,\"" ..DurationYee..",2,"..WhiteYee..","..DimYee.."\"]}\\r\\n' | /opt/bin/nc -w1 " ..IP.." " ..PORT.."";
if debug then print(runcommandYeelight) end
os.execute(runcommandYeelight)
end
end
Then you call such a function like:
YeelightOff() or something like YeelightTemperature(WhiteYeeValue, DimYeeValue, DurationYeeValue)
The function will run for all IP's in the list IPs
Hope this helps you.
If you want i can share the complete scripts if that is more helpful
That would be helpful, thanks

Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Tuesday 21 February 2017 12:48
by bertbigb
LouiS22 wrote:
That would be helpful, thanks

I put the script at
Yeelight and Hue lights - use same settings
http://www.domoticz.com/forum/viewtopic ... 61&t=16233
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Friday 24 February 2017 23:47
by hekm77
Westcott wrote:The code can be included with -
package.path = '/home/pi/domoticz/scripts/lua/?.lua;' .. package.path
YEE = require("Yee")
It can be run either from Domoticz Lua, or from a stand-alone Lua test script.
It should be able to support multiple lamps, but that's untested.
It uses a socket, but could probably use io.popen(url) instead to get the lamp's status.
Hi
Westcott.
I am newbie. Can you help me how to use your script?
Explain it to me like I'm a five-year-old

Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Friday 24 February 2017 23:59
by Westcott
Hi Hekm77,
Thanks for your interest, but sorry to say I have not made a script.
What I have created is a library of functions that can be called from other Lua scripts.
It's intended for experienced users who do not need detailed instruction, and requires extra Lua libraries to be installed.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Saturday 25 February 2017 0:12
by hekm77
Westcott wrote:Hi Hekm77,
Thanks for your interest, but sorry to say I have not made a script.
What I have created is a library of functions that can be called from other Lua scripts.
It's intended for experienced users who do not need detailed instruction, and requires extra Lua libraries to be installed.
Thanks for the answer. But I'm learning and I want to understand. Where to get extra Lua libraries?
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Saturday 04 March 2017 16:58
by LouiS22
So guy, just a quick heads up. A while ago I asked the RGBW led's default color temperature. Well, I just installed the white only version and it seems that the RGBWs default (I mean when you install and first switch it on

) color temperature is exactly the same as the white ones (4000K). Might be useful information for someone don't need the color options but wants a decent (and not too cold white) wifi led.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Saturday 04 March 2017 23:00
by deennoo
We are working with Corbin on YeeLight ceiling bulb.
Domoticz got à exclusive feature : nightlight same as the YeeLight app.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Sunday 05 March 2017 21:14
by westd001
Hi Guys,
Just got a Yeelight bulb from China and followed the wiki to add the controller hardware, scripts etc. The bulb is working fine and I can control it via the virtual Yeelight Dimmer en Temp switch/dimmer. But the bulb doesn't appear in the Devices tab. In the logging every minute the bulb is found (2017-03-05 21:10:13.709 YeeLight: New Light Found (192.168.2.110/YeeLight LED (Color))) but isn't added to the device list.
Somebody has the same experience or something else wrong ?
Thanks in advance
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 06 March 2017 0:32
by deennoo
Have you add it ? From device tab ? Click on the green arrow...À domoticz basic
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 06 March 2017 18:43
by westd001
That's the point, it doesn't show up in the device tab
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 06 March 2017 19:09
by deennoo
Even on not used one ?
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 06 March 2017 19:33
by westd001
No Yeelight devices at all
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 06 March 2017 19:50
by corbin
and other devices still add ok? what if you use the 'add light' button on the hardware page? also try with different ip for testing, ie 192.168.5.2
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 06 March 2017 20:55
by westd001
Other devices still add Ok, I made a few virtual switches to test the Yeelight with dimmer values and temperature via LUA scripts, that works fine.
After adding a "Yeelight test" bulb via the 'add light' button on the Yeelight controller at the hardware page no device appear in de device tab, in the log there is :
2017-03-06 20:42:09.925 YeeLight: New Light Found (192.168.2.5/Yeelight test),
further down the log file every minute he finds a new Yeeligth (with the correct IP adress and the default name) but still doesn't appear in the device tab:
2017-03-06 20:43:51.413 YeeLight: New Light Found (192.168.2.110/YeeLight LED (Color))
By the way, I use the last beta version of Domoticz.
Re: RE: Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Tuesday 07 March 2017 20:32
by westd001
westd001 wrote:Other devices still add Ok, I made a few virtual switches to test the Yeelight with dimmer values and temperature via LUA scripts, that works fine.
After adding a "Yeelight test" bulb via the 'add light' button on the Yeelight controller at the hardware page no device appear in de device tab, in the log there is :
2017-03-06 20:42:09.925 YeeLight: New Light Found (192.168.2.5/Yeelight test),
further down the log file every minute he finds a new Yeeligth (with the correct IP adress and the default name) but still doesn't appear in the device tab:
2017-03-06 20:43:51.413 YeeLight: New Light Found (192.168.2.110/YeeLight LED (Color))
By the way, I use the last beta version of Domoticz.
Somebody knows a solution? or a workaround?
Verstuurd vanaf mijn SM-G920F met Tapatalk
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Wednesday 15 March 2017 20:25
by Thunderbolt
If not already said, it works with the Yeelight ceiling light, too. Thanks a lot for that!!!!
I did everything in the wiki, but changed the command for the white temperature color (Discussion page) to just change the color, but not the brightness.
EDIT
And had to change the color calculation.
CalcValue = ((DomValue-1) * 38)+2700;
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Wednesday 15 March 2017 21:03
by westd001
I found the solution, Domoticz automatically finds my Yeelight but only add it to the device list when new hardware is enabled (for 5 minutes) lol
Verstuurd vanaf mijn SM-G920F met Tapatalk
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 20 March 2017 21:25
by Doomed
Hello i am a new to this domoticz thing but i have somehow managed to add my yeelight to my domoticz explorer and it is awesome but i have a question for you, how can i add a FLOW fuction? Can someone please explain it in more easy way?
Thank you so much.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Tuesday 21 March 2017 5:10
by corbin
Have you seen the examples on
https://www.domoticz.com/wiki/Yeelight# ... lb_Only.29?
should be simple to modify with the colour flow command, eg:
Code: Select all
{"id":1,"method":"start_cf","params":[ 4, 2, "1000, 2, 2700, 100, 500, 1, 255, 10, 5000, 7, 0,0, 500, 2, 5000, 1"]
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Tuesday 28 March 2017 10:40
by greg
Hello,
My 2 cents about an alternative method to control Yeelight bulbs from LUA.
I'm using yeecli (
https://pypi.python.org/pypi/yeecli ), via a system call :
Code: Select all
os.execute('/opt/bin/yeecli/cli.py --ip 10.0.0.2 -e smooth -d 500 rgb 007fce')
Greg