-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Dmitry Mamontov
committed
Apr 15, 2022
1 parent
0dd49ae
commit 13ec332
Showing
5 changed files
with
138 additions
and
16 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
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
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,57 @@ | ||
"""MiWifi diagnostic.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Final | ||
|
||
from homeassistant.components.diagnostics import async_redact_data | ||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.const import ( | ||
CONF_PASSWORD, | ||
CONF_USERNAME, | ||
CONF_URL, | ||
CONF_TOKEN, | ||
CONF_ID, | ||
) | ||
from homeassistant.core import HomeAssistant | ||
|
||
from .const import ( | ||
DOMAIN, | ||
UPDATER, | ||
ATTR_CAMERA_IMAGE, | ||
) | ||
|
||
TO_REDACT: Final = { | ||
CONF_PASSWORD, | ||
CONF_USERNAME, | ||
CONF_URL, | ||
CONF_TOKEN, | ||
CONF_ID, | ||
ATTR_CAMERA_IMAGE, | ||
"routerId", | ||
"gateWay", | ||
"hostname", | ||
"ipv4", | ||
"ssid", | ||
"pwd", | ||
} | ||
|
||
|
||
async def async_get_config_entry_diagnostics( | ||
hass: HomeAssistant, config_entry: ConfigEntry | ||
) -> dict: | ||
"""Return diagnostics for a config entry.""" | ||
|
||
_data: dict = {"config_entry": async_redact_data(config_entry.as_dict(), TO_REDACT)} | ||
|
||
if _updater := hass.data[DOMAIN][config_entry.entry_id].get(UPDATER): | ||
if hasattr(_updater, "data"): | ||
_data["data"] = async_redact_data(_updater.data, TO_REDACT) | ||
|
||
if hasattr(_updater, "devices"): | ||
_data["devices"] = _updater.devices | ||
|
||
if len(_updater.luci.diagnostics) > 0: | ||
_data["requests"] = async_redact_data(_updater.luci.diagnostics, TO_REDACT) | ||
|
||
return _data |
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
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