Ecobee and HG

We just upgraded our HVAC system and it came with a Ecobee Wi-Fi thermostat. This made me think of maybe adding at least a temperature display in HG. There is an api for the ecobee and making calls to the thermostat seem straight forward. :sunglasses: Before I dig much more into this I was wondering if anyone else has done anything for the Ecobee to work with HG? No use reinventing the wheel. :roll_eyes:

No need. Just use the Restful API to call the appropriate value string into an APP with HG and it will be able to parse the data into a custom widget as needed. Easy and useful!

Yes, getting the values is a simple task.
I was wondering if anyone had created anything. The api supplies alot of info and provides total control of the thermostate.
Currently I’m only interested in displaying the temperature and maybe humidity. However I’m sure my interest will change.

Re-thinking this since I’m currently only interested in displaying info and not triggering events (yet) Displaying the web interface in a iframe widget like I’ve done for my off grid Magnum web info will work.

I have been trying to get the temperature and humidity level from my Nest Thermostats.

Google changed how their APIs work soni had to go thru that setup. I haven’t worked on it in a week or so but I was pulling the data in via an API call from the Pi command line.

The issue was the api uses tokens and the need to renew the token every hour makes it hard to drop and pick up work with it. Once I had something I can integrate the token renewal into the HG program (that was the plan anyway).

Not sure if the Ecobee has the same type of API or not.

Yes the ecobee has the similar type of API but doesn’t require renewal as frequent.
it also uses a refresh token along with a device ID to generate a new API access token.

The ecobee developer documentation shows a java script example for regeneration of a new access token. I thought it could be added and run as a catch response to a GET error.

I’ve not had time to play with this as yet and had hope someone had already put something simple together for this already. :disappointed:
The refresh token expires in 1 year the access token expires in less time but not clear on the exact interval (probably overlooked that in the Docs).
It appears the java script will retrieve a new refresh token if one is needed but I’m not 100% sure of that.

Can u share a link to the Ecobee api doc? Sounds similar to Nest so maybe we can collaborate.

Note: this is soxfan1966, for some reason on my phone it’s under a different email.

Not a problem, I did know who you were. :wink:
ecobee API

Thanks. I will take a look when I get a chance, maybe this weekend.

Others have access to a simple script when someone needs it and shares their scripts. I have shared many scripts that I wrote hoping someone else could benefit. If you have a script that is needed and hasn’t been composed yet, it would be great for the community as a whole if you were to share what you create. I started out as a consumer of others work and now provide more than I consume. It’s quite rewarding! :wink:

For informational purposes, here are the Google API Links I have been using for account access setup. There is a $5 one time charge to get access to the google api stuff (this is per email address).

From there, this site is helpful in creating the necessary access credentials. I was not planning to integrate any of this into the HG work, assuming rater than someone had the necessary access set up and had an access token, refresh token, client id and client secret (there is also a project id you need, which is part of the initial set up).

I am working on this now for a bit to see if I can get a HG program to make the API calls to generate a new access token from the refresh token (which I need to do every hour) and also access my Nest device to get the json file with the info about the thermostat I want.

Here is another Google link:

So here is where I am at - using Tuicemen’s system status as a model to make a call to the Pi using curl as opposed to trying to use the Net.WebStatus() to make an API call.
If I use this approach in a HG C# Program I get lines of info returned from the API about my thermostat, which could then parse and get the temp and humidity if I wanted

Program.Notify(“Nest Thermostat Temp and Humidity”, “Started”);
var projectIdC = “YourOwnProjectId”;
var deviceIdC = “YourOwnDeviceId”;
var accessTokenC = “YourOwnAccessToken”;

var CurlString = “-X GET ‘"+projectIdC+"/devices/"+deviceIdC+"’ -H ‘Content-Type: application/json’ -H ‘Authorization: Bearer “+accessTokenC+”’”;
//Program.Notify(“Curl string =”, CurlString);

var proc = new System.Diagnostics.Process {
StartInfo = new System.Diagnostics.ProcessStartInfo {
FileName = “curl”,
Arguments = CurlString,
UseShellExecute = false,
RedirectStandardOutput = true

// This gets the data if something returned (i.e. “echo xxxx”)
while (!proc.StandardOutput.EndOfStream) {
string line = proc.StandardOutput.ReadLine();
Program.Notify(“Nest Thermostat Temp and Humidity”, line);

Program.Notify(“Nest Thermostat Temp and Humidity”,“Finished”);

This approach using Net.WebService() is not returning anything (my result is always blank):

Action NestThmermostatQuery = (string ipAddress) =>
var projectId = “YourOwnProjectId”;
var deviceId = “YourOwnDeviceId”;
var accessToken = “YourOwnAccessToken”;

var nestUrl = “” + projectId + “/devices/” + deviceId;
// Program.Notify(“Nest Url=”, nestUrl);

var request = Net.WebService(nestUrl)
.AddHeader(“Content-type”, “application/json”)
.AddHeader(“Authorization: Bearer”,accessToken);

Program.Notify(“request=”, request);

var result = request.GetData();
Program.Notify(“Result=”, result);
if (String.IsNullOrEmpty(result))
Program.Notify(“ERROR: no response received!”);

while (Program.IsEnabled) {
Program.Notify(“Call Nest API”);

And nothing more annoying than using other people’s scripts without giving the due credit they deserve by way of outlining the sources they came from.

Some really bad habits have crept into this forum over recent times, one being poorly formed or documented scripts. If a script is to be shared with others it should be clearly documented in the body of script the sources from where the initial work came from and who that work is originally attributed to or at least attach links to those sources.

I made the point already. There’s some very accomplished program coders both here and other forums who provide code on a free to use basis and are entitled to have their efforts credited where due. Changing the odd header or variable in someone else’s code without giving the source of the code or the context of the script is disingenuous and clearly not keeping with the spirit of open source and discourages other experienced coders from making further contributions.

At least you are now aware of this etiquette and no doubt you will provide the credits and sources where applicable.

If you lift code from another source without giving context you cannot expect others to comment or contribute here.

As I said the point is made. We don’t want others to feel they cannot contribute coded solutions without them turning up an alternative forums uncredited. This is not within the spirit of this forum and likewise its impossible to comment productively on code snippets here without sources or context.

Other than that it’s entirely your decision weather you post here or not but etiquette and best practices are important elements for a properly functioning forum. This forum relies heavily on those elements.