Page 12 of 18
Re: RE: Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 08 December 2016 12:38
by deennoo
somiarun wrote:what do you mean when you say White Dummy Dimmer - you mean add a virtual sensor
I am on domoticz 3.5877 but there is no white dummy dimmer only RGB or RGBW
Damn man, i made a how to 4 post before yours, open your eyes !
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 08 December 2016 23:11
by corbin
deennoo, could you add your guide to the Yeelight page on the wiki?
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 08 December 2016 23:24
by somiarun
Deennoo sorry i am still new to LUA...tried your above example and ended getting 2 errors when i trigger the virtual dimmer lamp
2016-12-09 09:21:00.167 Error: EventSystem: in YeeLounge: [string "--..."]:30: attempt to index global 'devicechanged' (a nil value)
2016-12-09 09:18:05.971 Error: EventSystem: in YeeLounge: [string "--..."]:37: attempt to perform arithmetic on global 'DomValue' (a string value)
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 08 December 2016 23:33
by deennoo
corbin wrote:deennoo, could you add your guide to the Yeelight page on the wiki?
Honestly i can, but this not a good solution (answer timing is not fast as a on domoticz on board solution), and it don't make us work on a way to add directly on domoticz code.
Will do it ! but this have to not stop a better integration !
Status return give us all information to update "dummy" slider for a real one, as i can see with Jeedom, integration is perfect (and dev do it without any bulb with him, just ask to 3 beta tester to check is work twice a day, OK looks to be a pro dev, and language is php maybe more easy from c++)
Will try to get some times and knowloedge to help you, if @weiweipossible & @gizmocuz can help us a bit, this can be done quickly, LUA script aren't so far from c++ but link them to dimmer i don't know, choose good hadware to create instead of limitlessled can be done fastly too.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 08 December 2016 23:38
by deennoo
somiarun wrote:Deennoo sorry i am still new to LUA...tried your above example and ended getting 2 errors when i trigger the virtual dimmer lamp
2016-12-09 09:21:00.167 Error: EventSystem: in YeeLounge: [string "--..."]:30: attempt to index global 'devicechanged' (a nil value)
2016-12-09 09:18:05.971 Error: EventSystem: in YeeLounge: [string "--..."]:37: attempt to perform arithmetic on global 'DomValue' (a string value)
Can you share your lua script ?
Which kind of dummy device you use for dimmer ? need one who return a % svalue
Please chech it on event tab " show current state"
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 08 December 2016 23:44
by corbin
Maybe the variables have not been added to Domoticz
https://www.domoticz.com/wiki/User_variables
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Friday 09 December 2016 0:11
by deennoo
corbin wrote:deennoo, could you add your guide to the Yeelight page on the wiki?
Ok Done !
https://www.domoticz.com/wiki/Yeelight
Didn't put scene selector waiting some elements.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Friday 09 December 2016 0:28
by deennoo
No user variables on my script.
His probleme is a dimmer type, certains provide 0 t0 100% value, other provid 0 to 36.
I made script run with % who come from value.
Wiki exemple are ok just need to be read
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Friday 09 December 2016 0:32
by deennoo
somiarun wrote:Deennoo sorry i am still new to LUA...tried your above example and ended getting 2 errors when i trigger the virtual dimmer lamp
2016-12-09 09:21:00.167 Error: EventSystem: in YeeLounge: [string "--..."]:30: attempt to index global 'devicechanged' (a nil value)
2016-12-09 09:18:05.971 Error: EventSystem: in YeeLounge: [string "--..."]:37: attempt to perform arithmetic on global 'DomValue' (a string value)
How you get 30 or 37 lines (Probleme are on line 30 and 37) or more when my script only get 22 lines
Have you set your lua as a
device one on events editor ?
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Friday 09 December 2016 0:58
by corbin
Looks good!
I will try it out over the weekend
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Friday 09 December 2016 1:04
by corbin
deennoo wrote:
Have you set your lua as a device one on events editor ?
Yes that looks to be the first problem, can't reference the devicechanged object.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 12 December 2016 11:18
by deennoo
Brightness Dimmer LUA update,
Now Brithgness dimmer, look at White Temp Dimmer and automaticaly turn ON the bulb to the White Temperature choose on the White Temp slider
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 12 December 2016 11:48
by corbin
deennoo wrote:
Honestly i can, but this not a good solution (answer timing is not fast as a on domoticz on board solution), and it don't make us work on a way to add directly on domoticz code.
Will do it ! but this have to not stop a better integration !
Status return give us all information to update "dummy" slider for a real one, as i can see with Jeedom, integration is perfect (and dev do it without any bulb with him, just ask to 3 beta tester to check is work twice a day, OK looks to be a pro dev, and language is php maybe more easy from c++)
Will try to get some times and knowloedge to help you, if @weiweipossible & @gizmocuz can help us a bit, this can be done quickly, LUA script aren't so far from c++ but link them to dimmer i don't know, choose good hadware to create instead of limitlessled can be done fastly too.
What does Domoticz need added/modified to get the functions you are after? Like a new html control for the light that has the extra options?
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Monday 12 December 2016 12:06
by deennoo
Not really a new html control, all is present actually.
Just need to chose the good one :
Instead of getting a limitlessled hardware like : just a rgbw on (without disco etc who can't be call on lua, scene, group)
adding a white temp slider as my lua script do, (this one can be update with prop return if change from app or other HA app)
adding a dimmer slider with auto on/off (brightness value can beget by prop return form the bulb if change from app or other HA app)
and with weiweipossible adding a selector swith to drive "disco" and retrive scene who are present on android app (no update about this).
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 15 December 2016 15:52
by woody4165
Hi
Is it possible to turn on the yeelight using the last, saved status of an RGB lamp?
There is a setting in the Yeelight app where I can choose to save automatically the last status.
I would like also to turn on the lamp, via domoticz, with Flow status, changing color randomly.
Is it possible?
Thanks
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 15 December 2016 16:20
by Westcott
Hi Woody,
Yes, all of those things are possible.
One way would be to build on the Lua code I posted on the previous page (11).
It does all of the basics, including saving/retaining the last setting, and getting Flow status.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 15 December 2016 17:39
by woody4165
Thanks Wescott.
I made the Dim device from your code and it work flawlessy.
I haven't understood how to use the flow code in an empty lua script.
I've removed
and replaced with
Removed all the prefix
from various functions.
But now, what should I do/call this script?
Thanks
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 15 December 2016 18:21
by Westcott
Hi Woody,
My code is intended as a library to be called from an existing Domoticz Lua script.
It does not run directly from the GUI interface device.
Instead its functions are called when my security detectors are triggered.
E.g.
Code: Select all
package.path = '/home/pi/domoticz/scripts/lua/?.lua;' .. package.path
YEE = require("Yee")
If (devicechanged['xxx'] == 'On') then
YEE.Pulse("ff69B4",5,600,50,1)
end
The parameters for Pulse() are -
(RGBcolour, repetitions, change speed in ms, max brightness (1-100), min brightness)
so the example above is -
RGB = "ff69B4" (Hot pink!)
repetitions = 5 (5 times max->min)
change speed = 600ms between min/max
max brightness = 50
min = 1
The parameters for OnFor() are -
On for seconds, colour, brightness
where colour is either RGB or colour temperature
Both of these functions return the bulb to its setting before the call.
Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 15 December 2016 18:27
by woody4165
Ok, thanks Wescott
I have to study your code and make some tries so I will get what I want.
Thanks very much for sharing!
Re: RE: Re: [Plugin now available in Beta] Help with Yeelight Bulb
Posted: Thursday 15 December 2016 19:09
by deennoo
Westcott wrote:Hi Woody,
My code is intended as a library to be called from an existing Domoticz Lua script.
It does not run directly from the GUI interface device.
Instead its functions are called when my security detectors are triggered.
E.g.
Code: Select all
package.path = '/home/pi/domoticz/scripts/lua/?.lua;' .. package.path
YEE = require("Yee")
If (devicechanged['xxx'] == 'On') then
YEE.Pulse("ff69B4",5,600,50,1)
end
The parameters for Pulse() are -
(RGBcolour, repetitions, change speed in ms, max brightness (1-100), min brightness)
so the example above is -
RGB = "ff69B4" (Hot pink!)
repetitions = 5 (5 times max->min)
change speed = 600ms between min/max
max brightness = 50
min = 1
The parameters for OnFor() are -
On for seconds, colour, brightness
where colour is either RGB or colour temperature
Both of these functions return the bulb to its setting before the call.
Doesn't try your code yet, surely he is more evoluate than mine and can be more easyer to use (lib way is a good thing, as for the speedup ones).
If you think yours are better than mine feel free to update wiki, don't forget to give some exemple and screen