bdraco / yalexs

Python API for Yale Access (formerly August) Smart Lock and Doorbell
MIT License
41 stars 19 forks source link

Brand.YALE_HOME auth seems to have broken recently #167

Open danricho opened 3 months ago

danricho commented 3 months ago

Hi, I've recently found that I keep getting 403 to many of the API endpoints which used to work. I cleared my token cache and now I can't get passed the session creation.

My script to re-create:

from yalexs.api import Api
from yalexs.authenticator import Authenticator, AuthenticationState
from yalexs.const import Brand

api = Api(timeout=20, brand=Brand.YALE_HOME)
authenticator = Authenticator(api, "email", "XXXXX", "YYYYY",
                              access_token_cache_file="yaleAuth.txt")

authentication = authenticator.authenticate()

# State can be either REQUIRES_VALIDATION, BAD_PASSWORD or AUTHENTICATED
# You'll need to call different methods to finish authentication process, see below
AuthenticationState = authentication.state

print(f"AuthenticationState: {AuthenticationState}")

Error:

Traceback (most recent call last):
  File "/pythonApp/yale-lock-data-gatherer/updater.py", line 12, in <module>
    authentication = authenticator.authenticate()
  File "/pythonApp/yale-lock-data-gatherer/venv/lib/python3.9/site-packages/yalexs/authenticator.py", line 79, in authenticate
    response = self._api.get_session(install_id, identifier, self._password)
  File "/pythonApp/yale-lock-data-gatherer/venv/lib/python3.9/site-packages/yalexs/api.py", line 52, in get_session
    return self._dict_to_api(
  File "/pythonApp/yale-lock-data-gatherer/venv/lib/python3.9/site-packages/yalexs/api.py", line 287, in _dict_to_api
    _raise_response_exceptions(response)
  File "/pythonApp/yale-lock-data-gatherer/venv/lib/python3.9/site-packages/yalexs/api.py", line 321, in _raise_response_exceptions
    raise err
  File "/pythonApp/yale-lock-data-gatherer/venv/lib/python3.9/site-packages/yalexs/api.py", line 294, in _raise_response_exceptions
    response.raise_for_status()
  File "/pythonApp/yale-lock-data-gatherer/venv/lib/python3.9/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.aaecosystem.com/session
bdraco commented 3 months ago

Yes its blocked https://community.home-assistant.io/t/psa-yale-home-integration-blocked-new-integration-coming/762999/17

danricho commented 3 months ago

That thread looks like it is now fixed in the latest version. I'm not using home assistant, but python direct so I will have to wait for a newer example that is compatible with the newer version of this.

Thanks for the efforts!

spraot commented 2 months ago

@danricho I had to rework my code to run on asyncio instead of threads to get newer versions of this lib working. pubnub still isn't giving me any events though. @bdraco is pubnub working at all, or will I need to migrate to using sockets instead? EDIT: i got pubnub working too now 👍