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

Dummy questions LUA


Question

Posted (edited)

Hello all,

I use some VD made by expert members like @AutoFrank, @Sankotronic and others, an today i try some tests so i can understand how they made this LUA VD so great.

 

I'm beginner in LUA so please be gentle whit me, i just want to learn.

 

I start understand LUA but i have some question. 

Now i play whit SONOS VD, and i have 3 buttons on same line, they have id 7. I try to call them in LUA but i can't call button 2 and 3....i have no idea how to use their ID...or how to find their ID.

 

For call button 1 (play) is use:

 

fibaro:call(1334, "pressButton", "7")
fibaro:debug("play!")

 

AND SONONS play!

 

But how to use rest of buttons, for example stop and mute, both on same line...

I really want to make my first LUA scene....so any support is welcome.

 

 

Edited by Mediacut

5 answers to this question

Recommended Posts

  • 0
Posted

Hi @Mediacut,

 

You have to count the buttons, labels, etc. So if the button "Play" works with 7 the next will be 8 then 9, etc. Just try it and see the magic happen!

  • 0
Posted

@Mediacut

 

Take the following  example ...

Please login or register to see this attachment.

The label "status' counts as id = 1 so the buttons are 

Gate open and close = 2

Gate open 4 mins =3

 

And so on

 

The first number before pressButton is the vd id itself and the number after if my (7 in your ecample) is the button id

 

 

  • 0
  • Inquirer
  • Posted
    3 hours ago, boerremk said:

    Hi @Mediacut,

     

    You have to count the buttons, labels, etc. So if the button "Play" works with 7 the next will be 8 then 9, etc. Just try it and see the magic happen!

     

    Thanks, indeed works! I'm beginner.....:)

     

    20 minutes ago, AutoFrank said:

    @Mediacut

     

    Take the following  example ...

    Please login or register to see this attachment.

    The label "status' counts as id = 1 so the buttons are 

    Gate open and close = 2

    Gate open 4 mins =3

     

    And so on

     

    The first number before pressButton is the vd id itself and the number after if my (7 in your ecample) is the button id

     

     

    Thanks,

    I need to learn more, I started whit LUA manual today.

     

    I really like your VD they are nice and useful.

    I need to learn how you show status value and temperature bellow buttons:)

     

     

    • 0
  • Inquirer
  • Posted

    Other question,

    How to populate EX. label1 whit value from an ID status.

    Based on @AutoFrank example above, how to make label status (ex.gate) to take value from module that control that gate?

    • 0
    Posted

    @Mediacut

    If you take a look at the label id and the code in main loop you will see the connection between the code and populating the label

     

    I learned ( and still learn)  a huge amount from reading through other users code to try and understand what it is doing ... 

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