Ecobee 3 Remote Sensors into ST

Hi @storageanarchy, you may want to try my new smartapp, ecobeeSetZoneWithSchedule.

This smartapp allows you to set your zone settings and control smart vents like EcoVents, Econet, or Keen Home vents, but based on ecobee’s own program schedules (ex. Awake, Sleep, Home).

This way you can still rely on ecobee’s scheduling, control your smart vents, and adjust your setpoints according to an outdoor sensor if needed.

The smartapp is in my beta branch:

https://github.com/yracine/device-type.myecobee/blob/beta/smartapps/ecobeeSetZoneWithSchedule.groovy

Let me know how it goes.

Hello @gwithers105, @Drewbert34, @swamplynx, @gator94 and others who have experienced losing their connection to ecobee in the past weeks:

I made some changes yesterday and tested it with @storageanarchy.

I implemented some new defensive code mechanisms in MyEcobee Device to set a minimum polling interval (set to 3 minutes) to avoid polling ecobee servers too many times.

For large ecobee3 installations such as @gwithers105 (who has 4 ecobee3 thermostats), this could reduce
the overall load on the ecobee servers, and avoid the unauthorized exceptions.

Also, I made some changes to the ecobee3RemoteSensorInit smartapp to avoid doing unecessary polls() to MyEcobeeDevice, again in order to reduce the overall load on the ST and ecobee platforms.

To implement the new code in your environment, please do the following (as usual):

(1) If you have My Ecobee Device’s trace set to ‘true’, please set it back to blank to avoid detailed logging
on a continous basis (this input parameter is used just for debugging purpose only)

a) Go to https://graph.api.smartthings.com/device/list
b) Click on My Ecobee device
c) Edit the preferences (middle of the page)
d) Set verboseTrace to blank (remote the true value if any)
e) Click Save at the bottom of the page

(2)Grab the latest version of MyEcobee Device at github:

Save and Publish.

(3) Clear your cache as the old Device may be cached

On Android, you’d need to go to settings/apps/smartthings and clear cache.

On iOS, you’d need to uninstall the smartThings app and reinstall it.

(4) Execute ecobee3RemoteSensorInit and change the polling interval within ecobee3RemoteSensorInit from 5 minutes (or from 10 minutes) to at least 15 minutes in order to avoid reaching any ST platform’s constraints (ex. max app execution time constraint).

Let me know how it goes!

Thnx for your patience.

2 Likes

@yvesracine How often does ST poll your ecobee device for temperature? I’m trying to use my ecobee temp to control and external window AC using Virtual Thermostat, and having a bit of trouble. Not sure how often the temp is being read so I figured I’d start there.

Hi @adamzeis,

By default, in general, I think ST polls devices (that implement polling) every hour or so.

The My Ecobee Init smartapp polls your ecobee thermostat(s) every 20 minutes in order to keep
its refresh token alive (for authorization purposes).

To see the actual polling done by My Ecobee Init smartapp, just do the following:

  1. Click on https://graph.api.smartthings.com/location/list

And, then click on “smartapps” at the right for your location.

Then scroll down to My Ecobee Init, and click on it. You should see something like this:

FYI, every time, a poll() command is sent to My Ecobee Device, it does not necessarily mean that the
temperature or any other attributes will be shown in the events list as the device type only
updates the attributes whose value has changed. So, if your indoor temperature is constant, nothing will
show in the events list for a while till there is a variation.

Regards.

Hi yvesracine,

I have installed your latest device type and change mode and resume prog apps for my ecobee3 and they continue to fail with internal server error and unauthorized token refresh. Everything worked perfectly for 6 weeks but stopped working 1 or 2 weeks ago. What can I do to fix this?

PS Have you considered putting a human friendly version number or change date in comments at top of all code so we can be sure we have published latest versions?

PS2 I am relatively new to ST but your instructions are very good even for new ST users and your code and applications are high quality and incredibly useful. It’s developers like you that make ST the best hub the industry.

Hello @jdolan01

Here is my statement about this issue. I’m repeating what I’ve said before in this thread.

My ecobee Init is a smartapp that polls the My ecobee device(s) on a regular basis to ensure that the refresh token is renewed on a regular basis. Ecobee requires (contrary to some other cloud providers) to refresh its authorization token every 59 minutes for greater security. The code that I’ve developed is an interface between ST and ecobee, so there are some dependencies on both platforms.

The algorithm within MyEcobeeInit and MyEcobee device has been coded to renew automatically the token every 55 minutes or so. If it fails to renew the token, then the connection with ecobee will be lost.

As you can see, the algorithm will work the same after 1 hour or several days. So, if the smartapp works for more than 1 hour, it should work for days even months without issues provided that there are no other external factors (ex. connection issues between ST and ecobee or with your physical thermostat).

You can infer that there are 3 potential “points of failure”:

(1) It could be an issue on the ecobee side: there could be a temporary network issue or an issue with the ecobee servers.

