Redact data from zwave_js diagnostics (#68348)
* Redact home ID and location from zwave_js diagnostics * Switch to set
This commit is contained in:
parent
e0b577f8bd
commit
4578de68e7
1 changed files with 5 additions and 2 deletions
|
@ -5,6 +5,7 @@ from zwave_js_server.client import Client
|
|||
from zwave_js_server.dump import dump_msgs
|
||||
from zwave_js_server.model.node import NodeDataType
|
||||
|
||||
from homeassistant.components.diagnostics.util import async_redact_data
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -14,6 +15,8 @@ from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
|||
from .const import DATA_CLIENT, DOMAIN
|
||||
from .helpers import get_home_and_node_id_from_device_entry
|
||||
|
||||
TO_REDACT = ("homeId", "location")
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry
|
||||
|
@ -22,7 +25,7 @@ async def async_get_config_entry_diagnostics(
|
|||
msgs: list[dict] = await dump_msgs(
|
||||
config_entry.data[CONF_URL], async_get_clientsession(hass)
|
||||
)
|
||||
return msgs
|
||||
return async_redact_data(msgs, TO_REDACT)
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
|
@ -42,5 +45,5 @@ async def async_get_device_diagnostics(
|
|||
"minSchemaVersion": client.version.min_schema_version,
|
||||
"maxSchemaVersion": client.version.max_schema_version,
|
||||
},
|
||||
"state": node.data,
|
||||
"state": async_redact_data(node.data, TO_REDACT),
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue