Include all entities in cloud lists (#92406)
This commit is contained in:
parent
31de1b17e8
commit
b71f98e8b7
2 changed files with 17 additions and 8 deletions
|
@ -618,14 +618,11 @@ async def google_assistant_list(
|
|||
"""List all google assistant entities."""
|
||||
cloud = hass.data[DOMAIN]
|
||||
gconf = await cloud.client.get_google_config()
|
||||
entity_registry = er.async_get(hass)
|
||||
entities = google_helpers.async_get_entities(hass, gconf)
|
||||
|
||||
result = []
|
||||
|
||||
for entity in entities:
|
||||
if not entity_registry.async_is_registered(entity.entity_id):
|
||||
continue
|
||||
result.append(
|
||||
{
|
||||
"entity_id": entity.entity_id,
|
||||
|
@ -724,14 +721,11 @@ async def alexa_list(
|
|||
"""List all alexa entities."""
|
||||
cloud = hass.data[DOMAIN]
|
||||
alexa_config = await cloud.client.get_alexa_config()
|
||||
entity_registry = er.async_get(hass)
|
||||
entities = alexa_entities.async_get_entities(hass, alexa_config)
|
||||
|
||||
result = []
|
||||
|
||||
for entity in entities:
|
||||
if not entity_registry.async_is_registered(entity.entity_id):
|
||||
continue
|
||||
result.append(
|
||||
{
|
||||
"entity_id": entity.entity_id,
|
||||
|
|
|
@ -762,7 +762,17 @@ async def test_list_google_entities(
|
|||
await client.send_json_auto_id({"type": "cloud/google_assistant/entities"})
|
||||
response = await client.receive_json()
|
||||
assert response["success"]
|
||||
assert len(response["result"]) == 0
|
||||
assert len(response["result"]) == 2
|
||||
assert response["result"][0] == {
|
||||
"entity_id": "light.kitchen",
|
||||
"might_2fa": False,
|
||||
"traits": ["action.devices.traits.OnOff"],
|
||||
}
|
||||
assert response["result"][1] == {
|
||||
"entity_id": "cover.garage",
|
||||
"might_2fa": True,
|
||||
"traits": ["action.devices.traits.OpenClose"],
|
||||
}
|
||||
|
||||
# Add the entities to the entity registry
|
||||
entity_registry.async_get_or_create(
|
||||
|
@ -939,7 +949,12 @@ async def test_list_alexa_entities(
|
|||
await client.send_json_auto_id({"id": 5, "type": "cloud/alexa/entities"})
|
||||
response = await client.receive_json()
|
||||
assert response["success"]
|
||||
assert len(response["result"]) == 0
|
||||
assert len(response["result"]) == 1
|
||||
assert response["result"][0] == {
|
||||
"entity_id": "light.kitchen",
|
||||
"display_categories": ["LIGHT"],
|
||||
"interfaces": ["Alexa.PowerController", "Alexa.EndpointHealth", "Alexa"],
|
||||
}
|
||||
|
||||
# Add the entity to the entity registry
|
||||
entity_registry.async_get_or_create(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue