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


  • 3

Lua script for Motion sensor and auto light


MDC
 Share

Question

Hello, can somebody share a script for auto turn on lights when motion sensor breaks and keeps on during motion detected? And lux setting also.

i have a script currently buy some time happen to crash.

 

thanks

Link to comment
Share on other sites

Recommended Posts

  • 0

Hi. I have some lua-code here. You have to add lux yourself

Please login or register to see this link.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 2 minutes ago, Thomasn said:

    Hi. I have some lua-code here. You have to add lux yourself

    Please login or register to see this link.

     Thanks Thomas,

    i know your site, i found there many interesting things.

    your code is great, but need a lux settings in order to turn lights on only night.

    can you add this setting?

    thanks

    Link to comment
    Share on other sites

    • 0

    for example

     

    Please login or register to see this code.

     

    Edited by 10der
    • Thanks 1
    Link to comment
    Share on other sites

    • 0
    46 minutes ago, MDC said:

     Thanks Thomas,

    i know your site, i found there many interesting things.

    your code is great, but need a lux settings in order to turn lights on only night.

    can you add this setting?

    thanks

    10der has a solution!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @10der code has some errors in sunset and sunrise.

     

    Please login or register to see this image.

    /monthly_2018_11/1335140083_Screenshot2018-11-17at03_21_40.png.a5c5f4956efd2f273c87f7fe067a3420.png" alt="1335140083_Screenshot2018-11-17at03_21_40.png.a5c5f4956efd2f273c87f7fe067a3420.png" />

    Link to comment
    Share on other sites

    • 0

    my fail add $ to Sunrise

     local time_interval = "$Sunset-15..$Sunrise+10"

    Link to comment
    Share on other sites

    • 0

    You don't need to do this with LUA. Add all devices you want to be switched on to Association Group 2. The Day / Night exclusion can be done via Parameter 8.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 5 minutes ago, Wegerhoff said:

    You don't need to do this with LUA. Add all devices you want to be switched on to Association Group 2. The Day / Night exclusion can be done via Parameter 8.

     

    Can you share more details? How to turn off after specific time? how to start light if Lux is above a value?

    Thanks

     

    10 hours ago, 10der said:

    my fail add $ to Sunrise

     local time_interval = "$Sunset-15..$Sunrise+10"

     

    Thank you,

    I love your scene, i like that have more options, time, sunset, lux, dimmer setup.

    Great job!

    Edited by MDC
    Link to comment
    Share on other sites

    • 0
    21 minutes ago, MDC said:

    Can you share more details? How to turn off after specific time? how to start light if Lux is above a value?

     

    It's way more easy than you think:

     

    1) Add the devices you want to switch on and off to association group 2 (see screenshot below)

    2) Set Parameter 6 (of Motion Sensor) to the time delay you want the light to stay on after the last motion detected (see screenshot below)

     

    Optional:

    3) If you want to switch on only in the dark, set Parameter 8 (of Motion Sensor) to "2 - The PIR sensor is active only during the night."

    4) Set Parameter 9 (of Motion Sensor) to the light intensity level you define as night/dark

    5) Set Parameter 14 (of Motion Sensor) to the brightness you went the lamps to be switched on

    6) Set Parameter 16 (of Motion Sensor) to a low  brightness you went the lamps to be switched off (makes sense e.g. for toilets ;-))

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

     

     

     

     

    3 minutes ago, Wegerhoff said:

    how to start light if Lux is above a value?

     

    If this is not a typo, use this magic scene, and your are done.

    Please login or register to see this attachment.

    Edited by Wegerhoff
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 34 minutes ago, Wegerhoff said:

     

    It's way more easy than you think:

     

    1) Add the devices you want to switch on and off to association group 2 (see screenshot below)

    2) Set Parameter 6 (of Motion Sensor) to the time delay you want the light to stay on after the last motion detected (see screenshot below)

     

    Optional:

    3) If you want to switch on only in the dark, set Parameter 8 (of Motion Sensor) to "2 - The PIR sensor is active only during the night."

    4) Set Parameter 9 (of Motion Sensor) to the light intensity level you define as night/dark

    5) Set Parameter 14 (of Motion Sensor) to the brightness you went the lamps to be switched on

    6) Set Parameter 16 (of Motion Sensor) to a low  brightness you went the lamps to be switched off (makes sense e.g. for toilets ;-))

     

     

    Thanks for sharing.

    2 questions:

    1. If i set parameter 8 to "2 - The PIR sensor is active only during the night.", when arm house, PIR is disabled during day, so no alarm?

    2. If set parameter to 10 min, this mean in case of alarm, fibaro will receive that sensor is breach for 10 min?

     

    Link to comment
    Share on other sites

    • 0
    1 hour ago, Wegerhoff said:

     

    It's way more easy than you think:

     

    [Skipped]

     

     

    Hmm... no comments.

    • Like 1
    Link to comment
    Share on other sites

    • 0
    59 minutes ago, MDC said:

    1. If i set parameter 8 to "2 - The PIR sensor is active only during the night.", when arm house, PIR is disabled during day, so no alarm?

    2. If set parameter to 10 min, this mean in case of alarm, fibaro will receive that sensor is breach for 10 min?

     

     

    1) This I haven't tried. Check it out and let me know :-)

     

    2) It's the alarm cancellation delay, means when the Command OFF ist sent to associations. I guess this does not affect alarms. But you need to check it out also. 

    Edited by Wegerhoff
    Link to comment
    Share on other sites

    • 0

    Btw, some devices (now I am talking about motion sensors) doesn’t have parameter 6, TBH more than, almost all devices != Fibaro as well doesn’t have templates and parameters in UI at all, yes you can add it manually but I am not sure how many devices in my home has “parameter 6” ;) 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 minute ago, TurboWannaBe said:

    Hi,

     

    Could you shortly explain what this scene does?

     

    Hi, scene from @10der use a motion sensor and a switch, and turn on the switch when motion detected and turn off after time set, also use LUX value of motion sensor and turn on the light if LUX is bellow set value.

     

    What it's nice on this scene, is that can turn on the light if movement detected between sunset and sunrise. Nice to use for outdoor motion light.

     

    Also has different time setting for dimmers, for example if is between 20:00 and 22:00 dimmer will light to 20%, and after 22:01 and 00:01 dimmer go to full load. Of course this is just sample settings, you can add yours hours.

     

    It's the best i ever find, and i try all :))

     

    Enjoy

    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    @MDC

     Thanks for your answer, but if I want to have different dimmings, let's say between 00:00 and 05:00  I want the dimmer set to 10% and from 05:00 to 08:00 dimmer set to 50% and so on, how do I define that in the scene?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 minute ago, TurboWannaBe said:

    @MDC

     Thanks for your answer, but if I want to have different dimmings, let's say between 00:00 and 05:00  I want the dimmer set to 10% and from 05:00 to 08:00 dimmer set to 50% and so on, how do I define that in the scene?

     

    Download the scene and play, you have this code for dimmers, to be ones i don't have any dimmer so... but should work.

     

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    Hi,

    3 minutes ago, MDC said:

     

    Download the scene and play, you have this code for dimmers, to be ones i don't have any dimmer so... but should work.

     

    Please login or register to see this code.

     

    Thanks, had tried that but it didn't work, copied the code again and now it works :)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 2 minutes ago, TurboWannaBe said:

    Hi,

     

    Thanks, had tried that but it didn't work, copied the code again and now it works :)

     

    Un comment code by deleting the  - -

    Link to comment
    Share on other sites

    • 0

    some comments here

    you may schedule lights (and level light) by weekday also.

     

    for example, I am a Jew, for example,:) I have on Friday for Shabbat. :)

    so, 

    Please login or register to see this code.

    Mo-Th from 18:00 till 6 morning

    Fr and Sat from Sunset till 23:35

    and Su back to normal

     

     

    if you do not want to control lights by LUX simple make Ids is empty

     

    Please login or register to see this code.

    if you wanna control lights by many motions simple add Ids by a comma

     

    Please login or register to see this code.

    if you wanna  lights many lights simple add Ids by a comma

     

    Please login or register to see this code.

    quick update.

     

    now you may control all lights in house via single scene

    Edited by 10der
    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.

    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.

     Share

    ×
    ×
    • Create New...