-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add docs for OptionsFlowWithReload #2730
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
Conversation
📝 WalkthroughWalkthroughThe documentation for config entry options flow handlers was expanded with new and improved examples. It now includes a minimal Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant OptionsFlowHandler
participant System
User->>OptionsFlowHandler: Initiate options flow (async_step_init)
OptionsFlowHandler->>OptionsFlowHandler: Show form with suggested values
User->>OptionsFlowHandler: Submit options
OptionsFlowHandler->>System: Create or update entry with new options
System-->>User: Confirm options updated
sequenceDiagram
participant User
participant MyOptionsFlow (OptionsFlowWithReload)
participant System
User->>MyOptionsFlow: Initiate options flow (async_step_init)
MyOptionsFlow->>MyOptionsFlow: Show form with suggested values
User->>MyOptionsFlow: Submit options
MyOptionsFlow->>System: Create or update entry with new options
System->>MyOptionsFlow: Automatically reload integration
MyOptionsFlow-->>User: Confirm options updated and reloaded
Estimated code review effort1 (<30 minutes) 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
docs/config_entries_options_flow_handler.md (4)
28-35
: Add missing imports and fix spacing around assignment to keep examples copy-pastableThe code snippet will not run as-is because
Any
,ConfigFlowResult
, andvol
are not imported, and there’s a PEP 8 spacing issue (OPTIONS_SCHEMA=vol.Schema
). Tight examples that execute without edits are more useful.-from homeassistant.config_entries import OptionsFlow - -OPTIONS_SCHEMA=vol.Schema( +from typing import Any +import voluptuous as vol +from homeassistant.config_entries import ConfigFlowResult, OptionsFlow + +OPTIONS_SCHEMA = vol.Schema(
53-56
: Tweak wording for subject/verb agreementUse plural with “options” and simplify the sentence.
-The most common use-case for adding an update listener to a config entry is to reload the integration when the options has been changed. +The most common reason to add an update listener is to reload the integration when the options have changed.
60-64
: Apply PEP 8 spacing in the second schema declarationKeep stylistic consistency with the previous fix.
-OPTIONS_SCHEMA=vol.Schema( +OPTIONS_SCHEMA = vol.Schema(
92-94
: Import types for the listener example to avoid undefined namesReaders copying this snippet will hit
NameError
forHomeAssistant
andConfigEntry
.```python +from homeassistant.core import HomeAssistant +from homeassistant.config_entries import ConfigEntry + async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry):
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
docs/config_entries_options_flow_handler.md
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
*/**(html|markdown|md)
Instructions used from:
Sources:
⚙️ CodeRabbit Configuration File
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
Proposed change
Add docs for automatic reloading of config entry options with use of
OptionsFlowWithReload
Type of change
Checklist
Additional information
Summary by CodeRabbit