Re: Get color of RGBW device in dzVents
Posted: Monday 22 June 2020 17:27
I've the same problem with a RGBW switch. The print shows the old values, I don't know why it shows the old values. Doesn't make sense.
It sends to a MySensors node, using S_INFO
Is there a bug submitted?
Quick fix, not a nice one...
It sends to a MySensors node, using S_INFO
Is there a bug submitted?
Quick fix, not a nice one...
Code: Select all
return {
on = {
devices = {
'Klokje - Verlichting'
}
},
data = {
state = { initial = 0 }
},
execute = function(domoticz, device)
local klokVerlichting = domoticz.devices('Klokje - Verlichting')
if (domoticz.data.state == 0) then
klokVerlichting.switchOn().afterSec(0.3)
domoticz.data.state = 1
elseif (domoticz.data.state == 1) then
colorTable = domoticz.utils.fromJSON(klokVerlichting.color)
local dataToSend = ''
--if (colorTable.ww > 0) then
-- dataToSend = '#000000' .. string.format("%x", colorTable.ww)
--else
-- dataToSend = string.format("%x", colorTable.r) .. string.format("%x", colorTable.g) .. string.format("%x", colorTable.b)
--end
dataToSend = colorTable.r .. '.' .. colorTable.g .. '.' .. colorTable.b .. '.' .. colorTable.ww .. '.' .. klokVerlichting.level
print(dataToSend)
domoticz.devices('Klokje - Text').updateText(dataToSend)
domoticz.data.state = 0
else
domoticz.data.state = 0
end
end
}