Ecobee binding v2

Yessss Sir ! You got it right! All is OK now. It works !
Here is my new code excerpt, so simple :grinning: so powerful :smiley:

val newHeat = (runtime_desiredHeat.state as QuantityType<Number>) - 0.5|"°C"
val newCool = (runtime_desiredCool.state as QuantityType<Number>) + 0.5|"°C"

logInfo("HeatHold", "LAURENT: Setting heat setpoint to " + newHeat.toString + " and cooling at " + newCool.toString)

val ecobeeActions = getActions("ecobee","ecobee:thermostat:xxxxx")
ecobeeActions.setHold(newCool,newHeat)

Log:
LAURENT: Setting heat setpoint to 18.50 °C and cooling at 25.00 °C

Thank you so much mhilbush, you make my day!

1 Like

Thanks. I tried again after the official update for 2.5.11 (I thought maybe I did something wrong with the manual update), but still had the same problem, so I went ahead with nuking the OAuth json files, and this time everything worked as expected. So strange.

Has anyone noticed that the units for the forecast0…9#pressure channel items seem to be incorrect. It appears the number is actually hPA instead of inHg units. I tried using the inHg UOM and get the same value, but when I tried hPA the value returned was clearly wrong and it appears it was converting the value that is actually and hPa unit to a very much larger hPa.

Thanks for reporting. I’ll take a look.

Well, the Ecobee API doesn’t specify the units, so what I’m using very well might be wrong.

It looks like it comes back from the API in millibars. So I need to use Units.MILLIBAR instead of ImperialUnits.INCH_OF_MERCURY.

          {
            "weatherSymbol": 1,
            "dateTime": "2020-12-20 18:01:30",
            "condition": "Mostly Cloudy",
            "temperature": 391,
            "pressure": 1016,
            "relativeHumidity": 86,
            "dewpoint": 351,
            "visibility": 16000,
            "windSpeed": 3,
            "windGust": -5002,
            "windDirection": "S",
            "windBearing": 169,
            "pop": 0,
            "tempHigh": 440,
            "tempLow": 305,
            "sky": 4
          },

Issue opened.

Thanks Mark.

It looks like it comes back from the API in millibars. So I need to use Units.MILLIBAR instead of ImperialUnits.INCH_OF_MERCURY.

They’re probably reporting in hectopascal, which I think is the SI unit that Openhab uses, not millibars. For the numerical value, they are identical, though.

Possibly, but I was assuming millibar. Except for visibility, which is in meters, all the other values returned by the API are Imperial units. Shouldn’t matter, though, as they are numerically identical as you point out. When OH converts to SI, you should get the hPa unit.

This will be fixed in the latest 3.0 snapshot. Please let me know if you believe the problem is resolved.

Ok, thanks. I am about a month away from migrating to 3.0.

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)