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

Reset counter motion sensor


Question

Posted

Hi all,

 

Forst and foremost, sorry for posting this.

I am pretty sure I have seen this discussed here before, so this post is probably a duplicate. Anyway, this is what I am in desperate need for :) :

 

I want to turn on and keep a light on in a room when there is movement.

 

In other words;

 

xx value (in header)

 

if motion sensor value==1, then turn on light.

if motion sensor value==0, then turn off light.

 

meanwhile (and this is what I actually need), I need something to make the motion sensor constantly check for movement and keep its value on 1, as long as it is seeing movement. 

People are moving around in the room, but not always in line of sight for the motion sensor. It is ok though when there is a delay of lets say 10mins in turning off the lights. So, a scenario where it checks the motion sensors status every 30secs and only decided it is '0' when it has seen 20 times a 'no motion'. (if this makes sense).

 

I can code the lua part above (the if part so to speak), but I need some help on the checks with the motion sensor.

 

 

..Anyone any idea please? :D

Thanks!

 

 

 

5 answers to this question

Recommended Posts

  • 0
Posted

The topic has been moved from "

Please login or register to see this link.

" to "

Please login or register to see this link.

".

 

Temat został przeniesiony z "

Please login or register to see this link.

" do "

Please login or register to see this link.

".

  • 0
Posted

Here is an idea. Make a separate "turn off scene" like this:

 

Use %%killOtherInstances in your header, so only the last instance runs.

 

In your scene, if motion sensor value==0, then sleep (30 minutes), then turn off light.

 

Suppose the light is on and the sensor reports "safe". This "turn off scene" runs, but nothing happens until those 30 minutes have passed. If someone breaches the sensor while this scene is still running, the running instance gets killed so no "turnOff" will happen. A new instance will start with value 1 so again nothing happens. If people do not move during the blind time of the sensor, the device will report "safe" and then the cycle starts again.

 

You can also  toy with the "blind time" of your motion sensor (depends on brand and model).

 

To make a complete solution, including every other possible option ("only when the light level is < 100 Lux", "only when device X is off", ...) will require more code, but I think this concept is highly educational. I use it, but I don't post code because all the optional stuff makes it difficult to read.

 

 

  • 0
Posted
19 hours ago, MaTi said:

Hi all,

 

Forst and foremost, sorry for posting this.

I am pretty sure I have seen this discussed here before, so this post is probably a duplicate. Anyway, this is what I am in desperate need for :) :

 

I want to turn on and keep a light on in a room when there is movement.

 

In other words;

 

xx value (in header)

 

if motion sensor value==1, then turn on light.

if motion sensor value==0, then turn off light.

 

meanwhile (and this is what I actually need), I need something to make the motion sensor constantly check for movement and keep its value on 1, as long as it is seeing movement. 

People are moving around in the room, but not always in line of sight for the motion sensor. It is ok though when there is a delay of lets say 10mins in turning off the lights. So, a scenario where it checks the motion sensors status every 30secs and only decided it is '0' when it has seen 20 times a 'no motion'. (if this makes sense).

 

I can code the lua part above (the if part so to speak), but I need some help on the checks with the motion sensor.

 

 

..Anyone any idea please? :D

Thanks!

 

 

 

 

 

I do exactly that + more in my "hallway light" scene... I actually do what you want plus have added lux values and hysteresis. So with my scene you can shut the light off manually and leave without the PIR lighting it up again for xx secs.

Please login or register to see this link.

 

You are very welcome to steal LUA or ideas from it. Note though that I have not spent all my brain capacity on it. So the code could look nicer. But it is stable as I have used it for months now.

 

Peo

Note that I have two versions of the scene. One version is with Fibaro sensors where you can ask the sensor for it last breach time, whereas thew other version is when I went over to my DSC alarm sensors that required an extra global variable as those sensors cannot be asked for breach  time.

 

 

 

Addition no 2...

This scene is one scene only, auto started under right conditions and self-die when no longer needed. So scene should be set to "automatic"

 

  • 0
Posted

Hi @MaTi,

 

And of course you are welcomed to check Very Smart Lights scene and use any part of code you find suitable for you. It uses timer that is reset as long as there is movement registered by motion sensor, but you can also use global variable as motion sensor, or you can use many other ways to keep lights on or set lights brightness. You can setup wall plug to keep light on if power consumption is greater than set value etc. Find code here:

If you need it for very simple light control then you don't need even to declare all those global variables, just set them not used and scene will still work. Only global variables that are needed are TimeOfDay, Darkness, PresentState and SleepState.

  • 0
  • Inquirer
  • Posted

    Thank you all gents! Am going to play with it this weekend..

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