Add myuplink diagnostics download (#109925)

* Dump all relevant data from API

* Cleanup and adjust

* Redact serialNumber

* WIP

* Add fixtures

* WIP

* Tests for diagnostics completed

* Address review comments

* Change to fake token

* Add missed redact

* Improve mocks

* Resolve review comments
This commit is contained in:
Åke Strandberg 2024-02-12 10:56:06 +01:00 committed by GitHub
parent 1b8bda6067
commit 8376c07969
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 2370 additions and 1 deletions

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -0,0 +1,3 @@
"""Constants for myuplink tests."""
CLIENT_ID = "12345"
CLIENT_SECRET = "67890"

View file

@ -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
}
}

View file

@ -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
}
]

View file

@ -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"
}
}
]
}
]
}

File diff suppressed because it is too large Load diff

View file

@ -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")
)

View file

@ -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"