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 login and api query


AutoFrank

Question

Hi folks,

I'm looking for some help or some directing.

I've searched the forum but can't find what I'm looking for even though it has to be there and tried before.

 

I am trying to create a scene to read and adjust my heating system through the API

 

The steps would be 

- login over http passing username and password. (this would activate a session)

- read back the authentication code to use in next step

- issue a post to the API to read or adjust the heating (over http)

 

any help or pointing me to other forum posts would be appreciated

 

Thanks

Frank

 

Edit: I've attached a wireshark trace export of the transaction requesting a 1 deg decrease. I blanked out some email addresses and site specific information for privacy.

 

This is essentially what I am trying to replicate through a scene if it's possible.

Please login or register to see this link.

Link to comment
Share on other sites

20 answers to this question

Recommended Posts

  • 0

the way my webapp communicates with fibaro is by sending direct requests using html requests to the api.

so I don't receive an auth code, I simply use htpp://name:password@fibaroip

Link to comment
Share on other sites

  • 0

First of all, you can not post Net.FHttp commands through LUA. You must use a virtual Device.

 

Create a virtual device and configure it with the IP address and port for your heating system.

 

Use Net.FHttp command in buttons:

Please login or register to see this code.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • the way my webapp communicates with fibaro is by sending direct requests using html requests to the api.

    so I don't receive an auth code, I simply use htpp://name:password@fibaroip

     

    Thanks reiniertc for the input.

    I'm not sure what you mean. I am looking to use a scene running on the the HC2 that could talk to the API or my heating system (not the fibaro API)

     

    does this make sense ?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  •  

    First of all, you can not post Net.FHttp commands through LUA. You must use a virtual Device.

     

    Create a virtual device and configure it with the IP address and port for your heating system.

     

    Use Net.FHttp command in buttons:

    Please login or register to see this code.

     

    Thanks Brick

    A VD would be better as I could create a label to display the current temp setting and two buttons to increase or decrease the temp.

     

    This heating system (thermia atec) is a bit different and they only way I seem to be able to access it is through the companies website. I cant seem to find a way to access it through the local network. I can find the IP on my local network but a scan doesn't reveal what port it operates through. I'm not sure the API is opened locally on my network.

    Link to comment
    Share on other sites

    • 0

    Please login or register to see this link.

    I think this topic solves similar problems. A partly participated. I'm sorry I can't summarize it for you, due to my priorities and the rather technical nature of the question

    Let me know how you get along. I think if you know "wireshark" then that topic may get get you on the right track...

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • thanks peter et al. ... I'll take a look later and see if I can piece together something.

    Looks like its do-able which as half my question......

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi,

    Trying to get my HC2 scene to control my heating system (thermia atec)

    The API isnt public but I found the web services details

     

    This is the one for authentication

    Authentication

    REST Paths

    The following REST paths are available for this service.

    GET,POST,DELETE authentication

    To override the Content-type in your clients HTTP Accept Header, append ?format=json

    To embed the response in a jsonp callback, append ?callback=myCallback

    HTTP + JSON

    The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

    Please login or register to see this code.

    Please login or register to see this code.

     

    I've started with authentication with the following scene

    Please login or register to see this code.

    This is very new to me and what I have pieced together from peterb and ROBBShop and others

     

    I am getting a success status of 200 so I assume the http request is being sent okay (even though I cant find it on a wireshark trace from either my laptop or the HC2 IP's)

     

    How could I verify the request is authenticated and then start to parse the auth-code from the response

     

    My end goal here is to read the heating setpoint and adjust up/down

     

    Any help appreciated 

     

    Thanks

    -F

     

    Update: I'm also getting a HC2 403 System Error (blue box) when I run this 

    Link to comment
    Share on other sites

    • 0

    What I can already tell you, is that you won't see the traffic in "wireshark". You're probably connected to a switched network (network switch or wireless). The data exchange between HC2 and your device doesn't show on the network port of your PC. You need a smart switch with a "monitor port" or a very, very old "hub" instead of a "switch".

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • What I can already tell you, is that you won't see the traffic in "wireshark". You're probably connected to a switched network (network switch or wireless). The data exchange between HC2 and your device doesn't show on the network port of your PC. You need a smart switch with a "monitor port" or a very, very old "hub" instead of a "switch".

    Thanks Peter and now that you said it is very obvious...

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" /> 

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" /> 

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" /> 

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" />

    I assume something like 

    Please login or register to see this link.

    would prob do the trick if the relevant devices like my PC, HC2 and heating controller were connected into it...?

     

    any thoughts on my http POST issue ?

    Link to comment
    Share on other sites

    • 0

    This is what I use for the authentication for the Evohome system:

    Please login or register to see this code.

    From the response I use the status.data to call the next action (this contains the authenticated session).

     

    Hope it will get you in the right way.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks boerremk

     

    I was actually looking at your post earlier

    Could you share the webservices/api details for evohome. I could use that to understand your solution a bit more.

    .. particularly what the expected responses are

     

     

    -F

    Link to comment
    Share on other sites

    • 0

    Also the Evohome is not documented ...

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    I started with

    Please login or register to see this link.

    , and from there it grew to what it is today.

     

    You can find the complete scene here:

    Please login or register to see this link.

     

    I first authenticate the session (getuserdata), then with that result I get the data from the thermostat (getfulldata) and with that data I can get/set actions, so it is always a 3-way approach to get it working (authenticate, data, action).

     

    PS.  In a scene you need to call a function from a function if you use http(s) calls so:

    working:

    function1()

      function2() -- call second function

    end

    function1() -- call first function

    not working

    function1()

    end

    function2()

    end

    function1() -- call first function

    function2() -- call second function

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Also the Evohome is not documented ...

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    I started with

    Please login or register to see this link.

    , and from there it grew to what it is today.

     

    You can find the complete scene here:

    Please login or register to see this link.

     

    I first authenticate the session (getuserdata), then with that result I get the data from the thermostat (getfulldata) and with that data I can get/set actions, so it is always a 3-way approach to get it working (authenticate, data, action).

     

    PS.  In a scene you need to call a function from a function if you use http(s) calls so:

    working:

    function1()

      function2() -- call second function

    end

    function1() -- call first function

    not working

    function1()

    end

    function2()

    end

    function1() -- call first function

    function2() -- call second function

     

    Thanks - looks like a similar challenge

    I'll pick it apart and see if I can create one for my own setup.

     

    I can't access my device directly - its on my network but has no services exposed other than being able to ping it.

    I log into a website and from there I can adjust the system 'remotely. 

     

    It is this remote access I am trying mimic using wireshark to see what happens when I interact via the website.

     

    It's strange that I cannot access the system 'locally' and I also have a parallel track to try that angle

    peterb suggested a smart switch with port mirroring so I can monitor what is happening on the system itself locally when I interact it remotely. I ordered a 5 port smart switch and when that arrives I might have a local 'in' as well...

     

    anyway - back to the grind to see if I can get the remote access working....

    Link to comment
    Share on other sites

    • 0

    Or just a plain hub instead of a switch, then you should be able to wireshark the traffic.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Or just a plain hub instead of a switch, then you should be able to wireshark the traffic.

     

    yep, wasn't too sure where I could get/buy a hub

    Please login or register to see this image.

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

     

    I got a 5 port TP-link smart switch for €30, should have it in a few days

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Also the Evohome is not documented ...

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    I started with

    Please login or register to see this link.

    , and from there it grew to what it is today.

     

    You can find the complete scene here:

    Please login or register to see this link.

     

    I first authenticate the session (getuserdata), then with that result I get the data from the thermostat (getfulldata) and with that data I can get/set actions, so it is always a 3-way approach to get it working (authenticate, data, action).

     

    PS.  In a scene you need to call a function from a function if you use http(s) calls so:

    working:

    function1()

      function2() -- call second function

    end

    function1() -- call first function

    not working

    function1()

    end

    function2()

    end

    function1() -- call first function

    function2() -- call second function

     

    My plan may have fallen at the first hurdle

    Please login or register to see this image.

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

     

    a WS trace seems to show that the password is encrypted by the web app

     

    Here is the object that is passed as part of the POST for authentication and the password is different that what I submit when I login

    Please login or register to see this code.

    Does anybody know if this looks to be encrypted ( or changed to HEX ??) and how I might get around it ?

     

    Thanks

    -F

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Also the Evohome is not documented ...

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    I started with

    Please login or register to see this link.

    , and from there it grew to what it is today.

     

    You can find the complete scene here:

    Please login or register to see this link.

     

    I first authenticate the session (getuserdata), then with that result I get the data from the thermostat (getfulldata) and with that data I can get/set actions, so it is always a 3-way approach to get it working (authenticate, data, action).

     

    PS.  In a scene you need to call a function from a function if you use http(s) calls so:

    working:

    function1()

      function2() -- call second function

    end

    function1() -- call first function

    not working

    function1()

    end

    function2()

    end

    function1() -- call first function

    function2() -- call second function

     

    Do you know if the password is transformed/encrypted by the evohome app ?

    In your scene did you just use the same password that you use for the regular evohome app/website ?

    Link to comment
    Share on other sites

    • 0

    Do you know if the password is transformed/encrypted by the evohome app ?

    In your scene did you just use the same password that you use for the regular evohome app/website ?

    I use the same password as for the regular evohome app/website.

    It is send like it is and I receive a session key.

    Link to comment
    Share on other sites

    • 0

    Send me some relevant wireshark traces. I'll contact you via PM.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Send me some relevant wireshark traces. I'll contact you via PM.

     

    Just sent them on .... thanks

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