From 9a1173f6a68047f197b0725ae74665ee2a7215cc Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Tue, 7 Nov 2023 08:44:24 +0100 Subject: [PATCH] Add diagnostics tests to Overkiz integration (#103560) Co-authored-by: Joost Lekkerkerker --- tests/components/overkiz/__init__.py | 14 + tests/components/overkiz/conftest.py | 50 +- .../overkiz/fixtures/setup_tahoma_switch.json | 891 ++++++++ .../overkiz/snapshots/test_diagnostics.ambr | 1931 +++++++++++++++++ tests/components/overkiz/test_diagnostics.py | 63 + 5 files changed, 2947 insertions(+), 2 deletions(-) create mode 100644 tests/components/overkiz/fixtures/setup_tahoma_switch.json create mode 100644 tests/components/overkiz/snapshots/test_diagnostics.ambr create mode 100644 tests/components/overkiz/test_diagnostics.py diff --git a/tests/components/overkiz/__init__.py b/tests/components/overkiz/__init__.py index d827bcb8334..407527b619e 100644 --- a/tests/components/overkiz/__init__.py +++ b/tests/components/overkiz/__init__.py @@ -1 +1,15 @@ """Tests for the overkiz component.""" +import humps +from pyoverkiz.models import Setup + +from tests.common import load_json_object_fixture + + +def load_setup_fixture( + fixture: str = "overkiz/setup_tahoma_switch.json", +) -> Setup: + """Return setup from fixture.""" + setup_json = load_json_object_fixture(fixture) + setup = Setup(**humps.decamelize(setup_json)) + + return setup diff --git a/tests/components/overkiz/conftest.py b/tests/components/overkiz/conftest.py index 6e00b6f5fe2..990b88d84ed 100644 --- a/tests/components/overkiz/conftest.py +++ b/tests/components/overkiz/conftest.py @@ -1,14 +1,60 @@ """Configuration for overkiz tests.""" from collections.abc import Generator -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, Mock, patch import pytest +from homeassistant.components.overkiz.const import DOMAIN +from homeassistant.core import HomeAssistant + +from tests.common import MockConfigEntry +from tests.components.overkiz import load_setup_fixture +from tests.components.overkiz.test_config_flow import ( + TEST_EMAIL, + TEST_GATEWAY_ID, + TEST_HUB, + TEST_PASSWORD, +) + +MOCK_SETUP_RESPONSE = Mock(devices=[], gateways=[]) + + +@pytest.fixture +def mock_config_entry() -> MockConfigEntry: + """Return the default mocked config entry.""" + return MockConfigEntry( + title="Somfy TaHoma Switch", + domain=DOMAIN, + unique_id=TEST_GATEWAY_ID, + data={"username": TEST_EMAIL, "password": TEST_PASSWORD, "hub": TEST_HUB}, + ) + @pytest.fixture def mock_setup_entry() -> Generator[AsyncMock, None, None]: - """Override async_setup_entry.""" + """Mock setting up a config entry.""" with patch( "homeassistant.components.overkiz.async_setup_entry", return_value=True ) as mock_setup_entry: yield mock_setup_entry + + +@pytest.fixture +async def init_integration( + hass: HomeAssistant, + mock_config_entry: MockConfigEntry, +) -> MockConfigEntry: + """Set up the Overkiz integration for testing.""" + mock_config_entry.add_to_hass(hass) + + with patch.multiple( + "pyoverkiz.client.OverkizClient", + login=AsyncMock(return_value=True), + get_setup=AsyncMock(return_value=load_setup_fixture()), + get_scenarios=AsyncMock(return_value=[]), + fetch_events=AsyncMock(return_value=[]), + ): + await hass.config_entries.async_setup(mock_config_entry.entry_id) + await hass.async_block_till_done() + + return mock_config_entry diff --git a/tests/components/overkiz/fixtures/setup_tahoma_switch.json b/tests/components/overkiz/fixtures/setup_tahoma_switch.json new file mode 100644 index 00000000000..6b5d8beb7f9 --- /dev/null +++ b/tests/components/overkiz/fixtures/setup_tahoma_switch.json @@ -0,0 +1,891 @@ +{ + "creationTime": 1665238624000, + "lastUpdateTime": 1665238624000, + "id": "SETUP-****-****-6867", + "location": { + "creationTime": 1665238624000, + "lastUpdateTime": 1667054735000, + "city": "** **", + "country": "**", + "postalCode": "** **", + "addressLine1": "** **", + "addressLine2": "*", + "timezone": "Europe/Amsterdam", + "longitude": "**", + "latitude": "**", + "twilightMode": 2, + "twilightAngle": "SOLAR", + "twilightCity": "amsterdam", + "summerSolsticeDuskMinutes": 1290, + "winterSolsticeDuskMinutes": 990, + "twilightOffsetEnabled": false, + "dawnOffset": 0, + "duskOffset": 0, + "countryCode": "NL" + }, + "gateways": [ + { + "gatewayId": "****-****-6867", + "type": 98, + "subType": 1, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "autoUpdateEnabled": true, + "alive": true, + "timeReliable": true, + "connectivity": { + "status": "OK", + "protocolVersion": "2023.4.4" + }, + "upToDate": true, + "updateStatus": "UP_TO_DATE", + "syncInProgress": false, + "mode": "ACTIVE", + "functions": "INTERNET_AUTHORIZATION,SCENARIO_DOWNLOAD,SCENARIO_AUTO_LAUNCHING,SCENARIO_TELECO_LAUNCHING,INTERNET_UPLOAD,INTERNET_UPDATE,TRIGGERS_SENSORS" + } + ], + "devices": [ + { + "creationTime": 1665238630000, + "lastUpdateTime": 1665238630000, + "label": "** *(**)*", + "deviceURL": "homekit://****-****-6867/stack", + "shortcut": false, + "controllableName": "homekit:StackComponent", + "definition": { + "commands": [ + { + "commandName": "deleteControllers", + "nparams": 0 + } + ], + "states": [], + "dataProperties": [], + "widgetName": "HomekitStack", + "uiProfiles": ["Specific"], + "uiClass": "ProtocolGateway", + "qualifiedName": "homekit:StackComponent", + "type": "PROTOCOL_GATEWAY" + }, + "attributes": [ + { + "name": "homekit:SetupPayload", + "type": 3, + "value": "**:*/*/**" + }, + { + "name": "homekit:SetupCode", + "type": 3, + "value": "**" + } + ], + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 5, + "widget": "HomekitStack", + "oid": "ab964849-56ca-4e9c-a58c-33ce5e341b68", + "uiClass": "ProtocolGateway" + }, + { + "creationTime": 1665238630000, + "lastUpdateTime": 1665238630000, + "label": "**", + "deviceURL": "internal://****-****-6867/pod/0", + "shortcut": false, + "controllableName": "internal:PodV3Component", + "definition": { + "commands": [ + { + "commandName": "getName", + "nparams": 0 + }, + { + "commandName": "update", + "nparams": 0 + }, + { + "commandName": "setCountryCode", + "nparams": 1 + }, + { + "commandName": "activateCalendar", + "nparams": 0 + }, + { + "commandName": "deactivateCalendar", + "nparams": 0 + }, + { + "commandName": "refreshPodMode", + "nparams": 0 + }, + { + "commandName": "refreshUpdateStatus", + "nparams": 0 + }, + { + "commandName": "setCalendar", + "nparams": 1 + }, + { + "commandName": "setLightingLedPodMode", + "nparams": 1 + }, + { + "commandName": "setPodLedOff", + "nparams": 0 + }, + { + "commandName": "setPodLedOn", + "nparams": 0 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["offline", "online"], + "qualifiedName": "core:ConnectivityState" + }, + { + "type": "DataState", + "qualifiedName": "core:CountryCodeState" + }, + { + "eventBased": true, + "type": "DataState", + "qualifiedName": "core:LocalAccessProofState" + }, + { + "type": "DataState", + "qualifiedName": "core:LocalIPv4AddressState" + }, + { + "type": "DataState", + "qualifiedName": "core:NameState" + }, + { + "eventBased": true, + "type": "DiscreteState", + "values": ["pressed", "stop"], + "qualifiedName": "internal:Button1State" + }, + { + "eventBased": true, + "type": "DiscreteState", + "values": ["pressed", "stop"], + "qualifiedName": "internal:Button2State" + }, + { + "eventBased": true, + "type": "DiscreteState", + "values": ["pressed", "stop"], + "qualifiedName": "internal:Button3State" + }, + { + "type": "ContinuousState", + "qualifiedName": "internal:LightingLedPodModeState" + } + ], + "dataProperties": [], + "widgetName": "Pod", + "uiProfiles": ["UpdatableComponent"], + "uiClass": "Pod", + "qualifiedName": "internal:PodV3Component", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "internal:LightingLedPodModeState", + "type": 2, + "value": 1 + }, + { + "name": "core:CountryCodeState", + "type": 3, + "value": "NL" + }, + { + "name": "internal:Button1State", + "type": 3, + "value": "pressed" + }, + { + "name": "internal:Button3State", + "type": 3, + "value": "stop" + }, + { + "name": "core:LocalAccessProofState", + "type": 3, + "value": "localAccessProof" + }, + { + "name": "core:LocalIPv4AddressState", + "type": 3, + "value": "192.168.1.42" + }, + { + "name": "core:NameState", + "type": 3, + "value": "**" + } + ], + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 1, + "widget": "Pod", + "oid": "c79a8bf6-59d6-434e-8cfd-97193541fa17", + "uiClass": "Pod" + }, + { + "creationTime": 1665238630000, + "lastUpdateTime": 1665238630000, + "label": "** *(**/**)*", + "deviceURL": "internal://****-****-6867/wifi/0", + "shortcut": false, + "controllableName": "internal:WifiComponent", + "definition": { + "commands": [ + { + "commandName": "clearCredentials", + "nparams": 0 + }, + { + "commandName": "setTargetInfraConfig", + "nparams": 2 + }, + { + "commandName": "setWifiMode", + "nparams": 1 + } + ], + "states": [ + { + "type": "DataState", + "qualifiedName": "internal:CurrentInfraConfigState" + }, + { + "type": "ContinuousState", + "qualifiedName": "internal:SignalStrengthState" + }, + { + "type": "DataState", + "qualifiedName": "internal:WifiModeState" + } + ], + "dataProperties": [], + "widgetName": "Wifi", + "uiProfiles": ["Specific"], + "uiClass": "Wifi", + "qualifiedName": "internal:WifiComponent", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "internal:WifiModeState", + "type": 3, + "value": "infrastructure" + }, + { + "name": "internal:CurrentInfraConfigState", + "type": 3, + "value": "AM" + }, + { + "name": "internal:SignalStrengthState", + "type": 1, + "value": 69 + } + ], + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 1, + "widget": "Wifi", + "oid": "4272c61b-5493-453c-8d87-a58e45ef60f8", + "uiClass": "Wifi" + }, + { + "creationTime": 1665238924000, + "lastUpdateTime": 1665238924000, + "label": "** *(**)*", + "deviceURL": "io://****-****-6867/4167385", + "shortcut": false, + "controllableName": "io:StackComponent", + "definition": { + "commands": [ + { + "commandName": "advancedSomfyDiscover", + "nparams": 1 + }, + { + "commandName": "discover1WayController", + "nparams": 2 + }, + { + "commandName": "discoverActuators", + "nparams": 1 + }, + { + "commandName": "discoverSensors", + "nparams": 1 + }, + { + "commandName": "discoverSomfyUnsetActuators", + "nparams": 0 + }, + { + "commandName": "joinNetwork", + "nparams": 0 + }, + { + "commandName": "resetNetworkSecurity", + "nparams": 0 + }, + { + "commandName": "shareNetwork", + "nparams": 0 + } + ], + "states": [], + "dataProperties": [], + "widgetName": "IOStack", + "uiProfiles": ["Specific"], + "uiClass": "ProtocolGateway", + "qualifiedName": "io:StackComponent", + "type": "PROTOCOL_GATEWAY" + }, + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 5, + "widget": "IOStack", + "oid": "bb301e56-0957-417f-ba37-26efc11659aa", + "uiClass": "ProtocolGateway" + }, + { + "creationTime": 1665238637000, + "lastUpdateTime": 1665238637000, + "label": "** ** **", + "deviceURL": "ogp://****-****-6867/00000BE8", + "shortcut": false, + "controllableName": "ogp:Bridge", + "definition": { + "commands": [ + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "sendPrivate", + "nparams": 1 + }, + { + "commandName": "setName", + "nparams": 1 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:AvailabilityState" + }, + { + "type": "DataState", + "qualifiedName": "core:NameState" + }, + { + "type": "DataState", + "qualifiedName": "core:Private10State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private1State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private2State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private3State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private4State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private5State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private6State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private7State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private8State" + }, + { + "type": "DataState", + "qualifiedName": "core:Private9State" + }, + { + "type": "DataState", + "qualifiedName": "core:RemovableState" + } + ], + "dataProperties": [], + "widgetName": "DynamicBridge", + "uiProfiles": ["Specific"], + "uiClass": "ProtocolGateway", + "qualifiedName": "ogp:Bridge", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:NameState", + "type": 3, + "value": "** ** **" + } + ], + "attributes": [ + { + "name": "core:Technology", + "type": 3, + "value": "KNX" + }, + { + "name": "core:ManufacturerReference", + "type": 3, + "value": "OGP KNX Bridge" + }, + { + "name": "ogp:Features", + "type": 10, + "value": [ + { + "name": "private" + }, + { + "name": "identification" + } + ] + }, + { + "name": "core:Manufacturer", + "type": 3, + "value": "Overkiz" + } + ], + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 1, + "widget": "DynamicBridge", + "oid": "e88717c3-02a9-49b6-a5a5-5adca558afe9", + "uiClass": "ProtocolGateway" + }, + { + "creationTime": 1665238799000, + "lastUpdateTime": 1665238799000, + "label": "** ** **", + "deviceURL": "ogp://****-****-6867/0003FEF3", + "shortcut": false, + "controllableName": "ogp:Bridge", + "definition": { + "commands": [ + { + "commandName": "discover", + "nparams": 0 + }, + { + "commandName": "reset", + "nparams": 0 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:AvailabilityState" + }, + { + "type": "DataState", + "qualifiedName": "core:NameState" + }, + { + "type": "DataState", + "qualifiedName": "core:RemovableState" + } + ], + "dataProperties": [], + "widgetName": "DynamicBridge", + "uiProfiles": ["Specific"], + "uiClass": "ProtocolGateway", + "qualifiedName": "ogp:Bridge", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:NameState", + "type": 3, + "value": "** ** **" + } + ], + "attributes": [ + { + "name": "core:ManufacturerReference", + "type": 3, + "value": "OGP Sonos Bridge" + }, + { + "name": "core:Manufacturer", + "type": 3, + "value": "Overkiz" + }, + { + "name": "ogp:Features", + "type": 10, + "value": [ + { + "name": "identification", + "commandLess": true + }, + { + "name": "discovery" + }, + { + "name": "reset" + } + ] + }, + { + "name": "core:Technology", + "type": 3, + "value": "Sonos" + } + ], + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 1, + "widget": "DynamicBridge", + "oid": "4031915f-df40-4a70-a97f-64031182a507", + "uiClass": "ProtocolGateway" + }, + { + "creationTime": 1665238637000, + "lastUpdateTime": 1665238637000, + "label": "** ** **", + "deviceURL": "ogp://****-****-6867/039575E9", + "shortcut": false, + "controllableName": "ogp:Bridge", + "definition": { + "commands": [ + { + "commandName": "discover", + "nparams": 0 + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "setName", + "nparams": 1 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:AvailabilityState" + }, + { + "type": "DataState", + "qualifiedName": "core:NameState" + }, + { + "type": "DataState", + "qualifiedName": "core:RemovableState" + } + ], + "dataProperties": [], + "widgetName": "DynamicBridge", + "uiProfiles": ["Specific"], + "uiClass": "ProtocolGateway", + "qualifiedName": "ogp:Bridge", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:NameState", + "type": 3, + "value": "** ** **" + } + ], + "attributes": [ + { + "name": "core:Manufacturer", + "type": 3, + "value": "Overkiz" + }, + { + "name": "ogp:Features", + "type": 10, + "value": [ + { + "name": "discovery" + }, + { + "name": "identification" + } + ] + }, + { + "name": "core:ManufacturerReference", + "type": 3, + "value": "OGP Siegenia Bridge" + }, + { + "name": "core:Technology", + "type": 3, + "value": "Siegenia" + } + ], + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 1, + "widget": "DynamicBridge", + "oid": "5cdf0023-2d7e-4e8e-bfb0-74ebb6ebe0eb", + "uiClass": "ProtocolGateway" + }, + { + "creationTime": 1665238637000, + "lastUpdateTime": 1665238637000, + "label": "** ** **", + "deviceURL": "ogp://****-****-6867/09E45393", + "shortcut": false, + "controllableName": "ogp:Bridge", + "definition": { + "commands": [ + { + "commandName": "discover", + "nparams": 0 + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "setName", + "nparams": 1 + } + ], + "states": [ + { + "type": "DiscreteState", + "values": ["available", "unavailable"], + "qualifiedName": "core:AvailabilityState" + }, + { + "type": "DataState", + "qualifiedName": "core:NameState" + }, + { + "type": "DataState", + "qualifiedName": "core:RemovableState" + } + ], + "dataProperties": [], + "widgetName": "DynamicBridge", + "uiProfiles": ["Specific"], + "uiClass": "ProtocolGateway", + "qualifiedName": "ogp:Bridge", + "type": "ACTUATOR" + }, + "states": [ + { + "name": "core:NameState", + "type": 3, + "value": "** ** **" + } + ], + "attributes": [ + { + "name": "core:ManufacturerReference", + "type": 3, + "value": "OGP Intesis Bridge" + }, + { + "name": "ogp:Features", + "type": 10, + "value": [ + { + "name": "discovery" + }, + { + "name": "identification" + } + ] + }, + { + "name": "core:Manufacturer", + "type": 3, + "value": "Overkiz" + }, + { + "name": "core:Technology", + "type": 3, + "value": "Intesis" + } + ], + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 1, + "widget": "DynamicBridge", + "oid": "b1f5dc24-058e-4cb2-a052-7b2d5a7de7a5", + "uiClass": "ProtocolGateway" + }, + { + "creationTime": 1667840384000, + "lastUpdateTime": 1667840384000, + "label": "** ** **", + "deviceURL": "rts://****-****-6867/16756006", + "shortcut": false, + "controllableName": "rts:RollerShutterRTSComponent", + "definition": { + "commands": [ + { + "commandName": "close", + "nparams": 1 + }, + { + "commandName": "down", + "nparams": 1 + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "my", + "nparams": 1 + }, + { + "commandName": "open", + "nparams": 1 + }, + { + "commandName": "rest", + "nparams": 1 + }, + { + "commandName": "stop", + "nparams": 1 + }, + { + "commandName": "test", + "nparams": 0 + }, + { + "commandName": "up", + "nparams": 1 + }, + { + "commandName": "openConfiguration", + "nparams": 1 + } + ], + "states": [], + "dataProperties": [ + { + "value": "0", + "qualifiedName": "core:identifyInterval" + } + ], + "widgetName": "UpDownRollerShutter", + "uiProfiles": ["OpenCloseShutter", "OpenClose"], + "uiClass": "RollerShutter", + "qualifiedName": "rts:RollerShutterRTSComponent", + "type": "ACTUATOR" + }, + "attributes": [ + { + "name": "rts:diy", + "type": 6, + "value": true + } + ], + "available": true, + "enabled": true, + "placeOID": "9e3d6899-50bb-4869-9c5e-46c2b57f7c9e", + "type": 1, + "widget": "UpDownRollerShutter", + "oid": "1a10d6f6-9bc3-40f3-a33c-e383fd41d3e8", + "uiClass": "RollerShutter" + }, + { + "creationTime": 1665238630000, + "lastUpdateTime": 1665238630000, + "label": "** *(**)*", + "deviceURL": "zigbee://****-****-6867/65535", + "shortcut": false, + "controllableName": "zigbee:TransceiverV3_0Component", + "definition": { + "commands": [], + "states": [], + "dataProperties": [], + "widgetName": "ZigbeeStack", + "uiProfiles": ["Specific"], + "uiClass": "ProtocolGateway", + "qualifiedName": "zigbee:TransceiverV3_0Component", + "type": "PROTOCOL_GATEWAY" + }, + "available": true, + "enabled": true, + "placeOID": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "type": 5, + "widget": "ZigbeeStack", + "oid": "1629c223-d115-4aad-808a-373f428d9c27", + "uiClass": "ProtocolGateway" + } + ], + "zones": [], + "resellerDelegationType": "NEVER", + "disconnectionConfiguration": { + "notificationTitle": "[User] : Your Somfy box is disconnected", + "notificationText": "Your Somfy box is disconnected", + "targetPushSubscriptions": ["8849df9a-b61a-498f-ab81-67a767adba31"], + "notificationType": "PUSH" + }, + "oid": "15eaf55a-8af9-483b-ae4a-ffd4254fd762", + "rootPlace": { + "creationTime": 1665238624000, + "lastUpdateTime": 1665238630000, + "label": "** **", + "type": 200, + "oid": "41d63e43-bfa8-4e24-8c16-4faae0448cab", + "subPlaces": [ + { + "creationTime": 1667840432000, + "lastUpdateTime": 1667840432000, + "label": "**", + "type": 108, + "metadata": "{\"color\":\"#08C27F\"}", + "oid": "9e3d6899-50bb-4869-9c5e-46c2b57f7c9e", + "subPlaces": [] + } + ] + }, + "features": [] +} diff --git a/tests/components/overkiz/snapshots/test_diagnostics.ambr b/tests/components/overkiz/snapshots/test_diagnostics.ambr new file mode 100644 index 00000000000..06a456f88af --- /dev/null +++ b/tests/components/overkiz/snapshots/test_diagnostics.ambr @@ -0,0 +1,1931 @@ +# serializer version: 1 +# name: test_device_diagnostics + dict({ + 'device': dict({ + 'controllable_name': 'rts:RollerShutterRTSComponent', + 'device_url': 'rts://****-****-6867/16756006', + 'firmware': None, + 'model': 'UpDownRollerShutter', + }), + 'execution_history': list([ + ]), + 'server': 'somfy_europe', + 'setup': dict({ + 'creationTime': 1665238624000, + 'devices': list([ + dict({ + 'attributes': list([ + dict({ + 'name': 'homekit:SetupPayload', + 'type': 3, + 'value': '**:*/*/**', + }), + dict({ + 'name': 'homekit:SetupCode', + 'type': 3, + 'value': '**', + }), + ]), + 'available': True, + 'controllableName': 'homekit:StackComponent', + 'creationTime': 1665238630000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'deleteControllers', + 'nparams': 0, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'homekit:StackComponent', + 'states': list([ + ]), + 'type': 'PROTOCOL_GATEWAY', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'HomekitStack', + }), + 'deviceURL': 'homekit://****-****-6867/stack', + 'enabled': True, + 'label': '** *(**)*', + 'lastUpdateTime': 1665238630000, + 'oid': 'ab964849-56ca-4e9c-a58c-33ce5e341b68', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'type': 5, + 'uiClass': 'ProtocolGateway', + 'widget': 'HomekitStack', + }), + dict({ + 'available': True, + 'controllableName': 'internal:PodV3Component', + 'creationTime': 1665238630000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'getName', + 'nparams': 0, + }), + dict({ + 'commandName': 'update', + 'nparams': 0, + }), + dict({ + 'commandName': 'setCountryCode', + 'nparams': 1, + }), + dict({ + 'commandName': 'activateCalendar', + 'nparams': 0, + }), + dict({ + 'commandName': 'deactivateCalendar', + 'nparams': 0, + }), + dict({ + 'commandName': 'refreshPodMode', + 'nparams': 0, + }), + dict({ + 'commandName': 'refreshUpdateStatus', + 'nparams': 0, + }), + dict({ + 'commandName': 'setCalendar', + 'nparams': 1, + }), + dict({ + 'commandName': 'setLightingLedPodMode', + 'nparams': 1, + }), + dict({ + 'commandName': 'setPodLedOff', + 'nparams': 0, + }), + dict({ + 'commandName': 'setPodLedOn', + 'nparams': 0, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'internal:PodV3Component', + 'states': list([ + dict({ + 'qualifiedName': 'core:ConnectivityState', + 'type': 'DiscreteState', + 'values': list([ + 'offline', + 'online', + ]), + }), + dict({ + 'qualifiedName': 'core:CountryCodeState', + 'type': 'DataState', + }), + dict({ + 'eventBased': True, + 'qualifiedName': 'core:LocalAccessProofState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:LocalIPv4AddressState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'eventBased': True, + 'qualifiedName': 'internal:Button1State', + 'type': 'DiscreteState', + 'values': list([ + 'pressed', + 'stop', + ]), + }), + dict({ + 'eventBased': True, + 'qualifiedName': 'internal:Button2State', + 'type': 'DiscreteState', + 'values': list([ + 'pressed', + 'stop', + ]), + }), + dict({ + 'eventBased': True, + 'qualifiedName': 'internal:Button3State', + 'type': 'DiscreteState', + 'values': list([ + 'pressed', + 'stop', + ]), + }), + dict({ + 'qualifiedName': 'internal:LightingLedPodModeState', + 'type': 'ContinuousState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'Pod', + 'uiProfiles': list([ + 'UpdatableComponent', + ]), + 'widgetName': 'Pod', + }), + 'deviceURL': 'internal://****-****-6867/pod/0', + 'enabled': True, + 'label': '**', + 'lastUpdateTime': 1665238630000, + 'oid': 'c79a8bf6-59d6-434e-8cfd-97193541fa17', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'internal:LightingLedPodModeState', + 'type': 2, + 'value': 1, + }), + dict({ + 'name': 'core:CountryCodeState', + 'type': 3, + 'value': 'NL', + }), + dict({ + 'name': 'internal:Button1State', + 'type': 3, + 'value': 'pressed', + }), + dict({ + 'name': 'internal:Button3State', + 'type': 3, + 'value': 'stop', + }), + dict({ + 'name': 'core:LocalAccessProofState', + 'type': 3, + 'value': 'localAccessProof', + }), + dict({ + 'name': 'core:LocalIPv4AddressState', + 'type': 3, + 'value': '192.168.1.42', + }), + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '**', + }), + ]), + 'type': 1, + 'uiClass': 'Pod', + 'widget': 'Pod', + }), + dict({ + 'available': True, + 'controllableName': 'internal:WifiComponent', + 'creationTime': 1665238630000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'clearCredentials', + 'nparams': 0, + }), + dict({ + 'commandName': 'setTargetInfraConfig', + 'nparams': 2, + }), + dict({ + 'commandName': 'setWifiMode', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'internal:WifiComponent', + 'states': list([ + dict({ + 'qualifiedName': 'internal:CurrentInfraConfigState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'internal:SignalStrengthState', + 'type': 'ContinuousState', + }), + dict({ + 'qualifiedName': 'internal:WifiModeState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'Wifi', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'Wifi', + }), + 'deviceURL': 'internal://****-****-6867/wifi/0', + 'enabled': True, + 'label': '** *(**/**)*', + 'lastUpdateTime': 1665238630000, + 'oid': '4272c61b-5493-453c-8d87-a58e45ef60f8', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'internal:WifiModeState', + 'type': 3, + 'value': 'infrastructure', + }), + dict({ + 'name': 'internal:CurrentInfraConfigState', + 'type': 3, + 'value': 'AM', + }), + dict({ + 'name': 'internal:SignalStrengthState', + 'type': 1, + 'value': 69, + }), + ]), + 'type': 1, + 'uiClass': 'Wifi', + 'widget': 'Wifi', + }), + dict({ + 'available': True, + 'controllableName': 'io:StackComponent', + 'creationTime': 1665238924000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'advancedSomfyDiscover', + 'nparams': 1, + }), + dict({ + 'commandName': 'discover1WayController', + 'nparams': 2, + }), + dict({ + 'commandName': 'discoverActuators', + 'nparams': 1, + }), + dict({ + 'commandName': 'discoverSensors', + 'nparams': 1, + }), + dict({ + 'commandName': 'discoverSomfyUnsetActuators', + 'nparams': 0, + }), + dict({ + 'commandName': 'joinNetwork', + 'nparams': 0, + }), + dict({ + 'commandName': 'resetNetworkSecurity', + 'nparams': 0, + }), + dict({ + 'commandName': 'shareNetwork', + 'nparams': 0, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'io:StackComponent', + 'states': list([ + ]), + 'type': 'PROTOCOL_GATEWAY', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'IOStack', + }), + 'deviceURL': 'io://****-****-6867/4167385', + 'enabled': True, + 'label': '** *(**)*', + 'lastUpdateTime': 1665238924000, + 'oid': 'bb301e56-0957-417f-ba37-26efc11659aa', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'type': 5, + 'uiClass': 'ProtocolGateway', + 'widget': 'IOStack', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'core:Technology', + 'type': 3, + 'value': 'KNX', + }), + dict({ + 'name': 'core:ManufacturerReference', + 'type': 3, + 'value': 'OGP KNX Bridge', + }), + dict({ + 'name': 'ogp:Features', + 'type': 10, + 'value': list([ + dict({ + 'name': 'private', + }), + dict({ + 'name': 'identification', + }), + ]), + }), + dict({ + 'name': 'core:Manufacturer', + 'type': 3, + 'value': 'Overkiz', + }), + ]), + 'available': True, + 'controllableName': 'ogp:Bridge', + 'creationTime': 1665238637000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'identify', + 'nparams': 0, + }), + dict({ + 'commandName': 'sendPrivate', + 'nparams': 1, + }), + dict({ + 'commandName': 'setName', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'ogp:Bridge', + 'states': list([ + dict({ + 'qualifiedName': 'core:AvailabilityState', + 'type': 'DiscreteState', + 'values': list([ + 'available', + 'unavailable', + ]), + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private10State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private1State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private2State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private3State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private4State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private5State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private6State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private7State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private8State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private9State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:RemovableState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'DynamicBridge', + }), + 'deviceURL': 'ogp://****-****-6867/00000BE8', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1665238637000, + 'oid': 'e88717c3-02a9-49b6-a5a5-5adca558afe9', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '** ** **', + }), + ]), + 'type': 1, + 'uiClass': 'ProtocolGateway', + 'widget': 'DynamicBridge', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'core:ManufacturerReference', + 'type': 3, + 'value': 'OGP Sonos Bridge', + }), + dict({ + 'name': 'core:Manufacturer', + 'type': 3, + 'value': 'Overkiz', + }), + dict({ + 'name': 'ogp:Features', + 'type': 10, + 'value': list([ + dict({ + 'commandLess': True, + 'name': 'identification', + }), + dict({ + 'name': 'discovery', + }), + dict({ + 'name': 'reset', + }), + ]), + }), + dict({ + 'name': 'core:Technology', + 'type': 3, + 'value': 'Sonos', + }), + ]), + 'available': True, + 'controllableName': 'ogp:Bridge', + 'creationTime': 1665238799000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'discover', + 'nparams': 0, + }), + dict({ + 'commandName': 'reset', + 'nparams': 0, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'ogp:Bridge', + 'states': list([ + dict({ + 'qualifiedName': 'core:AvailabilityState', + 'type': 'DiscreteState', + 'values': list([ + 'available', + 'unavailable', + ]), + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:RemovableState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'DynamicBridge', + }), + 'deviceURL': 'ogp://****-****-6867/0003FEF3', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1665238799000, + 'oid': '4031915f-df40-4a70-a97f-64031182a507', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '** ** **', + }), + ]), + 'type': 1, + 'uiClass': 'ProtocolGateway', + 'widget': 'DynamicBridge', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'core:Manufacturer', + 'type': 3, + 'value': 'Overkiz', + }), + dict({ + 'name': 'ogp:Features', + 'type': 10, + 'value': list([ + dict({ + 'name': 'discovery', + }), + dict({ + 'name': 'identification', + }), + ]), + }), + dict({ + 'name': 'core:ManufacturerReference', + 'type': 3, + 'value': 'OGP Siegenia Bridge', + }), + dict({ + 'name': 'core:Technology', + 'type': 3, + 'value': 'Siegenia', + }), + ]), + 'available': True, + 'controllableName': 'ogp:Bridge', + 'creationTime': 1665238637000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'discover', + 'nparams': 0, + }), + dict({ + 'commandName': 'identify', + 'nparams': 0, + }), + dict({ + 'commandName': 'setName', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'ogp:Bridge', + 'states': list([ + dict({ + 'qualifiedName': 'core:AvailabilityState', + 'type': 'DiscreteState', + 'values': list([ + 'available', + 'unavailable', + ]), + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:RemovableState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'DynamicBridge', + }), + 'deviceURL': 'ogp://****-****-6867/039575E9', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1665238637000, + 'oid': '5cdf0023-2d7e-4e8e-bfb0-74ebb6ebe0eb', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '** ** **', + }), + ]), + 'type': 1, + 'uiClass': 'ProtocolGateway', + 'widget': 'DynamicBridge', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'core:ManufacturerReference', + 'type': 3, + 'value': 'OGP Intesis Bridge', + }), + dict({ + 'name': 'ogp:Features', + 'type': 10, + 'value': list([ + dict({ + 'name': 'discovery', + }), + dict({ + 'name': 'identification', + }), + ]), + }), + dict({ + 'name': 'core:Manufacturer', + 'type': 3, + 'value': 'Overkiz', + }), + dict({ + 'name': 'core:Technology', + 'type': 3, + 'value': 'Intesis', + }), + ]), + 'available': True, + 'controllableName': 'ogp:Bridge', + 'creationTime': 1665238637000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'discover', + 'nparams': 0, + }), + dict({ + 'commandName': 'identify', + 'nparams': 0, + }), + dict({ + 'commandName': 'setName', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'ogp:Bridge', + 'states': list([ + dict({ + 'qualifiedName': 'core:AvailabilityState', + 'type': 'DiscreteState', + 'values': list([ + 'available', + 'unavailable', + ]), + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:RemovableState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'DynamicBridge', + }), + 'deviceURL': 'ogp://****-****-6867/09E45393', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1665238637000, + 'oid': 'b1f5dc24-058e-4cb2-a052-7b2d5a7de7a5', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '** ** **', + }), + ]), + 'type': 1, + 'uiClass': 'ProtocolGateway', + 'widget': 'DynamicBridge', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'rts:diy', + 'type': 6, + 'value': True, + }), + ]), + 'available': True, + 'controllableName': 'rts:RollerShutterRTSComponent', + 'creationTime': 1667840384000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'close', + 'nparams': 1, + }), + dict({ + 'commandName': 'down', + 'nparams': 1, + }), + dict({ + 'commandName': 'identify', + 'nparams': 0, + }), + dict({ + 'commandName': 'my', + 'nparams': 1, + }), + dict({ + 'commandName': 'open', + 'nparams': 1, + }), + dict({ + 'commandName': 'rest', + 'nparams': 1, + }), + dict({ + 'commandName': 'stop', + 'nparams': 1, + }), + dict({ + 'commandName': 'test', + 'nparams': 0, + }), + dict({ + 'commandName': 'up', + 'nparams': 1, + }), + dict({ + 'commandName': 'openConfiguration', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + dict({ + 'qualifiedName': 'core:identifyInterval', + 'value': '0', + }), + ]), + 'qualifiedName': 'rts:RollerShutterRTSComponent', + 'states': list([ + ]), + 'type': 'ACTUATOR', + 'uiClass': 'RollerShutter', + 'uiProfiles': list([ + 'OpenCloseShutter', + 'OpenClose', + ]), + 'widgetName': 'UpDownRollerShutter', + }), + 'deviceURL': 'rts://****-****-6867/16756006', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1667840384000, + 'oid': '1a10d6f6-9bc3-40f3-a33c-e383fd41d3e8', + 'placeOID': '9e3d6899-50bb-4869-9c5e-46c2b57f7c9e', + 'shortcut': False, + 'type': 1, + 'uiClass': 'RollerShutter', + 'widget': 'UpDownRollerShutter', + }), + dict({ + 'available': True, + 'controllableName': 'zigbee:TransceiverV3_0Component', + 'creationTime': 1665238630000, + 'definition': dict({ + 'commands': list([ + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'zigbee:TransceiverV3_0Component', + 'states': list([ + ]), + 'type': 'PROTOCOL_GATEWAY', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'ZigbeeStack', + }), + 'deviceURL': 'zigbee://****-****-6867/65535', + 'enabled': True, + 'label': '** *(**)*', + 'lastUpdateTime': 1665238630000, + 'oid': '1629c223-d115-4aad-808a-373f428d9c27', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'type': 5, + 'uiClass': 'ProtocolGateway', + 'widget': 'ZigbeeStack', + }), + ]), + 'disconnectionConfiguration': dict({ + 'notificationText': 'Your Somfy box is disconnected', + 'notificationTitle': '[User] : Your Somfy box is disconnected', + 'notificationType': 'PUSH', + 'targetPushSubscriptions': list([ + '8849df9a-b61a-498f-ab81-67a767adba31', + ]), + }), + 'features': list([ + ]), + 'gateways': list([ + dict({ + 'alive': True, + 'autoUpdateEnabled': True, + 'connectivity': dict({ + 'protocolVersion': '2023.4.4', + 'status': 'OK', + }), + 'functions': 'INTERNET_AUTHORIZATION,SCENARIO_DOWNLOAD,SCENARIO_AUTO_LAUNCHING,SCENARIO_TELECO_LAUNCHING,INTERNET_UPLOAD,INTERNET_UPDATE,TRIGGERS_SENSORS', + 'gatewayId': '****-****-6867', + 'mode': 'ACTIVE', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'subType': 1, + 'syncInProgress': False, + 'timeReliable': True, + 'type': 98, + 'upToDate': True, + 'updateStatus': 'UP_TO_DATE', + }), + ]), + 'id': 'SETUP-****-****-6867', + 'lastUpdateTime': 1665238624000, + 'location': dict({ + 'addressLine1': '** **', + 'addressLine2': '*', + 'city': '** **', + 'country': '**', + 'countryCode': 'NL', + 'creationTime': 1665238624000, + 'dawnOffset': 0, + 'duskOffset': 0, + 'lastUpdateTime': 1667054735000, + 'latitude': '**', + 'longitude': '**', + 'postalCode': '** **', + 'summerSolsticeDuskMinutes': 1290, + 'timezone': 'Europe/Amsterdam', + 'twilightAngle': 'SOLAR', + 'twilightCity': 'amsterdam', + 'twilightMode': 2, + 'twilightOffsetEnabled': False, + 'winterSolsticeDuskMinutes': 990, + }), + 'oid': '15eaf55a-8af9-483b-ae4a-ffd4254fd762', + 'resellerDelegationType': 'NEVER', + 'rootPlace': dict({ + 'creationTime': 1665238624000, + 'label': '** **', + 'lastUpdateTime': 1665238630000, + 'oid': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'subPlaces': list([ + dict({ + 'creationTime': 1667840432000, + 'label': '**', + 'lastUpdateTime': 1667840432000, + 'metadata': '{"color":"#08C27F"}', + 'oid': '9e3d6899-50bb-4869-9c5e-46c2b57f7c9e', + 'subPlaces': list([ + ]), + 'type': 108, + }), + ]), + 'type': 200, + }), + 'zones': list([ + ]), + }), + }) +# --- +# name: test_diagnostics + dict({ + 'execution_history': list([ + ]), + 'server': 'somfy_europe', + 'setup': dict({ + 'creationTime': 1665238624000, + 'devices': list([ + dict({ + 'attributes': list([ + dict({ + 'name': 'homekit:SetupPayload', + 'type': 3, + 'value': '**:*/*/**', + }), + dict({ + 'name': 'homekit:SetupCode', + 'type': 3, + 'value': '**', + }), + ]), + 'available': True, + 'controllableName': 'homekit:StackComponent', + 'creationTime': 1665238630000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'deleteControllers', + 'nparams': 0, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'homekit:StackComponent', + 'states': list([ + ]), + 'type': 'PROTOCOL_GATEWAY', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'HomekitStack', + }), + 'deviceURL': 'homekit://****-****-6867/stack', + 'enabled': True, + 'label': '** *(**)*', + 'lastUpdateTime': 1665238630000, + 'oid': 'ab964849-56ca-4e9c-a58c-33ce5e341b68', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'type': 5, + 'uiClass': 'ProtocolGateway', + 'widget': 'HomekitStack', + }), + dict({ + 'available': True, + 'controllableName': 'internal:PodV3Component', + 'creationTime': 1665238630000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'getName', + 'nparams': 0, + }), + dict({ + 'commandName': 'update', + 'nparams': 0, + }), + dict({ + 'commandName': 'setCountryCode', + 'nparams': 1, + }), + dict({ + 'commandName': 'activateCalendar', + 'nparams': 0, + }), + dict({ + 'commandName': 'deactivateCalendar', + 'nparams': 0, + }), + dict({ + 'commandName': 'refreshPodMode', + 'nparams': 0, + }), + dict({ + 'commandName': 'refreshUpdateStatus', + 'nparams': 0, + }), + dict({ + 'commandName': 'setCalendar', + 'nparams': 1, + }), + dict({ + 'commandName': 'setLightingLedPodMode', + 'nparams': 1, + }), + dict({ + 'commandName': 'setPodLedOff', + 'nparams': 0, + }), + dict({ + 'commandName': 'setPodLedOn', + 'nparams': 0, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'internal:PodV3Component', + 'states': list([ + dict({ + 'qualifiedName': 'core:ConnectivityState', + 'type': 'DiscreteState', + 'values': list([ + 'offline', + 'online', + ]), + }), + dict({ + 'qualifiedName': 'core:CountryCodeState', + 'type': 'DataState', + }), + dict({ + 'eventBased': True, + 'qualifiedName': 'core:LocalAccessProofState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:LocalIPv4AddressState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'eventBased': True, + 'qualifiedName': 'internal:Button1State', + 'type': 'DiscreteState', + 'values': list([ + 'pressed', + 'stop', + ]), + }), + dict({ + 'eventBased': True, + 'qualifiedName': 'internal:Button2State', + 'type': 'DiscreteState', + 'values': list([ + 'pressed', + 'stop', + ]), + }), + dict({ + 'eventBased': True, + 'qualifiedName': 'internal:Button3State', + 'type': 'DiscreteState', + 'values': list([ + 'pressed', + 'stop', + ]), + }), + dict({ + 'qualifiedName': 'internal:LightingLedPodModeState', + 'type': 'ContinuousState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'Pod', + 'uiProfiles': list([ + 'UpdatableComponent', + ]), + 'widgetName': 'Pod', + }), + 'deviceURL': 'internal://****-****-6867/pod/0', + 'enabled': True, + 'label': '**', + 'lastUpdateTime': 1665238630000, + 'oid': 'c79a8bf6-59d6-434e-8cfd-97193541fa17', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'internal:LightingLedPodModeState', + 'type': 2, + 'value': 1, + }), + dict({ + 'name': 'core:CountryCodeState', + 'type': 3, + 'value': 'NL', + }), + dict({ + 'name': 'internal:Button1State', + 'type': 3, + 'value': 'pressed', + }), + dict({ + 'name': 'internal:Button3State', + 'type': 3, + 'value': 'stop', + }), + dict({ + 'name': 'core:LocalAccessProofState', + 'type': 3, + 'value': 'localAccessProof', + }), + dict({ + 'name': 'core:LocalIPv4AddressState', + 'type': 3, + 'value': '192.168.1.42', + }), + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '**', + }), + ]), + 'type': 1, + 'uiClass': 'Pod', + 'widget': 'Pod', + }), + dict({ + 'available': True, + 'controllableName': 'internal:WifiComponent', + 'creationTime': 1665238630000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'clearCredentials', + 'nparams': 0, + }), + dict({ + 'commandName': 'setTargetInfraConfig', + 'nparams': 2, + }), + dict({ + 'commandName': 'setWifiMode', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'internal:WifiComponent', + 'states': list([ + dict({ + 'qualifiedName': 'internal:CurrentInfraConfigState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'internal:SignalStrengthState', + 'type': 'ContinuousState', + }), + dict({ + 'qualifiedName': 'internal:WifiModeState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'Wifi', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'Wifi', + }), + 'deviceURL': 'internal://****-****-6867/wifi/0', + 'enabled': True, + 'label': '** *(**/**)*', + 'lastUpdateTime': 1665238630000, + 'oid': '4272c61b-5493-453c-8d87-a58e45ef60f8', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'internal:WifiModeState', + 'type': 3, + 'value': 'infrastructure', + }), + dict({ + 'name': 'internal:CurrentInfraConfigState', + 'type': 3, + 'value': 'AM', + }), + dict({ + 'name': 'internal:SignalStrengthState', + 'type': 1, + 'value': 69, + }), + ]), + 'type': 1, + 'uiClass': 'Wifi', + 'widget': 'Wifi', + }), + dict({ + 'available': True, + 'controllableName': 'io:StackComponent', + 'creationTime': 1665238924000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'advancedSomfyDiscover', + 'nparams': 1, + }), + dict({ + 'commandName': 'discover1WayController', + 'nparams': 2, + }), + dict({ + 'commandName': 'discoverActuators', + 'nparams': 1, + }), + dict({ + 'commandName': 'discoverSensors', + 'nparams': 1, + }), + dict({ + 'commandName': 'discoverSomfyUnsetActuators', + 'nparams': 0, + }), + dict({ + 'commandName': 'joinNetwork', + 'nparams': 0, + }), + dict({ + 'commandName': 'resetNetworkSecurity', + 'nparams': 0, + }), + dict({ + 'commandName': 'shareNetwork', + 'nparams': 0, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'io:StackComponent', + 'states': list([ + ]), + 'type': 'PROTOCOL_GATEWAY', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'IOStack', + }), + 'deviceURL': 'io://****-****-6867/4167385', + 'enabled': True, + 'label': '** *(**)*', + 'lastUpdateTime': 1665238924000, + 'oid': 'bb301e56-0957-417f-ba37-26efc11659aa', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'type': 5, + 'uiClass': 'ProtocolGateway', + 'widget': 'IOStack', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'core:Technology', + 'type': 3, + 'value': 'KNX', + }), + dict({ + 'name': 'core:ManufacturerReference', + 'type': 3, + 'value': 'OGP KNX Bridge', + }), + dict({ + 'name': 'ogp:Features', + 'type': 10, + 'value': list([ + dict({ + 'name': 'private', + }), + dict({ + 'name': 'identification', + }), + ]), + }), + dict({ + 'name': 'core:Manufacturer', + 'type': 3, + 'value': 'Overkiz', + }), + ]), + 'available': True, + 'controllableName': 'ogp:Bridge', + 'creationTime': 1665238637000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'identify', + 'nparams': 0, + }), + dict({ + 'commandName': 'sendPrivate', + 'nparams': 1, + }), + dict({ + 'commandName': 'setName', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'ogp:Bridge', + 'states': list([ + dict({ + 'qualifiedName': 'core:AvailabilityState', + 'type': 'DiscreteState', + 'values': list([ + 'available', + 'unavailable', + ]), + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private10State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private1State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private2State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private3State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private4State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private5State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private6State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private7State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private8State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:Private9State', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:RemovableState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'DynamicBridge', + }), + 'deviceURL': 'ogp://****-****-6867/00000BE8', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1665238637000, + 'oid': 'e88717c3-02a9-49b6-a5a5-5adca558afe9', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '** ** **', + }), + ]), + 'type': 1, + 'uiClass': 'ProtocolGateway', + 'widget': 'DynamicBridge', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'core:ManufacturerReference', + 'type': 3, + 'value': 'OGP Sonos Bridge', + }), + dict({ + 'name': 'core:Manufacturer', + 'type': 3, + 'value': 'Overkiz', + }), + dict({ + 'name': 'ogp:Features', + 'type': 10, + 'value': list([ + dict({ + 'commandLess': True, + 'name': 'identification', + }), + dict({ + 'name': 'discovery', + }), + dict({ + 'name': 'reset', + }), + ]), + }), + dict({ + 'name': 'core:Technology', + 'type': 3, + 'value': 'Sonos', + }), + ]), + 'available': True, + 'controllableName': 'ogp:Bridge', + 'creationTime': 1665238799000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'discover', + 'nparams': 0, + }), + dict({ + 'commandName': 'reset', + 'nparams': 0, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'ogp:Bridge', + 'states': list([ + dict({ + 'qualifiedName': 'core:AvailabilityState', + 'type': 'DiscreteState', + 'values': list([ + 'available', + 'unavailable', + ]), + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:RemovableState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'DynamicBridge', + }), + 'deviceURL': 'ogp://****-****-6867/0003FEF3', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1665238799000, + 'oid': '4031915f-df40-4a70-a97f-64031182a507', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '** ** **', + }), + ]), + 'type': 1, + 'uiClass': 'ProtocolGateway', + 'widget': 'DynamicBridge', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'core:Manufacturer', + 'type': 3, + 'value': 'Overkiz', + }), + dict({ + 'name': 'ogp:Features', + 'type': 10, + 'value': list([ + dict({ + 'name': 'discovery', + }), + dict({ + 'name': 'identification', + }), + ]), + }), + dict({ + 'name': 'core:ManufacturerReference', + 'type': 3, + 'value': 'OGP Siegenia Bridge', + }), + dict({ + 'name': 'core:Technology', + 'type': 3, + 'value': 'Siegenia', + }), + ]), + 'available': True, + 'controllableName': 'ogp:Bridge', + 'creationTime': 1665238637000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'discover', + 'nparams': 0, + }), + dict({ + 'commandName': 'identify', + 'nparams': 0, + }), + dict({ + 'commandName': 'setName', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'ogp:Bridge', + 'states': list([ + dict({ + 'qualifiedName': 'core:AvailabilityState', + 'type': 'DiscreteState', + 'values': list([ + 'available', + 'unavailable', + ]), + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:RemovableState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'DynamicBridge', + }), + 'deviceURL': 'ogp://****-****-6867/039575E9', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1665238637000, + 'oid': '5cdf0023-2d7e-4e8e-bfb0-74ebb6ebe0eb', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '** ** **', + }), + ]), + 'type': 1, + 'uiClass': 'ProtocolGateway', + 'widget': 'DynamicBridge', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'core:ManufacturerReference', + 'type': 3, + 'value': 'OGP Intesis Bridge', + }), + dict({ + 'name': 'ogp:Features', + 'type': 10, + 'value': list([ + dict({ + 'name': 'discovery', + }), + dict({ + 'name': 'identification', + }), + ]), + }), + dict({ + 'name': 'core:Manufacturer', + 'type': 3, + 'value': 'Overkiz', + }), + dict({ + 'name': 'core:Technology', + 'type': 3, + 'value': 'Intesis', + }), + ]), + 'available': True, + 'controllableName': 'ogp:Bridge', + 'creationTime': 1665238637000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'discover', + 'nparams': 0, + }), + dict({ + 'commandName': 'identify', + 'nparams': 0, + }), + dict({ + 'commandName': 'setName', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'ogp:Bridge', + 'states': list([ + dict({ + 'qualifiedName': 'core:AvailabilityState', + 'type': 'DiscreteState', + 'values': list([ + 'available', + 'unavailable', + ]), + }), + dict({ + 'qualifiedName': 'core:NameState', + 'type': 'DataState', + }), + dict({ + 'qualifiedName': 'core:RemovableState', + 'type': 'DataState', + }), + ]), + 'type': 'ACTUATOR', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'DynamicBridge', + }), + 'deviceURL': 'ogp://****-****-6867/09E45393', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1665238637000, + 'oid': 'b1f5dc24-058e-4cb2-a052-7b2d5a7de7a5', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'states': list([ + dict({ + 'name': 'core:NameState', + 'type': 3, + 'value': '** ** **', + }), + ]), + 'type': 1, + 'uiClass': 'ProtocolGateway', + 'widget': 'DynamicBridge', + }), + dict({ + 'attributes': list([ + dict({ + 'name': 'rts:diy', + 'type': 6, + 'value': True, + }), + ]), + 'available': True, + 'controllableName': 'rts:RollerShutterRTSComponent', + 'creationTime': 1667840384000, + 'definition': dict({ + 'commands': list([ + dict({ + 'commandName': 'close', + 'nparams': 1, + }), + dict({ + 'commandName': 'down', + 'nparams': 1, + }), + dict({ + 'commandName': 'identify', + 'nparams': 0, + }), + dict({ + 'commandName': 'my', + 'nparams': 1, + }), + dict({ + 'commandName': 'open', + 'nparams': 1, + }), + dict({ + 'commandName': 'rest', + 'nparams': 1, + }), + dict({ + 'commandName': 'stop', + 'nparams': 1, + }), + dict({ + 'commandName': 'test', + 'nparams': 0, + }), + dict({ + 'commandName': 'up', + 'nparams': 1, + }), + dict({ + 'commandName': 'openConfiguration', + 'nparams': 1, + }), + ]), + 'dataProperties': list([ + dict({ + 'qualifiedName': 'core:identifyInterval', + 'value': '0', + }), + ]), + 'qualifiedName': 'rts:RollerShutterRTSComponent', + 'states': list([ + ]), + 'type': 'ACTUATOR', + 'uiClass': 'RollerShutter', + 'uiProfiles': list([ + 'OpenCloseShutter', + 'OpenClose', + ]), + 'widgetName': 'UpDownRollerShutter', + }), + 'deviceURL': 'rts://****-****-6867/16756006', + 'enabled': True, + 'label': '** ** **', + 'lastUpdateTime': 1667840384000, + 'oid': '1a10d6f6-9bc3-40f3-a33c-e383fd41d3e8', + 'placeOID': '9e3d6899-50bb-4869-9c5e-46c2b57f7c9e', + 'shortcut': False, + 'type': 1, + 'uiClass': 'RollerShutter', + 'widget': 'UpDownRollerShutter', + }), + dict({ + 'available': True, + 'controllableName': 'zigbee:TransceiverV3_0Component', + 'creationTime': 1665238630000, + 'definition': dict({ + 'commands': list([ + ]), + 'dataProperties': list([ + ]), + 'qualifiedName': 'zigbee:TransceiverV3_0Component', + 'states': list([ + ]), + 'type': 'PROTOCOL_GATEWAY', + 'uiClass': 'ProtocolGateway', + 'uiProfiles': list([ + 'Specific', + ]), + 'widgetName': 'ZigbeeStack', + }), + 'deviceURL': 'zigbee://****-****-6867/65535', + 'enabled': True, + 'label': '** *(**)*', + 'lastUpdateTime': 1665238630000, + 'oid': '1629c223-d115-4aad-808a-373f428d9c27', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'shortcut': False, + 'type': 5, + 'uiClass': 'ProtocolGateway', + 'widget': 'ZigbeeStack', + }), + ]), + 'disconnectionConfiguration': dict({ + 'notificationText': 'Your Somfy box is disconnected', + 'notificationTitle': '[User] : Your Somfy box is disconnected', + 'notificationType': 'PUSH', + 'targetPushSubscriptions': list([ + '8849df9a-b61a-498f-ab81-67a767adba31', + ]), + }), + 'features': list([ + ]), + 'gateways': list([ + dict({ + 'alive': True, + 'autoUpdateEnabled': True, + 'connectivity': dict({ + 'protocolVersion': '2023.4.4', + 'status': 'OK', + }), + 'functions': 'INTERNET_AUTHORIZATION,SCENARIO_DOWNLOAD,SCENARIO_AUTO_LAUNCHING,SCENARIO_TELECO_LAUNCHING,INTERNET_UPLOAD,INTERNET_UPDATE,TRIGGERS_SENSORS', + 'gatewayId': '****-****-6867', + 'mode': 'ACTIVE', + 'placeOID': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'subType': 1, + 'syncInProgress': False, + 'timeReliable': True, + 'type': 98, + 'upToDate': True, + 'updateStatus': 'UP_TO_DATE', + }), + ]), + 'id': 'SETUP-****-****-6867', + 'lastUpdateTime': 1665238624000, + 'location': dict({ + 'addressLine1': '** **', + 'addressLine2': '*', + 'city': '** **', + 'country': '**', + 'countryCode': 'NL', + 'creationTime': 1665238624000, + 'dawnOffset': 0, + 'duskOffset': 0, + 'lastUpdateTime': 1667054735000, + 'latitude': '**', + 'longitude': '**', + 'postalCode': '** **', + 'summerSolsticeDuskMinutes': 1290, + 'timezone': 'Europe/Amsterdam', + 'twilightAngle': 'SOLAR', + 'twilightCity': 'amsterdam', + 'twilightMode': 2, + 'twilightOffsetEnabled': False, + 'winterSolsticeDuskMinutes': 990, + }), + 'oid': '15eaf55a-8af9-483b-ae4a-ffd4254fd762', + 'resellerDelegationType': 'NEVER', + 'rootPlace': dict({ + 'creationTime': 1665238624000, + 'label': '** **', + 'lastUpdateTime': 1665238630000, + 'oid': '41d63e43-bfa8-4e24-8c16-4faae0448cab', + 'subPlaces': list([ + dict({ + 'creationTime': 1667840432000, + 'label': '**', + 'lastUpdateTime': 1667840432000, + 'metadata': '{"color":"#08C27F"}', + 'oid': '9e3d6899-50bb-4869-9c5e-46c2b57f7c9e', + 'subPlaces': list([ + ]), + 'type': 108, + }), + ]), + 'type': 200, + }), + 'zones': list([ + ]), + }), + }) +# --- diff --git a/tests/components/overkiz/test_diagnostics.py b/tests/components/overkiz/test_diagnostics.py new file mode 100644 index 00000000000..6d0498c237b --- /dev/null +++ b/tests/components/overkiz/test_diagnostics.py @@ -0,0 +1,63 @@ +"""Tests for the diagnostics data provided by the Overkiz integration.""" +from unittest.mock import AsyncMock, patch + +from syrupy import SnapshotAssertion + +from homeassistant.components.overkiz.const import DOMAIN +from homeassistant.core import HomeAssistant +from homeassistant.helpers import device_registry as dr + +from tests.common import MockConfigEntry, load_json_object_fixture +from tests.components.diagnostics import ( + get_diagnostics_for_config_entry, + get_diagnostics_for_device, +) +from tests.typing import ClientSessionGenerator + + +async def test_diagnostics( + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + init_integration: MockConfigEntry, + snapshot: SnapshotAssertion, +) -> None: + """Test diagnostics.""" + diagnostic_data = load_json_object_fixture("overkiz/setup_tahoma_switch.json") + + with patch.multiple( + "pyoverkiz.client.OverkizClient", + get_diagnostic_data=AsyncMock(return_value=diagnostic_data), + get_execution_history=AsyncMock(return_value=[]), + ): + assert ( + await get_diagnostics_for_config_entry(hass, hass_client, init_integration) + == snapshot + ) + + +async def test_device_diagnostics( + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + init_integration: MockConfigEntry, + device_registry: dr.DeviceRegistry, + snapshot: SnapshotAssertion, +) -> None: + """Test device diagnostics.""" + diagnostic_data = load_json_object_fixture("overkiz/setup_tahoma_switch.json") + + device = device_registry.async_get_device( + identifiers={(DOMAIN, "rts://****-****-6867/16756006")} + ) + assert device is not None + + with patch.multiple( + "pyoverkiz.client.OverkizClient", + get_diagnostic_data=AsyncMock(return_value=diagnostic_data), + get_execution_history=AsyncMock(return_value=[]), + ): + assert ( + await get_diagnostics_for_device( + hass, hass_client, init_integration, device + ) + == snapshot + )