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

HTTP POST


ROBBshop

Question

Hi everyone,

I want to create to virtual device to display my ICY thermostat in the HC2. Later I want to extend this with the ability to change the set point. People already found out the system it works with and programmed around it.

I know (I think I know....) how to pull the token from the JSON feedback. I just don't know how I can parse it into the GET requests.

In linux terminal:

Please login or register to see this code.

The output of the file in json:

Please login or register to see this code.

I also pulled the actual return of the TOKEN request:

Please login or register to see this code.

My attempt so far:

Please login or register to see this code.

This code is not working because I will need to implement the security token.

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0

ROBBshop, FHttp not support https request

Please login or register to see this image.

/emoticons/default_icon_sad.gif" alt=":-(" /> can you request the service in other way ?

Link to comment
Share on other sites

  • 0
  • Inquirer
  • @jeroen sure thing

    @krikroff unfortunatly they implemented decent security into this thermostat, so https is required....

    [ Added: 2014-01-19, 13:33 ]

    Can this be done in he HC2? (it is LUA, but might have a few faults in it...)

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    No you can't do that in LUA with HC2 :

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • So my idea fails here? or is there a work-around solution?

    Link to comment
    Share on other sites

    • 0

    if https is absolutely necessary there is no way, sorry

    Please login or register to see this image.

    /emoticons/default_icon_sad.gif" alt=":-(" />

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Ok, will see if there is a way around it. I know it is possible to use a internal IP address but the documentation is very limited

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • So, now that HTTPS is supported in 4.033, how to get this to work?

    Link to comment
    Share on other sites

    • 0

    Supported only in scene, not in VD.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Not ideal, but I could use a scene to set a variable and plug that into a VD?

     

    So mainly, how to post username password to https and get back a token.... Any sample code would help

    Link to comment
    Share on other sites

    • 0

    So my idea fails here? or is there a work-around solution?

    I hope not, I have also a  ICY thermostat, I want to connect 

    Please login or register to see this image.

    /emoticons/default_wacko.png" alt=":wacko:" /> 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • So, reading around I found another post that confirms this should work, but unable to get it to play

    Please login or register to see this code.

    But how to apply this with a post, answer and strip part.

     

    I used the pushover scene and tried to edit it, but does not work yet:

    Please login or register to see this code.

    The debug:

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Ok, so revisiting this project I have made a bit of progress but still do not get the desired result. I created 2 functions in a scene.

    Please login or register to see this code.

    This first function works flawless and gives me a 200 responds and the security token. I write it to a globalvariable because the token will not be parsed outside the function (not sure why)

    Please login or register to see this code.

    This always ends up in a 401 unauthorized access. Not sure why..

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    This is a long shot, but could it be that the argument to "headers" is incorrect? I'd expect it to be a lua table.

    Something different, but maybe related: if you need to pass arguments, you may need encoding of the arguments. An example of that, and of a header, is in my posts here:

    Please login or register to see this link.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I did try another method of parsing the header:

    Please login or register to see this code.

    but the responds I get then is:

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • BINGO!!!

    Please login or register to see this code.

    And now it works (not sure where the content length messed it up

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Unfortunatly this does limit the functions of a thermostat to a scene. Which is unfortunate, but it will work if https support is added to virtual devices (or someone can combine these into a plugin)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Ok, making progress here. I know created a Virtual device with just 2 labels. the ID in my case is 232

    Current temp (TempNow)

    SetPoint (TempSet)

     

    I also created 2 global variables to store the Security Token and the thermostat UID.

     

    Then I created 1 scene to retrieve the data from my thermostat:

    Please login or register to see this code.

    I also created a scene to set a new setpoint:

    Please login or register to see this code.

    Now I want to create a way of setting a more flexible setpoint. Either via a global variable or different. Not sure how yet

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