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 - First few lines?


rvorsten

Question

Folks -

Can anyone explain that these initial lines at each piece of LUA actually mean or, even better, there the HC2 specific LUA code is documented?

The LUA tutorials on the web tell me that everything between the --[[ and ]] is actually commentary only, so according to that, the three lines starting with %% below have no impact at all...

--[[

%% autostart

%% properties

%% globals

--]]

So that raises the question: why are they there in most of the samples I see here, and also in all the LUA code that gets generated when translating form Blocks to LUA?

Thanks for your insight!

Ronald

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0
Guest deraaij

%% autostart --> Start when HC2 Starts (for time based scenes)

%% properties --> Needs to be followed by one or mote properties which are used for this scene as trigger. e.g. 5 value (trigger on change in value of device # 5), 102 valueSensor etc

%% globals --> Needs to be followed by one or more variables of which a state change needs to trigger a scene.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • %% autostart --> Start when HC2 Starts (for time based scenes)

    %% properties --> Needs to be followed by one or mote properties which are used for this scene as trigger. e.g. 5 value (trigger on change in value of device # 5), 102 valueSensor etc

    %% globals --> Needs to be followed by one or more variables of which a state change needs to trigger a scene.

    Thanks!

    Link to comment
    Share on other sites

    • 0

    All,

    To me it is still strange/unclear how this works.

    A. Socha advised in another reply "yes that is a comment line but we took from that information for our scene engene "

    So the 'greyed' lines are active. To include a property you have to include them in greyed-out mode. Same for properties. I find it odd to believe but that is how it works. Agree?

    Also, when you create new LUA scene and you hit the option 'Start when Home Center starts' then this option is sort of buried in the system. It's active but not visible in the first few lines. The system doesn't generate the %autostart option for you.

    Then there is the option 'Active Scene'. I have no clue what that option does.

    Is this described anywhere? I know there are quite a few in this forum who understand these basic details. Please help?..

    Cheers,

    Hans

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • All,

    To me it is still strange/unclear how this works.

    A. Socha advised in another reply "yes that is a comment line but we took from that information for our scene engene "

    So the 'greyed' lines are active. To include a property you have to include them in greyed-out mode. Same for properties. I find it odd to believe but that is how it works. Agree?

    Also, when you create new LUA scene and you hit the option 'Start when Home Center starts' then this option is sort of buried in the system. It's active but not visible in the first few lines. The system doesn't generate the %autostart option for you.

    Then there is the option 'Active Scene'. I have no clue what that option does.

    Is this described anywhere? I know there are quite a few in this forum who understand these basic details. Please help?..

    Cheers,

    Hans

    Fully agree, Hans...

    @Fibaro: Isn't it time that you guys capture all of this into a proper English manual? That would save many of us many hours of guess-work and trial&error and therefor frustration...

    Link to comment
    Share on other sites

    • 0
    Guest Lode

    Do you mean the option "Scene Active" at the advanced tab from your scene ?

    In that case when it's marked your scene will run.

    When it's not marked your scene will never run.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Do you mean the option "Scene Active" at the advanced tab from your scene ?

    .

    No, we are referring to the first few lines in LUA scripts.

    Link to comment
    Share on other sites

    • 0

    Lode,

    Thanks for answering a part of the question. Makes sense that indeed that is how this feature works. I would expect, however, a setting like "disable" this scene or make the setting 'Activate the Scene' the default setting..

    Grateful if anyone can shed some light as to how the 'greyed-out' and on face value 'inactive' first lines of the scripts do function.

    Cheers,

    Hans

    [ Added: 2013-03-18, 21:55 ]

    Oh oh, overlooked one of robmac's recommendations (Thanks robmac!!!) .... Just followed the link

    Please login or register to see this link.

    and found quite some very good info. Parts of it translates from Polish to English automagically. Most of I had to run manually through BING translator. (Guess I have to use Google..). So the information is there. In Polish. This language aspect doesn't amaze me anymore.. The product is great, support definitely ok. The documentation and communication.. a disgrace to international customers!

    Hans

    Link to comment
    Share on other sites

    • 0
    Guest sgbirch
    The product is great, support definitely ok. The documentation and communication.. a disgrace to international customers!

    Hans

    Couldn't agree more. I actually wrote to Fibaro and volunteered to help with the translation, this was rejected, they said they have somebody working on it. Sigh.

    Fibaro has not yet learned the value of its community.

    Link to comment
    Share on other sites

    • 0
    %% autostart --> Start when HC2 Starts (for time based scenes)

    %% properties --> Needs to be followed by one or mote properties which are used for this scene as trigger. e.g. 5 value (trigger on change in value of device # 5), 102 valueSensor etc

    %% globals --> Needs to be followed by one or more variables of which a state change needs to trigger a scene.

    Ok, so does this mean (Yes, complete newbie here) the following:

    I have a Aeontec 4-in-1 where the Light sensor is shown as ID 68 in propertied.

    If i would like to have a scene that sets a global var "ItsAfterDark" if the value of that sensor falls below 100, i should then do

    NOT include %%autostart

    Include %%properties 68 value

    and then the scene will fire every time the sensor sends a new value to the system?

    (At first i thought i needed to have a timed script that checked the value every X minutes).

    Link to comment
    Share on other sites

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