nkgilley / python-ecobee-api

Python API for controlling Ecobee Thermostats
MIT License
44 stars 40 forks source link

Implement support for web-based login flow #79

Closed JJTech0130 closed 2 months ago

JJTech0130 commented 2 months ago

Implements web-based login flow as described in https://github.com/nkgilley/python-ecobee-api/issues/78

Closes #78

JJTech0130 commented 2 months ago

Still needs regression testing, I do not have a developer API key

JJTech0130 commented 2 months ago

Here's some sample code to show it works:

import pyecobee
import logging

logging.basicConfig(level=logging.DEBUG)

test = pyecobee.Ecobee("ecobee.conf")
test.read_config_from_file()

print(test.get_thermostats())

Where ecobee.conf looks like this:

{"API_KEY": null, "AUTH0_TOKEN": "<your 'auth0' cookie here>"}

The process for getting the auth0 cookie is as follows:

  1. Login to https://ecobee.com as normal
  2. Visit https://auth.ecobee.com/404 or any other URL that does not redirect you from that domain
  3. Open DevTools and copy the cookie called auth0
JJTech0130 commented 2 months ago

Currently maintaining a HACS modified version of the Ecobee integration to support this, plus bugfixes/minor changes for myself. Might rewrite the whole thing soon, a lot of it is very janky. https://github.com/JJTech0130/ha-ecobee