[Plugin now available in Beta] Help with Yeelight Bulb

Moderator: leecollings

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

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

Post 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 !
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
corbin
Posts: 463
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 »

deennoo, could you add your guide to the Yeelight page on the wiki?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
somiarun
Posts: 4
Joined: Thursday 08 December 2016 9:19
Target OS: Windows
Domoticz version: 3.5877
Location: Sydney
Contact:

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

Post 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)
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post 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.
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post 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"
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
corbin
Posts: 463
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 »

Maybe the variables have not been added to Domoticz https://www.domoticz.com/wiki/User_variables
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post 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.
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post by deennoo »

corbin wrote:Maybe the variables have not been added to Domoticz https://www.domoticz.com/wiki/User_variables
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
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post 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 ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
corbin
Posts: 463
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 »

deennoo wrote:
Ok Done !

https://www.domoticz.com/wiki/Yeelight

Didn't put scene selector waiting some elements.
Looks good!

I will try it out over the weekend
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
User avatar
corbin
Posts: 463
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 »

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.
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post 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
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
corbin
Posts: 463
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 »

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?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post 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).
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

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

Post 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
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

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

Post 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.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

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

Post 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

Code: Select all

local Yee = {}
and replaced with

Code: Select all

commandArray = {}
Removed all the prefix

Code: Select all

Yee.
from various functions.
But now, what should I do/call this script?

Thanks
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

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

Post 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.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

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

Post 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!
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

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

Post 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
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests