I'd like to get the HUE color
state, save it, change the color for few minutes and then restore the saved color
.
The problem is that I can get the color
state object but I can't restore the previous object as is:
return {
on = {
devices = {
'My Light'
}
},
data = {
savedColor = { initial = {} }
newColor = { initial = {} }
},
execute = function(domoticz, device)
if (device.active) then
domoticz.data.savedColor = device.getColor()
device.setRGB(50,50,50)
device.switchOff().afterSec(60).forMin(1)
-- here I'd like to restore the previous state; something like:
-- device.color = domoticz.data.savedColor
end
end
}
I do not know how to restore the previous state. I've saved the color
object but the option to set color is the method setColor(r, g, b, br, cw, ww, m, t)
that get the single values not the entire object saved!