A way to control RGB(W(W))
Posted: Sunday 19 November 2017 13:32
Hi All,
Is it possible to change color to RGB(W(W)) bulbs using dzVents?
Is it possible to change color to RGB(W(W)) bulbs using dzVents?
Code: Select all
os.execute('curl "http://127.0.0.1:8081/json.htm?type=command¶m=setcolbrightnessvalue&idx=3&hue=18&brightness=50&iswhite=false"')You can also use this for kelvin leveldannybloe wrote: Wednesday 22 November 2017 8:17 That's interesting. Are there more commands like these? Maybe useful to add this to the rgbw_device.lua adapter.
Code: Select all
http://127.0.0.1:8081/json.htm?type=command¶m=setkelvinlevel&idx=8&kelvin=10The FIBARO RGBW Controller has 5 nice animation programs built in that can be set using the Domoticz API URL.dannybloe wrote: Wednesday 22 November 2017 8:17 That's interesting. Are there more commands like these? Maybe useful to add this to the rgbw_device.lua adapter.
Code: Select all
Level Level name
0 Off
10 Fireplace
20 Storm
30 Rainbow
40 Aurora
50 LPD
60 Solid REDCode: Select all
return {
active = true,
logging = {
level = domoticz.LOG_DEBUG,
marker = 'RGBW'
},
on = {
devices = {
'RGBW Selector'
},
},
data = {
last_animation_program = {initial=0}
},
execute = function(domoticz, device)
local RGB_ANIMATION_OFF = 0
local RGB_ANIMATION_FIREPLACE = 10
local RGB_ANIMATION_STORM = 20
local RGB_ANIMATION_RAINBOW = 30
local RGB_ANIMATION_AURORA = 40
local RGB_ANIMATION_LPD = 50
local RGB_DEV = 337
local RGB_ZW_INT_NODE = 75 -- See: https://www.domoticz.com/forum/viewtopic.php?t=8605
local function delayedOpenURL(url, delay)
delay = delay or 0
if delay == 0 then
domoticz.openURL(url)
else
domoticz.log('Requesting url '..url..' with a delay of '..tostring(delay)..' seconds', domoticz.LOG_DEBUG)
os.execute('(sleep '..delay..';curl -s "'..url..'" > /dev/null)&')
end
end
local function setRGBWAnimation(rgbAnimation)
-- Add the number 6-10 to query string, base64- and URL encoded
local url = domoticz.settings['Domoticz url']..'/json.htm?type=command¶m=applyzwavenodeconfig&idx='..RGB_ZW_INT_NODE..'&valuelist=72_'
local delay = 0
if rgbAnimation == domoticz.data.last_animation_program then
if rgbAnimation ~= RGB_ANIMATION_OFF then
delayedOpenURL(url..'MQ%3D%3D', 0) -- Switch off the animation program first
delay = 2
end
else
domoticz.data.last_animation_program = rgbAnimation
end
if rgbAnimation == RGB_ANIMATION_OFF then
delayedOpenURL(url..'MQ%3D%3D', delay)
elseif rgbAnimation == RGB_ANIMATION_FIREPLACE then
delayedOpenURL(url..'Ng%3D%3D', delay)
elseif rgbAnimation == RGB_ANIMATION_STORM then
delayedOpenURL(url..'Nw%3D%3D', delay)
elseif rgbAnimation == RGB_ANIMATION_RAINBOW then
delayedOpenURL(url..'OA%3D%3D', delay)
elseif rgbAnimation == RGB_ANIMATION_AURORA then
delayedOpenURL(url..'OQ%3D%3D', delay)
elseif rgbAnimation == RGB_ANIMATION_LPD then
delayedOpenURL(url..'MTA%3D', delay)
end
end
local function setRGBWChannels(vBrightness, vHex)
local url = domoticz.settings['Domoticz url']..'/json.htm?type=command¶m=setcolbrightnessvalue&idx='..RGB_DEV..'&hex='..vHex..'&brightness='..vBrightness..'&iswhite=false'
domoticz.openURL(url)
end
if device.level <= 50 then
setRGBWAnimation(device.level)
else
setRGBWChannels(100, 'ff0000') -- Solid RED
end
end
}