我想获得 HUEcolor
状态,保存它,改变颜色几分钟,然后恢复保存的color
.
问题是我可以获得color
状态对象,但我无法按原样恢复以前的对象:
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
}
我不知道如何恢复以前的状态。我已经保存了color
对象,但是设置颜色的选项是setColor(r, g, b, br, cw, ww, m, t)
获取单个值而不是保存整个对象的方法!