Skip to content
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

Allow exposing entities not in the entity registry to assistants #92363

Merged
merged 7 commits into from
May 2, 2023

Conversation

emontnemery
Copy link
Contributor

Proposed change

Allow exposing entities not in the entity registry to assistants

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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 Black (black --fast 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.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented May 2, 2023

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

Code owner commands

Code owners of google_assistant 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 google_assistant Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@home-assistant
Copy link

home-assistant bot commented May 2, 2023

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

Code owner commands

Code owners of homeassistant 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 homeassistant Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@home-assistant
Copy link

home-assistant bot commented May 2, 2023

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

Code owner commands

Code owners of cloud 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 cloud Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@home-assistant
Copy link

home-assistant bot commented May 2, 2023

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

Code owner commands

Code owners of switch_as_x 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 switch_as_x Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@home-assistant
Copy link

home-assistant bot commented May 2, 2023

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

Code owner commands

Code owners of conversation 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 conversation Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@home-assistant
Copy link

home-assistant bot commented May 2, 2023

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

Code owner commands

Code owners of alexa 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 alexa Removes the current integration label and assignees on the pull request, add the integration domain after the command.

Copy link
Contributor

@jbouwh jbouwh left a comment

Choose a reason for hiding this comment

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

Looks good for Alexa. Tried the PR with some yaml entities without unique ID which worked fine.

@frenck
Copy link
Member

frenck commented May 2, 2023

If all assistants are marked as "not exposed", like this one:

image

Should it be removed from the storage collection instead?

The frontend doesn't show this one anymore at this point.
The exact same happens when removing the entity from the frontend.

(can be a later / smaller cleanup thought)

@bramkragten
Copy link
Member

Getting:

home-assistant/core/homeassistant/components/google_assistant/report_state.py:66: RuntimeWarning: coroutine 'CloudGoogleConfig.should_expose' was never awaited
  if not google_config.should_expose(new_state):
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

@emontnemery
Copy link
Contributor Author

emontnemery commented May 2, 2023

If all assistants are marked as "not exposed", like this one:

image

Should it be removed from the storage collection instead?

The frontend doesn't show this one anymore at this point. The exact same happens when removing the entity from the frontend.

(can be a later / smaller cleanup thought)

No, in case the user has enabled automatic expose of supported entities, the choice to not expose an entity needs to be stored.

@frenck
Copy link
Member

frenck commented May 2, 2023

No, in case the user has enabled automatic expose of supported entities, the choice to not expose an entity needs to be stored.

In that case, we have a frontend issue @bramkragten, if the case described above is true, it should also show up as such in the UI? Right now, there is no difference in the UI between the choice made to automatic expose or explicitly disabled expose in that case.

@emontnemery emontnemery requested a review from bdraco as a code owner May 2, 2023 17:46
@emontnemery
Copy link
Contributor Author

No, in case the user has enabled automatic expose of supported entities, the choice to not expose an entity needs to be stored.

In that case, we have a frontend issue @bramkragten, if the case described above is true, it should also show up as such in the UI? Right now, there is no difference in the UI between the choice made to automatic expose or explicitly disabled expose in that case.

The UI shows exposed entities, and the list shows the exposed entities, what's the problem?

Copy link
Contributor

@jbouwh jbouwh left a comment

Choose a reason for hiding this comment

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

Okay with alexa and google_assistant (test config via yaml with items without a unique id).

@DavidFW1960
Copy link

So I can now expose mt LimitlessLED lights (need to use the bottom right + Expose Entities option and they are there but
image
And the message is not supported by this assistant

def _create_item(self, item_id: str, data: dict) -> ExposedEntity:
"""Create an item from validated config."""
del data["entity_id"]
return ExposedEntity(**data)
Copy link
Member

Choose a reason for hiding this comment

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

We should always name all the keys as we otherwise don't allow rolling back.

@github-actions github-actions bot locked and limited conversation to collaborators May 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants