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

[SOLVED]<Solved> HTTP PUT command from HC2 to HCL ??


Torbjorn

Question

Hi,

 

I'm trying to change a parameter in one z-wave device connected to HCL from my HC2.

If I do it in the REST API in the HCL, everything works OK.

 

When doing it from the HC2 in a VD with this code:

 

HCL = Net.FHttp("admin:[email protected]")
jtable = '{"properties":{"parameters":[{"id":34,"size":1,"value":0}]}}'
HCL:PUT("/api/devices/6",jtable)

 

it does not work....

 

Is there a limitation in the HCL ?

 

I have exactly the same code running for the same device in HC2 and there it works

 

Thanks in advance for your help !

Please login or register to see this attachment.

Edited by Torbjorn
Solved
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • HI ,

     

    Seems to be working with your code, thanks a lot !

     

    Do you know why HCL is different ? My HC2 works OK with the previous code....

     

    Thanks again !

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  •  

    19 hours ago, boerremk said:

    Can you try:

    Please login or register to see this code.

     

    Hi @boerremk

     

    Now, if I would like to read the same value ("properties":{"parameters":[{"id":34,"..."value")  back from the remote HCL, what would the LUA code be ??

     

    Thanks in advance for your reply !

    Edited by Torbjorn
    update...
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hm....

    Without testing, I read the new, proposed code which is SETTING the value of the parameter and checking that the transfer is OK from a communication point of view.

    If my device would be hanging or not receivig the valeu (change), how would I know what state the parameter 34 is in ??

     

    I was more looking for the corresponding code to READ BACK what is the value of parameter 34 so I surely know it's correct....and to show in the controlling VD of the device...

     

    Thanks again for your kind help !

     

    Rgds

    Torbjorn

    Link to comment
    Share on other sites

    • 0

    The following will give you the response back of the put action you did (so not only communication point of view).

    Please login or register to see this code.

     

    But you could also do a other call to get the status of the device

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 2 hours ago, boerremk said:

    The following will give you the response back of the put action you did (so not only communication point of view).

    Please login or register to see this code.

     

    But you could also do a other call to get the status of the device

     

    Hi my helpful friend,

     

    Yes, I saw the whole dump of all data with the above debug code. 

    The question that follows is how do I get the actual value returned to display in the VD label ???

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    jsonTable = json.decode(response)
    fibaro:debug(jsonTable['value'])

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