mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-01 04:54:29 +02:00
updated diagnostics
This commit is contained in:
parent
5c8a8d4870
commit
0c097e2206
1 changed files with 8 additions and 43 deletions
|
@ -1,45 +1,10 @@
|
|||
"""Diagnostics support for Mikrotik Router."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
TO_REDACT = {
|
||||
"ip-address",
|
||||
"client-ip-address",
|
||||
"address",
|
||||
"active-address",
|
||||
"mac-address",
|
||||
"active-mac-address",
|
||||
"orig-mac-address",
|
||||
"port-mac-address",
|
||||
"client-mac-address",
|
||||
"client-id",
|
||||
"active-client-id",
|
||||
"eeprom",
|
||||
"sfp-vendor-serial",
|
||||
"gateway",
|
||||
"dns-server",
|
||||
"wins-server",
|
||||
"ntp-server",
|
||||
"caps-manager",
|
||||
"serial-number",
|
||||
"source",
|
||||
"from-addresses",
|
||||
"to-addresses",
|
||||
"src-address",
|
||||
"dst-address",
|
||||
"username",
|
||||
"password",
|
||||
"caller-id",
|
||||
"target",
|
||||
"ssid",
|
||||
}
|
||||
from .const import DOMAIN, TO_REDACT
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
|
@ -47,11 +12,11 @@ async def async_get_config_entry_diagnostics(
|
|||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
controller = hass.data[DOMAIN][config_entry.entry_id]
|
||||
diag: dict[str, Any] = {}
|
||||
diag["entry"]: dict[str, Any] = {}
|
||||
|
||||
diag["entry"]["data"] = async_redact_data(config_entry.data, TO_REDACT)
|
||||
diag["entry"]["options"] = async_redact_data(config_entry.options, TO_REDACT)
|
||||
diag["data"] = async_redact_data(controller.data, TO_REDACT)
|
||||
|
||||
return diag
|
||||
return {
|
||||
"entry": {
|
||||
"data": async_redact_data(config_entry.data, TO_REDACT),
|
||||
"options": async_redact_data(config_entry.options, TO_REDACT),
|
||||
},
|
||||
"data": async_redact_data(controller.data, TO_REDACT),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue