diff --git a/tests/components/myuplink/conftest.py b/tests/components/myuplink/conftest.py index f7d3e0d8c9a..15cdaea96ab 100644 --- a/tests/components/myuplink/conftest.py +++ b/tests/components/myuplink/conftest.py @@ -1,11 +1,10 @@ """Test helpers for myuplink.""" from collections.abc import Generator -import json import time from typing import Any from unittest.mock import MagicMock, patch -from myuplink import Device, System +from myuplink import Device, DevicePoint, System import pytest from homeassistant.components.application_credentials import ( @@ -15,10 +14,11 @@ from homeassistant.components.application_credentials import ( from homeassistant.components.myuplink.const import DOMAIN from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component +from homeassistant.util.json import json_loads from .const import CLIENT_ID, CLIENT_SECRET -from tests.common import MockConfigEntry, load_fixture, load_json_value_fixture +from tests.common import MockConfigEntry, load_fixture @pytest.fixture(name="expires_at") @@ -64,34 +64,91 @@ async def setup_credentials(hass: HomeAssistant) -> None: ) -@pytest.fixture -def mock_myuplink_client() -> Generator[MagicMock, None, None]: - """Mock a myuplink client.""" +# Fixture group for device API endpoint. - def process_json_system(data: dict[str, Any]) -> System: - array = json.loads(data) - return [System(system_data) for system_data in array["systems"]] + +@pytest.fixture(scope="session") +def load_device_file() -> str: + """Fixture for loading device file.""" + return load_fixture("device.json", DOMAIN) + + +@pytest.fixture +def device_fixture(load_device_file: str) -> Device: + """Fixture for device.""" + return Device(json_loads(load_device_file)) + + +# Fixture group for systems API endpoint. + + +@pytest.fixture +def load_systems_jv_file(load_systems_file: str) -> dict[str, Any]: + """Load fixture file for systems endpoint.""" + return json_loads(load_systems_file) + + +@pytest.fixture(scope="session") +def load_systems_file() -> str: + """Load fixture file for systems.""" + return load_fixture("systems.json", DOMAIN) + + +@pytest.fixture +def system_fixture(load_systems_file: str) -> list[System]: + """Fixture for systems.""" + data = json_loads(load_systems_file) + return [System(system_data) for system_data in data["systems"]] + + +# Fixture group for device points API endpoint. + + +@pytest.fixture(scope="session") +def load_device_points_file() -> str: + """Load fixture file for device-points endpoint.""" + return load_fixture("device_points_nibe_f730.json", DOMAIN) + + +@pytest.fixture +def load_device_points_jv_file(): + """Load fixture file for device_points.""" + return json_loads(load_device_points_file) + + +@pytest.fixture +def device_points_fixture(load_device_points_file: str) -> list[DevicePoint]: + """Fixture for devce_points.""" + data = json_loads(load_device_points_file) + return [DevicePoint(point_data) for point_data in data] + + +@pytest.fixture +def mock_myuplink_client( + load_device_file, + device_fixture, + load_device_points_file, + device_points_fixture, + system_fixture, + load_systems_jv_file, +) -> Generator[MagicMock, None, None]: + """Mock a myuplink client.""" with patch( "homeassistant.components.myuplink.MyUplinkAPI", autospec=True, ) as mock_client: client = mock_client.return_value - client.async_get_device_points_json.return_value = load_json_value_fixture( - "device_points_nibe_f730.json", DOMAIN - ) - client.async_get_systems.return_value = process_json_system( - load_fixture("systems.json", DOMAIN) - ) - client.async_get_device.return_value = Device( - load_json_value_fixture("device.json", DOMAIN) - ) - client.async_get_device_json.return_value = load_json_value_fixture( - "device.json", DOMAIN - ) - client.async_get_systems_json.return_value = load_json_value_fixture( - "systems.json", DOMAIN - ) + + client.async_get_systems.return_value = system_fixture + client.async_get_systems_json.return_value = load_systems_jv_file + + client.async_get_device.return_value = device_fixture + client.async_get_device_json.return_value = load_device_file + + client.async_get_device_points.return_value = device_points_fixture + client.async_get_device_points_json.return_value = load_device_points_file + yield client diff --git a/tests/components/myuplink/snapshots/test_diagnostics.ambr b/tests/components/myuplink/snapshots/test_diagnostics.ambr index 45cb48244e6..26bb2a24cbf 100644 --- a/tests/components/myuplink/snapshots/test_diagnostics.ambr +++ b/tests/components/myuplink/snapshots/test_diagnostics.ambr @@ -16,1090 +16,1007 @@ 'devices': list([ dict({ '123456-7890-1234': dict({ - 'device_data': dict({ - 'availableFeatures': dict({ - 'boostHotWater': True, - 'boostVentilation': True, - 'forceUpdate': False, - 'forcesync': True, - 'getGuideQuestion': False, - 'getMenu': False, - 'getMenuChain': False, - 'getScheduleConfig': False, - 'getScheduleModes': False, - 'getScheduleVacation': False, - 'getScheduleWeekly': False, - 'getZones': False, - 'processIntent': False, - 'reboot': True, - 'requestUpdate': False, - 'resetAlarm': True, - 'sendHaystack': True, - 'setAidMode': True, - 'setScheduleModes': False, - 'setScheduleOverride': False, - 'setScheduleVacation': False, - 'setScheduleWeekly': False, - 'setSmartMode': False, - 'setVentilationMode': False, - 'settings': True, - 'triggerEvent': True, - }), - 'connectionState': 'Connected', - 'firmware': dict({ - 'currentFwVersion': '9682R7', - 'desiredFwVersion': '9682R7', - }), - 'id': 'batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff', - 'product': dict({ - 'name': 'F730 CU 3x400V', - 'serialNumber': '**REDACTED**', - }), - }), - 'points': list([ - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40004', - 'parameterName': 'Current outd temp (BT1)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-9.3°C', - 'timestamp': '2024-02-09T10:56:12+00:00', - 'value': -9.3, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40008', - 'parameterName': 'Supply line (BT2)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '39.7°C', - 'timestamp': '2024-02-09T10:58:51+00:00', - 'value': 39.7, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40012', - 'parameterName': 'Return line (BT3)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '34.4°C', - 'timestamp': '2024-02-09T10:08:40+00:00', - 'value': 34.4, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40013', - 'parameterName': 'Hot water top (BT7)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '46°C', - 'timestamp': '2024-02-09T08:39:32+00:00', - 'value': 46, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40014', - 'parameterName': 'Hot water char\xadging (BT6)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '44.4°C', - 'timestamp': '2024-02-09T10:58:42+00:00', - 'value': 44.4, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40017', - 'parameterName': 'Con\xaddenser (BT12)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '37.7°C', - 'timestamp': '2024-02-09T10:41:49+00:00', - 'value': 37.7, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40018', - 'parameterName': 'Dis\xadcharge (BT14)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '89.1°C', - 'timestamp': '2024-02-09T10:19:24+00:00', - 'value': 89.1, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40019', - 'parameterName': 'Liquid line (BT15)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '34.4°C', - 'timestamp': '2024-02-09T10:42:11+00:00', - 'value': 34.4, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40020', - 'parameterName': 'Evap\xadorator (BT16)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-14.7°C', - 'timestamp': '2024-02-09T11:11:00+00:00', - 'value': -14.7, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40022', - 'parameterName': 'Suction gas (BT17)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-1.1°C', - 'timestamp': '2024-02-09T11:11:28+00:00', - 'value': -1.1, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40025', - 'parameterName': 'Exhaust air (BT20)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '22.5°C', - 'timestamp': '2024-02-09T09:48:50+00:00', - 'value': 22.5, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40026', - 'parameterName': 'Extract air (BT21)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-12.1°C', - 'timestamp': '2024-02-09T11:11:15+00:00', - 'value': -12.1, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40033', - 'parameterName': 'Room temp\xaderature (BT50)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '21.2°C', - 'timestamp': '2024-02-09T00:21:48+00:00', - 'value': 21.2, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40047', - 'parameterName': 'Supply line (BT61)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-32768°C', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': -32768, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40048', - 'parameterName': 'Return line (BT62)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-32768°C', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': -32768, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40050', - 'parameterName': 'Value, air veloc\xadity sensor (BS1)', - 'parameterUnit': '', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '101.5', - 'timestamp': '2024-02-09T11:10:42+00:00', - 'value': 101.5, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40067', - 'parameterName': 'Average outdoor temp (BT1)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-12.2°C', - 'timestamp': '2024-02-09T10:56:45+00:00', - 'value': -12.2, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40079', - 'parameterName': 'Current (BE1)', - 'parameterUnit': 'A', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '3.1A', - 'timestamp': '2024-02-09T09:05:50+00:00', - 'value': 3.1, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40081', - 'parameterName': 'Current (BE2)', - 'parameterUnit': 'A', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0.3A', - 'timestamp': '2024-02-09T11:11:19+00:00', - 'value': 0.3, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40083', - 'parameterName': 'Current (BE3)', - 'parameterUnit': 'A', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '5.7A', - 'timestamp': '2024-02-09T09:46:11+00:00', - 'value': 5.7, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40145', - 'parameterName': 'Oil temp\xaderature (EP15-BT29)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0°C', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40146', - 'parameterName': 'Oil temp\xaderature (BT29)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0°C', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40940', - 'parameterName': 'Degree minutes', - 'parameterUnit': '', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-875', - 'timestamp': '2024-02-09T11:09:39+00:00', - 'value': -875, - 'writable': True, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '40940', - 'parameterName': 'Degree minutes', - 'parameterUnit': '', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-875', - 'timestamp': '2024-02-09T11:09:39+00:00', - 'value': -875, - 'writable': True, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '41778', - 'parameterName': 'Current com\xadpressor fre\xadquency', - 'parameterUnit': 'Hz', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '57Hz', - 'timestamp': '2024-02-09T10:07:47+00:00', - 'value': 57, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '42770', - 'parameterName': 'Desired humid\xadity', - 'parameterUnit': '%', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0%', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43009', - 'parameterName': 'Calcu\xadlated supply climate system 1', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '37.9°C', - 'timestamp': '2024-02-09T11:04:53+00:00', - 'value': 37.9, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43066', - 'parameterName': 'Defrost\xading time', - 'parameterUnit': 's', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0s', - 'timestamp': '2024-02-09T09:45:41+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43081', - 'parameterName': 'Time factor add heat', - 'parameterUnit': '', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '1686.9', - 'timestamp': '2024-02-09T10:59:11+00:00', - 'value': 1686.9, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43108', - 'parameterName': 'Current fan mode', - 'parameterUnit': '%', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0%', - 'timestamp': '2024-02-08T16:27:27+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43109', - 'parameterName': 'Current hot water mode', - 'parameterUnit': '', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0', - 'timestamp': '2024-02-06T21:14:34+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43115', - 'parameterName': 'Hot water: charge set point value', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0°C', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43116', - 'parameterName': 'Hot water: charge current value ((BT12 | BT63))', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '0°C', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43122', - 'parameterName': 'Min com\xadpressor fre\xadquency', - 'parameterUnit': 'Hz', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '20Hz', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 20, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43123', - 'parameterName': 'Max com\xadpressor fre\xadquency', - 'parameterUnit': 'Hz', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '57Hz', - 'timestamp': '2024-02-09T10:07:44+00:00', - 'value': 57, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43124', - 'parameterName': 'Refer\xadence, air speed sensor', - 'parameterUnit': 'm3/h', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '127.6m3/h', - 'timestamp': '2024-02-09T09:51:03+00:00', - 'value': 127.6, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43125', - 'parameterName': 'De\xadcrease from refer\xadence value', - 'parameterUnit': '%', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '-1.1%', - 'timestamp': '2024-02-09T11:08:28+00:00', - 'value': -1.1, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43140', - 'parameterName': 'Invert\xader temp\xaderature', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '37.2°C', - 'timestamp': '2024-02-09T10:19:11+00:00', - 'value': 37.2, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43146', - 'parameterName': 'dT Invert\xader - exh air (BT20)', - 'parameterUnit': '°C', - 'scaleValue': '0.1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '14.9°C', - 'timestamp': '2024-02-09T10:37:53+00:00', - 'value': 14.9, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - dict({ - 'icon': '', - 'text': 'Off', - 'value': '0', - }), - dict({ - 'icon': '', - 'text': 'On', - 'value': '1', - }), - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43161', - 'parameterName': 'Extern. adjust\xadment climate system 1', - 'parameterUnit': '', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': 'Off', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 0, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - dict({ - 'icon': '', - 'text': 'off', - 'value': '20', - }), - dict({ - 'icon': '', - 'text': 'starts', - 'value': '40', - }), - dict({ - 'icon': '', - 'text': 'runs', - 'value': '60', - }), - dict({ - 'icon': '', - 'text': 'stops', - 'value': '100', - }), - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43427', - 'parameterName': 'Status com\xadpressor', - 'parameterUnit': '', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': 'runs', - 'timestamp': '2024-02-09T09:46:01+00:00', - 'value': 60, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '43437', - 'parameterName': 'Heating medium pump speed (GP1)', - 'parameterUnit': '%', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '79%', - 'timestamp': '2024-02-09T10:34:44+00:00', - 'value': 79, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '49633', - 'parameterName': 'Desired humid\xadity', - 'parameterUnit': '%', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': '50%', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 50, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - dict({ - 'icon': '', - 'text': 'Alarm', - 'value': '0', - }), - dict({ - 'icon': '', - 'text': 'Alarm', - 'value': '1', - }), - dict({ - 'icon': '', - 'text': 'Active', - 'value': '2', - }), - dict({ - 'icon': '', - 'text': 'Off', - 'value': '3', - }), - dict({ - 'icon': '', - 'text': 'Blocked', - 'value': '4', - }), - dict({ - 'icon': '', - 'text': 'Off', - 'value': '5', - }), - dict({ - 'icon': '', - 'text': 'Active', - 'value': '6', - }), - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '49993', - 'parameterName': 'Int elec add heat', - 'parameterUnit': '', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': 'Active', - 'timestamp': '2024-02-08T18:57:28+00:00', - 'value': 6, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - dict({ - 'icon': '', - 'text': 'Off', - 'value': '10', - }), - dict({ - 'icon': '', - 'text': 'Hot water', - 'value': '20', - }), - dict({ - 'icon': '', - 'text': 'Heating', - 'value': '30', - }), - dict({ - 'icon': '', - 'text': 'Pool', - 'value': '40', - }), - dict({ - 'icon': '', - 'text': 'Pool 2', - 'value': '41', - }), - dict({ - 'icon': '', - 'text': 'Trans\xadfer', - 'value': '50', - }), - dict({ - 'icon': '', - 'text': 'Cooling', - 'value': '60', - }), - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '49994', - 'parameterName': 'Prior\xadity', - 'parameterUnit': '', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': 'Heating', - 'timestamp': '2024-02-08T19:13:05+00:00', - 'value': 30, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - dict({ - 'icon': '', - 'text': 'Off', - 'value': '0', - }), - dict({ - 'icon': '', - 'text': 'On', - 'value': '1', - }), - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '49995', - 'parameterName': 'Pump: Heating medium (GP1)', - 'parameterUnit': '', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': 'On', - 'timestamp': '2024-02-01T14:30:32+00:00', - 'value': 1, - 'writable': False, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - dict({ - 'icon': '', - 'text': 'off', - 'value': '0', - }), - dict({ - 'icon': '', - 'text': 'on', - 'value': '1', - }), - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '50004', - 'parameterName': 'Tempo\xadrary lux', - 'parameterUnit': '', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': 'off', - 'timestamp': '2024-02-04T21:06:26+00:00', - 'value': 0, - 'writable': True, - 'zoneId': None, - }), - dict({ - 'category': 'NIBEF F730 CU 3x400V', - 'enumValues': list([ - dict({ - 'icon': '', - 'text': 'off', - 'value': '0', - }), - dict({ - 'icon': '', - 'text': 'on', - 'value': '1', - }), - ]), - 'maxValue': None, - 'minValue': None, - 'parameterId': '50005', - 'parameterName': 'In\xadcreased venti\xadlation', - 'parameterUnit': '', - 'scaleValue': '1', - 'smartHomeCategories': list([ - ]), - 'stepValue': 1, - 'strVal': 'off', - 'timestamp': '2024-02-08T16:27:26+00:00', - 'value': 0, - 'writable': True, - 'zoneId': None, - }), - ]), + 'device_data': ''' + { + "id": "batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff", + "connectionState": "Connected", + "firmware": { + "currentFwVersion": "9682R7", + "desiredFwVersion": "9682R7" + }, + "product": { + "serialNumber": "123456", + "name": "F730 CU 3x400V" + }, + "availableFeatures": { + "settings": true, + "reboot": true, + "forcesync": true, + "forceUpdate": false, + "requestUpdate": false, + "resetAlarm": true, + "triggerEvent": true, + "getMenu": false, + "getMenuChain": false, + "getGuideQuestion": false, + "sendHaystack": true, + "setSmartMode": false, + "setAidMode": true, + "getZones": false, + "processIntent": false, + "boostHotWater": true, + "boostVentilation": true, + "getScheduleConfig": false, + "getScheduleModes": false, + "getScheduleWeekly": false, + "getScheduleVacation": false, + "setScheduleModes": false, + "setScheduleWeekly": false, + "setScheduleOverride": false, + "setScheduleVacation": false, + "setVentilationMode": false + } + } + + ''', + 'points': ''' + [ + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40004", + "parameterName": "Current outd temp (BT1)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:56:12+00:00", + "value": -9.3, + "strVal": "-9.3°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40008", + "parameterName": "Supply line (BT2)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:58:51+00:00", + "value": 39.7, + "strVal": "39.7°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40012", + "parameterName": "Return line (BT3)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:08:40+00:00", + "value": 34.4, + "strVal": "34.4°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40013", + "parameterName": "Hot water top (BT7)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T08:39:32+00:00", + "value": 46, + "strVal": "46°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40014", + "parameterName": "Hot water char­ging (BT6)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:58:42+00:00", + "value": 44.4, + "strVal": "44.4°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40017", + "parameterName": "Con­denser (BT12)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:41:49+00:00", + "value": 37.7, + "strVal": "37.7°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40018", + "parameterName": "Dis­charge (BT14)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:19:24+00:00", + "value": 89.1, + "strVal": "89.1°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40019", + "parameterName": "Liquid line (BT15)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:42:11+00:00", + "value": 34.4, + "strVal": "34.4°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40020", + "parameterName": "Evap­orator (BT16)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T11:11:00+00:00", + "value": -14.7, + "strVal": "-14.7°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40022", + "parameterName": "Suction gas (BT17)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T11:11:28+00:00", + "value": -1.1, + "strVal": "-1.1°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40025", + "parameterName": "Exhaust air (BT20)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T09:48:50+00:00", + "value": 22.5, + "strVal": "22.5°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40026", + "parameterName": "Extract air (BT21)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T11:11:15+00:00", + "value": -12.1, + "strVal": "-12.1°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40033", + "parameterName": "Room temp­erature (BT50)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T00:21:48+00:00", + "value": 21.2, + "strVal": "21.2°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40047", + "parameterName": "Supply line (BT61)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": -32768, + "strVal": "-32768°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40048", + "parameterName": "Return line (BT62)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": -32768, + "strVal": "-32768°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40050", + "parameterName": "Value, air veloc­ity sensor (BS1)", + "parameterUnit": "", + "writable": false, + "timestamp": "2024-02-09T11:10:42+00:00", + "value": 101.5, + "strVal": "101.5", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40067", + "parameterName": "Average outdoor temp (BT1)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:56:45+00:00", + "value": -12.2, + "strVal": "-12.2°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40079", + "parameterName": "Current (BE1)", + "parameterUnit": "A", + "writable": false, + "timestamp": "2024-02-09T09:05:50+00:00", + "value": 3.1, + "strVal": "3.1A", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40081", + "parameterName": "Current (BE2)", + "parameterUnit": "A", + "writable": false, + "timestamp": "2024-02-09T11:11:19+00:00", + "value": 0.3, + "strVal": "0.3A", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40083", + "parameterName": "Current (BE3)", + "parameterUnit": "A", + "writable": false, + "timestamp": "2024-02-09T09:46:11+00:00", + "value": 5.7, + "strVal": "5.7A", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40145", + "parameterName": "Oil temp­erature (EP15-BT29)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 0, + "strVal": "0°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40146", + "parameterName": "Oil temp­erature (BT29)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 0, + "strVal": "0°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40940", + "parameterName": "Degree minutes", + "parameterUnit": "", + "writable": true, + "timestamp": "2024-02-09T11:09:39+00:00", + "value": -875, + "strVal": "-875", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "40940", + "parameterName": "Degree minutes", + "parameterUnit": "", + "writable": true, + "timestamp": "2024-02-09T11:09:39+00:00", + "value": -875, + "strVal": "-875", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "41778", + "parameterName": "Current com­pressor fre­quency", + "parameterUnit": "Hz", + "writable": false, + "timestamp": "2024-02-09T10:07:47+00:00", + "value": 57, + "strVal": "57Hz", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "42770", + "parameterName": "Desired humid­ity", + "parameterUnit": "%", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 0, + "strVal": "0%", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43009", + "parameterName": "Calcu­lated supply climate system 1", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T11:04:53+00:00", + "value": 37.9, + "strVal": "37.9°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43066", + "parameterName": "Defrost­ing time", + "parameterUnit": "s", + "writable": false, + "timestamp": "2024-02-09T09:45:41+00:00", + "value": 0, + "strVal": "0s", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43081", + "parameterName": "Time factor add heat", + "parameterUnit": "", + "writable": false, + "timestamp": "2024-02-09T10:59:11+00:00", + "value": 1686.9, + "strVal": "1686.9", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43108", + "parameterName": "Current fan mode", + "parameterUnit": "%", + "writable": false, + "timestamp": "2024-02-08T16:27:27+00:00", + "value": 0, + "strVal": "0%", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43109", + "parameterName": "Current hot water mode", + "parameterUnit": "", + "writable": false, + "timestamp": "2024-02-06T21:14:34+00:00", + "value": 0, + "strVal": "0", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43115", + "parameterName": "Hot water: charge set point value", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 0, + "strVal": "0°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43116", + "parameterName": "Hot water: charge current value ((BT12 | BT63))", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 0, + "strVal": "0°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43122", + "parameterName": "Min com­pressor fre­quency", + "parameterUnit": "Hz", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 20, + "strVal": "20Hz", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43123", + "parameterName": "Max com­pressor fre­quency", + "parameterUnit": "Hz", + "writable": false, + "timestamp": "2024-02-09T10:07:44+00:00", + "value": 57, + "strVal": "57Hz", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43124", + "parameterName": "Refer­ence, air speed sensor", + "parameterUnit": "m3/h", + "writable": false, + "timestamp": "2024-02-09T09:51:03+00:00", + "value": 127.6, + "strVal": "127.6m3/h", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43125", + "parameterName": "De­crease from refer­ence value", + "parameterUnit": "%", + "writable": false, + "timestamp": "2024-02-09T11:08:28+00:00", + "value": -1.1, + "strVal": "-1.1%", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43140", + "parameterName": "Invert­er temp­erature", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:19:11+00:00", + "value": 37.2, + "strVal": "37.2°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43146", + "parameterName": "dT Invert­er - exh air (BT20)", + "parameterUnit": "°C", + "writable": false, + "timestamp": "2024-02-09T10:37:53+00:00", + "value": 14.9, + "strVal": "14.9°C", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "0.1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43161", + "parameterName": "Extern. adjust­ment climate system 1", + "parameterUnit": "", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 0, + "strVal": "Off", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [ + { + "value": "0", + "text": "Off", + "icon": "" + }, + { + "value": "1", + "text": "On", + "icon": "" + } + ], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43427", + "parameterName": "Status com­pressor", + "parameterUnit": "", + "writable": false, + "timestamp": "2024-02-09T09:46:01+00:00", + "value": 60, + "strVal": "runs", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [ + { + "value": "20", + "text": "off", + "icon": "" + }, + { + "value": "40", + "text": "starts", + "icon": "" + }, + { + "value": "60", + "text": "runs", + "icon": "" + }, + { + "value": "100", + "text": "stops", + "icon": "" + } + ], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "43437", + "parameterName": "Heating medium pump speed (GP1)", + "parameterUnit": "%", + "writable": false, + "timestamp": "2024-02-09T10:34:44+00:00", + "value": 79, + "strVal": "79%", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "49633", + "parameterName": "Desired humid­ity", + "parameterUnit": "%", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 50, + "strVal": "50%", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "49993", + "parameterName": "Int elec add heat", + "parameterUnit": "", + "writable": false, + "timestamp": "2024-02-08T18:57:28+00:00", + "value": 6, + "strVal": "Active", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [ + { + "value": "0", + "text": "Alarm", + "icon": "" + }, + { + "value": "1", + "text": "Alarm", + "icon": "" + }, + { + "value": "2", + "text": "Active", + "icon": "" + }, + { + "value": "3", + "text": "Off", + "icon": "" + }, + { + "value": "4", + "text": "Blocked", + "icon": "" + }, + { + "value": "5", + "text": "Off", + "icon": "" + }, + { + "value": "6", + "text": "Active", + "icon": "" + } + ], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "49994", + "parameterName": "Prior­ity", + "parameterUnit": "", + "writable": false, + "timestamp": "2024-02-08T19:13:05+00:00", + "value": 30, + "strVal": "Heating", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [ + { + "value": "10", + "text": "Off", + "icon": "" + }, + { + "value": "20", + "text": "Hot water", + "icon": "" + }, + { + "value": "30", + "text": "Heating", + "icon": "" + }, + { + "value": "40", + "text": "Pool", + "icon": "" + }, + { + "value": "41", + "text": "Pool 2", + "icon": "" + }, + { + "value": "50", + "text": "Trans­fer", + "icon": "" + }, + { + "value": "60", + "text": "Cooling", + "icon": "" + } + ], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "49995", + "parameterName": "Pump: Heating medium (GP1)", + "parameterUnit": "", + "writable": false, + "timestamp": "2024-02-01T14:30:32+00:00", + "value": 1, + "strVal": "On", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [ + { + "value": "0", + "text": "Off", + "icon": "" + }, + { + "value": "1", + "text": "On", + "icon": "" + } + ], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "50004", + "parameterName": "Tempo­rary lux", + "parameterUnit": "", + "writable": true, + "timestamp": "2024-02-04T21:06:26+00:00", + "value": 0, + "strVal": "off", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [ + { + "value": "0", + "text": "off", + "icon": "" + }, + { + "value": "1", + "text": "on", + "icon": "" + } + ], + "scaleValue": "1", + "zoneId": null + }, + { + "category": "NIBEF F730 CU 3x400V", + "parameterId": "50005", + "parameterName": "In­creased venti­lation", + "parameterUnit": "", + "writable": true, + "timestamp": "2024-02-08T16:27:26+00:00", + "value": 0, + "strVal": "off", + "smartHomeCategories": [], + "minValue": null, + "maxValue": null, + "stepValue": 1, + "enumValues": [ + { + "value": "0", + "text": "off", + "icon": "" + }, + { + "value": "1", + "text": "on", + "icon": "" + } + ], + "scaleValue": "1", + "zoneId": null + } + ] + + ''', }), }), ]), diff --git a/tests/components/myuplink/test_init.py b/tests/components/myuplink/test_init.py new file mode 100644 index 00000000000..4134d2586df --- /dev/null +++ b/tests/components/myuplink/test_init.py @@ -0,0 +1,68 @@ +"""Tests for init module.""" +import http +import time +from unittest.mock import MagicMock + +import pytest + +from homeassistant.components.myuplink.const import DOMAIN, OAUTH2_TOKEN +from homeassistant.config_entries import ConfigEntryState +from homeassistant.core import HomeAssistant + +from . import setup_integration + +from tests.common import MockConfigEntry +from tests.test_util.aiohttp import AiohttpClientMocker + + +async def test_load_unload_entry( + hass: HomeAssistant, + mock_myuplink_client: MagicMock, + mock_config_entry: MockConfigEntry, +) -> None: + """Test load and unload entry.""" + await setup_integration(hass, mock_config_entry) + entry = hass.config_entries.async_entries(DOMAIN)[0] + + assert entry.state == ConfigEntryState.LOADED + + await hass.config_entries.async_remove(entry.entry_id) + await hass.async_block_till_done() + + assert entry.state == ConfigEntryState.NOT_LOADED + + +@pytest.mark.parametrize( + ("expires_at", "status", "expected_state"), + [ + ( + time.time() - 3600, + http.HTTPStatus.UNAUTHORIZED, + ConfigEntryState.SETUP_RETRY, # Will trigger reauth in the future + ), + ( + time.time() - 3600, + http.HTTPStatus.INTERNAL_SERVER_ERROR, + ConfigEntryState.SETUP_RETRY, + ), + ], + ids=["unauthorized", "internal_server_error"], +) +async def test_expired_token_refresh_failure( + hass: HomeAssistant, + mock_config_entry: MockConfigEntry, + aioclient_mock: AiohttpClientMocker, + status: http.HTTPStatus, + expected_state: ConfigEntryState, +) -> None: + """Test failure while refreshing token with a transient error.""" + + aioclient_mock.clear_requests() + aioclient_mock.post( + OAUTH2_TOKEN, + status=status, + ) + + await setup_integration(hass, mock_config_entry) + + assert mock_config_entry.state is expected_state diff --git a/tests/components/myuplink/test_sensor.py b/tests/components/myuplink/test_sensor.py new file mode 100644 index 00000000000..eb8c0f82bbd --- /dev/null +++ b/tests/components/myuplink/test_sensor.py @@ -0,0 +1,28 @@ +"""Tests for myuplink sensor module.""" + +from unittest.mock import MagicMock + +from homeassistant.core import HomeAssistant + +from . import setup_integration + +from tests.common import MockConfigEntry + + +async def test_sensor_states( + hass: HomeAssistant, + mock_myuplink_client: MagicMock, + mock_config_entry: MockConfigEntry, +) -> None: + """Test sensor state.""" + await setup_integration(hass, mock_config_entry) + + state = hass.states.get("sensor.f730_cu_3x400v_average_outdoor_temp_bt1") + assert state is not None + assert state.state == "-12.2" + assert state.attributes == { + "friendly_name": "F730 CU 3x400V Average outdoor temp (BT1)", + "device_class": "temperature", + "state_class": "measurement", + "unit_of_measurement": "°C", + }