Add uuid to google assistant (#35811)

This commit is contained in:
Bram Kragten 2020-05-26 02:39:09 +02:00 committed by GitHub
parent b15bac595d
commit e61280095e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View file

@ -426,6 +426,7 @@ class GoogleEntity:
"webhookId": self.config.local_sdk_webhook_id, "webhookId": self.config.local_sdk_webhook_id,
"httpPort": self.hass.http.server_port, "httpPort": self.hass.http.server_port,
"httpSSL": self.hass.config.api.use_ssl, "httpSSL": self.hass.config.api.use_ssl,
"uuid": await self.hass.helpers.instance_id.async_get(),
"baseUrl": get_url(self.hass, prefer_external=True), "baseUrl": get_url(self.hass, prefer_external=True),
"proxyDeviceId": agent_user_id, "proxyDeviceId": agent_user_id,
} }

View file

@ -44,6 +44,7 @@ async def test_google_entity_sync_serialize_with_local_sdk(hass):
config.async_enable_local_sdk() config.async_enable_local_sdk()
with patch("homeassistant.helpers.instance_id.async_get", return_value="abcdef"):
serialized = await entity.sync_serialize(None) serialized = await entity.sync_serialize(None)
assert serialized["otherDeviceIds"] == [{"deviceId": "light.ceiling_lights"}] assert serialized["otherDeviceIds"] == [{"deviceId": "light.ceiling_lights"}]
assert serialized["customData"] == { assert serialized["customData"] == {
@ -52,6 +53,7 @@ async def test_google_entity_sync_serialize_with_local_sdk(hass):
"proxyDeviceId": None, "proxyDeviceId": None,
"webhookId": "mock-webhook-id", "webhookId": "mock-webhook-id",
"baseUrl": "https://hostname:1234", "baseUrl": "https://hostname:1234",
"uuid": "abcdef",
} }
for device_type in NOT_EXPOSE_LOCAL: for device_type in NOT_EXPOSE_LOCAL: