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

LUA help


Question

Posted

Hi all,

 

I am new to LUA (and pretty much to programming actually).

I have tried building something, but unfortunately it does not do what I'd like :-)

I have tried breaking it down to troubleshoot, but then everything seems to be working fine (if then --> debugmessage). The end product however does not work..

Can someone please have a look with me and advise what to try/do? if someone has a working script he/she is willing to share that's fine too.. But also I am keen on learning what I do wrong here.. :-)

Thanks! I simplified the script a little.. The functions delay and debug are working and left out for your convenience.

 

The ID's for lamp and motion are correct and the global var DayOrNight is set to Night.

 

What it should do:

If my FIbaro eye (motion) is triggered and the golbar VAR is set to Night it should turn on the lamp for one minute to 40% and then off again (between 16:00 and 1:00), to 20% for one minute, should it be between 1:00 and 8:00.

 

What it actually does:

Nothing. (lol)

 

Please login or register to see this code.

 

Thanks in advance for your great help!

 

PS: Also any general/other programming advise is more than welcome, should there be room for improvement..

 

 

4 answers to this question

Recommended Posts

  • 0
Posted

The topic has been moved from "

Please login or register to see this link.

" to "

Please login or register to see this link.

".

 

Temat został przeniesiony z "

Please login or register to see this link.

" do "

Please login or register to see this link.

".

  • 0
Posted

Hi @MaTi,

 

Your scene does nothing because it is missing trigger to start it. So first you need to add motion sensor to scene header under %% properties section:

Please login or register to see this code.

Also you need to correct following line:

Please login or register to see this code.

since you use local variable lamp and not ganglamp.

 

To be honest, I don't believe in firm times or exact times since duration of day and night time changes during a year (sunrise & sunset times). So, maybe you can check my 

Please login or register to see this link.

 and then when you have setup that then try my 

Please login or register to see this link.

 scene to control lighting throughout all day and night?

 

  • 0
  • Inquirer
  • Posted

    Hi there,

     

    Thanks, will try :D

    The ganglamp is actually correct (I had simplified it to lamp for my question here, as ganglamp is Dutch).. Just forgot to rename that one I guess :)

     

    Will also look at your scripts tonight :-) Thanks!

    • 0
  • Inquirer
  • Posted

    All fixed and working now.. Partly with your other very smart lights-script. Thanks so much!

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