mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Exclude hidden entities from google_assistant (#68554)
This commit is contained in:
parent
ff7d5c92d5
commit
dc0c3a4d2d
@ -126,7 +126,10 @@ class GoogleConfig(AbstractConfig):
|
|||||||
entity_registry = er.async_get(self.hass)
|
entity_registry = er.async_get(self.hass)
|
||||||
registry_entry = entity_registry.async_get(state.entity_id)
|
registry_entry = entity_registry.async_get(state.entity_id)
|
||||||
if registry_entry:
|
if registry_entry:
|
||||||
auxiliary_entity = registry_entry.entity_category is not None
|
auxiliary_entity = (
|
||||||
|
registry_entry.entity_category is not None
|
||||||
|
or registry_entry.hidden_by is not None
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
auxiliary_entity = False
|
auxiliary_entity = False
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ from homeassistant.components import (
|
|||||||
from homeassistant.components.climate import const as climate
|
from homeassistant.components.climate import const as climate
|
||||||
from homeassistant.components.humidifier import const as humidifier
|
from homeassistant.components.humidifier import const as humidifier
|
||||||
from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES
|
from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from . import DEMO_DEVICES
|
from . import DEMO_DEVICES
|
||||||
|
|
||||||
@ -151,11 +152,27 @@ async def test_sync_request(hass_fixture, assistant_client, auth_header):
|
|||||||
suggested_object_id="system_switch",
|
suggested_object_id="system_switch",
|
||||||
entity_category="system",
|
entity_category="system",
|
||||||
)
|
)
|
||||||
|
entity_entry4 = entity_registry.async_get_or_create(
|
||||||
|
"switch",
|
||||||
|
"test",
|
||||||
|
"switch_hidden_integration_id",
|
||||||
|
suggested_object_id="hidden_integration_switch",
|
||||||
|
hidden_by=er.RegistryEntryHider.INTEGRATION,
|
||||||
|
)
|
||||||
|
entity_entry5 = entity_registry.async_get_or_create(
|
||||||
|
"switch",
|
||||||
|
"test",
|
||||||
|
"switch_hidden_user_id",
|
||||||
|
suggested_object_id="hidden_user_switch",
|
||||||
|
hidden_by=er.RegistryEntryHider.USER,
|
||||||
|
)
|
||||||
|
|
||||||
# These should not show up in the sync request
|
# These should not show up in the sync request
|
||||||
hass_fixture.states.async_set(entity_entry1.entity_id, "on")
|
hass_fixture.states.async_set(entity_entry1.entity_id, "on")
|
||||||
hass_fixture.states.async_set(entity_entry2.entity_id, "something_else")
|
hass_fixture.states.async_set(entity_entry2.entity_id, "something_else")
|
||||||
hass_fixture.states.async_set(entity_entry3.entity_id, "blah")
|
hass_fixture.states.async_set(entity_entry3.entity_id, "blah")
|
||||||
|
hass_fixture.states.async_set(entity_entry4.entity_id, "foo")
|
||||||
|
hass_fixture.states.async_set(entity_entry5.entity_id, "bar")
|
||||||
|
|
||||||
reqid = "5711642932632160983"
|
reqid = "5711642932632160983"
|
||||||
data = {"requestId": reqid, "inputs": [{"intent": "action.devices.SYNC"}]}
|
data = {"requestId": reqid, "inputs": [{"intent": "action.devices.SYNC"}]}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user