Page 1 of 1

Custom RGB Light Plugin

Posted: Saturday 09 September 2017 9:01
by miroslavpetrov
Hello everyone!
I bought few RGB Light bulbs that are based on ESP8266. The come with nice firmware which enables them to be controlled with HTTP requests.
I want to make a domoticz plugin for those(python preferably). Can you give me some guidance on how to begin. I was thinking of rewriting the plugin for Yeelight but I cannot find where the plugins are stored in domoticz.

Re: Custom RGB Light Plugin

Posted: Thursday 21 September 2017 19:20
by deennoo
miroslavpetrov wrote:Hello everyone!
I bought few RGB Light bulbs that are based on ESP8266. The come with nice firmware which enables them to be controlled with HTTP requests.
I want to make a domoticz plugin for those(python preferably). Can you give me some guidance on how to begin. I was thinking of rewriting the plugin for Yeelight but I cannot find where the plugins are stored in domoticz.
YeeLight isn't à plugin, that à part of domoticz (github source code), and it works great for me and other, with some lua script, we can drive every thing (white temp, scène, colorflow)

What is your esp8266 modules ?

Re: Custom RGB Light Plugin

Posted: Friday 22 September 2017 16:41
by miroslavpetrov
It is Shelly RGB bulb. Its firmware is based on mangoose OS. Here is an example http request:

http://192.168.1.20/color/0?turn=on&red ... 55&white=0

Can you give me some guidance how to begin with writing a LUA script or a python plugin in order to use domoticz's color picker?

Re: Custom RGB Light Plugin

Posted: Friday 22 September 2017 18:06
by deennoo
Colorpicker isn't on rgb but hsv, you have to use à translator if you want to use it.

On Lua you Can parse thé json value : https://www.domoticz.com/wiki/Domoticz_ ... fic_device

Another simple solution already used for hyperion plugin, or playbulb one's is to create 4. Dimmer :
Red
Green
Blue
white : if existe on your bulb

Re: Custom RGB Light Plugin

Posted: Tuesday 15 May 2018 19:18
by morilm
Dear all

There has been changes on domoticz and now the RGB color are being posted into Json, so its possible to query


json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()
local acolor = " "
ab='curl "http://192.168.1.101:8080/json.htm?type ... '..led_idx..'"'
local jsondata = assert(io.popen(ab))
local jsondevices = jsondata:read('*all')
jsondata:close()
local jsonCPM = json:decode(jsondevices)
local acolor=jsonCPM.result[1].Color

print (acolor)

---------
If you wish to decode the color reply from Json

acolorj=acolor:gsub("}",",}")
aacolor={}
for k,v in acolorj:gmatch('"(.-)":(.-),') do
aacolor[k]=v
print(k,v)
end

So you can get the RGB values in a nice table you can use later on your LUA

Hope it helps

Re: Custom RGB Light Plugin

Posted: Thursday 24 May 2018 8:39
by ledfreak3d
why do it the hard way just flash espeasy on it and use the build in support
gives you fading also problem solved