Jump to content

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!



Smart Home Forum by FIBARO Team

  • 4

HC3 no motion for X time = lights off, how to?





How do you configure a scene that will turn on lights when motion and does not turn off until motion sensor has been safe for X time?

I am looking for both Lua and block options, if available.

Until now I have only found option for "delay" meaning lights will turn off after given time no matter if there has been motion during "delay" period.


Hope someone has found a solution for this.

Link to comment
Share on other sites

Recommended Posts

  • 0



Below scene works perfect. Thanks for all contributors.

But,  I would like to modify it to include the light switch as well. If I use the light switch manually, the light will stay on until I turn it off manually. If I don't use the switch, the light will work as in the current scene (until motion sensors are breached + maxTime). How to do that?



  conditions = { {
      id = 78,
      isTrigger = true,
      operator = "==",
      property = "value",
      type = "device",
      value = true
    }, {
      id = 263,
      isTrigger = true,
      operator = "==",
      property = "value",
      type = "device",
      value = true
    } },
  operator = "any"



-- This scene turns on one or more lights: 
--    when Lux level is below a certain level (see DECLARATIONS) and 
--    shows the Lux level of one ore more Lux sensors and 
--    turns off the lights after a certain time (maxTime), 
--    unless there is motion from one or more Motion sensors
-- Please enter the right ID's (if more than one, seperate by ",") and the prefered maxTime for the lights to stay on 
local light = {26, 62} -- ID's of the lights to turn on
local motion = {78, 263} -- ID's of the Motion sensors to check if they are breached
local lux = {80, 265} -- ID's of the Lux sensors to (only) show the lux level
local maxTime = 1*60 -- Maximum time the sensor should be safe before turning off (n*60 where n is minutes)
local sleepTime = 5 -- Time in seconds between each check of the Motion sensor (default = 5)
local debug_TAG = "Woonkamer licht" -- Tag for the debug messages
-- Below here no changes are necessary
for i in pairs(light) do -- Turn on the lights
  fibaro.debug(debug_TAG,"Turning on (ID " ..light[i] ..") " ..fibaro.getName(light[i]) .." for " ..maxTime .." seconds")
for i in pairs(lux) do -- Show the lux level of the Lux sensors
  fibaro.debug(debug_TAG,"Current Lux level " ..lux[i] .." " ..fibaro.getName(lux[i]) ..": " ..fibaro.getValue(lux[i],"value"))
local safeTime = 0
while safeTime < maxTime do -- Loop until maxTime is reached
  fibaro.debug(debug_TAG,"Counting up safeTime " ..safeTime .." to maxTime " ..maxTime)
  for i in pairs(motion) do 
    if fibaro.getValue(motion[i],"value") then -- Check if Motion sensors are breached
       fibaro.debug(debug_TAG,"Reset by Motion sensor " ..motion[i] .." " ..fibaro.getName(motion[i]))
       safeTime = 0 -- Reset safeTime to zero
for i in pairs(light) do -- Counted down to maxTime, turn off the lights
  fibaro.debug(debug_TAG, "Turning off " ..light[i] .." " ..fibaro.getName(light[i]))
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...