[Plugin now available in Beta] Help with Yeelight Bulb

User avatar
LouiS22
Posts: 502
Joined: Friday 27 February 2015 14:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: Budapest, Hungary
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by LouiS22 » Sunday 19 February 2017 22:52

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 :)

bertbigb
Posts: 137
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by bertbigb » Tuesday 21 February 2017 13:48

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
Best regards Bert

Synology DS1515+ - DSM 6.1
Raspberry PI2 - B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon

hekm77
Posts: 46
Joined: Thursday 09 February 2017 19:31
Target OS: Raspberry Pi
Domoticz version: beta
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by hekm77 » Saturday 25 February 2017 0:47

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 :)

User avatar
Westcott
Posts: 548
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by Westcott » Saturday 25 February 2017 0:59

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.
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

hekm77
Posts: 46
Joined: Thursday 09 February 2017 19:31
Target OS: Raspberry Pi
Domoticz version: beta
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by hekm77 » Saturday 25 February 2017 1:12

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?

User avatar
LouiS22
Posts: 502
Joined: Friday 27 February 2015 14:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: Budapest, Hungary
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by LouiS22 » Saturday 04 March 2017 17:58

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.

deennoo
Posts: 942
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by deennoo » Sunday 05 March 2017 0:00

We are working with Corbin on YeeLight ceiling bulb.
Domoticz got à exclusive feature : nightlight same as the YeeLight app.
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / ESP8266 / MQTT / BLE
http://domo-attitude.fr

westd001
Posts: 24
Joined: Friday 28 August 2015 21:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by westd001 » Sunday 05 March 2017 22:14

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

deennoo
Posts: 942
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by deennoo » Monday 06 March 2017 1:32

Have you add it ? From device tab ? Click on the green arrow...À domoticz basic
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / ESP8266 / MQTT / BLE
http://domo-attitude.fr

westd001
Posts: 24
Joined: Friday 28 August 2015 21:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by westd001 » Monday 06 March 2017 19:43

That's the point, it doesn't show up in the device tab

deennoo
Posts: 942
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by deennoo » Monday 06 March 2017 20:09

Even on not used one ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / ESP8266 / MQTT / BLE
http://domo-attitude.fr

westd001
Posts: 24
Joined: Friday 28 August 2015 21:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by westd001 » Monday 06 March 2017 20:33

No Yeelight devices at all

User avatar
corbin
Posts: 513
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by corbin » Monday 06 March 2017 20:50

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
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)

westd001
Posts: 24
Joined: Friday 28 August 2015 21:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by westd001 » Monday 06 March 2017 21:55

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.

westd001
Posts: 24
Joined: Friday 28 August 2015 21:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: RE: Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by westd001 » Tuesday 07 March 2017 21:32

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

Thunderbolt
Posts: 13
Joined: Saturday 03 August 2013 12:51
Target OS: -
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by Thunderbolt » Wednesday 15 March 2017 21:25

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;
Last edited by Thunderbolt on Wednesday 15 March 2017 22:40, edited 1 time in total.

westd001
Posts: 24
Joined: Friday 28 August 2015 21:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by westd001 » Wednesday 15 March 2017 22:03

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

Doomed
Posts: 1
Joined: Monday 20 March 2017 22:22
Target OS: Windows
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by Doomed » Monday 20 March 2017 22:25

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.

User avatar
corbin
Posts: 513
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by corbin » Tuesday 21 March 2017 6:10

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"]
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)

greg
Posts: 5
Joined: Monday 26 December 2016 23:52
Target OS: Linux
Domoticz version:
Contact:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Post by greg » Tuesday 28 March 2017 10:40

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest