Repository navigation
docs: add standalone example login script - #171
Merged
Merged
Conversation
Adds examples/example_login.py: password + SMS on the first run, with the machine registered as a trusted device and credentials saved to hive_device.json (owner-only, gitignored); later runs use device_login and skip SMS. Verified live: second run skipped SMS and listed the same 73 devices. Closes Pyhass#68, closes Pyhass#57, closes Pyhass#63, closes Pyhass#65, closes Pyhass#109 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #171 +/- ##
=======================================
Coverage 99.96% 99.96%
=======================================
Files 30 30
Lines 2643 2643
Branches 310 310
=======================================
Hits 2642 2642
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
KJonline
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
examples/example_login.py, a standalone script showing the full login flow against the real Hive API. Several issues ask for exactly this, and the docs examples at pyhass.github.io still referencedeviceLoginandHive.Auth, which no longer exist.hive_device.json(owner-only permissions, gitignored). The password is never stored.device_login()with the saved credentials, no SMS prompt.start_session()and print every discovered device.Verification
Run twice against a live account on the current dev branch (with the SSO parser fix from #169 applied locally, since the Hive SSO page changed on 2026-10-20):
hive_device.json, and listed 73 devices across binary_sensor, climate, parent, sensor and switch.Also: full
pytest tests/passes (1061 tests, coverage unchanged); ruff, mypy and pylint (10/10) pass on the example.Note: the example depends on #169 to work against the live service today; without it
auth.login()raisesHiveUnknownConfiguration: SSO login page returned no data.Closes #68, closes #57, closes #63, closes #65, closes #109
🤖 Generated with Claude Code