Also the notification gets sendt immediately, I wan't it to wait until the HouseSw is off.
Code: Select all
return {
active = true,
on = {
devices = {'Bevegelse Stue'},
devices = {'Bevegelse Gang'},
devices = {'Test'},
},
execute = function(domoticz, device)
-- your script logic goes here, something like this:
local HouseSw = domoticz.devices('Bevegelse i Huset')
local LvgrmSw = domoticz.devices('Bevegelse Stue')
local HallSw = domoticz.devices('Bevegelse Gang')
local TestSw = domoticz.devices('Test')
if (HouseSw.state == 'Off') and ((TestSw.state == 'On') or (LvgrmSw.state == 'On') or (HallSw.state == 'On')) then
HouseSw.switchOn()
domoticz.notify('Bevegelse', 'Noen beveger seg i huset.', domoticz.PRIORITY_LOW)
domoticz.log('Noen beveger seg i huset.')
elseif (HouseSw.state == 'On') and (TestSw.state == 'Off') and (LvgrmSw.state == 'Off') and (HallSw.state == 'Off') then
HouseSw.switchOff().afterMin(30)
domoticz.notify('Ingen bevegelse', 'Ingen bevegelse i huset.', domoticz.PRIORITY_LOW)
domoticz.log('Ingen bevegelse i huset.')
end
end
}
