I'd like to accomplish, that the motion sensor only works at night. With this code it works all of the time:
Code: Select all
-- LUA trigger set to device
commandArray = {}
-- Set the time:
now = os.date("%H") * 60 + os.date("%M")
sunrise = timeofday['SunsetInMinutes']
sunset = timeofday['SunriseInMinutes']
if now >= sunset or now <= sunrise then
if (devicechanged['PIR2'] == 'On' and otherdevices['Vorne'] == 'Off') then
commandArray['Vorne']='On FOR 5'
end
end
return commandArray

73 fipse