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

Scene turn on light based on motion, lux and variable


kevin

Question

Hi,

 

I'm practicing with LUA but this scene has a fault but I don't know what. The debug shows no error.

What I want is; when motion is detected and lux level is lower then xxx and one of the two variables has the value thuis then turn on light.

 

Thank you in advance

 

Kevin

 

Please login or register to see this code.

 

Edited by kevin
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

call call calll call

but what you think about fibaro:getValue

try it ;) 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 15 minutes ago, 10der said:

    call call calll call

    but what you think about fibaro:getValue

    try it ;) 

     

     

    Thanks you for your reply. I actually don't know what to change now:oops:. I have tried some things but that doesn't solve it. Do I only need to change a line or do I have to add more lines with code? If I need more lines with code then I really have to find out what to do

    Link to comment
    Share on other sites

    • 0

    If you will change lines with “if” call on “getvalue” you can solve your issue ;) 

    please try. Do not ask help please try. Just try ;) 

    all ok trust me ;) 

    Ahh

    also replace breached on value  and compare eq with 1

    Edited by 10der
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I'm trying and trying all day long, but sadly I don't understand LUA good enough to see what I need to change:-(.

    I now have:

    Please login or register to see this code.

     

    I think the main issue is the Lux value, how can code that if the lux value is lower then xx

    Edited by kevin
    Link to comment
    Share on other sites

    • 0

    try this change the three ID's to the number of your devices

     

    if (
     ( tonumber(fibaro:getValue(ID, "value")) > 0 ) -- Motion
    and
     ( tonumber(fibaro:getValue(ID, "value")) < 500 ) -- Lux
    and
    ( fibaro:getGlobalValue("Kevin_locatie") == "Thuis" or fibaro:getGlobalValue("Suzanne_locatie") == "Thuis")
    )
    then
        fibaro:call(ID, "turnOn");
    end

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

    • 0
  • Inquirer
  • 19 minutes ago, Dman568 said:

    try this change the three ID's to the number of your devices

     

    if (
     ( tonumber(fibaro:getValue(ID, "value")) > 0 ) -- Lights
    and
     ( tonumber(fibaro:getValue(ID, "value")) < 500 ) -- Lux
    and
    ( fibaro:getGlobalValue("Kevin_locatie") == "Thuis" or fibaro:getGlobalValue("Suzanne_locatie") == "Thuis")
    )
    then
        fibaro:call(ID, "turnOn");
    end

     

    Many many many thanks!!:-D I first tried the code you provided with the ID's and that was working. Now I changed it back to the HomeTable names and it's working also.

     

    Now I can go to sleep without thinking what was wrong:-P

    • Thanks 1
    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...