Feature/rest command config entries - #179693
Draft
rioncm wants to merge 2 commits into
Draft
Conversation
Contributor
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Contributor
|
Hey there @jpbede, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
8 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Adds UI-managed RESTful Command endpoints while preserving YAML-defined commands and sharing HTTP execution logic.
Changes:
- Adds config flows and authentication options.
- Introduces
rest_command.call_endpoint. - Redacts sensitive request details and expands tests.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/rest_command/__init__.py |
Integrates config entries and shared request handling. |
homeassistant/components/rest_command/config_flow.py |
Implements setup and reconfiguration flows. |
homeassistant/components/rest_command/const.py |
Defines shared constants and defaults. |
homeassistant/components/rest_command/http.py |
Centralizes HTTP execution and errors. |
homeassistant/components/rest_command/icons.json |
Adds the endpoint action icon. |
homeassistant/components/rest_command/manifest.json |
Enables config flows and service classification. |
homeassistant/components/rest_command/services.yaml |
Defines the endpoint action fields. |
homeassistant/components/rest_command/strings.json |
Adds UI text, selectors, and revised errors. |
homeassistant/generated/config_flows.py |
Registers the generated config flow. |
homeassistant/generated/integrations.json |
Updates generated integration metadata. |
tests/components/rest_command/test_config_flow.py |
Tests setup, validation, and reconfiguration. |
tests/components/rest_command/test_init.py |
Tests endpoint execution, authentication, reloads, and redaction. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| ENDPOINT_SCHEMA = vol.Schema( | ||
| { | ||
| vol.Required(CONF_ENDPOINT_NAME): TextSelector(), |
Comment on lines
+1
to
+7
| call_endpoint: | ||
| fields: | ||
| config_entry_id: | ||
| required: true | ||
| selector: | ||
| config_entry: | ||
| integration: rest_command |
| "domain": "rest_command", | ||
| "name": "RESTful Command", | ||
| "codeowners": ["@jpbede"], | ||
| "config_flow": true, |
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.
Breaking change
Proposed change
RESTful Command currently requires YAML configuration, even for static outbound HTTP endpoints. This change adds config-entry support so endpoints can be configured through the Home Assistant UI.
Each config entry represents one endpoint and supports:
UI-managed endpoints are called through the
rest_command.call_endpointaction. YAML-defined commands and YAML reload behavior remain supported.For backward compatibility, an existing YAML command named
call_endpointtakes precedence. UI-managed endpoints become available through that action after the conflicting YAML command is renamed and RESTful Command is reloaded.YAML and UI-managed endpoints share the same HTTP execution path. Request logs and translated errors no longer expose rendered URLs, credentials, payloads, or low-level exception details.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: