32 lines
993 B
Python
32 lines
993 B
Python
"""Diagnostics support for the Main Gate Controller integration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from homeassistant.components.diagnostics import async_get_config_for_diagnostics
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from . import MainGateConfigEntry
|
|
from .coordinator import MainGateController
|
|
|
|
|
|
async def async_get_diagnostics(
|
|
hass: HomeAssistant, entry: MainGateConfigEntry
|
|
) -> dict[str, Any]:
|
|
"""Return diagnostics for a single gate.
|
|
|
|
No secrets are stored in this integration — there is no host, username,
|
|
password or token — so the whole config entry and controller state can be
|
|
reported verbatim.
|
|
"""
|
|
controller: MainGateController = entry.runtime_data
|
|
return {
|
|
"config": await async_get_config_for_diagnostics(hass, entry),
|
|
"state": {
|
|
"status": controller.status,
|
|
"is_running": controller.is_running,
|
|
**controller.extra_state_attributes,
|
|
},
|
|
}
|