Skip to content

Fix Hive reauthentication on invalid device authentication - #238

Open
bigshow104 wants to merge 1 commit into
Pyhass:devfrom
bigshow104:fix/hive-reauth-signed
Open

bigshow104 wants to merge 1 commit into
Pyhass:devfrom
bigshow104:fix/hive-reauth-signed

Conversation

@bigshow104

Copy link
Copy Markdown

What does this change?

This PR adds HiveInvalidDeviceAuthentication to the exception handling in custom_components/hive/__init__.py.

When the Hive refresh token expires, the integration attempts to log in again. If Hive requires SMS two-factor authentication, the API can raise HiveInvalidDeviceAuthentication.

Previously, this exception was not handled, causing integration setup to fail without triggering Home Assistant's reauthentication flow.

The change raises ConfigEntryAuthFailed for this exception, allowing Home Assistant to display the existing Reauthenticate prompt without removing the integration or losing its devices and entities.

Related issues

Related to #224.

This PR replaces #237 to ensure the change is submitted with a verified, signed commit.

Testing

Successfully tested manually on two separate Home Assistant installations:

  • Home Assistant Core 2026.11.0
  • Hive Custom Component v2026.10.1
  • Reauthentication prompt appeared after restarting Home Assistant Core
  • SMS authentication completed successfully
  • Existing Hive devices and entities continued working

Checklist

  • Tests added or updated, and script/test passes
  • script/lint --check passes
  • If this is going into a release: bumped version in manifest.json

Automated tests and lint checks have not been run. The fix has been verified manually on two installations.

@bigshow104
bigshow104 requested a review from KJonline as a code owner November 8, 2026 12:27

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant