"""Diagnostics support for NAM.""" from __future__ import annotations from dataclasses import asdict from homeassistant.components.diagnostics import async_redact_data from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import HomeAssistant from . import NAMDataUpdateCoordinator from .const import DOMAIN TO_REDACT = {CONF_PASSWORD, CONF_USERNAME} async def async_get_config_entry_diagnostics( hass: HomeAssistant, config_entry: ConfigEntry ) -> dict: """Return diagnostics for a config entry.""" coordinator: NAMDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id] diagnostics_data = { "info": async_redact_data(config_entry.data, TO_REDACT), "data": asdict(coordinator.data), } return diagnostics_data