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

Lights going on-off-on with 2 motion sensors


Question

Posted

Hi,

 

I have a small piece op code:

 

if (LastModifiedMotionKitchen < LastModifiedMotionHallway) and (LightStatusHallway == '0') then

fibaro:call(203, "pressButton", "2")

end

 

203 = VD with on/off status (Philips Hue lamp), button 2 starts the Hue scene

 

So, I leave the kitchen (motion detected) en go into the hallway (motion detected) and light in hallway is off. It turns on but after a second or so, light goes off again. Then when I move in the hallway the light goes on again.

I can't grasp what is going on here. I would not expect the on-off-on sequence as the conditions were full filled.

 

Anyone an idea? They are FIBARO motion sensors. Maybe settings on the motion sensors?

thx!

4 answers to this question

Recommended Posts

  • 0
Posted

I think it is because every movement detected by the pirs will make your script press the on/off switch. You need to make a script that only press the button when you want it. How about making a loop based on time?

  • 0
  • Inquirer
  • Posted
    1 hour ago, Thomasn said:

    I think it is because every movement detected by the pirs will make your script press the on/off switch. You need to make a script that only press the button when you want it. How about making a loop based on time?

     

    But the statement only runs when the lamp is off, and suppose it is on, so it should pass this statement and not pressing the 'Off' button, that should happen when I leave the room.

     

    Can you give an example what you mean by timed loop? Any help is appreciated.

    • 0
    Posted

    I get it that your statements only runs when it is true. But globals can take a second to load - so the statement could be true long enough to run again upon movement.

     

    I have made a pir program here: 

    Please login or register to see this link.

     

    • 0
  • Inquirer
  • Posted

    I made a mistake in my code: LastModifiedMotionKitchen and LastModifiedMotionHallway was indeed the variable 'lastmodified', but should have been 'lastbreached'.

    Now it works. For timer I use ((os.time()) -  tonumber(LastModifiedBreachedKitchen) >= Timer) instead of 'Sleep'. I don't know if this is better or not, but works well.

     

    I sure will have a look at your website with examples, looks very nice! Thank you for the help

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