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

My First Scene, after sunset - motiondetector (HC3, Block) not working


Kouzco

Question

I'm setting up my first scene, it's simple so far, just trying to get the basics to work, but no luck.

Please login or register to see this attachment.

All i want so far is the light to light up if i walk into the bathroom after sunset. But i can't ge tit right.

If i remove the sunrise/sunset trigger the light goes on. So i know it's not an issue with the detector.

what am I doing wrong here?

 

The only thing I can think of is that the scene will now only activate if its 1 minute after sunset, 1 minute before sunerise and i trigger the motion at the same time. which i ofc impossible. 

If this is the case, how to I get a scene to trigger while dark outside?

 

totalnoob

Edited by Kouzco
Link to comment
Share on other sites

Recommended Posts

  • 0

Why not remove the sunset/sunset condition and measure the lux level? If motion and luxvalue< threshold then turn lights on.? its the amount of luxe that counts (then it also works on dark days)

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 33 minutes ago, okidoki said:

    Why not remove the sunset/sunset condition and measure the lux level? If motion and luxvalue< threshold then turn lights on.? its the amount of luxe that counts (then it also works on dark days)

    And thats why I'm a n00b!

    Thanks!

     

    Next challange is to get it to turn off again :)

     

    I figure i have to make a scene for that as well... 

    I add a block for the motion detector, but there is not an option alowing me to add a function after no breaches after certain time limit... hm...

    Link to comment
    Share on other sites

    • 0

    You can add two things.

     

    Like a timer

     

    turn off mirror light under after 60 seconds.

     

    or you can work with the state of the motionsensor (if state is safe then turn mirror light under off)

     

    Link to comment
    Share on other sites

    • 0

    Maybe a challenge for now,  but there is a great lua script for lights with motion and or lux detection. The script has a timer function, so in your case, as long as you are in the bathroom, the light stays on if it is dark enough. 
     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 5/1/2020 at 11:27 AM, theplayernll said:

    You can add two things.

     

    Like a timer

     

    turn off mirror light under after 60 seconds.

     

    or you can work with the state of the motionsensor (if state is safe then turn mirror light under off)

     

     

    Works! (I think)...

    Things became much easier when I noticed the "delay" tab

     

    On 5/1/2020 at 12:37 PM, SmartHomeEddy said:

    Maybe a challenge for now,  but there is a great lua script for lights with motion and or lux detection. The script has a timer function, so in your case, as long as you are in the bathroom, the light stays on if it is dark enough. 
     

     

    LUA is way beyond me... any tips for a LUA - n00b guide?

    Link to comment
    Share on other sites

    • 0
    14 minutes ago, Kouzco said:

     

    LUA is way beyond me... any tips for a LUA - n00b guide?

     


    i am not a Lua hero myself ? I haven’t seen a lua for dummies document, but maybe that is not necessary. Because there are great examples on this forum. 

     

    I can copy and paste and just by looking at the code, I understand the logic. 
     

    in this case the lua code has two parts, declarations and actions. 
     

    declarions

    Please login or register to see this code.


    Actions

     

    Please login or register to see this code.


    in this code 254 is my motion sensor, 256 is my lux sensor and 251 is the light switch. You have to fill in the ID’s of your setup. 

     

    “value = 3” represents the lux value. So in this code <= 3 lux (and motion) will turn on the light. You can experiment with this value, which lux value suites you the best in your setup. 
     

    local maxTime = 1*60” represens the time the light stays on, in this case 60 seconds (and longer if there is still motion, motion resets the timer). 

     

    if you change them in your values, you have your first lua script running! ?

     

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • And I'm back.

     

    Things are not working pitch perfect, and I can't really see why.

     

    The scene runs ok, but it does not restart until the countdown is complete.

     

    They way the values are put in now:

    - If I walk into the room the light will go on, but even if i stay in the room the light will turn off after 10 sec.

    To get the light up and running again I have to exit the room, wait 10 sek and enter again... there has to be 10 sec without breach for the scene to restart..

     

    How can i get it to restart for every motion it detects?

     

    edit: I have allowed the scene to restart when creatning

     

     

     

    Please login or register to see this attachment.

    Edited by Kouzco
    Link to comment
    Share on other sites

    • 0

    That is a problem with the block scenes. There is no reset of the timer function. The lua scene solves the problem. 

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Right... So block scenes in HC3 is so far pretty much hopeless?

    This is just directly translated from the block scene

     

    Declarations

     

    Quote
    {
      conditions = { {
          id = 138,
          isTrigger = false,
          operator = "<=",
          property = "value",
          type = "device",
          value = 150
        }, {
          id = 136,
          isTrigger = true,
          operator = "==",
          property = "value",
          type = "device",
          value = true
        }, {
          conditions = { {
              isTrigger = false,
              operator = "match>=",
              property = "cron",
              type = "date",
              value = { "00""11""*""*""*""*" }
            }, {
              isTrigger = false,
              operator = "match<",
              property = "cron",
              type = "date",
              value = { "00""08""*""*""*""*" }
            } },
          operator = "any"
        } },
      operator = "all"
    }

    Actions

     

    Quote
    fibaro.call(134'turnOn')
    fibaro.setTimeout(10000function()
    fibaro.call(134'turnOff')
    end)

     

     

    Is there a simple way, and where does one add this part that you have ? (I assume this is what resets it)

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    If you replace the code in the action side with “my” lua code and replace the two id”s (“light” with 134 and “motion1” with 136) I think it should work. 
     

    ??

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 4 hours ago, SmartHomeEddy said:

    If you replace the code in the action side with “my” lua code and replace the two id”s (“light” with 134 and “motion1” with 136) I think it should work. 
     

    ??

    I really appreciate you doing this :)?

     

     

    I'll try it tomorrow and report back.

    thanks!

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 5/4/2020 at 12:09 AM, Kouzco said:

    I really appreciate you doing this :)?

     

     

    I'll try it tomorrow and report back.

    thanks!

     

     

    Reporting back!

     

    Working!

    thanks a million!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi!

     

    Again, your LUA is working as it should, so thank you very much.

     

    If I may, I have a suggestion.

    If one enters the room and the light turns on automatically and the person decides to turn the rest of the lights in the room on, the lights on the LUA scene will still turn it selv off after 10 minutes of no activity. Even if the rest of the lights are on.

     

    Is there a way to cancel out the scene if the other lights are turned on?

     

    Link to comment
    Share on other sites

    • 0
    10 minutes ago, Kouzco said:

    Hi!

     

    Again, your LUA is working as it should, so thank you very much.

     

    If I may, I have a suggestion.

    If one enters the room and the light turns on automatically and the person decides to turn the rest of the lights in the room on, the lights on the LUA scene will still turn it selv off after 10 minutes of no activity. Even if the rest of the lights are on.

     

    Is there a way to cancel out the scene if the other lights are turned on?

     

    Hi, There are many options, depends on  your situation. Are the other lights normal lights or are they also controlled via zwave?

    If so, then you can call the status of the other lights. If lights are on, you skip the turnoff.

    if not, than it is more difficult, you could try to measure the amount of lux by the motion sensor but my guess is that this is not so robust due to daylight changes.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 6/4/2020 at 9:12 PM, okidoki said:

    Hi, There are many options, depends on  your situation. Are the other lights normal lights or are they also controlled via zwave?

    If so, then you can call the status of the other lights. If lights are on, you skip the turnoff.

    if not, than it is more difficult, you could try to measure the amount of lux by the motion sensor but my guess is that this is not so robust due to daylight changes.

     

    I have 2 other lights controller by z-wave. 1 switch and 1 dimmer. Checkin status on the switch  would be perfect.

     

    Allthough I have no idea what or where to implement it into the code. 

    Any of you have the chance to help me with this one? The switch that it can check staus agaist is called 133. So basically if status is '"on"... cancel the scene.. does that work?

     

    Thanks

    K

    Link to comment
    Share on other sites

    • 0
    44 minutes ago, Kouzco said:

     

    I have 2 other lights controller by z-wave. 1 switch and 1 dimmer. Checkin status on the switch  would be perfect.

     

    Allthough I have no idea what or where to implement it into the code. 

    Any of you have the chance to help me with this one? The switch that it can check staus agaist is called 133. So basically if status is '"on"... cancel the scene.. does that work?

     

     

     

    With :

     

    if fibaro.getValue(lightid,"state") == true
    you can check if your other light (Lightid=133) is on (then it returns true) and then skip the turnof section of your light scene. 
    this is just one solution.
     
    What is did: i made a few simple scenes in which i plyed with these calls to that i was sure that i understood the code and that small piees function. Then you combine the pieces togeter till you have the scene working. Modifying a larger scene can be difficult if it doesn't work and you lack experience. Play with small pieses like turn lamp on, turn of. call status etc etc.
     

     

    seen this:?

    Please login or register to see this link.

    /

    Please login or register to see this link.

     

     

    Edited by okidoki
    Link to comment
    Share on other sites

    • 0

    This is the action code: 

    Please login or register to see this code.

    In this part of the action code: 

    Please login or register to see this code.

    The code checks if there (still) is motion and if so, it resets the timer to zero and the light won’t go off. If you extend that part of the code with a check if the other light is on

    Please login or register to see this code.

    the timer resets as long as that other light is still on.

     

    (local  otherlightID = 131 has to be added above with the other id’s) 

     

    I think that should do the job? 


     


     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • On 6/11/2020 at 11:49 AM, SmartHomeEddy said:

    This is the action code: 

    Please login or register to see this code.

    In this part of the action code: 

    Please login or register to see this code.

    The code checks if there (still) is motion and if so, it resets the timer to zero and the light won’t go off. If you extend that part of the code with a check if the other light is on

    Please login or register to see this code.

    the timer resets as long as that other light is still on.

     

    (local  otherlightID = 131 has to be added above with the other id’s) 

     

    I think that should do the job? 


     


     

     

    Thanks, I'll try this as soon as possible.

    Btw, do you mean put that new line in together in the same line or 1 line down?

    Link to comment
    Share on other sites

    • 0
    1 hour ago, Kouzco said:

    Btw, do you mean put that new line in together in the same line or 1 line down?


    replace the if-statement “if fibaro.getValue(motion1,"value")” 

     

    With this if-statement: 

    Please login or register to see this code.

     

    And add  below  “local motion1 = 254”

    Please login or register to see this code.


     

    I hope it works, lets see 

     

     

     

     

     

    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.

    ×
    ×
    • Create New...