Skip to content

Conversation

abmantis
Copy link
Member

@abmantis abmantis commented Aug 6, 2025

Proposed change

SSIA.

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features for which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Remove stale or deprecated documentation

Checklist

  • I have read and followed the documentation guidelines.
  • I have verified that my changes render correctly in the documentation.

Additional information

Summary by CodeRabbit

  • Documentation
    • Added documentation for a new WebSocket API command, extract_from_target, detailing its parameters and response structure, including how to specify targets, expand groups, and handle missing references.

Copy link
Contributor

coderabbitai bot commented Aug 6, 2025

📝 Walkthrough

Walkthrough

A new WebSocket API command, extract_from_target, has been documented. This command accepts a target specification with optional arrays of entity, device, area, and label IDs, and an optional group expansion flag. The response details resolved referenced entities, devices, and areas, along with any missing referenced IDs.

Changes

Cohort / File(s) Change Summary
WebSocket API Documentation
docs/api/websocket.md
Added documentation for the new extract_from_target WebSocket command, including parameters and response structure.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3077b0f and a2704d0.

📒 Files selected for processing (1)
  • docs/api/websocket.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/api/websocket.md
⏰ 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)
  • GitHub Check: Redirect rules - developers-home-assistant
  • GitHub Check: Header rules - developers-home-assistant
  • GitHub Check: Pages changed - developers-home-assistant
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch expand_target_api

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.

❤️ Share
🪧 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>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/api/websocket.md (4)

532-536: Add heading anchor consistency and cross-reference to target spec
All other command headings use a level-2 heading (##) followed immediately by an explanatory one-liner or cross-reference. “Expand target” introduces a new API that piggy-backs on the existing service call target syntax, yet it doesn’t link to that section (/docs/automation/targets/) like the other commands do. Adding an anchor link keeps the docs self-navigable and consistent with the rest of the page.

 ## Expand target
-This command allows you to expand one or multiple targets into their constituent entities, devices, and areas.
+This command allows you to expand one or multiple targets into their constituent entities, devices, and areas.  
+See the complete target schema in the
+[service call target documentation](/docs/automation/target/) for the field syntax.

540-548: Minor sample-data improvements
The example mixes “kitchen” and “living_room” areas, yet only “kitchen” is provided in the request. Consider either (a) expanding both areas in the request, or (b) limiting the response to match the request. This avoids the impression that the command adds unrelated areas.


551-557: Clarify referenced_* vs missing_* semantics
A one-sentence “The response includes:” list is provided, but there is no definition of how missing IDs are determined (e.g., nonexistent vs. filtered by permissions). A short clarification helps integrators interpret failures properly.

-The response includes:
+The response includes (all arrays contain raw IDs):

And add after the bullet list:

> **Note:** Items appear in a `missing_*` list only if the caller references
> an ID that does **not** exist in the current Home Assistant instance
> (regardless of user permissions). Missing items are **not** returned due
> to access restrictions; those are simply omitted from the corresponding
> `referenced_*` list.

540-548: JSON comment lines are fine, but keep them uniform
Throughout the page, comment lines inside JSON use // Optional. In this snippet the explanatory line for expand_group also uses that style—good. However, the intro comment (// Optional) line is missing before the target object although that field is mandatory. Consider adding // Required for symmetry with neighbouring examples.

📜 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

📥 Commits

Reviewing files that changed from the base of the PR and between bdcb14f and 3077b0f.

📒 Files selected for processing (1)
  • docs/api/websocket.md (1 hunks)
⏰ 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)
  • GitHub Check: Redirect rules - developers-home-assistant
  • GitHub Check: Header rules - developers-home-assistant
  • GitHub Check: Pages changed - developers-home-assistant
🔇 Additional comments (1)
docs/api/websocket.md (1)

573-580: missing_floors field lacks prior context
“floor” IDs have not been mentioned anywhere else in the WebSocket chapter or the target documentation. Introduce a short phrase explaining floors or remove the field until the floor concept is documented to avoid confusion.

@abmantis abmantis changed the title Add docs for expand_target websocket api Add docs for extract_from_target websocket api Aug 7, 2025
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be merged when the parent PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants