From d39ed0cde4d5e9d34849fb1df2d0ea1f32d4e1e2 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 23 Sep 2022 13:03:28 -0400 Subject: [PATCH] Remove unused custom data in Google Assistant (#79003) --- homeassistant/components/google_assistant/helpers.py | 7 ++----- tests/components/google_assistant/test_diagnostics.py | 6 ------ tests/components/google_assistant/test_helpers.py | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/google_assistant/helpers.py b/homeassistant/components/google_assistant/helpers.py index 0b9b12f2f4c..3351af94648 100644 --- a/homeassistant/components/google_assistant/helpers.py +++ b/homeassistant/components/google_assistant/helpers.py @@ -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 diff --git a/tests/components/google_assistant/test_diagnostics.py b/tests/components/google_assistant/test_diagnostics.py index 99a091f0bdc..9bb6f6955be 100644 --- a/tests/components/google_assistant/test_diagnostics.py +++ b/tests/components/google_assistant/test_diagnostics.py @@ -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, }, diff --git a/tests/components/google_assistant/test_helpers.py b/tests/components/google_assistant/test_helpers.py index 8898fc7ef76..3a455802054 100644 --- a/tests/components/google_assistant/test_helpers.py +++ b/tests/components/google_assistant/test_helpers.py @@ -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", }