Core: August component broken for many people.

Created on 10 May 2019  ·  19Comments  ·  Source: home-assistant/core

-->

Home Assistant release with the issue:

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):
Running on Ubuntu 18.04

Component/platform:
https://www.home-assistant.io/components/august/

Description of problem:
August component is broken. It is not a username/pass issue. Error messages typically look like this:

Line 40: 2019-05-09 21:20:17 INFO (MainThread) [homeassistant.setup] Setting up august
Line 85: 2019-05-09 21:20:19 ERROR (MainThread) [homeassistant.setup] Error during setup of component august
Line 91:   File "/usr/local/lib/python3.7/site-packages/homeassistant/components/august/__init__.py", line 166, in setup
Line 92:     return setup_august(hass, config, api, authenticator)
Line 93:   File "/usr/local/lib/python3.7/site-packages/homeassistant/components/august/__init__.py", line 113, in setup_august
Line 93:   File "/usr/local/lib/python3.7/site-packages/homeassistant/components/august/__init__.py", line 113, in setup_august
Line 95:   File "/usr/local/lib/python3.7/site-packages/homeassistant/components/august/__init__.py", line 177, in __init__
Line 97:   File "/usr/local/lib/python3.7/site-packages/august/api.py", line 146, in get_doorbells
Line 99:   File "/usr/local/lib/python3.7/site-packages/august/api.py", line 296, in _call_api
Line 103: requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api-production.august.com/users/doorbells/mine

Others are reporting the same issue as seen at:

https://community.home-assistant.io/t/august-lock-invalid-config/112172/2

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


Traceback (if applicable):


Additional information:

august

Most helpful comment

I opened a PR on the upstream library used to interact with the August API which adds support for refreshing the access token:

https://github.com/snjoetw/py-august/pull/23

As soon as this is merged, it should be pretty straightforward to leverage the support in the HomeAssistant component. The end result would be that you'd never need to go through the authentication flow again. The token would stay active forever (until August changes their API).

All 19 comments

have you tried the fix you did in this issue?
https://github.com/home-assistant/home-assistant/issues/19286

HOLY crap. I COMPLETELY forgot about that. It's hell getting old. But,
that begs the question....why do I have to keep doing this over and over??
There still seems to be an issue, i.e. I shouldn't have to do this.

On Fri, May 10, 2019 at 3:24 AM aidbish notifications@github.com wrote:

have you tried the fix you did in this issue?

19286 https://github.com/home-assistant/home-assistant/issues/19286


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/issues/23788#issuecomment-491204306,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI2LHWCVSBUIA5EPUARS273PUUWMBANCNFSM4HL7RNCQ
.

You'll probably find its on the august end, they probably require a new token after a certain amount of days

Tokens expire after 4 months. Currently HA does not automatically detect and renew...

Build an automation to delete the file after X months?

I suppose you could, but it should be easy to find a fix in the plugin startup.

The .august.config even has the token expiry date and time in it:

"access_token_expires": "2019-05-11T19:56:29.625Z", "state": "authenticated"

Seems like it should be simple for the plugin to evaluate if the current date and time is past this and set the state to "requires_authentication" (for next plugin initialization) or just trigger one right away.

Wow. I agree. If the plugin already knows the expiration date, then it
should expire on time and automatically require re-authentication as
opposed to users just wondering why their shit is broken.

On Wed, May 15, 2019 at 8:04 PM sreknob notifications@github.com wrote:

I suppose you could, but it should be easy to find a fix in the plugin
startup.

The .august.config even has the token expiry date and time in it:

"access_token_expires": "2019-05-11T19:56:29.625Z", "state":
"authenticated"

Seems like it should be simple for the plugin to evaluate if the current
date and time is past this and set the state to "requires_authentication"
(for next plugin initialization) or just trigger one right away.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/issues/23788?email_source=notifications&email_token=AI2LHWCDM6CNKI4LFKJ7W7TPVSXLJA5CNFSM4HL7RNC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVQLLUY#issuecomment-492877267,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI2LHWAOZZ5XS4W2BQCTHW3PVSXLJANCNFSM4HL7RNCQ
.

Not sure why the previous issue was closed, clearly the component only half implements authentication.

I agree it should prompt the user that the token has expired and ask the user if they want to re-authorize. Then then prompt for the auth code after triggering it.

Why don't we inspect the JWT token and delete the file if it's expired or handle this better? There is no way the normal user is going to do know to do this.

Manually inspecting my token it looks like it will expire again next month.. The expiry date is clearly in the token, seems like if this integration will continue to use this unofficial method it should at least prompt the user to re-auth BEFORE it expires and then delete / renew the token.

Unless there is anyone willing to take it on, then its probably not going to change

I poked around with the August API a bit using mitmproxy. Turns out the response to every API request contains a x-august-access-token with a fresh JWT expiring 3 months from the time the request is made, regardless of the expiration time of the token used for the request.

So not even necessary to have expiration checking logic as long as the new tokens are being extracted on a regular basis.

I opened a PR on the upstream library used to interact with the August API which adds support for refreshing the access token:

https://github.com/snjoetw/py-august/pull/23

As soon as this is merged, it should be pretty straightforward to leverage the support in the HomeAssistant component. The end result would be that you'd never need to go through the authentication flow again. The token would stay active forever (until August changes their API).

The token would stay active forever (until August changes their API).

Would be a good API for Nabu Casa to get an official 3rd party hook for.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

This is till relevant.

Yale is now shipping the August module by default over their own so I suspect August devices will grow in popularity.

Thanks @sidoh This is being integrated as part of #31735

Excellent!

Was this page helpful?
0 / 5 - 0 ratings