any tips on why one is working but the other is not?
i know its something wrong with the local HallLight.... but im not sure why it doesnt apply correctly
Code: Select all
return {
on = {
devices = {['Loungeroom motion sensor'] = {'at nighttime'}}
},
execute = function(dz, item, device)
local moodLight = dz.devices('Mood Light')
local HallLight = dz.devices(10,11)
local delay = 120
-- dz.log('Device ' .. device.name .. ' was changed', dz.LOG_INFO)
if item.state == 'On' then
if item.active then
if dz.time.matchesRule('between 23:00 and sunrise') then
moodLight.cancelQueuedCommands()
moodLight.dimTo(15)
moodLight.switchOff().afterSec(delay)
HallLight.cancelQueuedCommands()
HallLight.dimTo(15)
HallLight.switchOff().afterSec(delay)
else
moodLight.dimTo(100)
moodLight.switchOff().afterSec(delay)
HallLight.dimTo(100)
HallLight.switchOff().afterSec(delay)
end
end
end
end
}