mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 08:26:41 +01:00
Add latency results if available to the support package (#165377)
This commit is contained in:
@@ -516,6 +516,8 @@ class DownloadSupportPackageView(HomeAssistantView):
|
||||
hass_info: dict[str, Any],
|
||||
domains_info: dict[str, dict[str, str]],
|
||||
) -> str:
|
||||
cloud = hass.data[DATA_CLOUD]
|
||||
|
||||
def get_domain_table_markdown(domain_info: dict[str, Any]) -> str:
|
||||
if len(domain_info) == 0:
|
||||
return "No information available\n"
|
||||
@@ -572,6 +574,15 @@ class DownloadSupportPackageView(HomeAssistantView):
|
||||
"</details>\n\n"
|
||||
)
|
||||
|
||||
# Add stored latency response if available
|
||||
if locations := cloud.remote.latency_by_location:
|
||||
markdown += "## Latency by location\n\n"
|
||||
markdown += "Location | Latency (ms)\n"
|
||||
markdown += "--- | ---\n"
|
||||
for location in sorted(locations):
|
||||
markdown += f"{location} | {locations[location]['avg'] or 'N/A'}\n"
|
||||
markdown += "\n"
|
||||
|
||||
# Add installed packages section
|
||||
try:
|
||||
installed_packages = await async_get_installed_packages()
|
||||
|
||||
@@ -66,6 +66,7 @@ async def cloud_fixture() -> AsyncGenerator[MagicMock]:
|
||||
certificate_status=None,
|
||||
instance_domain=None,
|
||||
is_connected=False,
|
||||
latency_by_location={},
|
||||
)
|
||||
mock_cloud.auth = MagicMock(spec=CognitoAuth)
|
||||
mock_cloud.iot = MagicMock(
|
||||
|
||||
@@ -87,6 +87,13 @@
|
||||
|
||||
</details>
|
||||
|
||||
## Latency by location
|
||||
|
||||
Location | Latency (ms)
|
||||
--- | ---
|
||||
Earth | 13.37
|
||||
Moon | N/A
|
||||
|
||||
## Installed packages
|
||||
|
||||
<details><summary>Installed packages</summary>
|
||||
|
||||
@@ -1907,6 +1907,10 @@ async def test_download_support_package(
|
||||
|
||||
cloud.remote.snitun_server = "us-west-1"
|
||||
cloud.remote.certificate_status = CertificateStatus.READY
|
||||
cloud.remote.latency_by_location = {
|
||||
"Earth": {"avg": 13.37},
|
||||
"Moon": {"avg": None},
|
||||
}
|
||||
cloud.expiration_date = dt_util.parse_datetime("2025-01-17T11:19:31.0+00:00")
|
||||
|
||||
await cloud.client.async_system_message({"region": "xx-earth-616"})
|
||||
|
||||
Reference in New Issue
Block a user