Implement bridge-backed Home Assistant integration
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""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,
|
||||
}
|
||||
Reference in New Issue
Block a user