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!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Motion based scene and "to many instances"


Question

Hi

Have made some scenes that turn on the light by motion sensor and turn it off again if there been no motion for a set time

 

It is a lot of traffic in this area so the scene turning off the light "locks" and the light does not go off and I get the notification about to many instances.

How can I fix this?

Is it better to use association? Or can I set up the scene different or change some parameter for the fibaro Motion sensor. Will it help changing the parameter 6

Please login or register to see this link.

Please login or register to see this attachment.

Please login or register to see this attachment.

Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi

I was spent a week playing with auto on\off scenes with motion sensor. The only stable solution for me is to kill all other instances of scene when motion event happens.

Unfortunately, its not yet present for Magic/Block scenes, but you can use it for LUA %% killOtherInstances:

Please login or register to see this code.

Just a small sample

Link to post
Share on other sites
  • 0

Here is an other example that I use for my hallway.

It contains two parts: the first one , when "licht = licht" (dutch for 'light = light'), meaning that there is enough light from outside then only three lights will switch on in a very dark part of the hallway.

In the second part (else...) when "licht = donker" (dutch for 'Light = dark'), all eleven lights of the hallway will be switched on. In both cases lights will go off after 2 minutes after fibaro:sleep(120000)

Notice that there are three motion sensors mentioned in the header but not in the main code. This makes the scene trigger when one of the motionsensors is triggered (and a seond time when it gets bak to 'safe' a few seconds later). And everytime the status of one of the sensors changes the scene runs and all previous instances will be killed, making that there is light as long as there is motion and finally, 2 minutes after the last motion was detected all lights go off again.

Notice also that the 'light' variable is not a triggering factor, it's only there to decide if the three lights of the dark part or all the lights should switch on.

 

--[[
%% killOtherInstances
%% properties
2304 value
2019 value
2315 value
%% weather
%% events
%% globals
--]]

local startSource = fibaro:getSourceTrigger();

if (
 
  fibaro:getGlobalValue("Licht") == "Licht"
or
startSource["type"] == "other"
)
then
    fibaro:call(2484, "setValue", "70");
    fibaro:call(2486, "setValue", "70");
    fibaro:call(2505, "setValue", "70");
      fibaro:sleep(120000);
      fibaro:call(2505, "turnOff");
      fibaro:call(2486, "turnOff");
      fibaro:call(2484, "turnOff");
else

if 
    
  ( fibaro:getGlobalValue("Licht") == "Donker")

then
    fibaro:call(2484, "setValue", "70");
    fibaro:call(2486, "setValue", "70");
    fibaro:call(2505, "setValue", "70");
    fibaro:call(2457, "turnOn");
    fibaro:call(2413, "setValue", "70");
    fibaro:call(2670, "setValue", "70");
      fibaro:call(2672, "setValue", "70");
      fibaro:call(2417, "setValue", "70");
      fibaro:call(2407, "setValue", "70");
    fibaro:call(2509, "setValue", "70");
      fibaro:call(2507, "setValue", "70");
    fibaro:setGlobal("Overlooplicht", "Aan");
    fibaro:sleep(120000);
      fibaro:call(2505, "turnOff");
      fibaro:call(2486, "turnOff");
      fibaro:call(2484, "turnOff");
    fibaro:call(2484, "turnOff");
    fibaro:call(2486, "turnOff");
    fibaro:call(2505, "turnOff");
      fibaro:call(2457, "turnOff");
    fibaro:call(2413, "turnOff");
    fibaro:call(2670, "turnOff");
      fibaro:call(2672, "turnOff");
      fibaro:call(2417, "turnOff");
      fibaro:call(2407, "turnOff");
    fibaro:call(2509, "turnOff");
      fibaro:call(2507, "turnOff");
    fibaro:setGlobal("Overlooplicht", "Uit");
end 
end
  

Edited by wienog
  • Thanks 1
Link to post
Share on other sites
  • 0

Quite odd that "

Please login or register to see this code.

is NOT a default setting for all scenes.

 

In my site, ALL scenes that may trigger several instances, work perfect when converted to LUA and added Kill... When not edited in this way they do not work 100% reliably and also trigger a "Too may instances..." message.

Link to post
Share on other sites
  • 0
  • Inquirer
  • Can I just add "%% killOtherInstaces" to all my scenes giving this "to many instaces" warning. Of course after converting to LUA. Like done in example?

     

    Please login or register to see this attachment.

    Link to post
    Share on other sites
    • 0

    I think the problem lies in the way people look at 'scenes' and 'device parameters'. You shouldn't use any timers in scenes if you know that there is any chance they can be triggered multiple times in the set timeframe. This isn't a Fibaro design problem, but just a flaw in basic thinking in scenes imho. In this scenario you should only need two scenes:

     

    if MOTIONSENSOR = breached then LIGHT ON

     

    if MOTIONSENSOR = safe then LIGHT OFF

     

    Then all you have to do is set the device parameters of the MOTIONSENSOR device. These should include settings for how long it will stay breached and if it resets this timer everytime new motion is detected within this timeframe. After this time expires and no motion is detected, the MOTION SENSOR will send a SAFE notification to the Home Center. If your motion sensor does not support these parameters, then buy one that does.

     

    This way you only have two scenes in the home center which only run for a fraction of a second. Therefor there will be no problem with too many running instances.

     

    You can expand this with variables. For instance:

     

    if LIGHT=OFF and MOTIONSENSOR = breached then LIGHT ON and VAR-AUTOLIGHT=YES

    if LIGHT=ON and VAR-AUTOLIGHT=YES and MOTIONSENSOR = safe then LIGHT OFF and VAR-AUTOLIGHT=NO

     

    By using this variable the off-scene won't interfere if somebody turned the light on manually (like the cleaning lady).

     

    If you like to use the option to only turn the light on if it's dark. Please also use variables set by light sensors or the weather source (Sunrise/Sunsite, works perfectly). I have a Sunset and a Sunrise scene which only set a variable to DAYLIGHT=YES or DAYLIGHT=NO. I use this in many scenes:

     

    if DAYLIGHT=NO and LIGHT=OFF and MOTIONSENSOR = breached then LIGHT ON and VAR-AUTOLIGHT=YES

     

    Don't use the LUX light sensor within the motion sensor to control whether the light has to go on or not. It is interfered by surrounding lights and it's own light it controls in the room.

     

    So you see, you can use graphic block scenes, together with variables as long as you also carefully take into account the parameters of the devices. No need to learn complex LUA. :)

    Edited by hanhoo
    • Like 2
    Link to post
    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.

    Guest
    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...