mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add redacted constant in diagnostics (#64473)
This commit is contained in:
parent
d2a8114b48
commit
944f2c9745
@ -19,7 +19,9 @@ from homeassistant.util.json import (
|
||||
format_unserializable_data,
|
||||
)
|
||||
|
||||
from .const import DOMAIN
|
||||
from .const import DOMAIN, REDACTED
|
||||
|
||||
__all__ = ["REDACTED"]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
"""Constants for the Diagnostics integration."""
|
||||
|
||||
DOMAIN = "diagnostics"
|
||||
|
||||
REDACTED = "**REDACTED**"
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Diagnostics support for Evil Genius Labs."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@ -17,8 +18,8 @@ async def async_get_config_entry_diagnostics(
|
||||
return {
|
||||
"info": {
|
||||
**coordinator.info,
|
||||
"wiFiSsidDefault": "REDACTED",
|
||||
"wiFiSSID": "REDACTED",
|
||||
"wiFiSsidDefault": REDACTED,
|
||||
"wiFiSSID": REDACTED,
|
||||
},
|
||||
"data": coordinator.data,
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ from typing import Any, cast
|
||||
|
||||
from tuya_iot import TuyaDevice
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
@ -75,7 +76,7 @@ def _async_device_as_dict(hass: HomeAssistant, device: TuyaDevice) -> dict[str,
|
||||
for dpcode, value in device.status.items():
|
||||
# These statuses may contain sensitive information, redact these..
|
||||
if dpcode in {DPCode.ALARM_MESSAGE, DPCode.MOVEMENT_DETECT_PIC}:
|
||||
data["status"][dpcode] = "**REDACTED**"
|
||||
data["status"][dpcode] = REDACTED
|
||||
continue
|
||||
|
||||
with suppress(ValueError, TypeError):
|
||||
@ -133,7 +134,7 @@ def _async_device_as_dict(hass: HomeAssistant, device: TuyaDevice) -> dict[str,
|
||||
if "entity_picture" in state_dict["attributes"]:
|
||||
state_dict["attributes"] = {
|
||||
**state_dict["attributes"],
|
||||
"entity_picture": "**REDACTED**",
|
||||
"entity_picture": REDACTED,
|
||||
}
|
||||
|
||||
# The context doesn't provide useful information in this case.
|
||||
|
@ -1,6 +1,8 @@
|
||||
"""Test evil genius labs diagnostics."""
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.diagnostics import REDACTED
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
|
||||
|
||||
@ -12,8 +14,8 @@ async def test_entry_diagnostics(
|
||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||
"info": {
|
||||
**info_fixture,
|
||||
"wiFiSsidDefault": "REDACTED",
|
||||
"wiFiSSID": "REDACTED",
|
||||
"wiFiSsidDefault": REDACTED,
|
||||
"wiFiSSID": REDACTED,
|
||||
},
|
||||
"data": data_fixture,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user