home-assistant.io
home-assistant.io copied to clipboard
Add merge_response templating
Proposed change
Adds merge_response to HA templating
Type of change
- [ ] Spelling, grammar or other readability improvements (
currentbranch). - [ ] Adjusted missing or incorrect information in the current documentation (
currentbranch). - [ ] Added documentation for a new integration I'm adding to Home Assistant (
nextbranch).- [ ] I've opened up a PR to add logos and icons in Brands repository.
- [x] Added documentation for a new feature I'm adding to Home Assistant (
nextbranch). - [ ] Removed stale or deprecated documentation.
Additional information
- Link to parent pull request in the codebase: https://github.com/home-assistant/core/pull/114204
- Link to parent pull request in the Brands repository:
- This PR fixes or closes issue: fixes #
Checklist
- [ ] This PR uses the correct branch, based on one of the following:
- I made a change to the existing documentation and used the
currentbranch. - I made a change that is related to an upcoming version of Home Assistant and used the
nextbranch.
- I made a change to the existing documentation and used the
- [ ] The documentation follows the Home Assistant documentation standards.
Summary by CodeRabbit
- Documentation
- Enhanced the templating documentation with a new section on
merge_responsefunctionality, detailing parametersvalue,sort_by, andselected_key, along with practical examples to guide users in merging action responses effectively.
- Enhanced the templating documentation with a new section on
Walkthrough
Walkthrough
The recent changes enhance the templating documentation by introducing the merge_response functionality. This addition explains how to consolidate information from multiple entities into a single list. It includes a detailed description of the merge_response template, outlining its parameters—value, sort_by, and selected_key—along with practical examples, significantly improving user guidance on this feature.
Changes
| Files | Change Summary |
|---|---|
| source/_docs/configuration/templating.markdown | Added new section on merge_response functionality, detailing parameters (value, sort_by, selected_key) and providing multiple examples. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant TemplateEngine
participant EntityManager
User->>TemplateEngine: Request to merge responses
TemplateEngine->>EntityManager: Fetch entities
EntityManager-->>TemplateEngine: Return entities
TemplateEngine->>TemplateEngine: Process entities using merge_response
TemplateEngine-->>User: Return consolidated response
Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL
Commits
Files that changed from the base of the PR and between f7278e354d5fbfd905bffd733078409b0198808f and 8ec93b7b3a77bbc1e6e792c30e009643bd78713d.
Files selected for processing (1)
- source/_docs/configuration/templating.markdown (1 hunks)
Additional context used
Markdownlint
source/_docs/configuration/templating.markdown
1166-1166: Expected: 1; Actual: 2 Multiple consecutive blank lines
(MD012, no-multiple-blanks)
Additional comments not posted (10)
source/_docs/configuration/templating.markdown (10)
1151-1152: LGTM!The new "Merge action responses" section provides a good overview of the feature.
1153-1154: LGTM!The explanation of using action responses and the
merge_responsetemplate is clear and concise.
1156-1159: LGTM!The table provides a good description of the
valuevariable used inmerge_response.
1160-1161: LGTM!The explanation of the
entity_idkey behavior inmerge_responseis important and clearly stated.
1162-1163: LGTM!The explanation of the
value_keykey behavior inmerge_responseis important and clearly stated.
1164-1165: LGTM!The reference to the example showing the
entity_idandvalue_keykeys in the output is helpful.
1167-1177: LGTM!The example of using
merge_responsein YAML is clear and demonstrates how to access the merged data.
1178-1188: LGTM!The explanation and example of sorting the merged list using Jinja's
sortfilter are helpful and clear.
1190-1257: LGTM!The example of the calendar action response and the corresponding
merge_responseusage and output is clear and helpful.
1259-1321: LGTM!The example of non-list action responses and the corresponding
merge_responseusage and output is clear and helpful.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai generate interesting stats about this repository and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
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)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaior@coderabbitai titleanywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Early access features: disabled
We are currently testing the following features in early access:
- Anthropic
claude-3-5-sonnetfor code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.
Note:
- You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
- Please join our Discord Community to provide feedback and report issues on the discussion post.
Deploy Preview for home-assistant-docs ready!
| Name | Link |
|---|---|
| Latest commit | 8ec93b7b3a77bbc1e6e792c30e009643bd78713d |
| Latest deploy log | https://app.netlify.com/sites/home-assistant-docs/deploys/66d581bd04470300085fbb86 |
| Deploy Preview | https://deploy-preview-34050--home-assistant-docs.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1: