Add redacted subscription data to SimpliSafe diagnostics (#65751)
parent
b9b53bef00
commit
3387e8368b
|
@ -449,6 +449,7 @@ class SimpliSafe:
|
|||
self._websocket_reconnect_task: asyncio.Task | None = None
|
||||
self.entry = entry
|
||||
self.initial_event_to_use: dict[int, dict[str, Any]] = {}
|
||||
self.subscription_data: dict[int, Any] = api.subscription_data
|
||||
self.systems: dict[int, SystemType] = {}
|
||||
|
||||
# This will get filled in by async_init:
|
||||
|
|
|
@ -11,14 +11,28 @@ from homeassistant.core import HomeAssistant
|
|||
from . import SimpliSafe
|
||||
from .const import DOMAIN
|
||||
|
||||
CONF_CREDIT_CARD = "creditCard"
|
||||
CONF_EXPIRES = "expires"
|
||||
CONF_LOCATION = "location"
|
||||
CONF_LOCATION_NAME = "locationName"
|
||||
CONF_PAYMENT_PROFILE_ID = "paymentProfileId"
|
||||
CONF_SERIAL = "serial"
|
||||
CONF_SID = "sid"
|
||||
CONF_SYSTEM_ID = "system_id"
|
||||
CONF_UID = "uid"
|
||||
CONF_WIFI_SSID = "wifi_ssid"
|
||||
|
||||
TO_REDACT = {
|
||||
CONF_ADDRESS,
|
||||
CONF_CREDIT_CARD,
|
||||
CONF_EXPIRES,
|
||||
CONF_LOCATION,
|
||||
CONF_LOCATION_NAME,
|
||||
CONF_PAYMENT_PROFILE_ID,
|
||||
CONF_SERIAL,
|
||||
CONF_SID,
|
||||
CONF_SYSTEM_ID,
|
||||
CONF_UID,
|
||||
CONF_WIFI_SSID,
|
||||
}
|
||||
|
||||
|
@ -34,6 +48,7 @@ async def async_get_config_entry_diagnostics(
|
|||
"entry": {
|
||||
"options": dict(entry.options),
|
||||
},
|
||||
"subscription_data": simplisafe.subscription_data,
|
||||
"systems": [system.as_dict() for system in simplisafe.systems.values()],
|
||||
},
|
||||
TO_REDACT,
|
||||
|
|
|
@ -18,11 +18,12 @@ USER_ID = "12345"
|
|||
|
||||
|
||||
@pytest.fixture(name="api")
|
||||
def api_fixture(system_v3, websocket):
|
||||
def api_fixture(data_subscription, system_v3, websocket):
|
||||
"""Define a fixture for a simplisafe-python API object."""
|
||||
return Mock(
|
||||
async_get_systems=AsyncMock(return_value={SYSTEM_ID: system_v3}),
|
||||
refresh_token=REFRESH_TOKEN,
|
||||
subscription_data=data_subscription,
|
||||
user_id=USER_ID,
|
||||
websocket=websocket,
|
||||
)
|
||||
|
|
|
@ -7,7 +7,96 @@ from tests.components.diagnostics import get_diagnostics_for_config_entry
|
|||
async def test_entry_diagnostics(hass, config_entry, hass_client, setup_simplisafe):
|
||||
"""Test config entry diagnostics."""
|
||||
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
|
||||
"entry": {"options": {}},
|
||||
"entry": {
|
||||
"options": {},
|
||||
},
|
||||
"subscription_data": {
|
||||
"system_123": {
|
||||
"uid": REDACTED,
|
||||
"sid": REDACTED,
|
||||
"sStatus": 20,
|
||||
"activated": 1445034752,
|
||||
"planSku": "SSEDSM2",
|
||||
"planName": "Interactive Monitoring",
|
||||
"price": 24.99,
|
||||
"currency": "USD",
|
||||
"country": "US",
|
||||
"expires": REDACTED,
|
||||
"canceled": 0,
|
||||
"extraTime": 0,
|
||||
"creditCard": REDACTED,
|
||||
"time": 2628000,
|
||||
"paymentProfileId": REDACTED,
|
||||
"features": {
|
||||
"monitoring": True,
|
||||
"alerts": True,
|
||||
"online": True,
|
||||
"hazard": True,
|
||||
"video": True,
|
||||
"cameras": 10,
|
||||
"dispatch": True,
|
||||
"proInstall": False,
|
||||
"discount": 0,
|
||||
"vipCS": False,
|
||||
"medical": True,
|
||||
"careVisit": False,
|
||||
"storageDays": 30,
|
||||
},
|
||||
"status": {
|
||||
"hasBaseStation": True,
|
||||
"isActive": True,
|
||||
"monitoring": "Active",
|
||||
},
|
||||
"subscriptionFeatures": {
|
||||
"monitoredSensorsTypes": [
|
||||
"Entry",
|
||||
"Motion",
|
||||
"GlassBreak",
|
||||
"Smoke",
|
||||
"CO",
|
||||
"Freeze",
|
||||
"Water",
|
||||
],
|
||||
"monitoredPanicConditions": ["Fire", "Medical", "Duress"],
|
||||
"dispatchTypes": ["Police", "Fire", "Medical", "Guard"],
|
||||
"remoteControl": [
|
||||
"ArmDisarm",
|
||||
"LockUnlock",
|
||||
"ViewSettings",
|
||||
"ConfigureSettings",
|
||||
],
|
||||
"cameraFeatures": {
|
||||
"liveView": True,
|
||||
"maxRecordingCameras": 10,
|
||||
"recordingStorageDays": 30,
|
||||
"videoVerification": True,
|
||||
},
|
||||
"support": {
|
||||
"level": "Basic",
|
||||
"annualVisit": False,
|
||||
"professionalInstall": False,
|
||||
},
|
||||
"cellCommunicationBackup": True,
|
||||
"alertChannels": ["Push", "SMS", "Email"],
|
||||
"alertTypes": ["Alarm", "Error", "Activity", "Camera"],
|
||||
"alarmModes": ["Alarm", "SecretAlert", "Disabled"],
|
||||
"supportedIntegrations": [
|
||||
"GoogleAssistant",
|
||||
"AmazonAlexa",
|
||||
"AugustLock",
|
||||
],
|
||||
"timeline": {},
|
||||
},
|
||||
"dispatcher": "cops",
|
||||
"dcid": 0,
|
||||
"location": REDACTED,
|
||||
"pinUnlocked": True,
|
||||
"billDate": 1602887552,
|
||||
"billInterval": 2628000,
|
||||
"pinUnlockedBy": "pin",
|
||||
"autoActivation": None,
|
||||
}
|
||||
},
|
||||
"systems": [
|
||||
{
|
||||
"address": REDACTED,
|
||||
|
@ -183,7 +272,7 @@ async def test_entry_diagnostics(hass, config_entry, hass_client, setup_simplisa
|
|||
"shutter_open_when_off": False,
|
||||
"status": "online",
|
||||
"subscription_enabled": True,
|
||||
},
|
||||
}
|
||||
],
|
||||
"chime_volume": 2,
|
||||
"entry_delay_away": 30,
|
||||
|
|
Loading…
Reference in New Issue