mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Fix device name Google Assistant when using aliases (#31416)
* Fix device name Google Assistant when using aliases * Adjust cloud tests
This commit is contained in:
parent
883b8f21ce
commit
826433b680
@ -399,7 +399,7 @@ class GoogleEntity:
|
||||
# use aliases
|
||||
aliases = entity_config.get(CONF_ALIASES)
|
||||
if aliases:
|
||||
device["name"]["nicknames"] = aliases
|
||||
device["name"]["nicknames"] = [name] + aliases
|
||||
|
||||
if self.config.is_local_sdk_active:
|
||||
device["otherDeviceIds"] = [{"deviceId": self.entity_id}]
|
||||
|
@ -121,7 +121,7 @@ async def test_handler_google_actions(hass):
|
||||
device = devices[0]
|
||||
assert device["id"] == "switch.test"
|
||||
assert device["name"]["name"] == "Config name"
|
||||
assert device["name"]["nicknames"] == ["Config alias"]
|
||||
assert device["name"]["nicknames"] == ["Config name", "Config alias"]
|
||||
assert device["type"] == "action.devices.types.SWITCH"
|
||||
assert device["roomHint"] == "living room"
|
||||
|
||||
|
@ -104,7 +104,10 @@ DEMO_DEVICES = [
|
||||
},
|
||||
{
|
||||
"id": "light.ceiling_lights",
|
||||
"name": {"name": "Roof Lights", "nicknames": ["top lights", "ceiling lights"]},
|
||||
"name": {
|
||||
"name": "Roof Lights",
|
||||
"nicknames": ["Roof Lights", "top lights", "ceiling lights"],
|
||||
},
|
||||
"traits": [
|
||||
"action.devices.traits.OnOff",
|
||||
"action.devices.traits.Brightness",
|
||||
|
@ -92,7 +92,10 @@ async def test_sync_message(hass):
|
||||
"devices": [
|
||||
{
|
||||
"id": "light.demo_light",
|
||||
"name": {"name": "Demo Light", "nicknames": ["Hello", "World"]},
|
||||
"name": {
|
||||
"name": "Demo Light",
|
||||
"nicknames": ["Demo Light", "Hello", "World"],
|
||||
},
|
||||
"traits": [
|
||||
trait.TRAIT_BRIGHTNESS,
|
||||
trait.TRAIT_ONOFF,
|
||||
|
Loading…
x
Reference in New Issue
Block a user