mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Use entry.as_dict()
in SimpliSafe diagnostics (#80121)
This commit is contained in:
parent
d4465e4e69
commit
1262c0e221
@ -5,7 +5,14 @@ from typing import Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_ADDRESS, CONF_CODE, CONF_LOCATION
|
||||
from homeassistant.const import (
|
||||
CONF_ADDRESS,
|
||||
CONF_CODE,
|
||||
CONF_LOCATION,
|
||||
CONF_TOKEN,
|
||||
CONF_UNIQUE_ID,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import SimpliSafe
|
||||
@ -18,6 +25,7 @@ CONF_PAYMENT_PROFILE_ID = "paymentProfileId"
|
||||
CONF_SERIAL = "serial"
|
||||
CONF_SID = "sid"
|
||||
CONF_SYSTEM_ID = "system_id"
|
||||
CONF_TITLE = "title"
|
||||
CONF_UID = "uid"
|
||||
CONF_WIFI_SSID = "wifi_ssid"
|
||||
|
||||
@ -32,7 +40,13 @@ TO_REDACT = {
|
||||
CONF_SERIAL,
|
||||
CONF_SID,
|
||||
CONF_SYSTEM_ID,
|
||||
# Config entry title may contain sensitive data:
|
||||
CONF_TITLE,
|
||||
CONF_TOKEN,
|
||||
CONF_UID,
|
||||
# Config entry unique ID may contain sensitive data:
|
||||
CONF_UNIQUE_ID,
|
||||
CONF_USERNAME,
|
||||
CONF_WIFI_SSID,
|
||||
}
|
||||
|
||||
@ -45,9 +59,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
return async_redact_data(
|
||||
{
|
||||
"entry": {
|
||||
"options": dict(entry.options),
|
||||
},
|
||||
"entry": entry.as_dict(),
|
||||
"subscription_data": simplisafe.subscription_data,
|
||||
"systems": [system.as_dict() for system in simplisafe.systems.values()],
|
||||
},
|
||||
|
@ -8,9 +8,17 @@ async def test_entry_diagnostics(hass, config_entry, hass_client, setup_simplisa
|
||||
"""Test config entry diagnostics."""
|
||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||
"entry": {
|
||||
"options": {
|
||||
"code": REDACTED,
|
||||
},
|
||||
"entry_id": config_entry.entry_id,
|
||||
"version": 1,
|
||||
"domain": "simplisafe",
|
||||
"title": REDACTED,
|
||||
"data": {"token": REDACTED, "username": REDACTED},
|
||||
"options": {"code": REDACTED},
|
||||
"pref_disable_new_entities": False,
|
||||
"pref_disable_polling": False,
|
||||
"source": "user",
|
||||
"unique_id": REDACTED,
|
||||
"disabled_by": None,
|
||||
},
|
||||
"subscription_data": {
|
||||
"system_123": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user