8000 Fix supported features in Assist Satellite by arturpragacz · Pull Request #148561 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix supported features in Assist Satellite #148561

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

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

arturpragacz
Copy link
Contributor

Proposed change

Fix supported features in Assist Satellite service description for ask_question.

This fixes two problems:

  • We have to use filter, we can't put supported_features directly under entity.

  • We don't currently support enum names for features at this position, so we have to use a direct int.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@Copilot Copilot AI review requested due to automatic review settings July 10, 2025 14:45
@arturpragacz arturpragacz requested review from synesthesiam and a team as code owners July 10, 2025 14:45
@home-assistant
Copy link

Hey there @home-assistant/core, @synesthesiam, mind taking a look at this pull request as it has been labeled with an integration (assist_satellite) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of assist_satellite can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign assist_satellite Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the configuration of the Assist Satellite service description for the ask_question service by correcting the entity selector's supported features configuration.

  • Restructures the entity selector to use proper filter syntax instead of placing supported_features directly under entity
  • Replaces enum name with direct integer value (2) since enum names aren't supported in this context
  • Updates the selector validation to accept both integer values and string lists for supported features

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
homeassistant/helpers/selector.py Updates validation logic to handle both integer and string list formats for supported features
homeassistant/components/assist_satellite/services.yaml Fixes service configuration structure and replaces enum reference with integer value

@arturpragacz arturpragacz force-pushed the assist_satellite/fix-ask-question-supported-features-description branch from e46a15f to ae757f3 Compare July 10, 2025 15:09
@@ -154,7 +151,7 @@ class BaseSelectorConfig(TypedDict, total=False):
vol.Optional("device_class"): vol.All(cv.ensure_list, [str]),
# Features supported by the entity
vol.Optional("supported_features"): [
vol.All(cv.ensure_list, [str], _validate_supported_features)
vol.Any(int, vol.All(cv.ensure_list, [str], _validate_supported_features))
Copy link
Member

Choose a reason for hiding this comment

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

Why would we accept integers and not rely on _validate_supported_features resolving it?

Copy link
Contributor Author
@arturpragacz arturpragacz Jul 10, 2025

Choose a reason for hiding this comment

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

This check is run in two different contexts:

  • It is run fully offline by hassfest.
  • It is run in a much more limited fashion during runtime.

So as a result this check (and therefore translation of feature names) is run and does work for a target selector, but it is not run for other fields, in particular for any entity selectors.

Entity selectors are quite rare though, the only ones with supported features and therefore affected by this bug are this one and ai_task.generate_data. So the idea of this fix is to allow manually putting ints and use them for those two services.

An alternative fix would be to run the check fully for all fields for all services also during runtime. Yet another alternative would be to switch those two affected services to use a target selector.

@arturpragacz
Copy link
Contributor Author
arturpragacz commented Jul 10, 2025

Let's fix the two problems separately, starting with #148580.

@arturpragacz arturpragacz marked this pull request as draft July 10, 2025 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
0