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


Recommended Posts

Posted

I would like to do the following in my hall to switch the lights on and off:

When i am opening a door the light will go on in the hall. When i close the door the light will go off in XX minutes. If the door stays open, the light will be constantly on. Each door that give acces to the hall has to do exactly the same. All the doors are equiped with the Fibaro doorsensors.

It sounds simple but with the lua blocks i can't get it working. Can i do this simple cirquit with lua and how?

Please login or register to see this image.

Posted

create variable door, give it value 0

block scene 1:

if door 1 = open

or

door 2 = open

or

door 3 = open

then varibele door = 1

block scene 2

if door 1 = close

or

door 2 - close

or

door 3 = close

then varible door = 0

block scene 3

if door variable = 1

then turn light on

block scene 4

if door variable = 0

then turn light off in xx seconds

i

  • Topic Author
  • Posted

    Hello akatar,

    Thanks for the reply. Unfortunately your scene does not work. If I enter the hall through a door (for example door A) the door will go open and close. when i open the second door and leave it open for some time the previous timer of door A will set the lights off.

    Posted

    hi hugohekk

    How about

    create variable door, give it value 0

    block scene 1:

    if door 1 = open

    or

    door 2 = open

    or

    door 3 = open

    then variable door = 1

    block scene 2

    if door 1 = close

    and

    door 2 - close

    and

    door 3 = close

    then variable door = 0

    block scene 3

    if door variable = 1

    then turn light on

    block scene 4

    if door variable = 0

    then turn light off in xx seconds

    hope that helps

    Brian

    Posted

    Another way to do it? (not tested)

    block scene 1:

    if door 1 = open

    or

    door 2 = open

    or

    door 3 = open

    then variable door += 1

    block scene 2

    if door 1 = close

    or

    door 2 = close

    or

    door 3 = close

    then variable door -= 0

    block scene 3

    if door variable > 0

    then turn light on

    block scene 4

    if door variable <= 0

    then turn light off in xx seconds

    Although achieving your goal, you may consider the use of a PIR sensor?

    Posted

    Hi hugohekk (and others),

    If you want to do this with Lua rather than blocks, you can use the following scene:

    Please login or register to see this code.

    It gets triggered by any door. Once triggered it stays running until all doors are closed for the amount of time specified by delay. If any door opens again during this time, the scene notices this and resets the delay. The doors are checked every second once the scene is triggered.

    An optimisation you could work on: don't start the loop until all doors are closed.

    Happy automating,

    Adam Bewsher

  • Topic Author
  • Posted

    WOW Adam, this works great. Thanks a lot man, this makes me happy

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    Posted

    Hi hugohekk,

    I am very glad that I have made you happy! May the happiness continue!!

    Happy automating!

    Adam Bewsher

    • 3 months later...
  • Topic Author
  • Posted

    Hello, i don't know why but the following scene stoped working with the update to 4.033. Do you guys know what went wrong?

    Please login or register to see this code.

    Posted

    doorID in pairs(doorIDs)

     

    Can you explain what this does?

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

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