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

Syntax to get or read the value of IN1/IN2 using LUA on HCL3


liptsin

Question

Hi, 

 

Using a Smart Implant, I've successfully control my garage door.

I've recently added a limit switch to monitor if the door is open or closed.

This input has been connected to IN1. I'm able to get HCL3 to send a push message when the door is opened.

 

In order to create useful scene, I need to be able to read the state of IN1 via LUA, as I'm rather new to LUA I have no idea of the command needed to read the value.

 

Can you please help and tell me how to get the value of IN1 or IN2.

Also, as I'm trying to learn more about LUA, is there a recommendation on where to start or look into.

At the moment I'm learning by converting Block Scene to LUA and trying to look through some examples from Fibaro which is far and few.

 

Your help is much appreciated.

 

Thank you

Regards

Lip Tsin

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1
On 3/13/2022 at 7:02 AM, liptsin said:

Hi, 

 

Using a Smart Implant, I've successfully control my garage door.

I've recently added a limit switch to monitor if the door is open or closed.

This input has been connected to IN1. I'm able to get HCL3 to send a push message when the door is opened.

 

In order to create useful scene, I need to be able to read the state of IN1 via LUA, as I'm rather new to LUA I have no idea of the command needed to read the value.

 

Can you please help and tell me how to get the value of IN1 or IN2.

Also, as I'm trying to learn more about LUA, is there a recommendation on where to start or look into.

At the moment I'm learning by converting Block Scene to LUA and trying to look through some examples from Fibaro which is far and few.

 

Your help is much appreciated.

 

Thank you

Regards

Lip Tsin

 

 

IN1 and IN2 must have an ID in your system.

Find that id, and use it in this code

 

fibaro.getValue(ID,"value")

 

I have some similar solutions for my gate. 

 

 

Please login or register to see this attachment.

Edited by Neo Andersson
Link to comment
Share on other sites

  • 0
  • Inquirer
  • 47 minutes ago, Neo Andersson said:

    IN1 and IN2 must have an ID in your system.

    Find that id, and use it in this code

     

    fibaro.getValue(ID,"value")

     

    I have some similar solutions for my gate. 

     

     

    Please login or register to see this attachment.

    Thank you so much Neo for replying.  After searching for sometime I found a documentation on "LUA API Developer documentation for Fibaro System" and got the command that you mentioned.

    But because I did not know what type of value it return I had to test and trial with the debug command.

    I was using "0" and "1" thinking as it was a binary sensor but it obviously did not work.

    Eventually I converted the block scene that I created to send a push notification into LUA and found out that it returns  "True/False" as  a boolean variable and finally got my LUA done.

    After solving the issue, I wanted to delete the questions but I did not know how to do it.

     

    Once again thank you so much for helping.

     

    Regards

    Lip Tsin

    Link to comment
    Share on other sites

    • 0

    yes, it is true/false that is responded.

    If you are not familiar with devices and its capabilites, or actions that they can perform, please check th swagger of Fibaro. It is very helpful.

    Go to devices section and put your device ID there. In the response JSON you will see what properties, and what actions can be used.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • thanks Neo,

     

    I was wondering what the swagger things was about, not and easy thing to understand. I'll have to spend some time to look into it.

    I use to have the Home Center Lite, don't think that was there before.

     

    thanks again for your advise.

     

    Regards

    Lip Tsin

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