diff --git a/homeassistant/components/google_assistant/helpers.py b/homeassistant/components/google_assistant/helpers.py index bbdb8a82183..6c2fa3d82e1 100644 --- a/homeassistant/components/google_assistant/helpers.py +++ b/homeassistant/components/google_assistant/helpers.py @@ -423,8 +423,9 @@ class GoogleEntity: device["otherDeviceIds"] = [{"deviceId": self.entity_id}] device["customData"] = { "webhookId": self.config.local_sdk_webhook_id, - "httpPort": self.hass.config.api.port, + "httpPort": self.hass.http.server_port, "httpSSL": self.hass.config.api.use_ssl, + "baseUrl": self.hass.config.api.base_url, "proxyDeviceId": agent_user_id, } diff --git a/homeassistant/components/google_assistant/report_state.py b/homeassistant/components/google_assistant/report_state.py index d6bcafd3bff..ad944362721 100644 --- a/homeassistant/components/google_assistant/report_state.py +++ b/homeassistant/components/google_assistant/report_state.py @@ -48,6 +48,8 @@ def async_enable_report_state(hass: HomeAssistant, google_config: AbstractConfig if entity_data == old_entity.query_serialize(): return + _LOGGER.debug("Reporting state for %s: %s", changed_entity, entity_data) + await google_config.async_report_state_all( {"devices": {"states": {changed_entity: entity_data}}} ) diff --git a/homeassistant/components/google_assistant/smart_home.py b/homeassistant/components/google_assistant/smart_home.py index a3667f4c4f4..71e0d252fe1 100644 --- a/homeassistant/components/google_assistant/smart_home.py +++ b/homeassistant/components/google_assistant/smart_home.py @@ -96,6 +96,8 @@ async def async_devices_sync(hass, data, payload): await data.config.async_connect_agent_user(agent_user_id) + _LOGGER.debug("Syncing entities response: %s", response) + return response @@ -243,7 +245,7 @@ async def async_devices_identify(hass, data: RequestData, payload): """ return { "device": { - "id": data.context.user_id, + "id": data.config.get_agent_user_id(data.context), "isLocalOnly": True, "isProxy": True, "deviceInfo": { diff --git a/tests/components/google_assistant/test_helpers.py b/tests/components/google_assistant/test_helpers.py index 8d2aaa63c48..9f6f83fab59 100644 --- a/tests/components/google_assistant/test_helpers.py +++ b/tests/components/google_assistant/test_helpers.py @@ -24,7 +24,8 @@ 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=True) + hass.config.api = Mock(port=1234, use_ssl=True, base_url="https://hostname:1234") + hass.http = Mock(server_port=1234) config = MockConfig( hass=hass, local_sdk_webhook_id="mock-webhook-id", @@ -45,6 +46,7 @@ async def test_google_entity_sync_serialize_with_local_sdk(hass): "httpSSL": True, "proxyDeviceId": None, "webhookId": "mock-webhook-id", + "baseUrl": "https://hostname:1234", } for device_type in NOT_EXPOSE_LOCAL: