Ecobee binding v2

Suddenly I’m getting the following error:

2020-12-23 07:42:07.381 [ERROR] [oauth2client.internal.OAuthConnector] - grant type refresh_token to URL https://api.ecobee.com/token failed with HTTP response code 404
2020-12-23 07:42:07.385 [INFO ] [inding.ecobee.internal.api.EcobeeApi] - API: Got exception trying to get access token from OAuth service
org.eclipse.smarthome.core.auth.client.oauth2.OAuthException: Bad http response, http code 404
        at org.eclipse.smarthome.auth.oauth2client.internal.OAuthConnector.doRequest(OAuthConnector.java:321) ~[?:?]
        at org.eclipse.smarthome.auth.oauth2client.internal.OAuthConnector.grantTypeRefreshToken(OAuthConnector.java:181) ~[?:?]
        at org.eclipse.smarthome.auth.oauth2client.internal.OAuthClientServiceImpl.refreshToken(OAuthClientServiceImpl.java:300) ~[?:?]
        at org.eclipse.smarthome.auth.oauth2client.internal.OAuthClientServiceImpl.getAccessTokenResponse(OAuthClientServiceImpl.java:333) ~[?:?]
        at org.openhab.binding.ecobee.internal.api.EcobeeApi.isAuthorized(EcobeeApi.java:150) ~[?:?]
        at org.openhab.binding.ecobee.internal.api.EcobeeApi.performThermostatSummaryQuery(EcobeeApi.java:197) ~[?:?]
        at org.openhab.binding.ecobee.internal.handler.EcobeeAccountBridgeHandler.refreshThermostats(EcobeeAccountBridgeHandler.java:233) ~[?:?]
        at org.openhab.binding.ecobee.internal.handler.EcobeeAccountBridgeHandler.refresh(EcobeeAccountBridgeHandler.java:225) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_252]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_252]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_252]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]

As far as I know nothing has changed except and update was applied via apt-get update and a reboot.

openhab> version
4.2.7
openhab> bundle:list | grep Ecobee
217 x Active x  80 x 2.5.11                  x openHAB Add-ons :: Bundles :: Ecobee Binding

Someone also saw this recently. I’ll see if I can find that post.

Have you reauthorized with Ecobee following the changes they made to their auth system on December 1?

Here’s the link to the other post.

I have reauthorized recently for this same error, but I don’t know if it was after December 1st or not. I didn’t know they made changes. I’ll check out the post and respond.

It isn’t giving me a pin as the documentation says it should be. It just keep throwing the 404 error and the account thing status shows: ‘Status: OFFLINE - CONFIGURATION_PENDING Checking authorization’.

I’m not sure why, but some people have needed to do this to resolve the issue.

1 Like

Well, it’s probably because the binding doesn’t know how to deal with a 404 response when requesting an access token, as that’s not an expected response when calling that API endpoint.

This fixed it. Thanks! Hopefully it won’t happen again anytime soon, that is twice in under 2 months or less (not sure exact amount of time)

@mhilbush just for your attention, Kai found some issues with the ecobee binding thread usage while we were going dumpster diving for a thread exhaustion problem. I opened a bug based on his notes. Just making sure you are aware of it.

@morph166955 I saw the issue. So it appears to me that the root cause of the problem is the Samsung binding, as it causes all other calls to thingDiscovered to block. If you remove that binding, I would expect your system to function correctly.

Agreed. The SamsungTV binding is the root cause here. I think Kai just noticed the issue on the ecobee binding as he was going through my thread dump from the failed state.

Yeah, I’m working on that now. :wink:

I updated to 2.5.11 about a week ago due to the ecobee auth changes and I just noticed that the settings fanMinOnTime channel is not working (at least for my setup). Looking at the things discovery in paper ui, the fanMinOnTime channel is missing (yet in ecobee developer api docs, it should still exist).

It appears it is not being enumerated for some reason with 2.5.11. Are others seeing this issue?

Thanks

I just updated to Openhab3 and I can’t get past the ‘Status: OFFLINE - CONFIGURATION_PENDING Checking authorization’. Deleting the StorageHandler.For.OAuthClientService.json in the Openhab folder didn’t make any difference. My openhab.log is full of this:

2020-12-24 19:13:32.586 [INFO ] [inding.ecobee.internal.api.EcobeeApi] - API: The Ecobee authorization process threw an exception
org.openhab.binding.ecobee.internal.api.EcobeeAuthException: invalid_grant: The authorization grant, token or credentials are invalid, expired, revoked, do not match the redirection URI used in the authorization request, or was issued to another client.
	at org.openhab.binding.ecobee.internal.api.EcobeeAuth.authorize(EcobeeAuth.java:137) ~[bundleFile:?]
	at org.openhab.binding.ecobee.internal.api.EcobeeAuth.doAuthorization(EcobeeAuth.java:100) ~[bundleFile:?]
	at org.openhab.binding.ecobee.internal.api.EcobeeApi.isAuthorized(EcobeeApi.java:168) [bundleFile:?]
	at org.openhab.binding.ecobee.internal.api.EcobeeApi.performThermostatSummaryQuery(EcobeeApi.java:199) [bundleFile:?]
	at org.openhab.binding.ecobee.internal.handler.EcobeeAccountBridgeHandler.refreshThermostats(EcobeeAccountBridgeHandler.java:233) [bundleFile:?]
	at org.openhab.binding.ecobee.internal.handler.EcobeeAccountBridgeHandler.refresh(EcobeeAccountBridgeHandler.java:225) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

