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


Recommended Posts

Posted

Hi, 

 

I am aware that the easy integration with motion detection is to trigger a light upon motion detection and then simply set a timer to turn it off again after X seconds. Like so, typically:

 

Please login or register to see this code.

 

This of course is not the best use case for a house. It would be much more elegant to let a user move around in the house, turn on the light where motion is detected and then turn it off again when there is no motion for X minutes.

 

You may ask, how is this any different? Here is why: I walk into a room, the code above triggers, and I have 300 seconds to do what i need, and then the light WILL TURN OFF. If I push the actual wall button to get the light on permanently, it does not matter, because the motion trigger will override the wall button, and TURN OFF the light as scheduled (300 seconds), EVEN IF I pushed the wall button.

 

So this requires something more elegant. Does anyone have something to do this? Here is what I want to achieve:

 

1. Motion trigger: turn on the light in that room/zone

2. Wall button pressed affecting the same light: behave like a button (toggle light). Dont let the motion trigger turn it on again if I just turned it off. 

3. When no movement after X minutes, turn off the lights. (even if wall button pressed)

 

In my other favorite coding language (Which is not LUA, yet, I admit!!), I would do the following:

 

1. Keep a table of all triggers of all motions, with the ID of the triggered sensor and the last time triggered, and the lights (IDS) turned on upon that trigger

2. Check the table every X seconds and if the last trigger time is now X minutes old, turn the associated lights off

3. Advanced functionaltiy: If a wall button is pressed affecting the same lights from #1, dont let the motion turn it on again for X minutes. ("Respect the Button"). Extend the time to turn it off in #2 by Y minutes but it will still be turned off upon no motion in X+Y time.

 

I have literally no idea how to achieve this in LUA and in particular the LUA that Home Center 3 uses.

 

Anyone have pointers on this?

 

Best regards

 

 

 

 

Posted

There is a solution for that, but not so simple as it looks like. Especially when you add to this equation wall switch.

May I suggest to take a look on

Please login or register to see this link.

. It could provide a good and quicker solution. No LUA knowledge required.

Let me know if you go for it and I'll help you to configured step by step.

 

If you insist to write your own LUA code, please search on the forum...  this basic requirement has been posted hundreds of times.

 

  • Like 2
  • 6 months later...
Posted

You can do this simply in a block scene (Turn lights on, wait x minutes, turn lights off)

 

Make sure you have the 'allow scene to be restarted' box ticked

Set the motion sensor timeout significantly shorter than the time that you want

 

Then, each time the sensor detects movement, the scene is restarted and the timer starts again.

 

Paul

 

 

Join the conversation

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

Guest
Reply to this topic...

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