mirror of
https://github.com/home-assistant/core
synced 2024-09-12 15:16:21 +02:00
Use entry.as_dict()
in WattTime diagnostics (#80122)
This commit is contained in:
parent
687987f05b
commit
d4465e4e69
@ -9,17 +9,25 @@ from homeassistant.const import (
|
||||
CONF_LATITUDE,
|
||||
CONF_LONGITUDE,
|
||||
CONF_PASSWORD,
|
||||
CONF_UNIQUE_ID,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import DOMAIN
|
||||
from .const import CONF_BALANCING_AUTHORITY, CONF_BALANCING_AUTHORITY_ABBREV, DOMAIN
|
||||
|
||||
CONF_TITLE = "title"
|
||||
|
||||
TO_REDACT = {
|
||||
CONF_BALANCING_AUTHORITY,
|
||||
CONF_BALANCING_AUTHORITY_ABBREV,
|
||||
CONF_LATITUDE,
|
||||
CONF_LONGITUDE,
|
||||
CONF_PASSWORD,
|
||||
# Config entry title and unique ID may contain sensitive data:
|
||||
CONF_TITLE,
|
||||
CONF_UNIQUE_ID,
|
||||
CONF_USERNAME,
|
||||
}
|
||||
|
||||
@ -32,10 +40,7 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
return async_redact_data(
|
||||
{
|
||||
"entry": {
|
||||
"data": dict(entry.data),
|
||||
"options": dict(entry.options),
|
||||
},
|
||||
"entry": entry.as_dict(),
|
||||
"data": coordinator.data,
|
||||
},
|
||||
TO_REDACT,
|
||||
|
@ -8,15 +8,24 @@ async def test_entry_diagnostics(hass, config_entry, hass_client, setup_watttime
|
||||
"""Test config entry diagnostics."""
|
||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||
"entry": {
|
||||
"entry_id": config_entry.entry_id,
|
||||
"version": 1,
|
||||
"domain": "watttime",
|
||||
"title": REDACTED,
|
||||
"data": {
|
||||
"username": REDACTED,
|
||||
"password": REDACTED,
|
||||
"latitude": REDACTED,
|
||||
"longitude": REDACTED,
|
||||
"balancing_authority": "PJM New Jersey",
|
||||
"balancing_authority_abbreviation": "PJM_NJ",
|
||||
"balancing_authority": REDACTED,
|
||||
"balancing_authority_abbreviation": REDACTED,
|
||||
},
|
||||
"options": {},
|
||||
"pref_disable_new_entities": False,
|
||||
"pref_disable_polling": False,
|
||||
"source": "user",
|
||||
"unique_id": REDACTED,
|
||||
"disabled_by": None,
|
||||
},
|
||||
"data": {
|
||||
"freq": "300",
|
||||
|
Loading…
Reference in New Issue
Block a user