For the past months, it has happened more frequently.

See this thread at the ecobee forum:

http://developer.ecobee.com/api/topics/ecobee-servers-outage

Ecobee just recently admitted that there were some issues on their side also. I’ve asked for a status page so that everbody would be aware of any outages on their side (similar to ST’s status page).

(2) It could due to a (temporary) bad internet connection on your side. Ecobee thermostats connect thru wifi, so if the physical thermostat is not connected for a while, then you may not have control over the thermostat during that timeframe.

(3) It could also be an issue on the ST side. We’ve all experienced issues with ST scheduling. If the smartapp is not rescheduled every 20 minutes, and you don’t manually poll the thermostat thru ST, then the “refresh token” will not be obtained, and the authorization token will be lost.

In the logs, if one of these 3 potential points of failure happens, there will be an error msg such as

refresh_tokens> Authentication error, ecobee site cannot be reached

or some unauthorized exceptions

These points of failure are not easy to investigate.
I had myself a similar issue in the past month (2 or 3 times) after months of continual operation.

For the point of failure no 3, in the IDE, you can check if the smartapp is rescheduled to run every 20 minutes by clicking on

https://graph.api.smartthings.com/location/list

And, then click on “smartapps” at the right for your location.

Then scroll down to My Ecobee Init, and click on it. You should see something like this:

If you don’t see any waiting “takeAction” job with a future timestamp then it means that the job has not been rescheduled correctly.

You can also do the same for the ecobee3RemoteSensorInit smartapp, if your sensors are not updating within SmartThings, it could also be a connection issue (as stated above) or a ST scheduling issue.

See this other ST threads about this common issue with the scheduler:


HOW TO FIX THE UNAUTHORIZED ISSUES:

To fix these issues, you have to reschedule My ecobee Init and re-authorize ST with ecobee by executing
My Ecobee Init again.

The same thing for the ecobee3’s remote sensors, if you have an issue, please re-execute ecobee3RemoteSensorInit.

Sadly, I’ve tried to implement many workarounds in my code, but the real issue is rooted in the ST platform and/or on the ecobee side. My code is just an interface between the 2, and if one platform fails, my code will not be able to recover in all situations.

At my home, the scheduler has been running fine for about a week now, so hopefully, if you reschedule My Ecobee Init, it should be fine for weeks or (and hopefully) months of operation.

P.S. If you have a large installation of ecobee3 thermostats (more than 3 and many remote sensors), I’d recommend to create many instances of My Ecobee Init and split the thermostats amongst the My Ecobee Init instances as the ST platform reaches sometimes a max execution time constraint.

I had everything working perfectly for several weeks with my one ecobee3. Then, without changing anything, I started getting unauthorized errors 100% of the time for several weeks and all ecobee apps were unusable. A persistent and not an intermittent problem. Running My ecobee Init multiple times did not help. I checked scheduling of my apps and everything look good, just constant unauthorized. I contacted Ecobee technical support and they said to contact SmartThings. I finally deleted all ecobee apps (Init, ResumeProg, and ChangeMode), and then reinstalled, ran ecobee Init as part of reinstall, and everything is working perfectly again, for several days now.

@jdolan01, thnx for the feedback.

I made several changes today to the beta branch for beta testing, as I’m trying to
implement a better exception handling and some notifications to the ST users in case
of excessive exceptions in their logs.

My latest versions are the following:

My Ecobee Device type
My Ecobee Init with new notification page.
ecobee3RemoteSensorInit

You can just grab the code, save and publish in the IDE. You don’t need to
uninstall and re-install everything.

Let me know how it goes in a week or so,
Regards.

Hi Yvesracine,

I wanted to thank you for all your hard work. I’ve been following this thread for about one year, but had only recently taken then time to make my complex installation work.

I have 4 ecobee3 thermostats with a total of 12 sensors (including the sensors reporting from the thermostats themselves).

Aside from the complete messy view in ST of all these sensors and ecobees, your set up (device 2.0.13/init 1.9.4/remotesensor 1.1.4) has thus far worked well with one small exception.

In the remote sensor set up, I can’t get my 4th ecobee zone sensors to work. I have created a new instance of the remotesensor for each ecobee zone in my home, and the 4th one is recognized, but I get a blank screen when normally the list of sensors appear. I receive the following errors in the ecobee3RemoteSensorInit log:

java.lang.NullPointerException: Cannot invoke method generateRemoteSensorEvents() on null object @ line 68
java.lang.ArrayIndexOutOfBoundsException: 1 @ line 90

Is this because I’m coming up against a total sensor capacity number? I couldn’t tell by just looking at the code.

There are two other possibilities I’m troubleshooting- they may help your response:

  1. The last 2 ecobees, including the one giving me trouble - were installed earlier this afternoon and still have the older firmware 3.5 that I recall had weaker sensor support.

  2. The last zone has one sensor that fails to maintain a connection to the thermostat- I stupidly installed it next to a light switch and I think this is interfering.

