Heed help with RGB

Post Reply
Posts: 1
Joined: Sunday 13 May 2018 13:02
Target OS: Raspberry Pi
Domoticz version: Beta

Heed help with RGB

Post by Resperro » Sunday 13 May 2018 13:29

Hi, I'm new here, I'm trying to connect the RGB strip to the system. Dimmer was able to connect. But how to change the color, the color itself was sent to the ESP. As well as the dimmer value. I need HEX as in the log.

2018-05-13 11:18:43.084 setcolbrightnessvalue: ID: d, bri: 61, color: '{m: 3, RGB: caffd3, CWWW: 0000, CT: 0}'

Something similar to http://" .. IP .. "/?RGB=HEXvalue

or rgb like R=RR G=GG B=BB

Dimmer I use:

Code: Select all

commandArray = {}
DomDevice = 'Bed_rgb_light';
IP = '';
if devicechanged[DomDevice] then
         DomValue = otherdevices_svalues[DomDevice];
         CalcValue = DomValue;
         commandArray['Variable:Bed_rgb_light_var'] = tostring(CalcValue);
--         print ("dimm Level = "..uservariables['Bed_rgb_light_var']);
   runcommand = "curl http://" .. IP .. "/?A=" .. CalcValue .. " ";
print("PWM calculated value= "..CalcValue);
return commandArray
Is this possible in Domoticz?

Posts: 31
Joined: Friday 27 January 2017 13:57
Target OS: OS X
Domoticz version:

Re: Heed help with RGB

Post by morilm » Sunday 27 May 2018 9:58

Hi... Since a few weeks there has been changes on the RGB and now it's possible to read the color values using JSON. See example bellow how to get values for RGB colors

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

print (acolor)

If you wish to decode the color reply from Json you need to do some magic to strip the values from the color table

for k,v in acolorj:gmatch('"(.-)":(.-),') do

full info here: https://www.domoticz.com/wiki/Domoticz_ ... emperature

Hope some day LUA properties for switches will be updated to get the info directly without using JSON as part of the otherdevices_svalues for example.


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest