mirror of
https://github.com/home-assistant/core.git
synced 2025-04-30 04:07:51 +00:00
Add query data to google assistant diagnostic (#78828)
This commit is contained in:
parent
4f31f28e67
commit
924bffc7d0
@ -11,7 +11,11 @@ from homeassistant.helpers.typing import ConfigType
|
|||||||
|
|
||||||
from .const import CONF_SECURE_DEVICES_PIN, CONF_SERVICE_ACCOUNT, DATA_CONFIG, DOMAIN
|
from .const import CONF_SECURE_DEVICES_PIN, CONF_SERVICE_ACCOUNT, DATA_CONFIG, DOMAIN
|
||||||
from .http import GoogleConfig
|
from .http import GoogleConfig
|
||||||
from .smart_home import async_devices_sync_response, create_sync_response
|
from .smart_home import (
|
||||||
|
async_devices_query_response,
|
||||||
|
async_devices_sync_response,
|
||||||
|
create_sync_response,
|
||||||
|
)
|
||||||
|
|
||||||
TO_REDACT = [
|
TO_REDACT = [
|
||||||
"uuid",
|
"uuid",
|
||||||
@ -32,9 +36,11 @@ async def async_get_config_entry_diagnostics(
|
|||||||
yaml_config: ConfigType = data[DATA_CONFIG]
|
yaml_config: ConfigType = data[DATA_CONFIG]
|
||||||
devices = await async_devices_sync_response(hass, config, REDACTED)
|
devices = await async_devices_sync_response(hass, config, REDACTED)
|
||||||
sync = create_sync_response(REDACTED, devices)
|
sync = create_sync_response(REDACTED, devices)
|
||||||
|
query = await async_devices_query_response(hass, config, devices)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"config_entry": async_redact_data(entry.as_dict(), TO_REDACT),
|
"config_entry": async_redact_data(entry.as_dict(), TO_REDACT),
|
||||||
"yaml_config": async_redact_data(yaml_config, TO_REDACT),
|
"yaml_config": async_redact_data(yaml_config, TO_REDACT),
|
||||||
"sync": async_redact_data(sync, TO_REDACT),
|
"sync": async_redact_data(sync, TO_REDACT),
|
||||||
|
"query": async_redact_data(query, TO_REDACT),
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,11 @@ async def async_devices_query(hass, data, payload):
|
|||||||
context=data.context,
|
context=data.context,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return await async_devices_query_response(hass, data.config, payload_devices)
|
||||||
|
|
||||||
|
|
||||||
|
async def async_devices_query_response(hass, config, payload_devices):
|
||||||
|
"""Generate the device serialization."""
|
||||||
devices = {}
|
devices = {}
|
||||||
for device in payload_devices:
|
for device in payload_devices:
|
||||||
devid = device["id"]
|
devid = device["id"]
|
||||||
@ -139,7 +144,7 @@ async def async_devices_query(hass, data, payload):
|
|||||||
devices[devid] = {"online": False}
|
devices[devid] = {"online": False}
|
||||||
continue
|
continue
|
||||||
|
|
||||||
entity = GoogleEntity(hass, data.config, state)
|
entity = GoogleEntity(hass, config, state)
|
||||||
try:
|
try:
|
||||||
devices[devid] = entity.query_serialize()
|
devices[devid] = entity.query_serialize()
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
|
@ -80,6 +80,12 @@ async def test_diagnostics(hass: core.HomeAssistant, hass_client: Any):
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
"query": {
|
||||||
|
"devices": {
|
||||||
|
"switch.ac": {"on": False, "online": True},
|
||||||
|
"switch.decorative_lights": {"on": True, "online": True},
|
||||||
|
}
|
||||||
|
},
|
||||||
"yaml_config": {
|
"yaml_config": {
|
||||||
"expose_by_default": True,
|
"expose_by_default": True,
|
||||||
"exposed_domains": [
|
"exposed_domains": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user