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

LUA libraries and functions in HC2



Hello Forum,


Relatively new to the HC2 I am struggling a bit with getting my head around all the undocumented functions and features in the HC2. 


Would anyone know more about the ones I am mentioning below, which are nowhere mentioned in Fibaro's documentation.


The "Net" library

Net.FHttp function

Has a method called GET which requires some parameters. Which ones?

How about POSTPUT and DELETE methods? Do they exist and if so which parameters do they take?

Net.FTcpSocket function

I came across a reference to this function in a post on this forum but I don't know how it works.



The "api" library

api.get, api.put, api.post functions

Takes a local path as parameter so I am guessing this is a special implementation of the Net.FHttp function so one does not have to use the full URL for get/post/put etc.

api.get("/icons") for instance gives all icons according to Fibaro's REST-interface definition

Is there an api.delete function as well?


Googling the above does not give any indication that these libraries are generic LUA libraries so my conclusion is that they must be Fibaro-specific. But I could be wrong of course.


Storing tables in global variables

I came across this VD (by Sankotronic)  on the forum that helps you browse the icon library:


Looking through the code I found this very interesting concept of storing an entire data structure in a global variable. Check out the main loop in the VD. Very clever indeed!

The question then, which are the principles behind this very convenient way to handle variables? I mean, the standard functionality can only handle numbers and predefined values, not strings or collections of data.















Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1
  • Inquirer
  • 2 hours ago, Jamie mccrostie said:

    Have you been here?


    Please login or register to see this link.

    Yes, been there. 

    Not a very comprehensive documentation I am afraid.



    Link to comment
    Share on other sites

    • 0

    @perjarIt's about as good as it gets, till you start ripping apart code from here :)

    http://<Your HC-IP>/docs   also gives a little bit .. 





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