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

Need to learn LUA, any other languages necessary?


Question

Posted (edited)

Dear All,

 

I want to get into learning LUA. It seems that this is the right way to move forward if anyone is to use the HC2 seriously.

 

However, as a newbie (relatively) to programming, I want to first understand if I need to learn other languages besides LUA in order to get the most out of the HC2.

 

Any advice on where I should start this adventure?

 

 

Edited by LeeSteventon

8 answers to this question

Recommended Posts

  • 0
Posted
5 hours ago, LeeSteventon said:

Dear All,

 

I want to get into learning LUA. It seems that this is the right way to move forward if anyone is to use the HC2 seriously.

 

However, as a newbie (relatively) to programming, I want to first understand if I need to learn other languages besides LUA in order to get the most out of the HC2.

 

Any advice on where I should start this adventure?

 

 

 

Hi and welcome to the forum.

I was in your position about 18 months ago and found for me the best way to learn was from others in this forum.

Lua is an excellent place to start for a HC2. Many users publish their code and will explain what the code is doing.

I have to admit that this forum is excellent and the vast majority of user treat each other with respect and are more than helpful. If you are willing to do some reading and make an effort to solve yoiur issue (*rather than looking for others to provide it all) then I think you'll find this forum very useful.

 

  • There is a excellent lua guide at 

    Please login or register to see this link.

     but beware that fibaro's specific use of lua can differ from the standard in some places.
  • Fibaro have some good references for their lua and rest api's at 

    Please login or register to see this link.

 

Many users have provided solutions that can be leveraged as they are. I'd suggest looking at @cag014 solution for managing the HC2 device ID's through a predefined global variable. @Sankotronic has an excellent sunrise/sunset/scheduled events as well as others. @jompa68 has some good weather solutions, @Krikroff has a self contained solution for sonos and I have published an option that leverages jishi simple http api on git. @petergebruers is excellent along with many others on http challenges and @chaicka has been very helpful to me as well. There are many others that have helped me on my journey.  

 

I'd say dive right in start reading the forum posts and I'm sure you'll find others that I haven't encountered tey that will be more than willing to help

Happy coding....

  • 0
  • Inquirer
  • Posted

    Hi AutoFrank (Frank?) and many thanks for taking the time to reply (and also so extensively and thoroughly!)

     

    I have already purchased the LUA book (3rd edition) but it doesn't look like an easy read to a novice / beginner as it dives straight into concepts without really explaining them.

     

    I'll check through the solutions provided by the forum members you mentioned, (I have already looked through a lot of the forum content).

     

    One other topic I'm keen to get properly working is the Alarm aspect of Fibaro HC2. I see that there are a lot of posts on this but, could you recommend a "general"location to look which describes the "setup approach / process"?

     

    regards

    • 0
    Posted

    Maybe RestApi if you are going to provide support for others on HCL.

     

    Allso just because Lua can do something, that dosent mean FIBARO's Lua can, i think that Fibaro has done something to the language in order to adjust it for their own needs. (some commands might not work, there are probably few additionall commands specific for Fibaro aswell but thats normall).

     

    i would allso like to add a source of at least basics of Lua coding within Fibaro: 

    Please login or register to see this link.

    a fantastic site with very good explenations of pretty much everything you will need. Horray for (Fibaro) UK!

    • 0
  • Inquirer
  • Posted

    Hi Kuba,

     

    Many thanks for your reply, I will certainly look through the Fibaro UK pages on the LUA code (had a quick peek already and indeed it does seem useful)

    • 0
    Posted
    55 minutes ago, LeeSteventon said:

    Hi AutoFrank (Frank?) and many thanks for taking the time to reply (and also so extensively and thoroughly!)

     

    I have already purchased the LUA book (3rd edition) but it doesn't look like an easy read to a novice / beginner as it dives straight into concepts without really explaining them.

     

    I'll check through the solutions provided by the forum members you mentioned, (I have already looked through a lot of the forum content).

     

    One other topic I'm keen to get properly working is the Alarm aspect of Fibaro HC2. I see that there are a lot of posts on this but, could you recommend a "general"location to look which describes the "setup approach / process"?

     

    regards

     

    Glad it helped...

    I'm not sure just learning lua form a resource is the best way to get started as some of them can be daunting...

    I think you're better off starting with a specific challenge, trying to solve it and if you run into problems then start a post on this forum looking for help.

    The HC2 capabilities are vast and depending on what other devices you have it can seem like a huge mountain to climb all at once.

    I suggest starting with something simple like a sensor breached and a light turns on, or reading a temperature from a sensor and displaying that in a debug console or virtual device. These small intro tasks don't even have to be part of your final solution but will help facilitate your learning and get you familiar with the web interface. You also need to select a lua editor like notepad +, zerobraine, etc...

     

    Regarding the alarm.. I never used  this functionality as I have a standard siemens alarm that is tied into my HC2 through a gateway but there are many people here that do seem to use that feature a lot....

     

     

     

     

    • 0
  • Inquirer
  • Posted

    Hi Frank,

     

    Yes, I think the "specific challenge" route is the nest way forward (I've used this in the past for Access databases and a bit of C# programming, not that I got very far...:) )

     

    Many thanks for your help and advice!

    • 0
    Posted

    Well said, Frank. I too was once in the shoes of many others who joined this forum - new to home automation, Fibaro products and its scripting (LUA and REST API). I too have learnt a great deal from many of the forumers who are always willing to share, to guide, to advice. What I have benefited from the forum, I return to the forum too, in whatever little ways I can (compared to all the great programmers, scripters of this forum).

     

    Been participating in many forums for a decade or two or even long before forums exist (BBS for those who knows). One thing I have learnt along these time is that help will always be there for those who are willing to receive help (not sit and wait for spoon-feeding). Cheers. May the New Year be a great one and many more great milestones towards maturity in the z-wave journey.

    • 0
    Posted

    LeeSteventon,

     

    I came with bit of decades ago obsoleted programming such as pascal, foxtron, lotus script, c++ (or was it C without the ++?, too long ago). LUA and REST API are not too difficult to pick up as long as you understand the fundamental logics, rest is just differences in syntax.

     

    As long as you keep the 'what', 'why', 'when', 'how' in mind when seeking help in this forum, many others are always willing to help out whenever and whatever ways they can.

    Examples: What is the code or part of code having issue?, What is the outcome?, When does it happens?, How does it happens (sequence of events)?

    I call these the 3W1H (or 4W1H) which is the basic of seeking help from others. Try, Post, Try (out what others' input), Post (outcome), Try again, Post again. ;)

     

    Have fun... I had quite a good 2+ years journey down this path. :D

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