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
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
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));
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
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...
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.
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.•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.
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
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
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?