Lastly, is there a way to poll for humidity using RemoteSensor? I only see Temp and Motion.

Your feedback on this is greatly appreciated and thanks again.

Hello @Ihdihd,

  1. To get reliable occupancy data from ecobee, you’d need to contact ecobee support in order to upgrade to 3.6 firmware.

Version 3.5 does not provide any occupancy data and this may cause some of your problems.

That being said, you should still be able to retrieve temp data from your remote sensors.

  1. I made some additional changes this morning to avoid null pointer exception when retrieving occupancy data, so please grab the latest version at github::

My Ecobee Device
ecobeeRemoteSensorInit

  1. Prior to execute ecobeeRemoteSensorInit, set the My Ecobee Device’s trace preference flag to ‘true’ in order to get more detailed tracing (if you need more instructions about this, see step7 in my readme at http://github.com/yracine/device-type.myecobee)

  2. Please PM the logs of any exceptions, errors in the IDE live logging related to My Ecobee Device and
    ecobeeRemoteSensorInit (only those 2).

In any case, let me know how it goes.

Regards.

P.S. There is no maximum number of remote sensors in my code. However, if you have 4 ecobee thermostats, I’d recommend to split them into 2 instances of MyEcobeeInit to avoid any issues with the ST platform (i.e. max execution time constraint).

And, finally, to my knowledge, humidity data is not provided yet by ecobee through the APIs, but my code is ready for it when the data will be available.

1 Like

Thanks for the quick help. I followed the steps and sent you a PM. Hopefully we can troubleshoot using the log response.

I’ve also sent ecobee a request to upgrade the firmware to 3.6+.

Regards,
ihdihd

Fantastic work! Can’t wait to pick up an Ecobee3 to give it a try.

I’m guessing we have technical limitations but is ther way way to use the sensors in real time? Motion sensors with a 15 minute delay aren’t very useful…

Hello @lobo5519,

Actually, this has been discussed for a while (at the beginning of this thread),

but ecobee doesn’t allow real-time events. Also, on the ST side,there are some rate limiting and max execution time constraints to take into account which is why the polling interval cannot be lower than 10 minutes (at least for the moment, maybe HubV2 will open new possibilities).

Anyhow, there are some ecobee constraints, see this ecobee thread about it:

And, here in the ecobee API documentation:

https://www.ecobee.com/home/developer/api/documentation/v1/objects/RemoteSensor.shtml

Which states (about motion occupancy):

The remote sensor data will only show computed occupancy, as does the thermostat. Definition - For a given sensor, computed occupancy means a sensor is occupied if any motion was detected in the past 30 minutes.

Regards.

I wanted to provide an update a few weeks into installing my 4 ecobee / 12 sensor set up.

Everything is working as expected in Yvesracine’s code with no issues. I’ve left the higher detail polling on and it is scary the amount of information that is passed over to ST from ecobee every 15 minutes.

As predicted the motion sensors are only good for looking at general motion (if my kids have moved into/out of their rooms in last 30 minutes, for example). The temperature sensors work very well.

I haven’t used the controls in ST to control the ecobee (just using for monitoring). I have some learning to do since a couple of test commands somehow changed the mode from COOL to AUTO (including heat), so I’ll keep playing around.

The last annoyance is more of an ST problem, and that is having to shake the device to get sensor/device names. Why they couldn’t just list them is well beyond me.

Thanks to Yvesracine to for all the work he has put into this - very good outcome for the teams.

@Ihdihd, the ST UI annoyance (shaking your device to get sensor/device names) will be soon a thing of the past as I’ve seen (and tested) the latest UI in Palo Alto, and this “feature” will no longer be required…

Hang on till then!

I have the ecobee remote sensors integrated into my smartthings. Until recently everything was working great. For 4 days now my remote sensors are no longer indicating motion / no motion in smartthings. They seem to still update temps. I tried reiniting the devices and still no go. Any suggestions?

Hello @ADamL, do the ecobee remote sensors correctly report motion at the ecobee portal and at the physical thermostat?

What is your firmware version at the therrmostat? Version 3.6 is recommended for reporting motion.

Let me know.

Thanks! Turns out it is my ecobee. They have not been accurately reporting motion for a couple of days. If I go on the homeiq reports they are correct but not in the thermostat or mobile app. UG, add it to the list of issues with my ecobee the last couple of months. I do have firmware 6.0.x.

Thanks and off to troubleshoot them again.

Just in case anybody else sees this issue. I talked to ecobee support and there is currently a problem where these sensors do not report occupancy to the web app or mobile app, but if you look on the thermostat they are working. I am assuming that if they dont work on the web app they wont work on the remote sensor st app. Ecobee knows of the issue and is working on root cause / fix. Basically this does not impact all customers but it does impact some, like me!