29 lines
917 B
Python
29 lines
917 B
Python
"""Diagnostics support for MB-Secure."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from homeassistant.const import CONF_HOST
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.redact import async_redact_data
|
|
|
|
from . import MBSecureConfigEntry
|
|
from .const import CONF_TOKEN
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
|
hass: HomeAssistant, entry: MBSecureConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics without exposing the local bridge token."""
|
|
bridge_diagnostics = await entry.runtime_data.client.async_get_diagnostics()
|
|
safe_bridge_data = {
|
|
key: bridge_diagnostics[key]
|
|
for key in ("api_version", "connected", "snapshot_revision", "object_counts")
|
|
if key in bridge_diagnostics
|
|
}
|
|
return {
|
|
"config_entry": async_redact_data(dict(entry.data), {CONF_HOST, CONF_TOKEN}),
|
|
"bridge": safe_bridge_data,
|
|
}
|