In my toilet i have an AEON LABS Multisensor 6 Aeotec, whereby my light is been triggered by the sensor.
You can see the scene below, often the light goes out because there is no movement anymore in the toilet, while the person is still in the toilet!
if I increase the reset time, then it takes longer before the light dims (off), but on the other side, I would like to have a scene, when I step outside the toilet the light dims to off, within around 5 seconds.
Does somebody has an improved scene from his or her timer from the toilet or any other scene what is equivalent (revised) to this scene?
--[[
%% properties
442 value
%% globals
--]]
-- User Settings
local debug = false; -- true
local toiletSpot = 408; -- ToiletSpot
-- function variables
local time = 0;
local timeReset = 15; -- delay in seconds during which PresentState will not change after last breach
local timerStop = 16;
local motionSensor = 442; -- Motion Sensor Toilet
local Motion = tonumber(fibaro:getValue(motionSensor, "value"));
local toiletSpotStatus = tonumber(fibaro:getValue(toiletSpot, "value"));
local function log(str)
if debug then
fibaro:debug(str); end;
end
-- avoid loop of this scene
if tonumber(fibaro:countScenes()) > 1 then
fibaro:abort();
end
-----------------------------------------------------------------------------
-- Do Not change below this line
-----------------------------------------------------------------------------
function toiletFunction()
fibaro:call(toiletSpot, "setValue", "75")
log("Light Turned ON");
log(timeReset.. " seconds before Light goes OFF starting at " .. os.date());
fibaro:sleep(5000);
-- loop start ————————————————————----------------------------------------—
repeat
if tonumber(fibaro:getValue(motionSensor, "value")) > 0 then
time = 0;
log("Movement detected from Motion Sensor");
else
time = time + 1;
log("No Movement " .. time .." of " .. timeReset .. " seconds Detected");
end
fibaro:sleep(999);
until time >= timeReset -- 16 > 15
fibaro:call(toiletSpot, "turnOff");
log("Timer stopped, Vanity Mirror OFF");
log("-------------------------------------");
end
if Motion > 0 then
log("Start Timer")
toiletFunction()
end