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


  • 1

Read and set parameters from code


Question

Posted

Hello!

 

Really dumb question? I assume all devices have values and parameters? From my scene I can read values like fibaro:getValue(18, "power")). But how do I read the parameters E.g. parameter 20 "Switch type" on a Switch. And how can I set the parameters from code? 

 

Best regards, Mikael

 

8 answers to this question

Recommended Posts

  • 0
Posted

Welcome @Lenfors

 

Not sure if this screenshot is of any help to you, but when programming a LUA scene you can use the tool bar on the left to find a device and see its available properties and actions. Hover over the room, then slide over to a device, then slide over to its properties. Clicking on one of these will paste the LUA code in the code box for you:

 

Please login or register to see this attachment.

 

Hope that helps.

  • 0
  • Inquirer
  • Posted
    1 hour ago, devfern24 said:

     

    Ok, thank's. I already know about this feature but I can't find the parameters you see under Advanced. There are lots of parameters identified by numbers. E.g. a motion detector has a parameter "1 Motion detection - sensitivity". How can I read this value. And I also want to be able to set these parameters, how can I do that?

     

    Best regards, Mikael

     

    • 0
  • Inquirer
  • Posted

    Doesn't anyone know how to do this or is it not possible?

     

    Best regards, Mikael

     

    • 0
    Posted

    If you use the api from fibaro in /docs i believe you can do request to the /devices put. Then you have to insert a json like:

     

    Please login or register to see this code.

    And add the correct id of the device in your case.

    Page 12 of 

    Please login or register to see this link.

     shows you that, id = 1 for sensitivy, size = 2 and value of 15 is sensitivty.

    Some explaining in dutch (you can use google translate) but it shows you a VD example too. 

    Please login or register to see this link.

    • 0
  • Inquirer
  • Posted

    Ok thanks!

    I just didn't Think it was that complicated!

    I'm really missing some stuff in this LUA programming.....

     

    Best regards, Mikael

    • 0
    Posted

    This entry is a bit older, but I'm also looking for a way to set  a parameter.

    For example, to build a virtual scene to calibrate my roller shutters.

    Since I have installed 17 modules and sometimes I have someone to recalibrated.


    Does anyone have an idea here how to do that in the HC2 with LUA?
     

    Thank you so much!

    • 0
    Posted
    1 hour ago, dougdoug said:

    Does anyone have an idea here how to do that in the HC2 with LUA?

     

    Yes I do, here is a function to change a parameter:

     

     

    • 0
    Posted

    After changing various parameters, it worked perfectly.

     

    My changes:

    productInfo = "1,15,3,2,16,0,25,25" -- This is a Roller Shutter

    ...

    parameter={id=parameterID,size=2}

     

    Thx a lot!

     

    • Thanks 1

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