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!



Smart Home Forum by FIBARO Team

  • 0

Virtual Device; Run mainloop only once



I need the main loop to set some stuff up, but only once. How can I achieve this without the script becoming a performance hogg?

A regular script will run once a second. So I can use;

Please login or register to see this code.

But this is an eternal loop, that will keep memory occupied for the Lua VM in the system.

So how can I make sure it runs only once and then exit? (at HC startup)

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Use a scene... The nature of the main loop is that it will keep running. You can have the scene push a virtual button once on start up.

And yes the fibaro implementation of Lua is extremely performance hungry.

Link to comment
Share on other sites

  • 0

You can't thus my request on here for something else

Please login or register to see this link.

but not a lot of interest from others.

Sad as the main loop is a total dog of an idea. If I want a loop I can create a loop.

[ Added: 2014-06-12, 20:55 ]

BTW I use scenes

Please login or register to see this image.

/emoticons/default_laugh.png" alt=":lol:" />

Link to comment
Share on other sites

  • 0
  • Inquirer
  • I'm just starting with the HC, but this is probably the worst Lua implementation I've ever encountered (and I'm a 10yr Lua veteran coder, so I've been around).

    Lua is probably the fastest scripting language around, but this implementation is so bad...

    trying to hang in here, and see what I can do before I give up on this.

    [ Added: 2014-06-12, 22:30 ]

    thx for the feedback. I don't want to use scenes. I'm trying to create some devices that I can easily manage over an installed base of HC devices.

    This means that I have a requirement to setup the device with the least amount of hassle. Loading a virtual device and customizing a few elements is ok. But manually creating a lot of variables or scenes interconnected to devices etc, is going to be a maintenance nightmare. I cannot use that.

    Link to comment
    Share on other sites

    • 0

    Agree not good. We have been asking for more. There was some spurious security concern that they gave as an excuse for blocking anything advanced. Crossing fingers for 4.x

    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.

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