mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47: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.components.diagnostics import async_redact_data
|
||||||
from homeassistant.config_entries import ConfigEntry
|
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 homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from . import SimpliSafe
|
from . import SimpliSafe
|
||||||
@ -18,6 +25,7 @@ CONF_PAYMENT_PROFILE_ID = "paymentProfileId"
|
|||||||
CONF_SERIAL = "serial"
|
CONF_SERIAL = "serial"
|
||||||
CONF_SID = "sid"
|
CONF_SID = "sid"
|
||||||
CONF_SYSTEM_ID = "system_id"
|
CONF_SYSTEM_ID = "system_id"
|
||||||
|
CONF_TITLE = "title"
|
||||||
CONF_UID = "uid"
|
CONF_UID = "uid"
|
||||||
CONF_WIFI_SSID = "wifi_ssid"
|
CONF_WIFI_SSID = "wifi_ssid"
|
||||||
|
|
||||||
@ -32,7 +40,13 @@ TO_REDACT = {
|
|||||||
CONF_SERIAL,
|
CONF_SERIAL,
|
||||||
CONF_SID,
|
CONF_SID,
|
||||||
CONF_SYSTEM_ID,
|
CONF_SYSTEM_ID,
|
||||||
|
# Config entry title may contain sensitive data:
|
||||||
|
CONF_TITLE,
|
||||||
|
CONF_TOKEN,
|
||||||
CONF_UID,
|
CONF_UID,
|
||||||
|
# Config entry unique ID may contain sensitive data:
|
||||||
|
CONF_UNIQUE_ID,
|
||||||
|
CONF_USERNAME,
|
||||||
CONF_WIFI_SSID,
|
CONF_WIFI_SSID,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,9 +59,7 @@ async def async_get_config_entry_diagnostics(
|
|||||||
|
|
||||||
return async_redact_data(
|
return async_redact_data(
|
||||||
{
|
{
|
||||||
"entry": {
|
"entry": entry.as_dict(),
|
||||||
"options": dict(entry.options),
|
|
||||||
},
|
|
||||||
"subscription_data": simplisafe.subscription_data,
|
"subscription_data": simplisafe.subscription_data,
|
||||||
"systems": [system.as_dict() for system in simplisafe.systems.values()],
|
"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."""
|
"""Test config entry diagnostics."""
|
||||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||||
"entry": {
|
"entry": {
|
||||||
"options": {
|
"entry_id": config_entry.entry_id,
|
||||||
"code": REDACTED,
|
"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": {
|
"subscription_data": {
|
||||||
"system_123": {
|
"system_123": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user