Unable to register ecobee to beestat

Hi, I’m currently encountering issues with authorizing beestat I think?

I’ve tried a few times to “connect my ecobee” but it just hangs and eventually loads an error page.

From my end it looks like the auth happens on the ecobee side. It then looks to make a call to app.beestat.io’s initialize method and falls over.

 {"success":false,"data":{"error_message":"Ecobee returned invalid JSON.","error_code":10502}}

Checking dev tools, I don’t see any correlation IDs I can share with you, but I did see this in the params, which might help you track down whats wrong:

arguments:

{“code”:“k7APw3MO8JsE_lum”}

FWIW the method call is returning HTTP 500.

I can PM you my serial if you need check on the backend for problems. Let me know how I can help.

I have another user with a similar issue. Could you PM me your thermostat serial number so I can enable verbose debugging and have you try again?

Actually, that may not be useful. Other questions:

  1. Are you an ecobee SmartBuildings customer?
  2. Are you the primary user on the ecobee account or has someone else given you access to theirs?
  1. Nope, just a plain ecobee4

  2. This could certainly be related. When I originally set up the ecobee, I used my partners’ phone and email. However, I’m using my account for trying to authorize API access for beestat. Could certainly be janky design on their end that doesn’t allow secondary accounts to authorize API access. I will try with the base account later today.

Sending you the serial. You should see it in your PMs shortly.

Bingo.

Using my partners credentials to authorize API access worked.

Couple Thoughts:

  1. Haven’t read the code yet; Are errors in the auth flow handled? this seems like a good case to watch for.
  2. May need to file a bug with Ecobee; Sounds like there could be a problem here with their auth schema. In fact, I don’t even see anywhere in the ecobee front-end that authorizations for API access is even surfaced? Is this hiding somewhere I haven’t seen?

Cheers. I’ll have a gander at the code - if you want to collab on a PR, we can do that.

Thanks for making this sweet little platform.

Thanks for helping to figure this one out. I have another user with (likely) the same problem: Connecting fails if you are not the primary user on the ecobee account · Issue #309 · beestat/app · GitHub

As far as errors in the authorization go, I am “handling” simple errors by looking for well-formed JSON responses and ensuring that I actually get a token back.

In this case, the authorization succeeds but the first sync returns no thermostats which is not expected or handled. I can handle this crudely just by detecting this and throwing an exception with a more useful error message.

You’re welcome to submit a PR but it’ll be difficult to test it unless you get beestat up and running on your own server. Not impossible just not really documented.

I’ll do some more validation of the issue and reach out to ecobee to confirm their intent. Also, they do show third party authorizations under the “My Apps” section of the sidebar if you log in to your ecobee account.

No problem.

Have a look at what I posted in the github issue - I believe we’re on to something, just need to validate it.

I’ve gone ahead and marked a solution on here - as the workaround for now is just to use the primary account holder for the time being.

1 Like