mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 08:26:41 +01:00
33 lines
939 B
Python
33 lines
939 B
Python
"""Diagnostics support for Modern Forms."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import asdict
|
|
from typing import Any
|
|
|
|
from homeassistant.components.diagnostics import async_redact_data
|
|
from homeassistant.const import CONF_MAC
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .coordinator import ModernFormsConfigEntry
|
|
|
|
REDACT_CONFIG = {CONF_MAC}
|
|
REDACT_DEVICE_INFO = {"mac_address", "owner"}
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
|
hass: HomeAssistant, entry: ModernFormsConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics for a config entry."""
|
|
coordinator = entry.runtime_data
|
|
|
|
return {
|
|
"config_entry": async_redact_data(entry.as_dict(), REDACT_CONFIG),
|
|
"device": {
|
|
"info": async_redact_data(
|
|
asdict(coordinator.modern_forms.info), REDACT_DEVICE_INFO
|
|
),
|
|
"status": asdict(coordinator.modern_forms.status),
|
|
},
|
|
}
|