Remove unused custom data in Google Assistant (#79003)

This commit is contained in:
Paulus Schoutsen 2022-09-23 13:03:28 -04:00 committed by GitHub
parent e6f567a751
commit d39ed0cde4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 15 deletions

View file

@ -11,6 +11,7 @@ import pprint
from aiohttp.web import json_response
from awesomeversion import AwesomeVersion
from yarl import URL
from homeassistant.components import webhook
from homeassistant.const import (
@ -610,12 +611,8 @@ class GoogleEntity:
device["otherDeviceIds"] = [{"deviceId": self.entity_id}]
device["customData"] = {
"webhookId": self.config.get_local_webhook_id(agent_user_id),
"httpPort": self.hass.http.server_port,
"httpPort": URL(get_url(self.hass, allow_external=False)).port,
"uuid": instance_uuid,
# Below can be removed in HA 2022.9
"httpSSL": self.hass.config.api.use_ssl,
"baseUrl": get_url(self.hass, prefer_external=True),
"proxyDeviceId": agent_user_id,
}
# Add trait sync attributes

View file

@ -53,10 +53,7 @@ async def test_diagnostics(hass: core.HomeAssistant, hass_client: Any):
"type": "action.devices.types.SWITCH",
"willReportState": False,
"customData": {
"baseUrl": "**REDACTED**",
"httpPort": 8123,
"httpSSL": False,
"proxyDeviceId": "**REDACTED**",
"uuid": "**REDACTED**",
"webhookId": None,
},
@ -70,10 +67,7 @@ async def test_diagnostics(hass: core.HomeAssistant, hass_client: Any):
"type": "action.devices.types.OUTLET",
"willReportState": False,
"customData": {
"baseUrl": "**REDACTED**",
"httpPort": 8123,
"httpSSL": False,
"proxyDeviceId": "**REDACTED**",
"uuid": "**REDACTED**",
"webhookId": None,
},

View file

@ -30,7 +30,7 @@ from tests.common import (
async def test_google_entity_sync_serialize_with_local_sdk(hass):
"""Test sync serialize attributes of a GoogleEntity."""
hass.states.async_set("light.ceiling_lights", "off")
hass.config.api = Mock(port=1234, use_ssl=False)
hass.config.api = Mock(port=1234, local_ip="192.168.123.123", use_ssl=False)
await async_process_ha_core_config(
hass,
{"external_url": "https://hostname:1234"},
@ -57,10 +57,7 @@ async def test_google_entity_sync_serialize_with_local_sdk(hass):
assert serialized["otherDeviceIds"] == [{"deviceId": "light.ceiling_lights"}]
assert serialized["customData"] == {
"httpPort": 1234,
"httpSSL": False,
"proxyDeviceId": "mock-user-id",
"webhookId": "mock-webhook-id",
"baseUrl": "https://hostname:1234",
"uuid": "abcdef",
}