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

First LUA Scene but is it not run with Light


Question

Posted

Hello

i have wrote my first LUA scene for my light on the stairs but it is not run

Please login or register to see this image.

/emoticons/default_icon_mad.gif" alt=":-x" />

If the variable "HausStatus" is set to 2 and the sensor on first or second floor detect motion

then the light goes on with 60% and when no motion ist detect the light goes to 30%.

When the sun goes down, the variable "HausStatus" is set to 2 the light goes on when the

first motion ist detect with 60% but when no motion ist detect the light does not go to 30%.

Please login or register to see this code.

Somewhere there is a fault or a thought of the cross depends, i do not know.

Please help

Please login or register to see this image.

/emoticons/default_icon_biggrin.gif" alt=":-D" />

Regards Alex

PS: Sorry for my English

18 answers to this question

Recommended Posts

  • 0
Posted

You don't need this:

Please login or register to see this code.

and this:

Please login or register to see this code.

is the same as this:

Please login or register to see this code.

Please login or register to see this code.

  • 0
Posted
You don't need this:

Please login or register to see this code.

and this:

Please login or register to see this code.

is the same as this:

Please login or register to see this code.

Please login or register to see this code.

assuming 102 and 100 are his light sensors think he does need them

Please login or register to see this code.

or it will not trigger

but I think you need some delay time in there. Just now it will dim as soon as both movement sensors close.

Please login or register to see this code.

but I have not tested

  • 0
Posted

Of course the triggers need to be declared, sorry about the confusion.

Try to simplify the code and add some debug lines in there so that you're able to follow the code and see what actually happens.

Please login or register to see this code.

  • 0
Posted

think elseif must be else if

  • 0
  • Inquirer
  • Posted

    @StarkJohan: Thanks for improvement

    @robmac: you are right, need the values for trigger

    the new script, but does not run still.

    Please login or register to see this code.

    @Kage:I've tried the result is

    Please login or register to see this code.

    this works perfect

    Please login or register to see this code.

    but only this not want, the wrong command?

    Please login or register to see this code.

    Please login or register to see this image.

    /emoticons/default_icon_sad.gif" alt=":-(" />

    • 0
    Posted

    your brackets look odd I take it that it should be

    (itIsNight and (movement1 or movement2))

    and the second condition may want to be an and not an or

    (itIsNight and (not movement1) and (not movement2))

    you would make it easier to read if you put the values into variables at the top

    • 0
  • Inquirer
  • Posted
    your brackets look odd I take it that it should be

    (itIsNight and (movement1 or movement2))

    and the second condition may want to be an and not an or

    (itIsNight and (not movement1) and (not movement2))

    you would make it easier to read if you put the values into variables at the top

    You are probably right but i do not understand why it is not going????

    • 0
    Posted

    Please login or register to see this code.

    • 0
    Posted

    Edit: Disregard this post...

    • 0
    Posted

    and with that

    what about the Rugby

    Wales 27

    France 6

    • 0
    Posted
    and with that

    what about the Rugby

    Wales 27

    France 6

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />))

    • 0
  • Inquirer
  • Posted

    Please login or register to see this code.

    It works, many thanks for you help

    Please login or register to see this image.

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

    The new code:

    Please login or register to see this code.

    • 0
    Posted

    you are welcome

    • 0
  • Inquirer
  • Posted
    you are welcome

    Thank you

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    The new Script without the last part, else problem with other scenes on the floor.

    Please login or register to see this code.

    • 0
    Posted

    It sounds like you have other scenes controlling this device.

    You could consider putting them together. You can work out the device or variable that triggered the scene if you use getSourceTrigger and getSourceTriggerType

    Docs are here but there used to be a typo so go for some samples on the forum.

    Please login or register to see this link.

    Please login or register to see this link.

    Logic will be in one place then.

    good luck

    • 0
  • Inquirer
  • Posted

    Thx robmac

    Please login or register to see this image.

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

    Scene runs so far, now i'am play with ModificationTime but it works, somehow, not.

    Do you still have a tip for me how I can solve the problem?

    Please login or register to see this image.

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

    Please login or register to see this code.

    • 0
    Posted
    Thx robmac

    Please login or register to see this image.

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

    Scene runs so far, now i'am play with ModificationTime but it works, somehow, not.

    Do you still have a tip for me how I can solve the problem?

    Please login or register to see this image.

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

    Please login or register to see this code.

    but I am not sure how you want to trigger this. If you just want a delay this is not the way to do this.

    • 0
  • Inquirer
  • Posted

    Sorry the Post was not complete, was yet still play on.

    The last days i have try to complete the script an now it is ready and so far it runs

    Please login or register to see this image.

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

    i don't know whether it is correctly but i am satisfied.

    Would be grateful if you would have improvements, let me know.

    Sun goes down and Motion detect on 1 Floor or 2 Floor the Light turn on with DIM 70%.

    After 5 min (TimeOut Sensor) the light DIM 40%.

    No Motion after 15 min the light turn off.

    Please login or register to see this code.

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    [ Added: 2014-03-01, 18:21 ]

    Small improvements, now works better and the loop starts only when property triggered and Sun

    ist down.

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Please login or register to see this code.

    [ Added: 2014-03-01, 18:29 ]

    What do you think about it, is it ok

    Please login or register to see this image.

    /emoticons/default_icon_question.gif" alt=":?:" />

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