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
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""Diagnostics support for ONVIF."""
|
|
|
|
from dataclasses import asdict
|
|
from typing import Any
|
|
|
|
from homeassistant.components.diagnostics import async_redact_data
|
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .device import ONVIFConfigEntry
|
|
|
|
REDACT_CONFIG = {CONF_HOST, CONF_PASSWORD, CONF_USERNAME}
|
|
|
|
|
|
async def async_get_config_entry_diagnostics(
|
|
hass: HomeAssistant, entry: ONVIFConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics for a config entry."""
|
|
device = entry.runtime_data
|
|
data: dict[str, Any] = {}
|
|
|
|
data["config"] = async_redact_data(entry.as_dict(), REDACT_CONFIG)
|
|
data["device"] = {
|
|
"info": asdict(device.info),
|
|
"capabilities": asdict(device.capabilities),
|
|
"profiles": [asdict(profile) for profile in device.profiles],
|
|
"services": {
|
|
str(key): service.url for key, service in device.device.services.items()
|
|
},
|
|
"xaddrs": device.device.xaddrs,
|
|
}
|
|
data["events"] = {
|
|
"webhook_manager_state": device.events.webhook_manager.state,
|
|
"pullpoint_manager_state": device.events.pullpoint_manager.state,
|
|
}
|
|
|
|
return data
|