mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add diagnostics to SimpliSafe (#65171)
* Add diagnostics to SimpliSafe * Bump * Cleanup
This commit is contained in:
parent
cc94af2872
commit
58f624a3da
40
homeassistant/components/simplisafe/diagnostics.py
Normal file
40
homeassistant/components/simplisafe/diagnostics.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
"""Diagnostics support for SimpliSafe."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from homeassistant.components.diagnostics import async_redact_data
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.const import CONF_ADDRESS
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
|
from . import SimpliSafe
|
||||||
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
CONF_SERIAL = "serial"
|
||||||
|
CONF_SYSTEM_ID = "system_id"
|
||||||
|
CONF_WIFI_SSID = "wifi_ssid"
|
||||||
|
|
||||||
|
TO_REDACT = {
|
||||||
|
CONF_ADDRESS,
|
||||||
|
CONF_SERIAL,
|
||||||
|
CONF_SYSTEM_ID,
|
||||||
|
CONF_WIFI_SSID,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async def async_get_config_entry_diagnostics(
|
||||||
|
hass: HomeAssistant, entry: ConfigEntry
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
"""Return diagnostics for a config entry."""
|
||||||
|
simplisafe: SimpliSafe = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
|
return async_redact_data(
|
||||||
|
{
|
||||||
|
"entry": {
|
||||||
|
"options": dict(entry.options),
|
||||||
|
},
|
||||||
|
"systems": [system.as_dict() for system in simplisafe.systems.values()],
|
||||||
|
},
|
||||||
|
TO_REDACT,
|
||||||
|
)
|
@ -3,7 +3,7 @@
|
|||||||
"name": "SimpliSafe",
|
"name": "SimpliSafe",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/simplisafe",
|
"documentation": "https://www.home-assistant.io/integrations/simplisafe",
|
||||||
"requirements": ["simplisafe-python==2021.12.2"],
|
"requirements": ["simplisafe-python==2022.01.0"],
|
||||||
"codeowners": ["@bachya"],
|
"codeowners": ["@bachya"],
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"dhcp": [
|
"dhcp": [
|
||||||
|
@ -2190,7 +2190,7 @@ simplehound==0.3
|
|||||||
simplepush==1.1.4
|
simplepush==1.1.4
|
||||||
|
|
||||||
# homeassistant.components.simplisafe
|
# homeassistant.components.simplisafe
|
||||||
simplisafe-python==2021.12.2
|
simplisafe-python==2022.01.0
|
||||||
|
|
||||||
# homeassistant.components.sisyphus
|
# homeassistant.components.sisyphus
|
||||||
sisyphus-control==3.1.2
|
sisyphus-control==3.1.2
|
||||||
|
@ -1340,7 +1340,7 @@ sharkiqpy==0.1.8
|
|||||||
simplehound==0.3
|
simplehound==0.3
|
||||||
|
|
||||||
# homeassistant.components.simplisafe
|
# homeassistant.components.simplisafe
|
||||||
simplisafe-python==2021.12.2
|
simplisafe-python==2022.01.0
|
||||||
|
|
||||||
# homeassistant.components.slack
|
# homeassistant.components.slack
|
||||||
slackclient==2.5.0
|
slackclient==2.5.0
|
||||||
|
@ -1,24 +1,27 @@
|
|||||||
"""Define test fixtures for SimpliSafe."""
|
"""Define test fixtures for SimpliSafe."""
|
||||||
|
import json
|
||||||
from unittest.mock import AsyncMock, Mock, patch
|
from unittest.mock import AsyncMock, Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from simplipy.system.v3 import SystemV3
|
||||||
|
|
||||||
from homeassistant.components.simplisafe.config_flow import CONF_AUTH_CODE
|
from homeassistant.components.simplisafe.config_flow import CONF_AUTH_CODE
|
||||||
from homeassistant.components.simplisafe.const import CONF_USER_ID, DOMAIN
|
from homeassistant.components.simplisafe.const import CONF_USER_ID, DOMAIN
|
||||||
from homeassistant.const import CONF_TOKEN
|
from homeassistant.const import CONF_TOKEN
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry, load_fixture
|
||||||
|
|
||||||
REFRESH_TOKEN = "token123"
|
REFRESH_TOKEN = "token123"
|
||||||
|
SYSTEM_ID = "system_123"
|
||||||
USER_ID = "12345"
|
USER_ID = "12345"
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="api")
|
@pytest.fixture(name="api")
|
||||||
def api_fixture(websocket):
|
def api_fixture(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(),
|
async_get_systems=AsyncMock(return_value={SYSTEM_ID: system_v3}),
|
||||||
refresh_token=REFRESH_TOKEN,
|
refresh_token=REFRESH_TOKEN,
|
||||||
user_id=USER_ID,
|
user_id=USER_ID,
|
||||||
websocket=websocket,
|
websocket=websocket,
|
||||||
@ -50,19 +53,43 @@ def config_code_fixture(hass):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(name="data_latest_event", scope="session")
|
||||||
|
def data_latest_event_fixture():
|
||||||
|
"""Define latest event data."""
|
||||||
|
return json.loads(load_fixture("latest_event_data.json", "simplisafe"))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(name="data_sensor", scope="session")
|
||||||
|
def data_sensor_fixture():
|
||||||
|
"""Define sensor data."""
|
||||||
|
return json.loads(load_fixture("sensor_data.json", "simplisafe"))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(name="data_settings", scope="session")
|
||||||
|
def data_settings_fixture():
|
||||||
|
"""Define settings data."""
|
||||||
|
return json.loads(load_fixture("settings_data.json", "simplisafe"))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(name="data_subscription", scope="session")
|
||||||
|
def data_subscription_fixture():
|
||||||
|
"""Define subscription data."""
|
||||||
|
return json.loads(load_fixture("subscription_data.json", "simplisafe"))
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="setup_simplisafe")
|
@pytest.fixture(name="setup_simplisafe")
|
||||||
async def setup_simplisafe_fixture(hass, api, config):
|
async def setup_simplisafe_fixture(hass, api, config):
|
||||||
"""Define a fixture to set up SimpliSafe."""
|
"""Define a fixture to set up SimpliSafe."""
|
||||||
with patch(
|
with patch(
|
||||||
|
"homeassistant.components.simplisafe.config_flow.API.async_from_auth",
|
||||||
|
return_value=api,
|
||||||
|
), patch(
|
||||||
"homeassistant.components.simplisafe.API.async_from_auth", return_value=api
|
"homeassistant.components.simplisafe.API.async_from_auth", return_value=api
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.simplisafe.API.async_from_refresh_token",
|
"homeassistant.components.simplisafe.API.async_from_refresh_token",
|
||||||
return_value=api,
|
return_value=api,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.simplisafe.SimpliSafe.async_init"
|
"homeassistant.components.simplisafe.SimpliSafe._async_start_websocket_loop"
|
||||||
), patch(
|
|
||||||
"homeassistant.components.simplisafe.config_flow.API.async_from_auth",
|
|
||||||
return_value=api,
|
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.simplisafe.PLATFORMS", []
|
"homeassistant.components.simplisafe.PLATFORMS", []
|
||||||
):
|
):
|
||||||
@ -71,6 +98,17 @@ async def setup_simplisafe_fixture(hass, api, config):
|
|||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(name="system_v3")
|
||||||
|
def system_v3_fixture(data_latest_event, data_sensor, data_settings, data_subscription):
|
||||||
|
"""Define a fixture for a simplisafe-python V3 System object."""
|
||||||
|
system = SystemV3(Mock(subscription_data=data_subscription), SYSTEM_ID)
|
||||||
|
system.async_get_latest_event = AsyncMock(return_value=data_latest_event)
|
||||||
|
system.sensor_data = data_sensor
|
||||||
|
system.settings_data = data_settings
|
||||||
|
system.generate_device_objects()
|
||||||
|
return system
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="websocket")
|
@pytest.fixture(name="websocket")
|
||||||
def websocket_fixture():
|
def websocket_fixture():
|
||||||
"""Define a fixture for a simplisafe-python websocket object."""
|
"""Define a fixture for a simplisafe-python websocket object."""
|
||||||
|
21
tests/components/simplisafe/fixtures/latest_event_data.json
Normal file
21
tests/components/simplisafe/fixtures/latest_event_data.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"eventId": 1234567890,
|
||||||
|
"eventTimestamp": 1564018073,
|
||||||
|
"eventCid": 1400,
|
||||||
|
"zoneCid": "2",
|
||||||
|
"sensorType": 1,
|
||||||
|
"sensorSerial": "01010101",
|
||||||
|
"account": "00011122",
|
||||||
|
"userId": 12345,
|
||||||
|
"sid": "system_123",
|
||||||
|
"info": "System Disarmed by PIN 2",
|
||||||
|
"pinName": "",
|
||||||
|
"sensorName": "Kitchen",
|
||||||
|
"messageSubject": "SimpliSafe System Disarmed",
|
||||||
|
"messageBody": "System Disarmed: Your SimpliSafe security system was ...",
|
||||||
|
"eventType": "activity",
|
||||||
|
"timezone": 2,
|
||||||
|
"locationOffset": -360,
|
||||||
|
"videoStartedBy": "",
|
||||||
|
"video": {}
|
||||||
|
}
|
75
tests/components/simplisafe/fixtures/sensor_data.json
Normal file
75
tests/components/simplisafe/fixtures/sensor_data.json
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"825": {
|
||||||
|
"type": 5,
|
||||||
|
"serial": "825",
|
||||||
|
"name": "Fire Door",
|
||||||
|
"setting": {
|
||||||
|
"instantTrigger": false,
|
||||||
|
"away2": 1,
|
||||||
|
"away": 1,
|
||||||
|
"home2": 1,
|
||||||
|
"home": 1,
|
||||||
|
"off": 0
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"triggered": false
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"swingerShutdown": false,
|
||||||
|
"lowBattery": false,
|
||||||
|
"offline": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"14": {
|
||||||
|
"type": 12,
|
||||||
|
"serial": "14",
|
||||||
|
"name": "Front Door",
|
||||||
|
"setting": {
|
||||||
|
"instantTrigger": false,
|
||||||
|
"away2": 1,
|
||||||
|
"away": 1,
|
||||||
|
"home2": 1,
|
||||||
|
"home": 1,
|
||||||
|
"off": 0
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"triggered": false
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"swingerShutdown": false,
|
||||||
|
"lowBattery": false,
|
||||||
|
"offline": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"987": {
|
||||||
|
"serial": "987",
|
||||||
|
"type": 16,
|
||||||
|
"status": {
|
||||||
|
"pinPadState": 0,
|
||||||
|
"lockState": 1,
|
||||||
|
"pinPadOffline": false,
|
||||||
|
"pinPadLowBattery": false,
|
||||||
|
"lockDisabled": false,
|
||||||
|
"lockLowBattery": false,
|
||||||
|
"calibrationErrDelta": 0,
|
||||||
|
"calibrationErrZero": 0,
|
||||||
|
"lockJamState": 0
|
||||||
|
},
|
||||||
|
"name": "Front Door",
|
||||||
|
"deviceGroupID": 1,
|
||||||
|
"firmwareVersion": "1.0.0",
|
||||||
|
"bootVersion": "1.0.0",
|
||||||
|
"setting": {
|
||||||
|
"autoLock": 3,
|
||||||
|
"away": 1,
|
||||||
|
"home": 1,
|
||||||
|
"awayToOff": 0,
|
||||||
|
"homeToOff": 1
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"swingerShutdown": false,
|
||||||
|
"lowBattery": false,
|
||||||
|
"offline": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
69
tests/components/simplisafe/fixtures/settings_data.json
Normal file
69
tests/components/simplisafe/fixtures/settings_data.json
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
{
|
||||||
|
"account": "12345012",
|
||||||
|
"settings": {
|
||||||
|
"normal": {
|
||||||
|
"wifiSSID": "MY_WIFI",
|
||||||
|
"alarmDuration": 240,
|
||||||
|
"alarmVolume": 3,
|
||||||
|
"doorChime": 2,
|
||||||
|
"entryDelayAway": 30,
|
||||||
|
"entryDelayAway2": 30,
|
||||||
|
"entryDelayHome": 30,
|
||||||
|
"entryDelayHome2": 30,
|
||||||
|
"exitDelayAway": 60,
|
||||||
|
"exitDelayAway2": 60,
|
||||||
|
"exitDelayHome": 0,
|
||||||
|
"exitDelayHome2": 0,
|
||||||
|
"lastUpdated": "2019-07-03T03:24:20.999Z",
|
||||||
|
"light": true,
|
||||||
|
"voicePrompts": 2,
|
||||||
|
"_id": "1197192618725121765212"
|
||||||
|
},
|
||||||
|
"pins": {
|
||||||
|
"lastUpdated": "2019-07-04T20:47:44.016Z",
|
||||||
|
"_id": "asd6281526381253123",
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"_id": "1271279d966212121124c7",
|
||||||
|
"pin": "3456",
|
||||||
|
"name": "Test 1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "1271279d966212121124c6",
|
||||||
|
"pin": "5423",
|
||||||
|
"name": "Test 2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "1271279d966212121124c5",
|
||||||
|
"pin": "",
|
||||||
|
"name": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "1271279d966212121124c4",
|
||||||
|
"pin": "",
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"duress": {
|
||||||
|
"pin": "9876"
|
||||||
|
},
|
||||||
|
"master": {
|
||||||
|
"pin": "1234"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"basestationStatus": {
|
||||||
|
"lastUpdated": "2019-07-15T15:28:22.961Z",
|
||||||
|
"rfJamming": false,
|
||||||
|
"ethernetStatus": 4,
|
||||||
|
"gsmRssi": -73,
|
||||||
|
"gsmStatus": 3,
|
||||||
|
"backupBattery": 5293,
|
||||||
|
"wallPower": 5933,
|
||||||
|
"wifiRssi": -49,
|
||||||
|
"wifiStatus": 1,
|
||||||
|
"_id": "6128153715231t237123",
|
||||||
|
"encryptionErrors": []
|
||||||
|
},
|
||||||
|
"lastUpdated": 1562273264
|
||||||
|
}
|
374
tests/components/simplisafe/fixtures/subscription_data.json
Normal file
374
tests/components/simplisafe/fixtures/subscription_data.json
Normal file
@ -0,0 +1,374 @@
|
|||||||
|
{
|
||||||
|
"system_123": {
|
||||||
|
"uid": 12345,
|
||||||
|
"sid": "system_123",
|
||||||
|
"sStatus": 20,
|
||||||
|
"activated": 1445034752,
|
||||||
|
"planSku": "SSEDSM2",
|
||||||
|
"planName": "Interactive Monitoring",
|
||||||
|
"price": 24.99,
|
||||||
|
"currency": "USD",
|
||||||
|
"country": "US",
|
||||||
|
"expires": 1602887552,
|
||||||
|
"canceled": 0,
|
||||||
|
"extraTime": 0,
|
||||||
|
"creditCard": {
|
||||||
|
"lastFour": "",
|
||||||
|
"type": "",
|
||||||
|
"ppid": "ABCDE12345",
|
||||||
|
"uid": 12345
|
||||||
|
},
|
||||||
|
"time": 2628000,
|
||||||
|
"paymentProfileId": "ABCDE12345",
|
||||||
|
"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": {
|
||||||
|
"sid": 12345,
|
||||||
|
"uid": 12345,
|
||||||
|
"lStatus": 10,
|
||||||
|
"account": "1234ABCD",
|
||||||
|
"street1": "1234 Main Street",
|
||||||
|
"street2": "",
|
||||||
|
"locationName": "",
|
||||||
|
"city": "Atlantis",
|
||||||
|
"county": "SEA",
|
||||||
|
"state": "UW",
|
||||||
|
"zip": "12345",
|
||||||
|
"country": "US",
|
||||||
|
"crossStreet": "River 1 and River 2",
|
||||||
|
"notes": "",
|
||||||
|
"residenceType": 2,
|
||||||
|
"numAdults": 2,
|
||||||
|
"numChildren": 0,
|
||||||
|
"locationOffset": -360,
|
||||||
|
"safeWord": "TRITON",
|
||||||
|
"signature": "Atlantis Citizen 1",
|
||||||
|
"timeZone": 2,
|
||||||
|
"primaryContacts": [
|
||||||
|
{
|
||||||
|
"name": "John Doe",
|
||||||
|
"phone": "1234567890"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"secondaryContacts": [
|
||||||
|
{
|
||||||
|
"name": "Jane Doe",
|
||||||
|
"phone": "9876543210"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"copsOptIn": false,
|
||||||
|
"certificateUri": "https://simplisafe.com/account2/12345/alarm-certificate/12345",
|
||||||
|
"nestStructureId": "",
|
||||||
|
"system": {
|
||||||
|
"serial": "1234ABCD",
|
||||||
|
"alarmState": "OFF",
|
||||||
|
"alarmStateTimestamp": 0,
|
||||||
|
"isAlarming": false,
|
||||||
|
"version": 3,
|
||||||
|
"capabilities": {
|
||||||
|
"setWifiOverCell": true,
|
||||||
|
"setDoorbellChimeVolume": true,
|
||||||
|
"outdoorBattCamera": true
|
||||||
|
},
|
||||||
|
"temperature": 67,
|
||||||
|
"exitDelayRemaining": 60,
|
||||||
|
"cameras": [
|
||||||
|
{
|
||||||
|
"staleSettingsTypes": [],
|
||||||
|
"upgradeWhitelisted": false,
|
||||||
|
"model": "SS001",
|
||||||
|
"uuid": "1234567890",
|
||||||
|
"uid": 12345,
|
||||||
|
"sid": 12345,
|
||||||
|
"cameraSettings": {
|
||||||
|
"cameraName": "Camera",
|
||||||
|
"pictureQuality": "720p",
|
||||||
|
"nightVision": "auto",
|
||||||
|
"statusLight": "off",
|
||||||
|
"micSensitivity": 100,
|
||||||
|
"micEnable": true,
|
||||||
|
"speakerVolume": 75,
|
||||||
|
"motionSensitivity": 0,
|
||||||
|
"shutterHome": "closedAlarmOnly",
|
||||||
|
"shutterAway": "open",
|
||||||
|
"shutterOff": "closedAlarmOnly",
|
||||||
|
"wifiSsid": "",
|
||||||
|
"canStream": false,
|
||||||
|
"canRecord": false,
|
||||||
|
"pirEnable": true,
|
||||||
|
"vaEnable": true,
|
||||||
|
"notificationsEnable": false,
|
||||||
|
"enableDoorbellNotification": true,
|
||||||
|
"doorbellChimeVolume": "off",
|
||||||
|
"privacyEnable": false,
|
||||||
|
"hdr": false,
|
||||||
|
"vaZoningEnable": false,
|
||||||
|
"vaZoningRows": 0,
|
||||||
|
"vaZoningCols": 0,
|
||||||
|
"vaZoningMask": [],
|
||||||
|
"maxDigitalZoom": 10,
|
||||||
|
"supportedResolutions": [
|
||||||
|
"480p",
|
||||||
|
"720p"
|
||||||
|
],
|
||||||
|
"admin": {
|
||||||
|
"IRLED": 0,
|
||||||
|
"pirSens": 0,
|
||||||
|
"statusLEDState": 1,
|
||||||
|
"lux": "lowLux",
|
||||||
|
"motionDetectionEnabled": false,
|
||||||
|
"motionThresholdZero": 0,
|
||||||
|
"motionThresholdOne": 10000,
|
||||||
|
"levelChangeDelayZero": 30,
|
||||||
|
"levelChangeDelayOne": 10,
|
||||||
|
"audioDetectionEnabled": false,
|
||||||
|
"audioChannelNum": 2,
|
||||||
|
"audioSampleRate": 16000,
|
||||||
|
"audioChunkBytes": 2048,
|
||||||
|
"audioSampleFormat": 3,
|
||||||
|
"audioSensitivity": 50,
|
||||||
|
"audioThreshold": 50,
|
||||||
|
"audioDirection": 0,
|
||||||
|
"bitRate": 284,
|
||||||
|
"longPress": 2000,
|
||||||
|
"kframe": 1,
|
||||||
|
"gopLength": 40,
|
||||||
|
"idr": 1,
|
||||||
|
"fps": 20,
|
||||||
|
"firmwareVersion": "2.6.1.107",
|
||||||
|
"netConfigVersion": "",
|
||||||
|
"camAgentVersion": "",
|
||||||
|
"lastLogin": 1600639997,
|
||||||
|
"lastLogout": 1600639944,
|
||||||
|
"pirSampleRateMs": 800,
|
||||||
|
"pirHysteresisHigh": 2,
|
||||||
|
"pirHysteresisLow": 10,
|
||||||
|
"pirFilterCoefficient": 1,
|
||||||
|
"logEnabled": true,
|
||||||
|
"logLevel": 3,
|
||||||
|
"logQDepth": 20,
|
||||||
|
"firmwareGroup": "public",
|
||||||
|
"irOpenThreshold": 445,
|
||||||
|
"irCloseThreshold": 840,
|
||||||
|
"irOpenDelay": 3,
|
||||||
|
"irCloseDelay": 3,
|
||||||
|
"irThreshold1x": 388,
|
||||||
|
"irThreshold2x": 335,
|
||||||
|
"irThreshold3x": 260,
|
||||||
|
"rssi": [
|
||||||
|
[
|
||||||
|
1600935204,
|
||||||
|
-43
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"battery": [],
|
||||||
|
"dbm": 0,
|
||||||
|
"vmUse": 161592,
|
||||||
|
"resSet": 10540,
|
||||||
|
"uptime": 810043.74,
|
||||||
|
"wifiDisconnects": 1,
|
||||||
|
"wifiDriverReloads": 1,
|
||||||
|
"statsPeriod": 3600000,
|
||||||
|
"sarlaccDebugLogTypes": 0,
|
||||||
|
"odProcessingFps": 8,
|
||||||
|
"odObjectMinWidthPercent": 6,
|
||||||
|
"odObjectMinHeightPercent": 24,
|
||||||
|
"odEnableObjectDetection": true,
|
||||||
|
"odClassificationMask": 2,
|
||||||
|
"odClassificationConfidenceThreshold": 0.95,
|
||||||
|
"odEnableOverlay": false,
|
||||||
|
"odAnalyticsLib": 2,
|
||||||
|
"odSensitivity": 85,
|
||||||
|
"odEventObjectMask": 2,
|
||||||
|
"odLuxThreshold": 445,
|
||||||
|
"odLuxHysteresisHigh": 4,
|
||||||
|
"odLuxHysteresisLow": 4,
|
||||||
|
"odLuxSamplingFrequency": 30,
|
||||||
|
"odFGExtractorMode": 2,
|
||||||
|
"odVideoScaleFactor": 1,
|
||||||
|
"odSceneType": 1,
|
||||||
|
"odCameraView": 3,
|
||||||
|
"odCameraFOV": 2,
|
||||||
|
"odBackgroundLearnStationary": true,
|
||||||
|
"odBackgroundLearnStationarySpeed": 15,
|
||||||
|
"odClassifierQualityProfile": 1,
|
||||||
|
"odEnableVideoAnalyticsWhileStreaming": false,
|
||||||
|
"wlanMac": "XX:XX:XX:XX:XX:XX",
|
||||||
|
"region": "us-east-1",
|
||||||
|
"enableWifiAnalyticsLib": false,
|
||||||
|
"ivLicense": ""
|
||||||
|
},
|
||||||
|
"pirLevel": "medium",
|
||||||
|
"odLevel": "medium"
|
||||||
|
},
|
||||||
|
"__v": 0,
|
||||||
|
"cameraStatus": {
|
||||||
|
"firmwareVersion": "2.6.1.107",
|
||||||
|
"netConfigVersion": "",
|
||||||
|
"camAgentVersion": "",
|
||||||
|
"lastLogin": 1600639997,
|
||||||
|
"lastLogout": 1600639944,
|
||||||
|
"wlanMac": "XX:XX:XX:XX:XX:XX",
|
||||||
|
"fwDownloadVersion": "",
|
||||||
|
"fwDownloadPercentage": 0,
|
||||||
|
"recovered": false,
|
||||||
|
"recoveredFromVersion": "",
|
||||||
|
"_id": "1234567890",
|
||||||
|
"initErrors": [],
|
||||||
|
"speedTestTokenCreated": 1600235629
|
||||||
|
},
|
||||||
|
"supportedFeatures": {
|
||||||
|
"providers": {
|
||||||
|
"webrtc": "none",
|
||||||
|
"recording": "simplisafe",
|
||||||
|
"live": "simplisafe"
|
||||||
|
},
|
||||||
|
"audioEncodings": [
|
||||||
|
"speex"
|
||||||
|
],
|
||||||
|
"resolutions": [
|
||||||
|
"480p",
|
||||||
|
"720p"
|
||||||
|
],
|
||||||
|
"_id": "1234567890",
|
||||||
|
"pir": true,
|
||||||
|
"videoAnalytics": false,
|
||||||
|
"privacyShutter": true,
|
||||||
|
"microphone": true,
|
||||||
|
"fullDuplexAudio": false,
|
||||||
|
"wired": true,
|
||||||
|
"networkSpeedTest": false,
|
||||||
|
"videoEncoding": "h264"
|
||||||
|
},
|
||||||
|
"subscription": {
|
||||||
|
"enabled": true,
|
||||||
|
"freeTrialActive": false,
|
||||||
|
"freeTrialUsed": true,
|
||||||
|
"freeTrialEnds": 0,
|
||||||
|
"freeTrialExpires": 0,
|
||||||
|
"planSku": "SSVM1",
|
||||||
|
"price": 0,
|
||||||
|
"expires": 0,
|
||||||
|
"storageDays": 30,
|
||||||
|
"trialUsed": true,
|
||||||
|
"trialActive": false,
|
||||||
|
"trialExpires": 0
|
||||||
|
},
|
||||||
|
"status": "online"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"connType": "wifi",
|
||||||
|
"stateUpdated": 1601502948,
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"_id": "xxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
|
"id": "xxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
|
"textTemplate": "Power Outage - Backup battery in use.",
|
||||||
|
"data": {
|
||||||
|
"time": "2020-02-16T03:20:28+00:00"
|
||||||
|
},
|
||||||
|
"text": "Power Outage - Backup battery in use.",
|
||||||
|
"code": "2000",
|
||||||
|
"filters": [],
|
||||||
|
"link": "http://link.to.info",
|
||||||
|
"linkLabel": "More Info",
|
||||||
|
"expiration": 0,
|
||||||
|
"category": "error",
|
||||||
|
"timestamp": 1581823228
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"powerOutage": false,
|
||||||
|
"lastPowerOutage": 1581991064,
|
||||||
|
"lastSuccessfulWifiTS": 1601424776,
|
||||||
|
"isOffline": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pinUnlocked": true,
|
||||||
|
"billDate": 1602887552,
|
||||||
|
"billInterval": 2628000,
|
||||||
|
"pinUnlockedBy": "pin",
|
||||||
|
"autoActivation": null
|
||||||
|
}
|
||||||
|
}
|
226
tests/components/simplisafe/test_diagnostics.py
Normal file
226
tests/components/simplisafe/test_diagnostics.py
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
"""Test SimpliSafe diagnostics."""
|
||||||
|
from homeassistant.components.diagnostics import REDACTED
|
||||||
|
|
||||||
|
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": {}},
|
||||||
|
"systems": [
|
||||||
|
{
|
||||||
|
"address": REDACTED,
|
||||||
|
"alarm_going_off": False,
|
||||||
|
"connection_type": "wifi",
|
||||||
|
"notifications": [],
|
||||||
|
"serial": REDACTED,
|
||||||
|
"state": 99,
|
||||||
|
"system_id": REDACTED,
|
||||||
|
"temperature": 67,
|
||||||
|
"version": 3,
|
||||||
|
"sensors": [
|
||||||
|
{
|
||||||
|
"name": "Fire Door",
|
||||||
|
"serial": REDACTED,
|
||||||
|
"type": 5,
|
||||||
|
"error": False,
|
||||||
|
"low_battery": False,
|
||||||
|
"offline": False,
|
||||||
|
"settings": {
|
||||||
|
"instantTrigger": False,
|
||||||
|
"away2": 1,
|
||||||
|
"away": 1,
|
||||||
|
"home2": 1,
|
||||||
|
"home": 1,
|
||||||
|
"off": 0,
|
||||||
|
},
|
||||||
|
"trigger_instantly": False,
|
||||||
|
"triggered": False,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Front Door",
|
||||||
|
"serial": REDACTED,
|
||||||
|
"type": 12,
|
||||||
|
"error": False,
|
||||||
|
"low_battery": False,
|
||||||
|
"offline": False,
|
||||||
|
"settings": {
|
||||||
|
"instantTrigger": False,
|
||||||
|
"away2": 1,
|
||||||
|
"away": 1,
|
||||||
|
"home2": 1,
|
||||||
|
"home": 1,
|
||||||
|
"off": 0,
|
||||||
|
},
|
||||||
|
"trigger_instantly": False,
|
||||||
|
"triggered": False,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"alarm_duration": 240,
|
||||||
|
"alarm_volume": 3,
|
||||||
|
"battery_backup_power_level": 5293,
|
||||||
|
"cameras": [
|
||||||
|
{
|
||||||
|
"camera_settings": {
|
||||||
|
"cameraName": "Camera",
|
||||||
|
"pictureQuality": "720p",
|
||||||
|
"nightVision": "auto",
|
||||||
|
"statusLight": "off",
|
||||||
|
"micSensitivity": 100,
|
||||||
|
"micEnable": True,
|
||||||
|
"speakerVolume": 75,
|
||||||
|
"motionSensitivity": 0,
|
||||||
|
"shutterHome": "closedAlarmOnly",
|
||||||
|
"shutterAway": "open",
|
||||||
|
"shutterOff": "closedAlarmOnly",
|
||||||
|
"wifiSsid": "",
|
||||||
|
"canStream": False,
|
||||||
|
"canRecord": False,
|
||||||
|
"pirEnable": True,
|
||||||
|
"vaEnable": True,
|
||||||
|
"notificationsEnable": False,
|
||||||
|
"enableDoorbellNotification": True,
|
||||||
|
"doorbellChimeVolume": "off",
|
||||||
|
"privacyEnable": False,
|
||||||
|
"hdr": False,
|
||||||
|
"vaZoningEnable": False,
|
||||||
|
"vaZoningRows": 0,
|
||||||
|
"vaZoningCols": 0,
|
||||||
|
"vaZoningMask": [],
|
||||||
|
"maxDigitalZoom": 10,
|
||||||
|
"supportedResolutions": ["480p", "720p"],
|
||||||
|
"admin": {
|
||||||
|
"IRLED": 0,
|
||||||
|
"pirSens": 0,
|
||||||
|
"statusLEDState": 1,
|
||||||
|
"lux": "lowLux",
|
||||||
|
"motionDetectionEnabled": False,
|
||||||
|
"motionThresholdZero": 0,
|
||||||
|
"motionThresholdOne": 10000,
|
||||||
|
"levelChangeDelayZero": 30,
|
||||||
|
"levelChangeDelayOne": 10,
|
||||||
|
"audioDetectionEnabled": False,
|
||||||
|
"audioChannelNum": 2,
|
||||||
|
"audioSampleRate": 16000,
|
||||||
|
"audioChunkBytes": 2048,
|
||||||
|
"audioSampleFormat": 3,
|
||||||
|
"audioSensitivity": 50,
|
||||||
|
"audioThreshold": 50,
|
||||||
|
"audioDirection": 0,
|
||||||
|
"bitRate": 284,
|
||||||
|
"longPress": 2000,
|
||||||
|
"kframe": 1,
|
||||||
|
"gopLength": 40,
|
||||||
|
"idr": 1,
|
||||||
|
"fps": 20,
|
||||||
|
"firmwareVersion": "2.6.1.107",
|
||||||
|
"netConfigVersion": "",
|
||||||
|
"camAgentVersion": "",
|
||||||
|
"lastLogin": 1600639997,
|
||||||
|
"lastLogout": 1600639944,
|
||||||
|
"pirSampleRateMs": 800,
|
||||||
|
"pirHysteresisHigh": 2,
|
||||||
|
"pirHysteresisLow": 10,
|
||||||
|
"pirFilterCoefficient": 1,
|
||||||
|
"logEnabled": True,
|
||||||
|
"logLevel": 3,
|
||||||
|
"logQDepth": 20,
|
||||||
|
"firmwareGroup": "public",
|
||||||
|
"irOpenThreshold": 445,
|
||||||
|
"irCloseThreshold": 840,
|
||||||
|
"irOpenDelay": 3,
|
||||||
|
"irCloseDelay": 3,
|
||||||
|
"irThreshold1x": 388,
|
||||||
|
"irThreshold2x": 335,
|
||||||
|
"irThreshold3x": 260,
|
||||||
|
"rssi": [[1600935204, -43]],
|
||||||
|
"battery": [],
|
||||||
|
"dbm": 0,
|
||||||
|
"vmUse": 161592,
|
||||||
|
"resSet": 10540,
|
||||||
|
"uptime": 810043.74,
|
||||||
|
"wifiDisconnects": 1,
|
||||||
|
"wifiDriverReloads": 1,
|
||||||
|
"statsPeriod": 3600000,
|
||||||
|
"sarlaccDebugLogTypes": 0,
|
||||||
|
"odProcessingFps": 8,
|
||||||
|
"odObjectMinWidthPercent": 6,
|
||||||
|
"odObjectMinHeightPercent": 24,
|
||||||
|
"odEnableObjectDetection": True,
|
||||||
|
"odClassificationMask": 2,
|
||||||
|
"odClassificationConfidenceThreshold": 0.95,
|
||||||
|
"odEnableOverlay": False,
|
||||||
|
"odAnalyticsLib": 2,
|
||||||
|
"odSensitivity": 85,
|
||||||
|
"odEventObjectMask": 2,
|
||||||
|
"odLuxThreshold": 445,
|
||||||
|
"odLuxHysteresisHigh": 4,
|
||||||
|
"odLuxHysteresisLow": 4,
|
||||||
|
"odLuxSamplingFrequency": 30,
|
||||||
|
"odFGExtractorMode": 2,
|
||||||
|
"odVideoScaleFactor": 1,
|
||||||
|
"odSceneType": 1,
|
||||||
|
"odCameraView": 3,
|
||||||
|
"odCameraFOV": 2,
|
||||||
|
"odBackgroundLearnStationary": True,
|
||||||
|
"odBackgroundLearnStationarySpeed": 15,
|
||||||
|
"odClassifierQualityProfile": 1,
|
||||||
|
"odEnableVideoAnalyticsWhileStreaming": False,
|
||||||
|
"wlanMac": "XX:XX:XX:XX:XX:XX",
|
||||||
|
"region": "us-east-1",
|
||||||
|
"enableWifiAnalyticsLib": False,
|
||||||
|
"ivLicense": "",
|
||||||
|
},
|
||||||
|
"pirLevel": "medium",
|
||||||
|
"odLevel": "medium",
|
||||||
|
},
|
||||||
|
"camera_type": 0,
|
||||||
|
"name": "Camera",
|
||||||
|
"serial": REDACTED,
|
||||||
|
"shutter_open_when_away": True,
|
||||||
|
"shutter_open_when_home": False,
|
||||||
|
"shutter_open_when_off": False,
|
||||||
|
"status": "online",
|
||||||
|
"subscription_enabled": True,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"chime_volume": 2,
|
||||||
|
"entry_delay_away": 30,
|
||||||
|
"entry_delay_home": 30,
|
||||||
|
"exit_delay_away": 60,
|
||||||
|
"exit_delay_home": 0,
|
||||||
|
"gsm_strength": -73,
|
||||||
|
"light": True,
|
||||||
|
"locks": [
|
||||||
|
{
|
||||||
|
"name": "Front Door",
|
||||||
|
"serial": REDACTED,
|
||||||
|
"type": 16,
|
||||||
|
"error": False,
|
||||||
|
"low_battery": False,
|
||||||
|
"offline": False,
|
||||||
|
"settings": {
|
||||||
|
"autoLock": 3,
|
||||||
|
"away": 1,
|
||||||
|
"home": 1,
|
||||||
|
"awayToOff": 0,
|
||||||
|
"homeToOff": 1,
|
||||||
|
},
|
||||||
|
"disabled": False,
|
||||||
|
"lock_low_battery": False,
|
||||||
|
"pin_pad_low_battery": False,
|
||||||
|
"pin_pad_offline": False,
|
||||||
|
"state": 1,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"offline": False,
|
||||||
|
"power_outage": False,
|
||||||
|
"rf_jamming": False,
|
||||||
|
"voice_prompt_volume": 2,
|
||||||
|
"wall_power_level": 5933,
|
||||||
|
"wifi_ssid": REDACTED,
|
||||||
|
"wifi_strength": -49,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user