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

Basic LUA Code For Lighting Needed


Question

Guest fat
Posted

Hi All. I have no idea in how to script LUA so I have been trying to get a scene working in blocks, but I can't get exactly what I want. What I am trying to achieve is that if I open my front door and it is after sunset but before sunrise that my entry feature lights turn on. Once I close the door I want these lights to turn off 20 seconds after closing the door, but only if the light was not on prior to me opening the door

I have been able to get the above working by using an "on scene" and an "off scene" in blocks but can't work out how to satisfy the if not on previous to door opening part of the scene

ID's

Front Door = 27

Entry Feature Lights = 9

Thanks

2 answers to this question

Recommended Posts

  • 0
Guest GG
  • Inquirer
  • Posted

    Hello!

    Here is a script that, I think, does what you want.

    Please login or register to see this code.

    There is one situation that is not handled and that is when you first open your door and the light is turned on. Then you close the door and within the 20s delay you open the door again.

    I think you need a global variable to handle that situation, but you can start out with this and see what you think.

    Regards

    • 0
    Guest fat
  • Inquirer
  • Posted

    Thanks GG. I will give it a go tonight

    [ Added: 2014-11-26, 14:39 ]

    Looking at the code I do not see an after sunset but before sunrise trigger. What code would I need to add to make this happen and where should the code be placed in this script?

    Thanks

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