@SRGDamiano I did a new install of OH3 yesterday and got this message in the log. If you are not seeing this, may be try delete and reinstall the binding? Once I authorize this on the Ecobee site, everything seems to be working fine.

2020-12-21 16:31:59.037 [INFO ] [nding.ecobee.internal.api.EcobeeAuth] - #################################################################
2020-12-21 16:31:59.037 [INFO ] [nding.ecobee.internal.api.EcobeeAuth] - # Ecobee: U S E R   I N T E R A C T I O N   R E Q U I R E D !!
2020-12-21 16:31:59.037 [INFO ] [nding.ecobee.internal.api.EcobeeAuth] - # Go to the Ecobee web portal, then:
2020-12-21 16:31:59.037 [INFO ] [nding.ecobee.internal.api.EcobeeAuth] - # Enter PIN 'XXXX-XXXX' in My Apps within 900 minutes.
2020-12-21 16:31:59.037 [INFO ] [nding.ecobee.internal.api.EcobeeAuth] - # NOTE: All API attempts will fail in the meantime.

I got it to work, and got the pin from the web ui like the documentation said. I just had to delete the ecobee account “thing” that had been imported from openHab2 and create a new one. I also uninstalled and reinstalled the binding and cleared the cache a few times, but I think it was just that I needed to create a new thing.

I was really trying to delete and re-create any “things” because I didn’t want to have to go through all of the adding items and channels again and all the other imported things came through ok. I shouldn’t have been afraid; because the account is just a bridge to the thermostat and the thermostat to the sensors, even though I deleted the account, I could re-link all those things to the new bridge and they came online right away. So I didn’t have to link any new channels after all. Whew. Thank you!

The fanMinOnTime channel is defined as advanced, so you need to click “Show More” in Paper UI to see it.

@morph166955 Are you running 3.0? If so, would you be interested in running a test version of the Ecobee binding with a reworked discovery process?

Yes sir I am! Fire away!

@morph166955 Here’s a version with the reworked discovery process. Note that this one is tagged 3.1 in case you have a 3.0 version in the addons directory.

https://github.com/mhilbush/openhab-binding-releases/blob/master/ecobee/org.openhab.binding.ecobee-3.1.0-SNAPSHOT.jar?raw=true

With discovery enabled in the account bridge thing, every discovery interval (5 minutes) you should now see debug logs that look similar to this.

2020-12-25 12:40:40.585 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Discovering Ecobee devices
2020-12-25 12:40:40.586 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Discovering thermostats
2020-12-25 12:40:40.586 [DEBUG] [org.openhab.binding.ecobee.internal.api.EcobeeApi ] - API: Perform query on thermostat: 'null'
2020-12-25 12:40:41.079 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Thermostat with id 'YYY' and name 'Upstairs' added with UID 'ecobee:thermostat:account:YYY'
2020-12-25 12:40:41.081 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Thermostat with id 'XXX' and name 'Main Floor' added with UID 'ecobee:thermostat:account:XXX'
2020-12-25 12:40:41.082 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Discovering sensors
2020-12-25 12:40:41.082 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Discovering sensors for thermostat 'YYY'
2020-12-25 12:40:41.083 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Sensor for 'YYY' with id 'rs:100' and name 'Office' added with UID 'ecobee:sensor:account:YYY:rs-100'
2020-12-25 12:40:41.085 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Sensor for 'YYY' with id 'rs:101' and name 'Master Bedroom' added with UID 'ecobee:sensor:account:YYY:rs-101'
2020-12-25 12:40:41.086 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Sensor for 'YYY' with id 'ei:0' and name 'Upstairs' added with UID 'ecobee:sensor:account:YYY:ei-0'
2020-12-25 12:40:41.086 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Discovering sensors for thermostat 'XXX'
2020-12-25 12:40:41.087 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Sensor for 'XXX' with id 'rs:100' and name 'Family Room' added with UID 'ecobee:sensor:account:XXX:rs-100'
2020-12-25 12:40:41.089 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Sensor for 'XXX' with id 'rs:101' and name 'Kitchen' added with UID 'ecobee:sensor:account:XXX:rs-101'
2020-12-25 12:40:41.089 [DEBUG] [g.ecobee.internal.discovery.EcobeeDiscoveryService] - EcobeeDiscovery: Sensor for 'XXX' with id 'ei:0' and name 'Main Floor' added with UID 'ecobee:sensor:account:XXX:ei-0'