Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schlage integration requiring reauth every few hours since 2023.12 upgrade #105270

Closed
elarsson1 opened this issue Dec 8, 2023 · 8 comments · Fixed by #105349
Closed

Schlage integration requiring reauth every few hours since 2023.12 upgrade #105270

elarsson1 opened this issue Dec 8, 2023 · 8 comments · Fixed by #105349

Comments

@elarsson1
Copy link

The problem

Since updating to HA Core 2023.12, entities exposed by the Schlage integration (two Encode locks) have gone Unavailable and notifications have prompted me to re-authenticate to Schalge (3 times in the past 24 hours since I've updated to 2023.12).

I suspect but cannot confirm that the reauth support added in #103351 is now triggering the reauth flow as a result of transient errors polling the API which were ignored before.

What version of Home Assistant Core has the issue?

core-2023.12.0

What was the last working version of Home Assistant Core?

core-2023.11.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Schlage

Link to integration documentation on our website

https://www.home-assistant.io/integrations/schlage

Diagnostics information

config_entry-schlage-2a78206c4fb8bf11f008c1bfe97eaf5d.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.schlage
Source: helpers/update_coordinator.py:353
Integration: Schlage (documentation, issues)
First occurred: December 6, 2023 at 8:00:09 PM (3 occurrences)
Last logged: 8:22:50 PM

Authentication failed while fetching schlage (REDACTED_EMAIL) data: Unauthorized

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Dec 8, 2023

Hey there @dknowles2, mind taking a look at this issue as it has been labeled with an integration (schlage) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of schlage can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign schlage Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


schlage documentation
schlage source
(message by IssueLinks)

@elarsson1
Copy link
Author

elarsson1 commented Dec 8, 2023

Supporting the theory that the re-auth flow is being triggered by some transient API error, reloading the integration without responding to the re-auth prompt also restores the entities.

I should be able to automate a workaround based upon entities going to Unavailable for a certain time period. Unfortunately reloading the integration does not clear the re-auth notification or remove the prompt to reconfigure the integration from Devices and services.

I suspect an HA restart also clears it, which i will try when I'm next prompted to re-auth.

@pm0u
Copy link

pm0u commented Dec 8, 2023

I am also experiencing this issue, and it does seem to line up with this update for me as well

@dknowles2
Copy link
Contributor

I saw this appear on my instance as well, and I agree with the assessment here.

My guess is that the API is sometimes returning a 401, which we treat as an unauthorized error, per HTTP spec. (https://github.com/dknowles2/pyschlage/blob/main/pyschlage/auth.py#L68-L69) But there's a different class of unauthorized error from the API that is more application-specific (https://github.com/dknowles2/pyschlage/blob/main/pyschlage/auth.py#L42-L45), which makes me think that the 401 error is a transient error coming from a proxy or LB somewhere in the serving stack.

I'll cut a new pyschlage release later tonight to remove the NotAuthorizedError on 401 and have it instead just return the HTTPError from requests. Once that's cut I'll bump it in HA, which should hopefully fix the problem.

@myevit
Copy link

myevit commented Dec 9, 2023

Same Issue.

@cnovicktx
Copy link

Unfortunate for me, the Schlage re-authentication issue is still occurring.

I have updated to the latest version as shown below:

Core
2023.12.1
Supervisor
2023.11.6
Operating System
11.2
Frontend
20231208.2

@pm0u
Copy link

pm0u commented Dec 11, 2023

@cnovicktx I don't believe this has been included in a released version yet, just merged into dev.

@dknowles2
Copy link
Contributor

Correct. Also note that restarting HA will resolve the issue without needing to actually reauthenticate.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants