Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Provide diagnostics for Mail and Packages.""" | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
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 homeassistant.helpers.device_registry import DeviceEntry | ||
|
||
from .const import ( | ||
COORDINATOR, | ||
DOMAIN, | ||
) | ||
|
||
REDACT_KEYS = {CONF_PASSWORD, CONF_USERNAME} | ||
|
||
async def async_get_config_entry_diagnostics( | ||
hass: HomeAssistant, config_entry: ConfigEntry | ||
) -> dict[str, Any]: | ||
"""Return diagnostics for a config entry.""" | ||
diag: dict[str, Any] = {} | ||
diag["config"] = config_entry.as_dict() | ||
return async_redact_data(diag, REDACT_KEYS) | ||
|
||
|
||
async def async_get_device_diagnostics( | ||
hass: HomeAssistant, config_entry: ConfigEntry, device: DeviceEntry | ||
) -> dict[str, Any]: | ||
"""Return diagnostics for a device.""" | ||
coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR] | ||
return coordinator.data |