Google local sdk: Set right port, correct device id and add base url (#34358)
parent
42b6ec2fb5
commit
01599d44f5
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -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}}}
|
||||
)
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue