docs: add narrative guides for public workflows (closes #92)#101
Merged
Conversation
Closes #92. Add a Guides section to the documentation site covering the public workflows that previously had no narrative coverage: - Async lifecycle and state priming - Sync wrapper usage and close/context-manager expectations - State and value listeners (both tiers, decorator patterns, removal) - Reconnect and disconnect behavior, including what is re-primed automatically - Service routing as advanced use only, with clear framing that high-level domain methods are the normal path - Custom domains and entry-point plugins, including the register-before-construct ordering pitfall - Per-domain workflow guides for light, switch, climate, cover, media_player, scene, timer, and sensor Also: - Expand the three previously stub reference pages (events, services, plugins) with one-paragraph introductions that point at the new guides. - Update docs/index.md to surface the guides and reframe the service-policy bullet as advanced usage. Restructure the custom-domain example into two fenced blocks (registration + usage) so the registration block remains executable for the docs-example regression test in tests/test_plugins.py. All examples use intent-specific domain methods rather than raw service calls, per the project's design philosophy.
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.
Issue validity
Valid and actionable. Issue #92 correctly identifies a real gap: the docs site has only a quick-start home page and mkdocstrings-generated reference stubs, with no narrative guidance for the public workflows users actually need to navigate (lifecycle, listeners, reconnect, service routing, custom domains, per-domain usage).
One sub-claim in the issue is stale: the "currently broken custom-domain example" in
docs/index.mdwas already repaired in PR #88 (docs: fix invalid custom-domain quick-start example), which also added a regression test (tests/test_plugins.py::test_docs_custom_domain_example_runs) that runs the snippet against an isolated registry. The example is functional; this PR only restructures it for clarity while keeping that regression test green.Fix
Adds a new Guides section to the documentation, surfaced in
mkdocs.ymlnav:Workflow guides
guides/lifecycle.md— async context manager, state priming sequence, lazy entity creation, manualconnect()/close(), errors during connect.guides/sync-wrapper.md—SyncHAClientthreading model, construction,close()requirements, listeners on the sync wrapper, when not to use it.guides/listeners.md— both listener tiers, the three granular categories (state value / transition / attribute), why granular > raw, removal semantics, non-entity events viaEventBus.guides/reconnect.md— what survives reconnect automatically, timing guarantees, in-flight call behavior, common patterns (asyncio.Eventwaits, UI degradation).guides/service-routing.md— clear "advanced use only" framing per the issue, explainsprefer="ws"|"rest"|"auto", lists the three legitimate reasons to use rawservices.call(), anti-patterns.guides/custom-domains.md— in-process registration with the register-before-construct ordering pitfall called out, listener decorators on custom entities, collection-levelDomainAccessorsubclasses, event routing, entry-point publishing,load_plugins=Falseopt-out.Per-domain workflow guides (
guides/domains/)light,switch,climate,cover,media_player,scene,timer,sensor— each covers reading state, common actions, granular listener decorators, and 2-3 typical patterns. All examples use intent-specific domain methods (e.g.light.set_brightness(200)), per the project's design philosophy.Reference cleanup
reference/core/events.md,reference/core/services.md,reference/core/plugins.md) with one-paragraph introductions that cross-link to the new guides above themkdocstringsblock.Home page
prefer="ws"|"rest"|"auto"bullet as advanced usage and added a "Next steps" section pointing at the guides.Tests / checks run
All green on Python 3.11:
mkdocs build --strictconfirms every internal link in the new guides resolves and the expanded nav is well-formed.