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