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
Decoded - EvoHome API access to control remotely.
Collapse
X
-
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));
Comment
-
-
Originally posted by watchforstock View PostInteresting. 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
Comment
-
-
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
Comment
-
-
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...
Comment
-
-
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.
Comment
-
Originally posted by watchforstock View PostI'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...
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
Comment
-
-
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?
Comment
-
-
Glad you got it working. To be honest, at least for my use case I'm just authenticating anew each time. My main use of the api is to record the room temperatures every 5 minutes and store that to a database for viewing (http://www.andrew-stock.com/weather/show/). It looks from the response that the token is valid for an hour, but I haven't done anything with that, or seen a use of a the "refresh" token either
Comment
-
-
That's fair enough.
It would appear that you can use the refresh token to get a new access_token. The purpose of this, is to reduce the number or times that client credentials are sent over the internet, this reducing the possibility of someone intercepting them.
Comment
-
-
I've made a few new updates to my web app, once again thanks to everyone who has provided code and help me get to where I've got to! I've had to put a PIN on it as I was seeing the settings being changed and the other half was complaining!
So, here's some screenshots of the latest developments of my little web app:
Comment
-
-
Continued...
As you can see, I have added setting switchpoints, editing switchpoints, deleting switchpoints, copying schedules and a schedule overview chart, so most things that you can do on the controller can now be done on here too.
Comment
-
-
Hello Magga
This webinterface for Evohome is really exciting. Very nice. Actually i also have a project, i want to set temperature settings with a small php script from outside. So i'm very interessted in some code samples how you did it do send informations to evohome. Would it be possible for you to share this with me?
Comment
-
Comment