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

Help with LUA Code - Storageroom light


Question

Posted

Hello,

 

My LUA coding knowledge are limited, learning all the time but it takes time

Please login or register to see this image.

 

 

Have a storageroom which has doorsensor, movementsensor and light switch.

 

Unit numbers are:
298 = Doorsensor
282 = Lightswitch
302 = Movement Sensor

Everything is Fibaro products

 

Want to have this functions:
1. When door opens lights should be turned on

2. When no movement in room for 5minutes (300sec) lights should be turned off even if the door is open..
3. If light is off and door is open and new movement is registerd in the room then light should be turned on again.
4. When door is closed light should be turned off.

 

Have this in "Block Scenes" today, but it takes 4 different scens to get it running and I get a lot of "Too many instances" messages, so I want to change this to LUA code to better control what is happening.

Could some friendly person help me with an example?

10 answers to this question

Recommended Posts

  • 0
Posted

Can be done even with simple block szenes.

With Fibaro Relay look for parameter "Auto off for relay X"

with the 2x1 switch it is 4 or 5.

Set this to 300.

 

Then you can trigger on door open or Movement = turnOn

Door close = turnOff

 

no timers or anything else and you shouldn't get too many instances

 

 

  • 0
Posted

Borgen

 

Did you manage to create LUA scene ?

  • 0
Posted

Why do you need a door sensor and motion sensor. surely just a motion sensor will do what you want?

  • 0
Posted

Why do you need a door sensor and motion sensor. surely just a motion sensor will do what you want?

Borgen,

I think qordz is right... 

Your fourth condition says to turn off the light if the door is closed, but if I close the door and stay in the storageroom, the light should be ON, right? So the light should be controlled by movement and not by door's state.

 

Please give a second thought what exactly you try to accomplish, otherwise you'll need to fix and debug the scene for a long time.

  • 0
Posted

Please give a second thought what exactly you try to accomplish, otherwise you'll need to fix and debug the scene for a long time.

 

Spot on.

  • 0
  • Inquirer
  • Posted

    Borgen,

    I think qordz is right... 

    Your fourth condition says to turn off the light if the door is closed, but if I close the door and stay in the storageroom, the light should be ON, right? So the light should be controlled by movement and not by door's state.

     

    Please give a second thought what exactly you try to accomplish, otherwise you'll need to fix and debug the scene for a long time.

    Hello,

     

    Thanks for your thoughts around this, there are probably different situations where my setup is not a suitable solution. But in my case and in the room that I am trying to configure I want the following functions:

    - When the door is opened the light should turn on at once, not after that I have opened the door and walked into the storage room.

    - Light should be turned of after 5 minutes if no movement in the room

    - If new movement in the room after 5 minutes the light should turn on again.

    - when door is closed the light should be turned off.

     

    In the particular storageroom it is never the case that we close the room and still are in the storageroom, 

     

    So in other cases I could agree that a door sensor is "over-kill" but in my case I want it.

    • 0
  • Inquirer
  • Posted

    I have given up the thoughts to do this in a "regular" LUA code. The reason for this is that I found (with help from Jompa68) the very interesting GEA project. So I have implemented GEA in my HC2 and have now moved all of the light control in my house from "Block scenes" into GEA and have reduced the amount of scenes from 45 to 17 in my system.

     

    GEA is a really interesting project and I am surprised that it is no threads in this forum around the GEA project, on the French forum there is a 296+ page long thread on the topic. It is an extremely strong "tool" that can do amazing things...My problem is that everything on the French forum is in French language, google translate can assist but it sometimes get strange

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    • 0
    Guest SPyRoX
    Posted

    Hey Borgen

    I can't find anything about that GEA project. Do you have a link to it?

    And i know the feeling about the French language. i can't understand it either.

    • 0
  • Inquirer
  • Posted

    SPyRoX,

    The GEA Project can be found here

    Please login or register to see this link.

    • 0
    Posted

    Honestly I don't see any advantage to use GEA, every thing could be done in LUA  and to my opinion in much better and efficient way.

    But may be I'm missing something... could you share more info how it reduces scenes (in your case from 47 to 17!). As I understand it just combines few scenes together, but it could be done in LUA as well. 

     

    Note:

    LUA is widely in use for several controllers (not Fibaro only) and other systems, so I believe is better to know LUA instead of learning other code which looks like built for Fibaro system only.

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