mirror of
https://github.com/home-assistant/core.git
synced 2025-04-28 19:27:51 +00:00
Add redacted subscription data to SimpliSafe diagnostics (#65751)
This commit is contained in:
parent
b9b53bef00
commit
3387e8368b
@ -449,6 +449,7 @@ class SimpliSafe:
|
|||||||
self._websocket_reconnect_task: asyncio.Task | None = None
|
self._websocket_reconnect_task: asyncio.Task | None = None
|
||||||
self.entry = entry
|
self.entry = entry
|
||||||
self.initial_event_to_use: dict[int, dict[str, Any]] = {}
|
self.initial_event_to_use: dict[int, dict[str, Any]] = {}
|
||||||
|
self.subscription_data: dict[int, Any] = api.subscription_data
|
||||||
self.systems: dict[int, SystemType] = {}
|
self.systems: dict[int, SystemType] = {}
|
||||||
|
|
||||||
# This will get filled in by async_init:
|
# This will get filled in by async_init:
|
||||||
|
@ -11,14 +11,28 @@ from homeassistant.core import HomeAssistant
|
|||||||
from . import SimpliSafe
|
from . import SimpliSafe
|
||||||
from .const import DOMAIN
|
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_SERIAL = "serial"
|
||||||
|
CONF_SID = "sid"
|
||||||
CONF_SYSTEM_ID = "system_id"
|
CONF_SYSTEM_ID = "system_id"
|
||||||
|
CONF_UID = "uid"
|
||||||
CONF_WIFI_SSID = "wifi_ssid"
|
CONF_WIFI_SSID = "wifi_ssid"
|
||||||
|
|
||||||
TO_REDACT = {
|
TO_REDACT = {
|
||||||
CONF_ADDRESS,
|
CONF_ADDRESS,
|
||||||
|
CONF_CREDIT_CARD,
|
||||||
|
CONF_EXPIRES,
|
||||||
|
CONF_LOCATION,
|
||||||
|
CONF_LOCATION_NAME,
|
||||||
|
CONF_PAYMENT_PROFILE_ID,
|
||||||
CONF_SERIAL,
|
CONF_SERIAL,
|
||||||
|
CONF_SID,
|
||||||
CONF_SYSTEM_ID,
|
CONF_SYSTEM_ID,
|
||||||
|
CONF_UID,
|
||||||
CONF_WIFI_SSID,
|
CONF_WIFI_SSID,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +48,7 @@ async def async_get_config_entry_diagnostics(
|
|||||||
"entry": {
|
"entry": {
|
||||||
"options": dict(entry.options),
|
"options": dict(entry.options),
|
||||||
},
|
},
|
||||||
|
"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()],
|
||||||
},
|
},
|
||||||
TO_REDACT,
|
TO_REDACT,
|
||||||
|
@ -18,11 +18,12 @@ USER_ID = "12345"
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="api")
|
@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."""
|
"""Define a fixture for a simplisafe-python API object."""
|
||||||
return Mock(
|
return Mock(
|
||||||
async_get_systems=AsyncMock(return_value={SYSTEM_ID: system_v3}),
|
async_get_systems=AsyncMock(return_value={SYSTEM_ID: system_v3}),
|
||||||
refresh_token=REFRESH_TOKEN,
|
refresh_token=REFRESH_TOKEN,
|
||||||
|
subscription_data=data_subscription,
|
||||||
user_id=USER_ID,
|
user_id=USER_ID,
|
||||||
websocket=websocket,
|
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):
|
async def test_entry_diagnostics(hass, config_entry, hass_client, setup_simplisafe):
|
||||||
"""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": {"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": [
|
"systems": [
|
||||||
{
|
{
|
||||||
"address": REDACTED,
|
"address": REDACTED,
|
||||||
@ -183,7 +272,7 @@ async def test_entry_diagnostics(hass, config_entry, hass_client, setup_simplisa
|
|||||||
"shutter_open_when_off": False,
|
"shutter_open_when_off": False,
|
||||||
"status": "online",
|
"status": "online",
|
||||||
"subscription_enabled": True,
|
"subscription_enabled": True,
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"chime_volume": 2,
|
"chime_volume": 2,
|
||||||
"entry_delay_away": 30,
|
"entry_delay_away": 30,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user