Skip to content

fix: parse single-quoted SSO config values on the Hive login page - #169

Merged
KJonline merged 2 commits into
Pyhass:devfrom
matt-thepie:fix/sso-single-quotes-dev
Oct 20, 2026
Merged

KJonline merged 2 commits into
Pyhass:devfrom
matt-thepie:fix/sso-single-quotes-dev

Conversation

@matt-thepie

Copy link
Copy Markdown
Contributor

Problem

Since 20 October 2026, https://sso.hivehome.com/ emits its bootstrap config as

window.HiveSSOPoolId = 'eu-west-1_…'
window.HiveSSOPublicCognitoClientId = '…'

(single quotes, spaces around =). _SSO_ASSIGNMENT only matches double-quoted values, so get_login_info() hits KeyError, returns None, and HiveAuthAsync.async_init crashes with AttributeError: 'NoneType' object has no attribute 'get'. Home Assistant then fails to set up the Hive integration after any restart: home-assistant/core#187516.

Fix

Accept either quote character, requiring the closing quote to match the opening one. Verified against the live page:

{'UPID': 'eu-west-1_SamNfoWtf', 'CLIID': '3rl4i0ajrmtdm8sbre54p9dvd9', 'REGION': 'eu-west-1_SamNfoWtf'}

Tests

  • new test_single_quoted_values_are_parsed (live format) and test_mismatched_quotes_are_not_parsed
  • pytest tests/unit: 859 passed; ruff check / ruff format clean

Home Assistant currently pins pyhive-integration==1.0.9 from master, so the same change is also opened as a backport against master for a 1.0.10 patch release.

🤖 Generated with Claude Code

Since 2026-10-20 https://sso.hivehome.com/ emits its bootstrap config as
window.HiveSSOPoolId = 'eu-west-1_...' (single quotes, spaces around =)
instead of window.HiveSSOPoolId="...". _SSO_ASSIGNMENT only matched
double quotes, so get_login_info() raised KeyError, returned None, and
HiveAuthAsync.async_init crashed with AttributeError on self.data.get.
Home Assistant then fails to set up the Hive integration after a restart
(home-assistant/core#187516).

Accept either quote character, requiring the closing quote to match, and
add unit tests for the new format and for mismatched quotes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (dev@b9dd532). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff           @@
##             dev     #169   +/-   ##
======================================
  Coverage       ?   99.96%           
======================================
  Files          ?       30           
  Lines          ?     2643           
  Branches       ?      310           
======================================
  Hits           ?     2642           
  Misses         ?        0           
  Partials       ?        1           
Flag Coverage Δ
unittests 99.96% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/api/hive_api.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matt-thepie

Copy link
Copy Markdown
Contributor Author

Context: Home Assistant is currently broken for every Hive user by this login-page change (home-assistant/core#187516). HA pins pyhive-integration==1.0.9 from master, so a 2.0 release needs integration-side changes too (renamed methods). If a 1.0.10 from master (#170) is an option, HA can fix it with a one-line manifest bump.

nsleigh added a commit to nsleigh/Hive-Custom-Component that referenced this pull request Oct 20, 2026
Since 2026-10-20 sso.hivehome.com emits window.HiveSSO* assignments with
single quotes, so _SSO_ASSIGNMENT matched nothing, get_login_info() hit
KeyError 'HiveSSOPoolId' and the integration stuck in setup_retry.

Accept either quote (closing quote must match). Mirrors Pyhass/Pyhive#169.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nsleigh added a commit to nsleigh/Pyhive that referenced this pull request Oct 20, 2026
Since 2026-10-20 sso.hivehome.com emits window.HiveSSO* assignments with
single quotes, so _SSO_ASSIGNMENT matched nothing and get_login_info()
failed with KeyError 'HiveSSOPoolId'. Accept either quote (closing quote
must match) and add tests.

Applied from Pyhass#169 (by @matt-thepie) ahead of upstream merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KJonline
KJonline merged commit ad54547 into Pyhass:dev Oct 20, 2026
10 checks passed
@mattmb

mattmb commented Oct 21, 2026

Copy link
Copy Markdown

Thanks for being so quick fixing this! You are literally keeping us all warm as the weather starts to get cooler 😄

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.

3 participants