go-ecobee icon indicating copy to clipboard operation
go-ecobee copied to clipboard

Unclear how to do first-time auth

Open joeshaw opened this issue 2 years ago • 4 comments

I am unsure how to create an app ID for use with the tool. The README says,

Create an Ecobee API Application ID (API key) at https://www.ecobee.com/consumerportal/index.html#/dev

You probably want to use the ecobee PIN authorization method for non-web based tools.

But when I visit this page, and hit the "Add Application" button, I see:

image

It wants a PIN before presumably issuing me an app ID.

It's not clear to me how to get a PIN from go-ecobee, and the tool wants an app ID before it does anything. There doesn't appear to be an explicit auth command, so it feels like a chicken and egg problem.

If I just put some random string into my config for the app ID and run go-ecobee list, I get:

% go-ecobee list
2023/10/16 13:56:21 error fetching thermostats: error on get request: Get "https://api.ecobee.com/1/thermostat?json=%7B%22selection%22%3A%7B%22selectionType%22%3A%22registered%22%2C%22selectionMatch%22%3A%22%22%2C%22includeRuntime%22%3Afalse%2C%22includeExtendedRuntime%22%3Afalse%2C%22includeElectricity%22%3Afalse%2C%22includeSettings%22%3Afalse%2C%22includeLocation%22%3Afalse%2C%22includeProgram%22%3Afalse%2C%22includeEvents%22%3Afalse%2C%22includeDevice%22%3Afalse%2C%22includeTechnician%22%3Afalse%2C%22includeUtility%22%3Afalse%2C%22includeManagement%22%3Afalse%2C%22includeAlerts%22%3Afalse%2C%22includeWeather%22%3Afalse%2C%22includeHouseDetails%22%3Afalse%2C%22includeOemCfg%22%3Afalse%2C%22includeEquipmentStatus%22%3Afalse%2C%22includeNotificationSettings%22%3Afalse%2C%22includePrivacy%22%3Afalse%2C%22includeVersion%22%3Afalse%2C%22includeSecuritySettings%22%3Afalse%2C%22includeSensors%22%3Afalse%2C%22includeAudio%22%3Afalse%7D%2C%22page%22%3A%7B%22totalPages%22%3A0%2C%22pageSize%22%3A0%2C%22total%22%3A0%7D%7D": error on initial authentication: invalid server response: 400 Bad Request

Which makes sense I guess.

So, some additional instructions on how to complete the first run process would be helpful.

joeshaw avatar Oct 16 '23 18:10 joeshaw

Oh, also worth noting that I think the URL has changed. ...#/dev no longer works, I think it is now https://www.ecobee.com/consumerportal/index.html#/my-apps.

joeshaw avatar Oct 16 '23 18:10 joeshaw

It didn't occur to me to try an empty ~/.go-ecobee.yaml file until just now, but if I do that I get a 401 Unauthorized error instead of the 400 Bad Request error I mentioned above.

joeshaw avatar Oct 16 '23 18:10 joeshaw

Ok, the missing piece was that I needed to register as a developer first at https://www.ecobee.com/home/developer/loginDeveloper.jsp to get the developer console in the main Ecobee portal, which lets me generate an app ID.

(And to register as a developer, you must not have 2FA enabled.)

I think it'd still be helpful to have that info available in the README.

joeshaw avatar Oct 16 '23 19:10 joeshaw

This is improved by #14, but there are few other suggested doc changes that we should do.

rspier avatar Jan 20 '24 06:01 rspier