diff --git a/homeassistant/components/myuplink/diagnostics.py b/homeassistant/components/myuplink/diagnostics.py new file mode 100644 index 00000000000..55cbb07c0d0 --- /dev/null +++ b/homeassistant/components/myuplink/diagnostics.py @@ -0,0 +1,46 @@ +"""Diagnostics support for myUplink.""" +from __future__ import annotations + +from typing import Any + +from myuplink import MyUplinkAPI + +from homeassistant.components.diagnostics import async_redact_data +from homeassistant.config_entries import ConfigEntry +from homeassistant.core import HomeAssistant + +from .const import DOMAIN + +TO_REDACT = {"access_token", "refresh_token", "serialNumber"} + + +async def async_get_config_entry_diagnostics( + hass: HomeAssistant, config_entry: ConfigEntry +) -> dict[str, Any]: + """Return diagnostics for a config entry. + + Pick up fresh data from API and dump it. + """ + api: MyUplinkAPI = hass.data[DOMAIN][config_entry.entry_id].api + myuplink_data = {} + myuplink_data["my_systems"] = await api.async_get_systems_json() + myuplink_data["my_systems"]["devices"] = [] + for system in myuplink_data["my_systems"]["systems"]: + for device in system["devices"]: + device_data = await api.async_get_device_json(device["id"]) + device_points = await api.async_get_device_points_json(device["id"]) + myuplink_data["my_systems"]["devices"].append( + { + system["systemId"]: { + "device_data": device_data, + "points": device_points, + } + } + ) + + diagnostics_data = { + "config_entry_data": async_redact_data(dict(config_entry.data), TO_REDACT), + "myuplink_data": async_redact_data(myuplink_data, TO_REDACT), + } + + return diagnostics_data diff --git a/tests/components/myuplink/__init__.py b/tests/components/myuplink/__init__.py index d5ca745ced0..ffce8144290 100644 --- a/tests/components/myuplink/__init__.py +++ b/tests/components/myuplink/__init__.py @@ -1 +1,11 @@ -"""Tests for the myUplink integration.""" +"""Tests for the myuplink integration.""" +from homeassistant.core import HomeAssistant + +from tests.common import MockConfigEntry + + +async def setup_integration(hass: HomeAssistant, config_entry: MockConfigEntry) -> None: + """Fixture for setting up the component.""" + config_entry.add_to_hass(hass) + + await hass.config_entries.async_setup(config_entry.entry_id) diff --git a/tests/components/myuplink/conftest.py b/tests/components/myuplink/conftest.py new file mode 100644 index 00000000000..f7d3e0d8c9a --- /dev/null +++ b/tests/components/myuplink/conftest.py @@ -0,0 +1,110 @@ +"""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 +import pytest + +from homeassistant.components.application_credentials import ( + ClientCredential, + async_import_client_credential, +) +from homeassistant.components.myuplink.const import DOMAIN +from homeassistant.core import HomeAssistant +from homeassistant.setup import async_setup_component + +from .const import CLIENT_ID, CLIENT_SECRET + +from tests.common import MockConfigEntry, load_fixture, load_json_value_fixture + + +@pytest.fixture(name="expires_at") +def mock_expires_at() -> float: + """Fixture to set the oauth token expiration time.""" + return time.time() + 3600 + + +@pytest.fixture +def mock_config_entry(expires_at: int) -> MockConfigEntry: + """Return the default mocked config entry.""" + return MockConfigEntry( + version=1, + domain=DOMAIN, + title="myUplink test", + data={ + "auth_implementation": DOMAIN, + "token": { + "access_token": "Fake_token", + "scope": "READSYSTEM offline", + "expires_in": 86399, + "refresh_token": "3012bc9f-7a65-4240-b817-9154ffdcc30f", + "token_type": "Bearer", + "expires_at": expires_at, + }, + }, + entry_id="myuplink_test", + ) + + +@pytest.fixture(autouse=True) +async def setup_credentials(hass: HomeAssistant) -> None: + """Fixture to setup credentials.""" + assert await async_setup_component(hass, "application_credentials", {}) + await async_import_client_credential( + hass, + DOMAIN, + ClientCredential( + CLIENT_ID, + CLIENT_SECRET, + ), + DOMAIN, + ) + + +@pytest.fixture +def mock_myuplink_client() -> Generator[MagicMock, None, None]: + """Mock a myuplink client.""" + + def process_json_system(data: dict[str, Any]) -> System: + array = json.loads(data) + return [System(system_data) for system_data in array["systems"]] + + 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 + ) + yield client + + +@pytest.fixture +async def init_integration( + hass: HomeAssistant, + mock_config_entry: MockConfigEntry, + mock_myuplink_client: MagicMock, +) -> MockConfigEntry: + """Set up the myuplink integration for testing.""" + mock_config_entry.add_to_hass(hass) + + 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/myuplink/const.py b/tests/components/myuplink/const.py new file mode 100644 index 00000000000..6ba324db12a --- /dev/null +++ b/tests/components/myuplink/const.py @@ -0,0 +1,3 @@ +"""Constants for myuplink tests.""" +CLIENT_ID = "12345" +CLIENT_SECRET = "67890" diff --git a/tests/components/myuplink/fixtures/device.json b/tests/components/myuplink/fixtures/device.json new file mode 100644 index 00000000000..55382ce85b0 --- /dev/null +++ b/tests/components/myuplink/fixtures/device.json @@ -0,0 +1,40 @@ +{ + "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 + } +} diff --git a/tests/components/myuplink/fixtures/device_points_nibe_f730.json b/tests/components/myuplink/fixtures/device_points_nibe_f730.json new file mode 100644 index 00000000000..49340bd9e26 --- /dev/null +++ b/tests/components/myuplink/fixtures/device_points_nibe_f730.json @@ -0,0 +1,955 @@ +[ + { + "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/fixtures/systems.json b/tests/components/myuplink/fixtures/systems.json new file mode 100644 index 00000000000..151e9f55a8d --- /dev/null +++ b/tests/components/myuplink/fixtures/systems.json @@ -0,0 +1,25 @@ +{ + "page": 1, + "itemsPerPage": 10, + "numItems": 1, + "systems": [ + { + "systemId": "123456-7890-1234", + "name": "Gotham City", + "securityLevel": "admin", + "hasAlarm": false, + "country": "Sweden", + "devices": [ + { + "id": "batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff", + "connectionState": "Connected", + "currentFwVersion": "9682R7", + "product": { + "serialNumber": "123456", + "name": "F730 CU 3x400V" + } + } + ] + } + ] +} diff --git a/tests/components/myuplink/snapshots/test_diagnostics.ambr b/tests/components/myuplink/snapshots/test_diagnostics.ambr new file mode 100644 index 00000000000..45cb48244e6 --- /dev/null +++ b/tests/components/myuplink/snapshots/test_diagnostics.ambr @@ -0,0 +1,1132 @@ +# serializer version: 1 +# name: test_diagnostics + dict({ + 'config_entry_data': dict({ + 'auth_implementation': 'myuplink', + 'token': dict({ + 'access_token': '**REDACTED**', + 'expires_in': 86399, + 'refresh_token': '**REDACTED**', + 'scope': 'READSYSTEM offline', + 'token_type': 'Bearer', + }), + }), + 'myuplink_data': dict({ + 'my_systems': dict({ + '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, + }), + ]), + }), + }), + ]), + 'itemsPerPage': 10, + 'numItems': 1, + 'page': 1, + 'systems': list([ + dict({ + 'country': 'Sweden', + 'devices': list([ + dict({ + 'connectionState': 'Connected', + 'currentFwVersion': '9682R7', + 'id': 'batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff', + 'product': dict({ + 'name': 'F730 CU 3x400V', + 'serialNumber': '**REDACTED**', + }), + }), + ]), + 'hasAlarm': False, + 'name': 'Gotham City', + 'securityLevel': 'admin', + 'systemId': '123456-7890-1234', + }), + ]), + }), + }), + }) +# --- diff --git a/tests/components/myuplink/test_diagnostics.py b/tests/components/myuplink/test_diagnostics.py new file mode 100644 index 00000000000..047ec06d4f2 --- /dev/null +++ b/tests/components/myuplink/test_diagnostics.py @@ -0,0 +1,26 @@ +"""Tests for the diagnostics data provided by the myuplink integration.""" + +from syrupy import SnapshotAssertion +from syrupy.filters import paths + +from homeassistant.core import HomeAssistant + +from tests.common import MockConfigEntry +from tests.components.diagnostics import get_diagnostics_for_config_entry +from tests.typing import ClientSessionGenerator + + +async def test_diagnostics( + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + mock_config_entry: MockConfigEntry, + init_integration, + snapshot: SnapshotAssertion, +) -> None: + """Test diagnostics.""" + + assert await get_diagnostics_for_config_entry( + hass, hass_client, mock_config_entry + ) == snapshot( + exclude=paths("config_entry_data.token.expires_at", "myuplink_test.entry_id") + ) diff --git a/tests/components/myuplink/test_update.py b/tests/components/myuplink/test_update.py new file mode 100644 index 00000000000..f25993e8ef6 --- /dev/null +++ b/tests/components/myuplink/test_update.py @@ -0,0 +1,22 @@ +"""Tests for myuplink update module.""" + +from unittest.mock import AsyncMock + +from homeassistant.core import HomeAssistant + +from . import setup_integration + +from tests.common import MockConfigEntry + + +async def test_update_states( + hass: HomeAssistant, + mock_myuplink_client: AsyncMock, + mock_config_entry: MockConfigEntry, +) -> None: + """Test update state.""" + await setup_integration(hass, mock_config_entry) + + state = hass.states.get("update.f730_cu_3x400v_firmware") + assert state is not None + assert state.state == "off"