mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Use entry.as_dict()
in Guardian diagnostics (#80112)
This commit is contained in:
parent
5743e9f83d
commit
0f002e7044
@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_UNIQUE_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import GuardianData
|
||||
@ -13,11 +14,15 @@ from .const import CONF_UID, DOMAIN
|
||||
CONF_BSSID = "bssid"
|
||||
CONF_PAIRED_UIDS = "paired_uids"
|
||||
CONF_SSID = "ssid"
|
||||
CONF_TITLE = "title"
|
||||
|
||||
TO_REDACT = {
|
||||
CONF_BSSID,
|
||||
CONF_PAIRED_UIDS,
|
||||
CONF_SSID,
|
||||
# Config entry title and unique ID may contain sensitive data:
|
||||
CONF_TITLE,
|
||||
CONF_UNIQUE_ID,
|
||||
CONF_UID,
|
||||
}
|
||||
|
||||
@ -29,10 +34,7 @@ async def async_get_config_entry_diagnostics(
|
||||
data: GuardianData = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
return {
|
||||
"entry": {
|
||||
"title": entry.title,
|
||||
"data": async_redact_data(entry.data, TO_REDACT),
|
||||
},
|
||||
"entry": async_redact_data(entry.as_dict(), TO_REDACT),
|
||||
"data": {
|
||||
"valve_controller": {
|
||||
api_category: async_redact_data(coordinator.data, TO_REDACT)
|
||||
|
@ -14,12 +14,21 @@ async def test_entry_diagnostics(hass, config_entry, hass_client, setup_guardian
|
||||
|
||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||
"entry": {
|
||||
"title": "Mock Title",
|
||||
"entry_id": config_entry.entry_id,
|
||||
"version": 1,
|
||||
"domain": "guardian",
|
||||
"title": REDACTED,
|
||||
"data": {
|
||||
"uid": REDACTED,
|
||||
"ip_address": "192.168.1.100",
|
||||
"port": 7777,
|
||||
"uid": REDACTED,
|
||||
},
|
||||
"options": {},
|
||||
"pref_disable_new_entities": False,
|
||||
"pref_disable_polling": False,
|
||||
"source": "user",
|
||||
"unique_id": REDACTED,
|
||||
"disabled_by": None,
|
||||
},
|
||||
"data": {
|
||||
"valve_controller": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user