I have an IKEA motion sensor 704.299.13, the new and smaller type. I installed it in our hallway to test it with the idea to use it for switching off the lamps if there's no one in the hallway. I don't need it to switch the lamps on.
Without automation the sensor is pretty useless. Exactly a minute after the sensor switched on, it switches off - regardless if there's still (or again) any motion. It even takes tens of seconds after that before the sensor switches on again if there's still motion. The time between switching off and on again is not constant, unlike the time between switching on and off again. The only solution I see now is to create a virtual sensor, that gets on when the motion sensor goes on. The virtual sensor should ignore the motion sensor switching off, but should switch itself off after - say - two minutes after the last time it was switched on. If the motion sensor switches on again in these two minutes, the two minutes should start again. In dzVents I created this script. Does anyone already have a better implementation of the sensor?
Code: Select all
return {
on = {
devices = {'Bewegingssensor (hal)'}, -- the motion sensor
},
execute = function(dz, device)
local virtualDevice = dz.devices('Bewegingssensor (hal, virtueel)') -- the virtual motion sensor
local delay = 120
if (virtualDevice.active) then
virtualDevice.switchOff().afterSec(120)
else
virtualDevice.switchOn().forSec(120)
end
end
}