Page 4 of 46 FirstFirst 12345678914 ... LastLast
Results 31 to 40 of 454

Thread: Decoded - EvoHome API access to control remotely.

  1. #31
    Automated Home Jr Member
    Join Date
    Mar 2014
    Posts
    19

    Default

    Interesting. I noticed that the ifttt channel had access to the service via oauth. I also noticed that some of the data returned references EMEA. Just need to wait for the android client to roll out and then I'll take a look

  2. #32
    Automated Home Jr Member
    Join Date
    Sep 2014
    Location
    Nottingham
    Posts
    24

    Default

    I have not had any succes in trying to connect using OAuth, I just keep getting "unsupported_grant_type", however "password" is the grant type that the app sends, so there must be something else wrong. If I first get the access_token issued via the iPhone app, I can then successfully use this token to access it outside of the app, until it expires, but I don't seem to be able to actually get the token from outside of the app. I don't know much about OAuth, so I'm probably doing something wrong.

    I'm trying something along the lines of:

    $url = "https://rs.alarmnet.com/TotalConnectComfort/Auth/OAuth/Token";
    $data = array(
    'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8',
    'grant_type' => 'password',
    'scope' => 'EMEA-V1-Basic EMEA-V1-Anonymous EMEA-V1-Get-Current-User-Account',
    'Username' => $username,
    'Password' => $password,
    );
    $postData = http_build_query($data);
    $headers = array(
    "Content-Type: application/x-www-form-urlencoded",
    "Content-Length: 0",
    "User-Agent: RestSharp/104.4.0.0"
    );
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = json_decode(curl_exec($ch));

  3. #33
    Automated Home Jr Member
    Join Date
    Sep 2014
    Location
    Nottingham
    Posts
    24

    Default

    Quote Originally Posted by watchforstock View Post
    Interesting. I noticed that the ifttt channel had access to the service via oauth. I also noticed that some of the data returned references EMEA. Just need to wait for the android client to roll out and then I'll take a look
    They have just sent an email saying the App is now available on App Store and Google Play, so you should be able to get hold of it now.

  4. #34
    Automated Home Jr Member
    Join Date
    Mar 2014
    Posts
    19

    Default

    There seems to be a fixed authorization header that you're missing on the call to get the token which may be your problem. I've got the token being issued correctly and sometimes using it works and sometimes not so I've got to work out what's going on then. I see what you mean about the completely different structures - it's obviously been extended to support all the new systems that have been launched

    I'll hopefully get an updated version of the python API up on github soon

  5. #35
    Automated Home Jr Member
    Join Date
    Mar 2014
    Posts
    19

    Default

    I've pushed an updated version of the Python API to github (https://github.com/watchforstock/evohome-client). This isn't fully tested yet, but seems to be successfully retrieving information from the system. The documentation hasn't caught up yet and as has been mentioned elsewhere, the API is quite different so the API for the library is different to match

    Interested in any feedback...

  6. #36
    Automated Home Jr Member zcapr17's Avatar
    Join Date
    Oct 2014
    Location
    UK
    Posts
    20

    Default

    Hi,

    First, a big thanks to Roy, Andrew, and Fraggel.

    I am hoping to use the c# library that Fraggel has created to build my own little data logger, and also (eventually) to create a link to my home automation controller (once I have decided which one I'm going to use - possibly openHAB or Fibaro).

    Couple of quick questions:

    • In v1 of the API, do you know how long the sessionid is valid for? I can’t see any “session timeout” or duration in the returned data. If I were to poll the api every minute from my data logger, do you think it would be wise to re-authenticate and get a new session every time or to use the existing session for as long as possible?
    • Is it possible to retrieve the state of the boiler relay (i.e. on/off)? I can't see it anywhere in the v1 api.
    • Can anyone recommend any data visualisation software, I'd like to produce graphs along the lines of what weejimmy posted.



    Many thanks,

    z.

  7. #37
    Automated Home Sr Member
    Join Date
    Oct 2014
    Posts
    84

    Default

    •Is it possible to retrieve the state of the boiler relay (i.e. on/off)? I can't see it anywhere in the v1 api.
    Nope. I've taken a stab at guessing this based on differential temperatures but it's very rough. Wish Honeywell would add this to the API.

  8. #38
    Automated Home Jr Member
    Join Date
    Sep 2014
    Location
    Nottingham
    Posts
    24

    Default

    Quote Originally Posted by watchforstock View Post
    I've pushed an updated version of the Python API to github (https://github.com/watchforstock/evohome-client). This isn't fully tested yet, but seems to be successfully retrieving information from the system. The documentation hasn't caught up yet and as has been mentioned elsewhere, the API is quite different so the API for the library is different to match

    Interested in any feedback...
    Well I've used your code to try my PHP version again, but I'm just getting back: {"error":"unsupported_grant_type"} when trying to get the access_token and I've no idea why!

    My code is as follows, perhaps someone can see something I've missed!

    $url = "https://rs.alarmnet.com:443/TotalConnectComfort/Auth/OAuth/Token";
    $data = array(
    'Content-Type: application/x-www-form-urlencoded; charset=utf-8',
    'Host: rs.alarmnet.com/',
    'Cache-Control: no-store no-cache',
    'Pragma: no-cache',
    'grant_type: password',
    'scope: EMEA-V1-Basic EMEA-V1-Anonymous EMEA-V1-Get-Current-User-Account',
    'Username: '.$username,
    'Password: '.$password,
    'Connection: Keep-Alive'
    );
    $headers = array(
    'Authorization: Basic YjAxM2FhMjYtOTcyNC00ZGJkLTg4OTctMDQ4YjlhYWRhMjQ5On Rlc3Q=',
    'Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml'
    );
    $postData = http_build_query($data);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    return($response);

    Matt

  9. #39
    Automated Home Jr Member
    Join Date
    Mar 2014
    Posts
    19

    Default

    I can't spot anything obvious. If you can, I might try running your version and mine, capture both requests via wireshark and see if you can spot the differences. Alternatively if you can capture a pcap through wireshark I'm happy to take a look and compare

  10. #40
    Automated Home Jr Member
    Join Date
    Sep 2014
    Location
    Nottingham
    Posts
    24

    Default

    I have managed to get it working now, it was basically that the http_build_query function seems to mess up the $data array due to the way it encodes whitespace, setting the query string manually as below worked:

    $data = 'Content-Type=application/x-www-form-urlencoded; charset=utf-8';
    $data.= '&Host=rs.alarmnet.com/';
    $data.= '&Cache-Control=no-store no-cache';
    $data.= '&Pragma+no-cache';
    $data.= '&grant_type=password';
    $data.= '&scope=EMEA-V1-Basic EMEA-V1-Anonymous EMEA-V1-Get-Current-User-Account';
    $data.= '&Username='.$username;
    $data.= '&Password='.$password;
    $data.= '&Connection=Keep-Alive';

    One question I had, is that this access_token you receive which you can use to make calls to the API, obviously expires after a certain amount of time, so how are you handling this? Or are you just getting a new access token for every request?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •