mirror of
https://github.com/home-assistant/core.git
synced 2026-07-03 04:36:04 +01:00
d766aae436
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
38 lines
958 B
Python
38 lines
958 B
Python
"""Diagnostics support for Ridwell."""
|
|
|
|
import dataclasses
|
|
from typing import Any
|
|
|
|
from homeassistant.components.diagnostics import async_redact_data
|
|
from homeassistant.const import CONF_PASSWORD, CONF_UNIQUE_ID, CONF_USERNAME
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .coordinator import RidwellConfigEntry
|
|
|
|
CONF_TITLE = "title"
|
|
|
|
TO_REDACT = {
|
|
CONF_PASSWORD,
|
|
# Config entry title and unique ID may contain sensitive data:
|
|
CONF_TITLE,
|
|
CONF_UNIQUE_ID,
|
|
CONF_USERNAME,
|
|
}
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
|
hass: HomeAssistant, entry: RidwellConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics for a config entry."""
|
|
return async_redact_data(
|
|
{
|
|
"entry": entry.as_dict(),
|
|
"data": [
|
|
dataclasses.asdict(event)
|
|
for events in entry.runtime_data.data.values()
|
|
for event in events
|
|
],
|
|
},
|
|
TO_REDACT,
|
|
)
|