Wake Up Light DzVents
Posted: Thursday 15 March 2018 23:22
Hi, im trying to make a wake up light with DzVents. I'm new to lua, but this is my best attempt. my problem is that the variable won't increase when the timer is done. Any help would be fantastic thank you.
Code: Select all
return {
on = {
timer = {'every 5 seconds'}
},
data = {
Bright = { initial = 0 }
},
execute = function(domoticz, item)
if (domoticz.devices.state == 'On') then -- Wake Switch is on
domoticz.log('Start Wake UP Light') -- Write to Log
if ((domoticz.devices('Bridge').level <= 100) and item.isTimer) then -- If Light is 100% stop increasing
domoticz.data.Bright = domoticz.data.Bright + 5 -- Add 5 to Varible Bright
domoticz.devices('Bridge').dimTo(domoticz.data.Bright)-- Set Brightness to Varible Bright
domoticz.log('Increase Brightnes by Varible is '..domoticz.data.Bright) --Log Bright Value
end
else
domoticz.log('Wake Up Off, reset Bright Varible')
domoticz.data.initialize('Bright')-- Reset Bright Varible
domoticz.devices('Bridge').dimTo(domoticz.data.Bright)
end
end
}