Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team

Question
rickydehaas 4
Hi all,
I noticed the large amount of smart light-scenes in this forum, but i didn't find the answer i was looking for.
I created a scene which checks (runs every 5 min by mainloop from @Sankotronic) multiple motion sensor if they aren't breached for (lets say) 30 minutes. When true then all lights in the same room as the motionsensor will turn off.
Problem is that some rooms have multiple motion sensors and currently if 1 of the sensors aren't breached for 30 min, the lights in that room will be turned off, but what i'm lookinfg for is when all sensors in 1 room aren't breached for 30 minutes, then the lights are turned off.
Current scene:
--[[
%% properties
%% weather
%% events
%% globals
--]]
if (fibaro:countScenes() > 1) then fibaro:abort() end;
local hc=fibaro
local startSource = fibaro:getSourceTrigger();
-- Locals
local lightID = {191, 33, 57, 116}
local motionID = {79, 102, 107, 50, 203, 194}
local movementMax = 30 -- in minutes
local motionRoom = "Null"
-- Mainscene
if(#motionID > 0)
then
for i=1,#motionID do
if ( (tonumber(os.time()) - tonumber(hc:getValue(motionID, "lastBreached"))) >= (tonumber(movementMax)*60) )
then
motionRoom = hc:getRoomNameByDeviceID(motionID)
if(#lightID > 0)
then
for z=1,#lightID do
if (hc:getRoomNameByDeviceID(lightID[z])==motionRoom
and tonumber(hc:getValue(lightID[z], "value")) > 0)
then
hc:call(lightID[z], "turnOff");
hc:debug("turned off light - " ..hc:getName(lightID[z]).." ("..hc:getRoomNameByDeviceID(lightID[z])..")")
end
end
end
end
end
end
Thanks in advance!
Rick
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.