From 2b4c82b56b1c49f7ce24ed4ed6f7b1eefdb7dfc1 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 21 Oct 2025 16:11:35 +0200 Subject: [PATCH 1/8] remove accessor from service --- PyViCare/PyViCareCachedService.py | 16 ++++++++-------- PyViCare/PyViCareService.py | 28 +++++++++++++--------------- tests/ViCareServiceMock.py | 8 +++----- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/PyViCare/PyViCareCachedService.py b/PyViCare/PyViCareCachedService.py index 340d4f97..667ff141 100644 --- a/PyViCare/PyViCareCachedService.py +++ b/PyViCare/PyViCareCachedService.py @@ -13,24 +13,24 @@ class ViCareCachedService(ViCareService): - def __init__(self, oauth_manager: AbstractViCareOAuthManager, accessor: ViCareDeviceAccessor, roles: List[str], cacheDuration: int) -> None: - ViCareService.__init__(self, oauth_manager, accessor, roles) + def __init__(self, oauth_manager: AbstractViCareOAuthManager, roles: List[str], cacheDuration: int) -> None: + ViCareService.__init__(self, oauth_manager, roles) self.__cacheDuration = cacheDuration self.__cache = None self.__cacheTime = None self.__lock = threading.Lock() - def getProperty(self, property_name: str) -> Any: - data = self.__get_or_update_cache() + def getProperty(self, accessor: ViCareDeviceAccessor, property_name: str) -> Any: + data = self.__get_or_update_cache(accessor) entities = data["data"] return readFeature(entities, property_name) - def setProperty(self, property_name, action, data): - response = super().setProperty(property_name, action, data) + def setProperty(self, accessor: ViCareDeviceAccessor, property_name, action, data): + response = super().setProperty(accessor, property_name, action, data) self.clear_cache() return response - def __get_or_update_cache(self): + def __get_or_update_cache(self, accessor: ViCareDeviceAccessor): with self.__lock: if self.is_cache_invalid(): # we always sett the cache time before we fetch the data @@ -39,7 +39,7 @@ def __get_or_update_cache(self): # we simply return the old cache in this case self.__cacheTime = ViCareTimer().now() - data = self.fetch_all_features() + data = self.fetch_all_features(accessor) if "data" not in data: logger.error("Missing 'data' property when fetching data.") raise PyViCareInvalidDataError(data) diff --git a/PyViCare/PyViCareService.py b/PyViCare/PyViCareService.py index 4416ae1c..6cfa8896 100644 --- a/PyViCare/PyViCareService.py +++ b/PyViCare/PyViCareService.py @@ -30,19 +30,18 @@ def __init__(self, _id: int, serial: str, device_id: str) -> None: self.device_id = device_id class ViCareService: - def __init__(self, oauth_manager: AbstractViCareOAuthManager, accessor: ViCareDeviceAccessor, roles: List[str]) -> None: + def __init__(self, oauth_manager: AbstractViCareOAuthManager, roles: List[str]) -> None: self.oauth_manager = oauth_manager - self.accessor = accessor self.roles = roles - def getProperty(self, property_name: str) -> Any: - url = self.buildGetPropertyUrl(property_name) + def getProperty(self, accessor: ViCareDeviceAccessor, property_name: str) -> Any: + url = self.buildGetPropertyUrl(accessor, property_name) return self.oauth_manager.get(url) - def buildGetPropertyUrl(self, property_name): + def buildGetPropertyUrl(self, accessor: ViCareDeviceAccessor, property_name): if self._isGateway(): - return f'/features/installations/{self.accessor.id}/gateways/{self.accessor.serial}/features/{property_name}' - return f'/features/installations/{self.accessor.id}/gateways/{self.accessor.serial}/devices/{self.accessor.device_id}/features/{property_name}' + return f'/features/installations/{accessor.id}/gateways/{accessor.serial}/features/{property_name}' + return f'/features/installations/{accessor.id}/gateways/{accessor.serial}/devices/{accessor.device_id}/features/{property_name}' def hasRoles(self, requested_roles) -> bool: return hasRoles(requested_roles, self.roles) @@ -50,20 +49,19 @@ def hasRoles(self, requested_roles) -> bool: def _isGateway(self) -> bool: return self.hasRoles(["type:gateway;VitoconnectOpto1"]) or self.hasRoles(["type:gateway;VitoconnectOpto2/OT2"]) or self.hasRoles(["type:gateway;TCU100"]) or self.hasRoles(["type:gateway;TCU200"]) or self.hasRoles(["type:gateway;TCU300"]) - def setProperty(self, property_name: str, action: str, data: Any) -> Any: - url = buildSetPropertyUrl( - self.accessor, property_name, action) + def setProperty(self, accessor: ViCareDeviceAccessor, property_name: str, action: str, data: Any) -> Any: + url = buildSetPropertyUrl(accessor, property_name, action) post_data = data if isinstance(data, str) else json.dumps(data) return self.oauth_manager.post(url, post_data) - def fetch_all_features(self) -> Any: - url = f'/features/installations/{self.accessor.id}/gateways/{self.accessor.serial}/devices/{self.accessor.device_id}/features/' + def fetch_all_features(self, accessor: ViCareDeviceAccessor) -> Any: + url = f'/features/installations/{accessor.id}/gateways/{accessor.serial}/devices/{accessor.device_id}/features/' if self._isGateway(): - url = f'/features/installations/{self.accessor.id}/gateways/{self.accessor.serial}/features/' + url = f'/features/installations/{accessor.id}/gateways/{accessor.serial}/features/' return self.oauth_manager.get(url) - def reboot_gateway(self) -> Any: - url = f'/equipment/installations/{self.accessor.id}/gateways/{self.accessor.serial}/reboot' + def reboot_gateway(self, accessor: ViCareDeviceAccessor) -> Any: + url = f'/equipment/installations/{accessor.id}/gateways/{accessor.serial}/reboot' data = "{}" return self.oauth_manager.post(url, data) diff --git a/tests/ViCareServiceMock.py b/tests/ViCareServiceMock.py index 0594b409..1d2256cd 100644 --- a/tests/ViCareServiceMock.py +++ b/tests/ViCareServiceMock.py @@ -23,17 +23,15 @@ def __init__(self, filename, rawInput=None): else: self.testData = rawInput - self.accessor = ViCareDeviceAccessor( - '[id]', '[serial]', '[deviceid]') self.setPropertyData = [] - def getProperty(self, property_name): + def getProperty(self, accessor: ViCareDeviceAccessor, property_name): entities = self.testData["data"] return readFeature(entities, property_name) - def setProperty(self, property_name, action, data): + def setProperty(self, accessor: ViCareDeviceAccessor, property_name, action, data): self.setPropertyData.append({ - "url": buildSetPropertyUrl(self.accessor, property_name, action), + "url": buildSetPropertyUrl(accessor, property_name, action), "property_name": property_name, "action": action, "data": data From f77355f3723330ebc41022c71423dae6a67f30fa Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 21 Oct 2025 17:17:25 +0200 Subject: [PATCH 2/8] add accessor to device and device config --- PyViCare/PyViCare.py | 10 ++++----- PyViCare/PyViCareDevice.py | 9 ++++---- PyViCare/PyViCareDeviceConfig.py | 36 +++++++++++++++++--------------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/PyViCare/PyViCare.py b/PyViCare/PyViCare.py index c4191f89..eaf90ca3 100644 --- a/PyViCare/PyViCare.py +++ b/PyViCare/PyViCare.py @@ -32,10 +32,10 @@ def initWithExternalOAuth(self, oauth_manager: AbstractViCareOAuthManager) -> No def initWithBrowserOAuth(self, client_id: str, token_file: str) -> None: self.initWithExternalOAuth(ViCareBrowserOAuthManager(client_id, token_file)) - def __buildService(self, accessor, roles): + def __buildService(self, roles): if self.cacheDuration > 0: - return ViCareCachedService(self.oauth_manager, accessor, roles, self.cacheDuration) - return ViCareService(self.oauth_manager, accessor, roles) + return ViCareCachedService(self.oauth_manager, roles, self.cacheDuration) + return ViCareService(self.oauth_manager, roles) def __loadInstallations(self): installations = self.oauth_manager.get( @@ -57,11 +57,11 @@ def __extract_devices(self): accessor = ViCareDeviceAccessor( installation.id, gateway.serial, device.id) - service = self.__buildService(accessor, device.roles) + service = self.__buildService(device.roles) logger.info("Device found: %s", device.modelId) - yield PyViCareDeviceConfig(service, device.id, device.modelId, device.status) + yield PyViCareDeviceConfig(accessor, service, device.id, device.modelId, device.status) class DictWrap(object): diff --git a/PyViCare/PyViCareDevice.py b/PyViCare/PyViCareDevice.py index 2364f4b0..81c87627 100644 --- a/PyViCare/PyViCareDevice.py +++ b/PyViCare/PyViCareDevice.py @@ -1,6 +1,6 @@ from typing import Any -from PyViCare.PyViCareService import ViCareService +from PyViCare.PyViCareService import ViCareService, ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError, handleAPICommandErrors, handleNotSupported @@ -11,14 +11,15 @@ class Device: Note that currently, a new token is generated for each run. """ - def __init__(self, service: ViCareService) -> None: + def __init__(self, accessor: ViCareDeviceAccessor, service: ViCareService) -> None: + self.accessor = accessor self.service = service def getProperty(self, property_name: str) -> Any: - return self.service.getProperty(property_name) + return self.service.getProperty(self.accessor, property_name) def setProperty(self, property_name: str, action: str, data: Any) -> Any: - return self.service.setProperty(property_name, action, data) + return self.service.setProperty(self.accessor, property_name, action, data) @handleNotSupported def getSerial(self): diff --git a/PyViCare/PyViCareDeviceConfig.py b/PyViCare/PyViCareDeviceConfig.py index 87ee0a9b..bd3e0f90 100644 --- a/PyViCare/PyViCareDeviceConfig.py +++ b/PyViCare/PyViCareDeviceConfig.py @@ -13,6 +13,7 @@ from PyViCare.PyViCareRadiatorActuator import RadiatorActuator from PyViCare.PyViCareRoomSensor import RoomSensor from PyViCare.PyViCareRepeater import Repeater +from PyViCare.PyViCareService import ViCareDeviceAccessor, ViCareService from PyViCare.PyViCareElectricalEnergySystem import ElectricalEnergySystem from PyViCare.PyViCareGateway import Gateway from PyViCare.PyViCareVentilationDevice import VentilationDevice @@ -22,59 +23,60 @@ class PyViCareDeviceConfig: - def __init__(self, service, device_id, device_model, status): + def __init__(self, accessor: ViCareDeviceAccessor, service: ViCareService, device_id, device_model, status): + self.accessor = accessor self.service = service self.device_id = device_id self.device_model = device_model self.status = status def asGeneric(self): - return HeatingDevice(self.service) + return HeatingDevice(self.accessor, self.service) def asGazBoiler(self): - return GazBoiler(self.service) + return GazBoiler(self.accessor, self.service) def asFuelCell(self): - return FuelCell(self.service) + return FuelCell(self.accessor, self.service) def asHeatPump(self): - return HeatPump(self.service) + return HeatPump(self.accessor, self.service) def asOilBoiler(self): - return OilBoiler(self.service) + return OilBoiler(self.accessor, self.service) def asPelletsBoiler(self): - return PelletsBoiler(self.service) + return PelletsBoiler(self.accessor, self.service) def asHybridDevice(self): - return Hybrid(self.service) + return Hybrid(self.accessor, self.service) def asRadiatorActuator(self): - return RadiatorActuator(self.service) + return RadiatorActuator(self.accessor, self.service) def asFloorHeating(self): - return FloorHeating(self.service) + return FloorHeating(self.accessor, self.service) def asFloorHeatingChannel(self): - return FloorHeatingChannel(self.service) + return FloorHeatingChannel(self.accessor, self.service) def asRoomSensor(self): - return RoomSensor(self.service) + return RoomSensor(self.accessor, self.service) def asRepeater(self): - return Repeater(self.service) + return Repeater(self.accessor, self.service) def asElectricalEnergySystem(self): - return ElectricalEnergySystem(self.service) + return ElectricalEnergySystem(self.accessor, self.service) def asGateway(self): - return Gateway(self.service) + return Gateway(self.accessor, self.service) def asVentilation(self): - return VentilationDevice(self.service) + return VentilationDevice(self.accessor, self.service) def getConfig(self): - return self.service.accessor + return self.accessor def getId(self): return self.device_id From 1a565ef312a3275cb3148f523f48c05f975cabb4 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 21 Oct 2025 17:17:51 +0200 Subject: [PATCH 3/8] fix get_available_burners --- PyViCare/PyViCareFuelCell.py | 2 +- PyViCare/PyViCareGazBoiler.py | 2 +- PyViCare/PyViCareHeatingDevice.py | 5 +++-- PyViCare/PyViCareOilBoiler.py | 2 +- PyViCare/PyViCarePelletsBoiler.py | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/PyViCare/PyViCareFuelCell.py b/PyViCare/PyViCareFuelCell.py index 629b3acc..524d4452 100644 --- a/PyViCare/PyViCareFuelCell.py +++ b/PyViCare/PyViCareFuelCell.py @@ -17,7 +17,7 @@ def getBurner(self, burner): @handleNotSupported def getAvailableBurners(self): - return get_available_burners(self.service) + return get_available_burners(self.accessor, self.service) @handleNotSupported def getReturnTemperature(self): diff --git a/PyViCare/PyViCareGazBoiler.py b/PyViCare/PyViCareGazBoiler.py index 64289b75..ccb510ca 100644 --- a/PyViCare/PyViCareGazBoiler.py +++ b/PyViCare/PyViCareGazBoiler.py @@ -17,7 +17,7 @@ def getBurner(self, burner): @handleNotSupported def getAvailableBurners(self): - return get_available_burners(self.service) + return get_available_burners(self.accessor, self.service) @handleNotSupported def getGasConsumptionHeatingUnit(self): diff --git a/PyViCare/PyViCareHeatingDevice.py b/PyViCare/PyViCareHeatingDevice.py index c082d449..693bdd90 100644 --- a/PyViCare/PyViCareHeatingDevice.py +++ b/PyViCare/PyViCareHeatingDevice.py @@ -2,6 +2,7 @@ from typing import Any, List, Optional from PyViCare.PyViCareDevice import Device +from PyViCare.PyViCareService import ViCareService, ViCareDeviceAccessor from PyViCare.PyViCareHeatCurveCalculation import ( heat_curve_formular_variant1, heat_curve_formular_variant2) from PyViCare.PyViCareUtils import (VICARE_DAYS, @@ -17,13 +18,13 @@ def all_set(_list: List[Any]) -> bool: return all(v is not None for v in _list) -def get_available_burners(service): +def get_available_burners(accessor: ViCareDeviceAccessor, service: ViCareService): # workaround starting from 25.01.2022 # see: https://github.com/somm15/PyViCare/issues/243 available_burners = [] for burner in ['0', '1', '2', '3', '4', '5']: with suppress(PyViCareNotSupportedFeatureError): - if service.getProperty(f"heating.burners.{burner}") is not None: + if service.getProperty(accessor, f"heating.burners.{burner}") is not None: available_burners.append(burner) return available_burners diff --git a/PyViCare/PyViCareOilBoiler.py b/PyViCare/PyViCareOilBoiler.py index ea3353da..fb91b390 100644 --- a/PyViCare/PyViCareOilBoiler.py +++ b/PyViCare/PyViCareOilBoiler.py @@ -17,7 +17,7 @@ def getBurner(self, burner): @handleNotSupported def getAvailableBurners(self): - return get_available_burners(self.service) + return get_available_burners(self.accessor, self.service) @handleNotSupported def getBoilerTemperature(self): diff --git a/PyViCare/PyViCarePelletsBoiler.py b/PyViCare/PyViCarePelletsBoiler.py index c64ae998..4e87f15b 100644 --- a/PyViCare/PyViCarePelletsBoiler.py +++ b/PyViCare/PyViCarePelletsBoiler.py @@ -16,7 +16,7 @@ def getBurner(self, burner) -> PelletsBurner: @handleNotSupported def getAvailableBurners(self): - return get_available_burners(self.service) + return get_available_burners(self.accessor, self.service) @handleNotSupported def getBoilerTemperature(self): From 203cf27f62221feb72d5311f3c2d19f402814a10 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 21 Oct 2025 17:18:18 +0200 Subject: [PATCH 4/8] adjust test cases --- tests/test_E3_TCU300_ethernet.py | 4 +- tests/test_Ecotronic.py | 4 +- tests/test_GenericDevice.py | 4 +- tests/test_PyViCareCachedService.py | 24 +++++------ tests/test_PyViCareDeviceConfig.py | 60 +++++++++++++-------------- tests/test_PyViCareService.py | 16 +++---- tests/test_Solar.py | 4 +- tests/test_VitoairFs300E.py | 4 +- tests/test_Vitocal111S.py | 4 +- tests/test_Vitocal151A.py | 4 +- tests/test_Vitocal200.py | 4 +- tests/test_Vitocal200S.py | 4 +- tests/test_Vitocal222S.py | 4 +- tests/test_Vitocal250A.py | 4 +- tests/test_Vitocal300G.py | 4 +- tests/test_Vitocal333G.py | 4 +- tests/test_Vitocaldens222F.py | 4 +- tests/test_Vitocharge05.py | 4 +- tests/test_VitochargeVX3.py | 4 +- tests/test_VitoconnectOpto1.py | 4 +- tests/test_VitoconnectOpto2.py | 4 +- tests/test_Vitodens100W.py | 4 +- tests/test_Vitodens200W.py | 4 +- tests/test_Vitodens200W_2.py | 4 +- tests/test_Vitodens200W_B2HF.py | 4 +- tests/test_Vitodens222W.py | 4 +- tests/test_Vitodens300W.py | 4 +- tests/test_Vitodens333F.py | 4 +- tests/test_VitolaUniferral.py | 4 +- tests/test_Vitoladens300-C_J3RA.py | 4 +- tests/test_Vitopure350.py | 4 +- tests/test_VitovalorPT2.py | 4 +- tests/test_device_error.py | 4 +- tests/test_vitocal-with-vitovent.py | 4 +- tests/test_zigbee_zk03838_fht.py | 7 +++- tests/test_zigbee_zk03839_cs.py | 4 +- tests/test_zigbee_zk03840_trv.py | 4 +- tests/test_zigbee_zk05390_repeater.py | 4 +- 38 files changed, 157 insertions(+), 86 deletions(-) diff --git a/tests/test_E3_TCU300_ethernet.py b/tests/test_E3_TCU300_ethernet.py index b3125c10..de0230ce 100644 --- a/tests/test_E3_TCU300_ethernet.py +++ b/tests/test_E3_TCU300_ethernet.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareGateway import Gateway +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.ViCareServiceMock import ViCareServiceMock class TCU300_ethernet(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/TCU300_ethernet.json') - self.device = Gateway(self.service) + self.device = Gateway(self.accessor, self.service) def test_getSerial(self): self.assertEqual( diff --git a/tests/test_Ecotronic.py b/tests/test_Ecotronic.py index f98ca5f0..593cef51 100644 --- a/tests/test_Ecotronic.py +++ b/tests/test_Ecotronic.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCarePelletsBoiler import PelletsBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.ViCareServiceMock import ViCareServiceMock class Ecotronic(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Ecotronic.json') - self.device = PelletsBoiler(self.service) + self.device = PelletsBoiler(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), False) diff --git a/tests/test_GenericDevice.py b/tests/test_GenericDevice.py index 6ad75236..4e246c9c 100644 --- a/tests/test_GenericDevice.py +++ b/tests/test_GenericDevice.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareHeatingDevice import HeatingDevice +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import MockCircuitsData, ViCareServiceMock class GenericDeviceTest(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock( None, {'data': [MockCircuitsData([0])]}) - self.device = HeatingDevice(self.service) + self.device = HeatingDevice(self.accessor, self.service) def test_activateComfort(self): self.device.circuits[0].activateComfort() diff --git a/tests/test_PyViCareCachedService.py b/tests/test_PyViCareCachedService.py index f2a3e70a..55ef5a7a 100644 --- a/tests/test_PyViCareCachedService.py +++ b/tests/test_PyViCareCachedService.py @@ -14,35 +14,35 @@ class PyViCareCachedServiceTest(unittest.TestCase): def setUp(self): self.oauth_mock = Mock() self.oauth_mock.get.return_value = {'data': [{"feature": "someprop"}]} - accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareCachedService( - self.oauth_mock, accessor, [], self.CACHE_DURATION) + self.oauth_mock, [], self.CACHE_DURATION) def test_getProperty_existing(self): - self.service.getProperty("someprop") + self.service.getProperty(self.accessor, "someprop") self.oauth_mock.get.assert_called_once_with( '/features/installations/[id]/gateways/[serial]/devices/[device]/features/') def test_getProperty_nonexisting_raises_exception(self): def func(): - return self.service.getProperty("some-non-prop") + return self.service.getProperty(self.accessor, "some-non-prop") self.assertRaises(PyViCareNotSupportedFeatureError, func) def test_setProperty_works(self): - self.service.setProperty("someotherprop", "doaction", {'name': 'abc'}) + self.service.setProperty(self.accessor, "someotherprop", "doaction", {'name': 'abc'}) self.oauth_mock.post.assert_called_once_with( '/features/installations/[id]/gateways/[serial]/devices/[device]/features/someotherprop/commands/doaction', '{"name": "abc"}') def test_getProperty_existing_cached(self): # time+0 seconds with now_is('2000-01-01 00:00:00'): - self.service.getProperty("someprop") - self.service.getProperty("someprop") + self.service.getProperty(self.accessor, "someprop") + self.service.getProperty(self.accessor, "someprop") # time+30 seconds with now_is('2000-01-01 00:00:30'): - self.service.getProperty("someprop") + self.service.getProperty(self.accessor, "someprop") self.assertEqual(self.oauth_mock.get.call_count, 1) self.oauth_mock.get.assert_called_once_with( @@ -50,7 +50,7 @@ def test_getProperty_existing_cached(self): # time+70 seconds (must be more than CACHE_DURATION) with now_is('2000-01-01 00:01:10'): - self.service.getProperty("someprop") + self.service.getProperty(self.accessor, "someprop") self.assertEqual(self.oauth_mock.get.call_count, 2) @@ -58,12 +58,12 @@ def test_setProperty_invalidateCache(self): # freeze time with now_is('2000-01-01 00:00:00'): self.assertEqual(self.service.is_cache_invalid(), True) - self.service.getProperty("someprop") + self.service.getProperty(self.accessor, "someprop") self.assertEqual(self.service.is_cache_invalid(), False) self.service.setProperty( - "someotherprop", "doaction", {'name': 'abc'}) + self.accessor, "someotherprop", "doaction", {'name': 'abc'}) self.assertEqual(self.service.is_cache_invalid(), True) - self.service.getProperty("someprop") + self.service.getProperty(self.accessor, "someprop") self.assertEqual(self.oauth_mock.get.call_count, 2) diff --git a/tests/test_PyViCareDeviceConfig.py b/tests/test_PyViCareDeviceConfig.py index 9b2ccc10..4eaf5770 100644 --- a/tests/test_PyViCareDeviceConfig.py +++ b/tests/test_PyViCareDeviceConfig.py @@ -2,7 +2,7 @@ from unittest.mock import Mock from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig -from PyViCare.PyViCareService import hasRoles +from PyViCare.PyViCareService import hasRoles, ViCareDeviceAccessor def has_roles(roles): @@ -12,165 +12,165 @@ def has_roles(roles): class PyViCareDeviceConfigTest(unittest.TestCase): def setUp(self) -> None: + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = Mock() self.service.hasRoles = has_roles([]) def test_autoDetect_Vitodens_asGazBoiler(self): - c = PyViCareDeviceConfig( - self.service, "0", "E3_Vitodens_200_xxxx/E3_Dictionary", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_Vitodens_200_xxxx/E3_Dictionary", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("GazBoiler", type(device_type).__name__) def test_autoDetect_Unknown_asGeneric(self): - c = PyViCareDeviceConfig(self.service, "0", "myRobot", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "myRobot", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("HeatingDevice", type(device_type).__name__) def test_autoDetect_VScot_asGazBoiler(self): - c = PyViCareDeviceConfig(self.service, "0", "VScotHO1_200", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "VScotHO1_200", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("GazBoiler", type(device_type).__name__) def test_autoDetect_RoleBoiler_asGazBoiler(self): self.service.hasRoles = has_roles(["type:boiler"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("GazBoiler", type(device_type).__name__) def test_autoDetect_RoleHeatpump_asHeatpump(self): self.service.hasRoles = has_roles(["type:heatpump"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("HeatPump", type(device_type).__name__) def test_autoDetect_RoleRadiator_asRadiatorActuator(self): self.service.hasRoles = has_roles(["type:radiator"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("RadiatorActuator", type(device_type).__name__) def test_autoDetect_RoleClimateSensor_asRoomSensor(self): self.service.hasRoles = has_roles(["type:climateSensor"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("RoomSensor", type(device_type).__name__) def test_autoDetect_RoleVentilation_asVentilation(self): self.service.hasRoles = has_roles(["type:ventilation"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_RoleVentilationCentral_asVentilation(self): self.service.hasRoles = has_roles(["type:ventilation;central"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_Vitoair_FS_300F_asVentilation(self): - c = PyViCareDeviceConfig(self.service, "0", "E3_ViAir_300F", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_ViAir_300F", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_RoleVentilationPurifier_asVentilation(self): self.service.hasRoles = has_roles(["type:ventilation;purifier"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_Vitopure_350_asVentilation(self): - c = PyViCareDeviceConfig(self.service, "0", "E3_VitoPure", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_VitoPure", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_RoleESS_asElectricalEnergySystem(self): self.service.hasRoles = has_roles(["type:ess"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("ElectricalEnergySystem", type(device_type).__name__) def test_autoDetect_Vitocharge05_asElectricalEnergySystem(self): - c = PyViCareDeviceConfig(self.service, "0", "E3_VitoCharge_05", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_VitoCharge_05", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("ElectricalEnergySystem", type(device_type).__name__) def test_autoDetect_VitoconnectOpto1_asGateway(self): - c = PyViCareDeviceConfig(self.service, "0", "Heatbox1", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Heatbox1", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_VitoconnectOpto2_asGateway(self): - c = PyViCareDeviceConfig(self.service, "0", "Heatbox2_SRC", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Heatbox2_SRC", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_TCU100_asGateway(self): - c = PyViCareDeviceConfig(self.service, "0", "E3_TCU41_x04", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_TCU41_x04", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_TCU200_asGateway(self): - c = PyViCareDeviceConfig(self.service, "0", "E3_TCU19_x05", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_TCU19_x05", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_TCU300_asGateway(self): - c = PyViCareDeviceConfig(self.service, "0", "E3_TCU10_x07", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_TCU10_x07", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_Ecotronic_asPelletsBoiler(self): self.service.hasRoles = has_roles(["type:boiler"]) - c = PyViCareDeviceConfig(self.service, "0", "Ecotronic", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Ecotronic", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("PelletsBoiler", type(device_type).__name__) def test_autoDetect_Vitoladens_asOilBoiler(self): self.service.hasRoles = has_roles(["type:boiler"]) - c = PyViCareDeviceConfig(self.service, "0", "Vitoladens", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Vitoladens", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("OilBoiler", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway(self): self.service.hasRoles = has_roles(["type:gateway;VitoconnectOpto1"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway_vc_opto2(self): self.service.hasRoles = has_roles(["type:gateway;VitoconnectOpto2/OT2"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway_TCU100(self): self.service.hasRoles = has_roles(["type:gateway;TCU100"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway_TCU200(self): self.service.hasRoles = has_roles(["type:gateway;TCU200"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway_TCU300(self): self.service.hasRoles = has_roles(["type:gateway;TCU300"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_legacy_device(self): self.service.hasRoles = has_roles(["type:legacy"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device = c.asAutoDetectDevice() self.assertEqual(device.isLegacyDevice(), True) self.assertEqual(device.isE3Device(), False) def test_e3_device(self): self.service.hasRoles = has_roles(["type:E3"]) - c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") device = c.asAutoDetectDevice() self.assertEqual(device.isLegacyDevice(), False) self.assertEqual(device.isE3Device(), True) diff --git a/tests/test_PyViCareService.py b/tests/test_PyViCareService.py index 86885bc9..de567874 100644 --- a/tests/test_PyViCareService.py +++ b/tests/test_PyViCareService.py @@ -9,31 +9,31 @@ class PyViCareServiceTest(unittest.TestCase): def setUp(self): self.oauth_mock = Mock() self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") - self.service = ViCareService(self.oauth_mock, self.accessor, []) + self.service = ViCareService(self.oauth_mock, []) def test_getProperty(self): - self.service.getProperty("someprop") + self.service.getProperty(self.accessor, "someprop") self.oauth_mock.get.assert_called_once_with( '/features/installations/[id]/gateways/[serial]/devices/[device]/features/someprop') def test_setProperty_object(self): - self.service.setProperty("someprop", "doaction", {'name': 'abc'}) + self.service.setProperty(self.accessor, "someprop", "doaction", {'name': 'abc'}) self.oauth_mock.post.assert_called_once_with( '/features/installations/[id]/gateways/[serial]/devices/[device]/features/someprop/commands/doaction', '{"name": "abc"}') def test_setProperty_string(self): - self.service.setProperty("someprop", "doaction", '{}') + self.service.setProperty(self.accessor, "someprop", "doaction", '{}') self.oauth_mock.post.assert_called_once_with( '/features/installations/[id]/gateways/[serial]/devices/[device]/features/someprop/commands/doaction', '{}') def test_getProperty_gateway(self): - self.service = ViCareService(self.oauth_mock, self.accessor, ["type:gateway;VitoconnectOpto1"]) - self.service.getProperty("someprop") + self.service = ViCareService(self.oauth_mock, ["type:gateway;VitoconnectOpto1"]) + self.service.getProperty(self.accessor, "someprop") self.oauth_mock.get.assert_called_once_with( '/features/installations/[id]/gateways/[serial]/features/someprop') def test_fetch_all_features_gateway(self): - self.service = ViCareService(self.oauth_mock, self.accessor, ["type:gateway;VitoconnectOpto1"]) - self.service.fetch_all_features() + self.service = ViCareService(self.oauth_mock, ["type:gateway;VitoconnectOpto1"]) + self.service.fetch_all_features(self.accessor) self.oauth_mock.get.assert_called_once_with( '/features/installations/[id]/gateways/[serial]/features/') diff --git a/tests/test_Solar.py b/tests/test_Solar.py index 9663847e..617f928c 100644 --- a/tests/test_Solar.py +++ b/tests/test_Solar.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareHeatingDevice import HeatingDevice +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class SolarTest(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Solar.json') - self.device = HeatingDevice(self.service) + self.device = HeatingDevice(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), True) diff --git a/tests/test_VitoairFs300E.py b/tests/test_VitoairFs300E.py index dc72a086..71bdf5ac 100644 --- a/tests/test_VitoairFs300E.py +++ b/tests/test_VitoairFs300E.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareVentilationDevice import VentilationDevice +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class VitoairFs300(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/VitoairFs300E.json') - self.device = VentilationDevice(self.service) + self.device = VentilationDevice(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), False) diff --git a/tests/test_Vitocal111S.py b/tests/test_Vitocal111S.py index a4fbca4e..4916980b 100644 --- a/tests/test_Vitocal111S.py +++ b/tests/test_Vitocal111S.py @@ -2,13 +2,15 @@ from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitocal200(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal111S.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_ventilation_state(self): self.assertEqual(self.device.getVentilationDemand(), "ventilation") diff --git a/tests/test_Vitocal151A.py b/tests/test_Vitocal151A.py index 512b139c..749fe23f 100644 --- a/tests/test_Vitocal151A.py +++ b/tests/test_Vitocal151A.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitocal200(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal151A.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_getPowerConsumptionCooling(self): self.assertEqual(self.device.getPowerConsumptionCoolingUnit(), "kilowattHour") diff --git a/tests/test_Vitocal200.py b/tests/test_Vitocal200.py index 2bf37d46..1cb71762 100644 --- a/tests/test_Vitocal200.py +++ b/tests/test_Vitocal200.py @@ -1,6 +1,7 @@ import unittest from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.helper import now_is from tests.ViCareServiceMock import ViCareServiceMock @@ -8,8 +9,9 @@ class Vitocal200(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal200.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_getCompressorActive(self): self.assertEqual(self.device.getCompressor(0).getActive(), False) diff --git a/tests/test_Vitocal200S.py b/tests/test_Vitocal200S.py index cb8dd6b8..d082d633 100644 --- a/tests/test_Vitocal200S.py +++ b/tests/test_Vitocal200S.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitocal200S(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal200S.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_getDomesticHotWaterConfiguredTemperature(self): self.assertEqual( diff --git a/tests/test_Vitocal222S.py b/tests/test_Vitocal222S.py index f2065594..588558cf 100644 --- a/tests/test_Vitocal222S.py +++ b/tests/test_Vitocal222S.py @@ -1,6 +1,7 @@ import unittest from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.helper import now_is from tests.ViCareServiceMock import ViCareServiceMock @@ -8,8 +9,9 @@ class Vitocal222S(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal222S.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_getDomesticHotWaterActiveMode_10_10_time(self): with now_is('2000-01-01 10:10:00'): diff --git a/tests/test_Vitocal250A.py b/tests/test_Vitocal250A.py index aacad964..fc8eac1f 100644 --- a/tests/test_Vitocal250A.py +++ b/tests/test_Vitocal250A.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.ViCareServiceMock import ViCareServiceMock class Vitocal250A(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal250A.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_getCompressorActive(self): self.assertFalse(self.device.compressors[0].getActive()) diff --git a/tests/test_Vitocal300G.py b/tests/test_Vitocal300G.py index 6c26c5e5..8d0cd8b3 100644 --- a/tests/test_Vitocal300G.py +++ b/tests/test_Vitocal300G.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitocal300G(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal300G.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_getCompressorActive(self): self.assertEqual(self.device.compressors[0].getActive(), False) diff --git a/tests/test_Vitocal333G.py b/tests/test_Vitocal333G.py index 49f67f27..da18da16 100644 --- a/tests/test_Vitocal333G.py +++ b/tests/test_Vitocal333G.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.ViCareServiceMock import ViCareServiceMock class Vitocal300G(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal333G.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_getDomesticHotWaterStorageTemperature(self): self.assertEqual( diff --git a/tests/test_Vitocaldens222F.py b/tests/test_Vitocaldens222F.py index 995d343b..47346d8a 100644 --- a/tests/test_Vitocaldens222F.py +++ b/tests/test_Vitocaldens222F.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareHybrid import Hybrid +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitocaldens222F(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocaldens222F.json') - self.device = Hybrid(self.service) + self.device = Hybrid(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), True) diff --git a/tests/test_Vitocharge05.py b/tests/test_Vitocharge05.py index 4c2b0450..6faf8253 100644 --- a/tests/test_Vitocharge05.py +++ b/tests/test_Vitocharge05.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareElectricalEnergySystem import ElectricalEnergySystem +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitocharge05(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocharge05.json') - self.device = ElectricalEnergySystem(self.service) + self.device = ElectricalEnergySystem(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), False) diff --git a/tests/test_VitochargeVX3.py b/tests/test_VitochargeVX3.py index ea50ee7f..1b806088 100644 --- a/tests/test_VitochargeVX3.py +++ b/tests/test_VitochargeVX3.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareElectricalEnergySystem import ElectricalEnergySystem +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class VitochargeVX3(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/VitochargeVX3.json') - self.device = ElectricalEnergySystem(self.service) + self.device = ElectricalEnergySystem(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), False) diff --git a/tests/test_VitoconnectOpto1.py b/tests/test_VitoconnectOpto1.py index 51e0a82f..86c261c0 100644 --- a/tests/test_VitoconnectOpto1.py +++ b/tests/test_VitoconnectOpto1.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareGateway import Gateway +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class VitoconnectOpto1(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/VitoconnectOpto1.json') - self.device = Gateway(self.service) + self.device = Gateway(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), False) diff --git a/tests/test_VitoconnectOpto2.py b/tests/test_VitoconnectOpto2.py index c1ad8e9b..3066a4a1 100644 --- a/tests/test_VitoconnectOpto2.py +++ b/tests/test_VitoconnectOpto2.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareGateway import Gateway +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class VitoconnectOpto2(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/VitoconnectOpto2.json') - self.device = Gateway(self.service) + self.device = Gateway(self.accessor, self.service) def test_getSerial(self): self.assertEqual( diff --git a/tests/test_Vitodens100W.py b/tests/test_Vitodens100W.py index 1c987bf3..b379555d 100644 --- a/tests/test_Vitodens100W.py +++ b/tests/test_Vitodens100W.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareGazBoiler import GazBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitodens100W(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitodens100W.json') - self.device = GazBoiler(self.service) + self.device = GazBoiler(self.accessor, self.service) def test_getActive(self): self.assertEqual(self.device.burners[0].getActive(), False) diff --git a/tests/test_Vitodens200W.py b/tests/test_Vitodens200W.py index 184584a5..e8eb9be4 100644 --- a/tests/test_Vitodens200W.py +++ b/tests/test_Vitodens200W.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareGazBoiler import GazBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.helper import now_is from tests.ViCareServiceMock import ViCareServiceMock class Vitodens200W(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitodens200W.json') - self.device = GazBoiler(self.service) + self.device = GazBoiler(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), True) diff --git a/tests/test_Vitodens200W_2.py b/tests/test_Vitodens200W_2.py index 2be07a0e..f9598592 100644 --- a/tests/test_Vitodens200W_2.py +++ b/tests/test_Vitodens200W_2.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareGazBoiler import GazBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.helper import now_is from tests.ViCareServiceMock import ViCareServiceMock class Vitodens200W_2(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitodens200W_2.json') - self.device = GazBoiler(self.service) + self.device = GazBoiler(self.accessor, self.service) def test_getSerial(self): self.assertEqual(self.device.getSerial(), '################') diff --git a/tests/test_Vitodens200W_B2HF.py b/tests/test_Vitodens200W_B2HF.py index 439f9a1c..50af84f4 100644 --- a/tests/test_Vitodens200W_B2HF.py +++ b/tests/test_Vitodens200W_B2HF.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareGazBoiler import GazBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitodens200W_B2HF(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitodens200W_B2HF.json') - self.device = GazBoiler(self.service) + self.device = GazBoiler(self.accessor, self.service) def test_getSupplyPressure(self): self.assertEqual(self.device.getSupplyPressure(), 1.5) diff --git a/tests/test_Vitodens222W.py b/tests/test_Vitodens222W.py index 96fc0df4..8bbf66ae 100644 --- a/tests/test_Vitodens222W.py +++ b/tests/test_Vitodens222W.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareGazBoiler import GazBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.ViCareServiceMock import ViCareServiceMock class Vitodens222W(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitodens222W.json') - self.device = GazBoiler(self.service) + self.device = GazBoiler(self.accessor, self.service) def test_getActive(self): self.assertEqual(self.device.burners[0].getActive(), True) diff --git a/tests/test_Vitodens300W.py b/tests/test_Vitodens300W.py index 7edda059..766d07ca 100644 --- a/tests/test_Vitodens300W.py +++ b/tests/test_Vitodens300W.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareGazBoiler import GazBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.ViCareServiceMock import ViCareServiceMock class Vitodens300W(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitodens300W.json') - self.device = GazBoiler(self.service) + self.device = GazBoiler(self.accessor, self.service) def test_getActive(self): self.assertEqual(self.device.burners[0].getActive(), False) diff --git a/tests/test_Vitodens333F.py b/tests/test_Vitodens333F.py index 9a540d81..98f3ec63 100644 --- a/tests/test_Vitodens333F.py +++ b/tests/test_Vitodens333F.py @@ -1,14 +1,16 @@ import unittest from PyViCare.PyViCareGazBoiler import GazBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from tests.ViCareServiceMock import ViCareServiceMock class Vitodens333F(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitodens333F.json') - self.device = GazBoiler(self.service) + self.device = GazBoiler(self.accessor, self.service) # currently missing an up-to-date test response def test_getActive(self): diff --git a/tests/test_VitolaUniferral.py b/tests/test_VitolaUniferral.py index 6a3eef23..4fe46fb1 100644 --- a/tests/test_VitolaUniferral.py +++ b/tests/test_VitolaUniferral.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareOilBoiler import OilBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class VitolaUniferral(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/VitolaUniferral.json') - self.device = OilBoiler(self.service) + self.device = OilBoiler(self.accessor, self.service) def test_getDomesticHotWaterConfiguredTemperature(self): self.assertEqual( diff --git a/tests/test_Vitoladens300-C_J3RA.py b/tests/test_Vitoladens300-C_J3RA.py index 5270cc29..fec24a49 100644 --- a/tests/test_Vitoladens300-C_J3RA.py +++ b/tests/test_Vitoladens300-C_J3RA.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareOilBoiler import OilBoiler +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitoladens300C(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitoladens300-C_J3RA.json') - self.device = OilBoiler(self.service) + self.device = OilBoiler(self.accessor, self.service) def test_getActive(self): self.assertEqual(self.device.burners[0].getActive(), False) diff --git a/tests/test_Vitopure350.py b/tests/test_Vitopure350.py index ed741bc5..799e8c74 100644 --- a/tests/test_Vitopure350.py +++ b/tests/test_Vitopure350.py @@ -1,5 +1,6 @@ import unittest +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError from PyViCare.PyViCareVentilationDevice import VentilationDevice from tests.ViCareServiceMock import ViCareServiceMock @@ -7,8 +8,9 @@ class Vitopure350(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitopure350.json') - self.device = VentilationDevice(self.service) + self.device = VentilationDevice(self.accessor, self.service) def test_getActiveMode(self): self.assertEqual("sensorDriven", self.device.getActiveMode()) diff --git a/tests/test_VitovalorPT2.py b/tests/test_VitovalorPT2.py index 7f2f0410..b043e3ae 100644 --- a/tests/test_VitovalorPT2.py +++ b/tests/test_VitovalorPT2.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareFuelCell import FuelCell +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class VitovalorPT2(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/VitovalorPT2.json') - self.device = FuelCell(self.service) + self.device = FuelCell(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), True) diff --git a/tests/test_device_error.py b/tests/test_device_error.py index cb22e218..86eb96d4 100644 --- a/tests/test_device_error.py +++ b/tests/test_device_error.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareDevice import Device +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class DeviceErrorTest(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/deviceerrors/F.1100.json') - self.device = Device(self.service) + self.device = Device(self.accessor, self.service) def test_deviceErrors(self): errors = self.device.getDeviceErrors() diff --git a/tests/test_vitocal-with-vitovent.py b/tests/test_vitocal-with-vitovent.py index 85d159b9..65018b80 100644 --- a/tests/test_vitocal-with-vitovent.py +++ b/tests/test_vitocal-with-vitovent.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareHeatPump import HeatPump +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class Vitocal_with_Vitovent(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/Vitocal-200S-with-Vitovent-300W.json') - self.device = HeatPump(self.service) + self.device = HeatPump(self.accessor, self.service) def test_isDomesticHotWaterDevice(self): self.assertEqual(self.device.isDomesticHotWaterDevice(), True) diff --git a/tests/test_zigbee_zk03838_fht.py b/tests/test_zigbee_zk03838_fht.py index 8b3d1dd9..4a31ea35 100644 --- a/tests/test_zigbee_zk03838_fht.py +++ b/tests/test_zigbee_zk03838_fht.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareFloorHeating import FloorHeating, FloorHeatingChannel +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class ZK03838MainViaHeatbox2(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/zigbee_zk03838_fht_main.json') - self.device = FloorHeating(self.service) + self.device = FloorHeating(self.accessor, self.service) def test_getSerial(self): self.assertEqual( @@ -35,8 +37,9 @@ def test_getZigbeeSignalStrength(self): class ZK03838ChannelViaHeatbox2(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/zigbee_zk03838_fht_channel.json') - self.device = FloorHeatingChannel(self.service) + self.device = FloorHeatingChannel(self.accessor, self.service) def test_getSerial(self): self.assertEqual( diff --git a/tests/test_zigbee_zk03839_cs.py b/tests/test_zigbee_zk03839_cs.py index da880c19..f97521b2 100644 --- a/tests/test_zigbee_zk03839_cs.py +++ b/tests/test_zigbee_zk03839_cs.py @@ -1,13 +1,15 @@ import unittest +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareRoomSensor import RoomSensor from tests.ViCareServiceMock import ViCareServiceMock class ZK03839ViaHeatbox2(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/zigbee_zk03839_cs.json') - self.device = RoomSensor(self.service) + self.device = RoomSensor(self.accessor, self.service) def test_getSerial(self): self.assertEqual(self.device.getSerial(), "zigbee-################") diff --git a/tests/test_zigbee_zk03840_trv.py b/tests/test_zigbee_zk03840_trv.py index 3b673832..daf5f966 100644 --- a/tests/test_zigbee_zk03840_trv.py +++ b/tests/test_zigbee_zk03840_trv.py @@ -1,13 +1,15 @@ import unittest +from PyViCare.PyViCareService import ViCareDeviceAccessor from PyViCare.PyViCareRadiatorActuator import RadiatorActuator from tests.ViCareServiceMock import ViCareServiceMock class ZK03840ViaHeatbox2(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/zigbee_zk03840_trv.json') - self.device = RadiatorActuator(self.service) + self.device = RadiatorActuator(self.accessor, self.service) def test_getSerial(self): self.assertEqual(self.device.getSerial(), "zigbee-################") diff --git a/tests/test_zigbee_zk05390_repeater.py b/tests/test_zigbee_zk05390_repeater.py index ae92a2cd..a2388fb3 100644 --- a/tests/test_zigbee_zk05390_repeater.py +++ b/tests/test_zigbee_zk05390_repeater.py @@ -1,13 +1,15 @@ import unittest from PyViCare.PyViCareRepeater import Repeater +from PyViCare.PyViCareService import ViCareDeviceAccessor from tests.ViCareServiceMock import ViCareServiceMock class ZK05390ViaHeatbox2(unittest.TestCase): def setUp(self): + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") self.service = ViCareServiceMock('response/zigbee_zk05390_repeater.json') - self.device = Repeater(self.service) + self.device = Repeater(self.accessor, self.service) def test_getSerial(self): self.assertEqual(self.device.getSerial(), "zigbee-################") From 1010eb1d602d0f1a5b4925fe450d0c9e993ad33c Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Wed, 22 Oct 2025 15:24:30 +0200 Subject: [PATCH 5/8] simplify PyViCareDeviceConfig --- PyViCare/PyViCare.py | 2 +- PyViCare/PyViCareDeviceConfig.py | 4 +-- tests/test_PyViCareDeviceConfig.py | 56 +++++++++++++++--------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/PyViCare/PyViCare.py b/PyViCare/PyViCare.py index eaf90ca3..89778a99 100644 --- a/PyViCare/PyViCare.py +++ b/PyViCare/PyViCare.py @@ -61,7 +61,7 @@ def __extract_devices(self): logger.info("Device found: %s", device.modelId) - yield PyViCareDeviceConfig(accessor, service, device.id, device.modelId, device.status) + yield PyViCareDeviceConfig(accessor, service, device.modelId, device.status) class DictWrap(object): diff --git a/PyViCare/PyViCareDeviceConfig.py b/PyViCare/PyViCareDeviceConfig.py index bd3e0f90..a44cb18c 100644 --- a/PyViCare/PyViCareDeviceConfig.py +++ b/PyViCare/PyViCareDeviceConfig.py @@ -23,10 +23,10 @@ class PyViCareDeviceConfig: - def __init__(self, accessor: ViCareDeviceAccessor, service: ViCareService, device_id, device_model, status): + def __init__(self, accessor: ViCareDeviceAccessor, service: ViCareService, device_model, status): self.accessor = accessor self.service = service - self.device_id = device_id + self.device_id = accessor.device_id self.device_model = device_model self.status = status diff --git a/tests/test_PyViCareDeviceConfig.py b/tests/test_PyViCareDeviceConfig.py index 4eaf5770..9480ff9f 100644 --- a/tests/test_PyViCareDeviceConfig.py +++ b/tests/test_PyViCareDeviceConfig.py @@ -17,160 +17,160 @@ def setUp(self) -> None: self.service.hasRoles = has_roles([]) def test_autoDetect_Vitodens_asGazBoiler(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_Vitodens_200_xxxx/E3_Dictionary", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "E3_Vitodens_200_xxxx/E3_Dictionary", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("GazBoiler", type(device_type).__name__) def test_autoDetect_Unknown_asGeneric(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "myRobot", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "myRobot", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("HeatingDevice", type(device_type).__name__) def test_autoDetect_VScot_asGazBoiler(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "VScotHO1_200", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "VScotHO1_200", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("GazBoiler", type(device_type).__name__) def test_autoDetect_RoleBoiler_asGazBoiler(self): self.service.hasRoles = has_roles(["type:boiler"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("GazBoiler", type(device_type).__name__) def test_autoDetect_RoleHeatpump_asHeatpump(self): self.service.hasRoles = has_roles(["type:heatpump"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("HeatPump", type(device_type).__name__) def test_autoDetect_RoleRadiator_asRadiatorActuator(self): self.service.hasRoles = has_roles(["type:radiator"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("RadiatorActuator", type(device_type).__name__) def test_autoDetect_RoleClimateSensor_asRoomSensor(self): self.service.hasRoles = has_roles(["type:climateSensor"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("RoomSensor", type(device_type).__name__) def test_autoDetect_RoleVentilation_asVentilation(self): self.service.hasRoles = has_roles(["type:ventilation"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_RoleVentilationCentral_asVentilation(self): self.service.hasRoles = has_roles(["type:ventilation;central"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_Vitoair_FS_300F_asVentilation(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_ViAir_300F", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "E3_ViAir_300F", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_RoleVentilationPurifier_asVentilation(self): self.service.hasRoles = has_roles(["type:ventilation;purifier"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_Vitopure_350_asVentilation(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_VitoPure", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "E3_VitoPure", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("VentilationDevice", type(device_type).__name__) def test_autoDetect_RoleESS_asElectricalEnergySystem(self): self.service.hasRoles = has_roles(["type:ess"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("ElectricalEnergySystem", type(device_type).__name__) def test_autoDetect_Vitocharge05_asElectricalEnergySystem(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_VitoCharge_05", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "E3_VitoCharge_05", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("ElectricalEnergySystem", type(device_type).__name__) def test_autoDetect_VitoconnectOpto1_asGateway(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Heatbox1", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Heatbox1", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_VitoconnectOpto2_asGateway(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Heatbox2_SRC", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Heatbox2_SRC", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_TCU100_asGateway(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_TCU41_x04", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "E3_TCU41_x04", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_TCU200_asGateway(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_TCU19_x05", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "E3_TCU19_x05", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_TCU300_asGateway(self): - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "E3_TCU10_x07", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "E3_TCU10_x07", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_Ecotronic_asPelletsBoiler(self): self.service.hasRoles = has_roles(["type:boiler"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Ecotronic", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Ecotronic", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("PelletsBoiler", type(device_type).__name__) def test_autoDetect_Vitoladens_asOilBoiler(self): self.service.hasRoles = has_roles(["type:boiler"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Vitoladens", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Vitoladens", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("OilBoiler", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway(self): self.service.hasRoles = has_roles(["type:gateway;VitoconnectOpto1"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway_vc_opto2(self): self.service.hasRoles = has_roles(["type:gateway;VitoconnectOpto2/OT2"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway_TCU100(self): self.service.hasRoles = has_roles(["type:gateway;TCU100"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway_TCU200(self): self.service.hasRoles = has_roles(["type:gateway;TCU200"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_autoDetect_RoleGateway_asGateway_TCU300(self): self.service.hasRoles = has_roles(["type:gateway;TCU300"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device_type = c.asAutoDetectDevice() self.assertEqual("Gateway", type(device_type).__name__) def test_legacy_device(self): self.service.hasRoles = has_roles(["type:legacy"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device = c.asAutoDetectDevice() self.assertEqual(device.isLegacyDevice(), True) self.assertEqual(device.isE3Device(), False) def test_e3_device(self): self.service.hasRoles = has_roles(["type:E3"]) - c = PyViCareDeviceConfig(self.accessor, self.service, "0", "Unknown", "Online") + c = PyViCareDeviceConfig(self.accessor, self.service, "Unknown", "Online") device = c.asAutoDetectDevice() self.assertEqual(device.isLegacyDevice(), False) self.assertEqual(device.isE3Device(), True) From 4c2c17179211da38cab38d0c31a8cda3007045d0 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Thu, 23 Oct 2025 17:14:29 +0200 Subject: [PATCH 6/8] check accessor in readFeature --- PyViCare/PyViCareCachedService.py | 2 +- PyViCare/PyViCareService.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PyViCare/PyViCareCachedService.py b/PyViCare/PyViCareCachedService.py index 667ff141..028abfcc 100644 --- a/PyViCare/PyViCareCachedService.py +++ b/PyViCare/PyViCareCachedService.py @@ -23,7 +23,7 @@ def __init__(self, oauth_manager: AbstractViCareOAuthManager, roles: List[str], def getProperty(self, accessor: ViCareDeviceAccessor, property_name: str) -> Any: data = self.__get_or_update_cache(accessor) entities = data["data"] - return readFeature(entities, property_name) + return readFeature(accessor, entities, property_name) def setProperty(self, accessor: ViCareDeviceAccessor, property_name, action, data): response = super().setProperty(accessor, property_name, action, data) diff --git a/PyViCare/PyViCareService.py b/PyViCare/PyViCareService.py index 6cfa8896..1d4d85d4 100644 --- a/PyViCare/PyViCareService.py +++ b/PyViCare/PyViCareService.py @@ -8,9 +8,15 @@ logger = logging.getLogger('ViCare') logger.addHandler(logging.NullHandler()) -def readFeature(entities, property_name): +class ViCareDeviceAccessor: + def __init__(self, _id: int, serial: str, device_id: str) -> None: + self.id = _id + self.serial = serial + self.device_id = device_id + +def readFeature(accessor: ViCareDeviceAccessor, entities, property_name): feature = next( - (f for f in entities if f["feature"] == property_name), None) + (f for f in entities if (not f.get("deviceId") or f["deviceId"] == accessor.device_id) and f["feature"] == property_name), None) if feature is None: raise PyViCareNotSupportedFeatureError(property_name) @@ -23,12 +29,6 @@ def hasRoles(requested_roles: List[str], existing_roles: List[str]) -> bool: def buildSetPropertyUrl(accessor, property_name, action): return f'/features/installations/{accessor.id}/gateways/{accessor.serial}/devices/{accessor.device_id}/features/{property_name}/commands/{action}' -class ViCareDeviceAccessor: - def __init__(self, _id: int, serial: str, device_id: str) -> None: - self.id = _id - self.serial = serial - self.device_id = device_id - class ViCareService: def __init__(self, oauth_manager: AbstractViCareOAuthManager, roles: List[str]) -> None: self.oauth_manager = oauth_manager From ff52021a78fb0bd5d822e8341b29f60729d6117e Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Thu, 23 Oct 2025 17:19:34 +0200 Subject: [PATCH 7/8] update testdata --- tests/response/VitoairFs300E.json | 150 ++++++++++++++-------------- tests/response/Vitocharge05.json | 56 +++++------ tests/response/VitochargeVX3.json | 158 +++++++++++++++--------------- 3 files changed, 182 insertions(+), 182 deletions(-) diff --git a/tests/response/VitoairFs300E.json b/tests/response/VitoairFs300E.json index 53702aed..d3cbfa99 100644 --- a/tests/response/VitoairFs300E.json +++ b/tests/response/VitoairFs300E.json @@ -3,7 +3,7 @@ { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.messages.errors.raw", "gatewayId": "################", "isEnabled": true, @@ -15,12 +15,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.messages.errors.raw" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/device.messages.errors.raw" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.productIdentification", "gatewayId": "################", "isEnabled": true, @@ -37,12 +37,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.productIdentification" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/device.productIdentification" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.serial", "gatewayId": "################", "isEnabled": true, @@ -54,12 +54,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.serial" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/device.serial" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "heating.boiler.serial", "gatewayId": "################", "isEnabled": true, @@ -71,12 +71,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/heating.boiler.serial" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/heating.boiler.serial" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation", "gatewayId": "################", "isEnabled": true, @@ -88,12 +88,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.levels.levelFour", "gatewayId": "################", "isEnabled": true, @@ -106,12 +106,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.levels.levelFour" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.levels.levelFour" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.levels.levelOne", "gatewayId": "################", "isEnabled": true, @@ -124,12 +124,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.levels.levelOne" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.levels.levelOne" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.levels.levelThree", "gatewayId": "################", "isEnabled": true, @@ -142,12 +142,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.levels.levelThree" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.levels.levelThree" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.levels.levelTwo", "gatewayId": "################", "isEnabled": true, @@ -160,7 +160,7 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.levels.levelTwo" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.levels.levelTwo" }, { "apiVersion": 1, @@ -182,16 +182,16 @@ "type": "string" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.active/commands/setMode" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.active/commands/setMode" }, "setModeContinuousSensorOverride": { "isExecutable": true, "name": "setModeContinuousSensorOverride", "params": {}, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.active/commands/setModeContinuousSensorOverride" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.active/commands/setModeContinuousSensorOverride" } }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.modes.active", "gatewayId": "################", "isEnabled": true, @@ -203,12 +203,12 @@ } }, "timestamp": "2024-11-07T02:31:12.967Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.active" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.active" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.modes.filterChange", "gatewayId": "################", "isEnabled": true, @@ -220,7 +220,7 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.filterChange" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.filterChange" }, { "apiVersion": 1, @@ -242,10 +242,10 @@ "type": "string" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.permanent/commands/setLevel" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.permanent/commands/setLevel" } }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.modes.permanent", "gatewayId": "################", "isEnabled": true, @@ -257,12 +257,12 @@ } }, "timestamp": "2024-11-07T07:20:15.814Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.permanent" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.permanent" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.modes.sensorDriven", "gatewayId": "################", "isEnabled": true, @@ -274,12 +274,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.sensorDriven" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.sensorDriven" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.modes.sensorOverride", "gatewayId": "################", "isEnabled": true, @@ -291,12 +291,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.sensorOverride" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.sensorOverride" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.modes.ventilation", "gatewayId": "################", "isEnabled": true, @@ -308,12 +308,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.modes.ventilation" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.modes.ventilation" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.programs.active", "gatewayId": "################", "isEnabled": true, @@ -325,7 +325,7 @@ } }, "timestamp": "2024-11-07T07:20:15.814Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.active" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.active" }, { "apiVersion": 1, @@ -345,14 +345,14 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.forcedLevelFour/commands/activate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.forcedLevelFour/commands/activate" }, "deactivate": { "isDeprecated": true, "isExecutable": true, "name": "deactivate", "params": {}, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.forcedLevelFour/commands/deactivate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.forcedLevelFour/commands/deactivate" }, "setDefaultRuntime": { "isDeprecated": true, @@ -369,7 +369,7 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.forcedLevelFour/commands/setDefaultRuntime" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.forcedLevelFour/commands/setDefaultRuntime" }, "setTimeout": { "isDeprecated": true, @@ -386,14 +386,14 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.forcedLevelFour/commands/setTimeout" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.forcedLevelFour/commands/setTimeout" } }, "deprecated": { "info": "none", "removalDate": "2024-09-15" }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.programs.forcedLevelFour", "gatewayId": "################", "isEnabled": true, @@ -414,7 +414,7 @@ } }, "timestamp": "2024-11-07T02:31:12.967Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.forcedLevelFour" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.forcedLevelFour" }, { "apiVersion": 1, @@ -423,7 +423,7 @@ "info": "none", "removalDate": "2024-09-15" }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.programs.levelFour", "gatewayId": "################", "isEnabled": true, @@ -440,7 +440,7 @@ } }, "timestamp": "2024-11-07T07:20:15.814Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.levelFour" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.levelFour" }, { "apiVersion": 1, @@ -449,7 +449,7 @@ "info": "none", "removalDate": "2024-09-15" }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.programs.levelOne", "gatewayId": "################", "isEnabled": true, @@ -466,7 +466,7 @@ } }, "timestamp": "2024-11-07T07:20:15.814Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.levelOne" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.levelOne" }, { "apiVersion": 1, @@ -475,7 +475,7 @@ "info": "none", "removalDate": "2024-09-15" }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.programs.levelThree", "gatewayId": "################", "isEnabled": true, @@ -492,7 +492,7 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.levelThree" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.levelThree" }, { "apiVersion": 1, @@ -501,7 +501,7 @@ "info": "none", "removalDate": "2024-09-15" }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.programs.levelTwo", "gatewayId": "################", "isEnabled": true, @@ -518,7 +518,7 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.levelTwo" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.levelTwo" }, { "apiVersion": 1, @@ -538,14 +538,14 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.silent/commands/activate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.silent/commands/activate" }, "deactivate": { "isDeprecated": true, "isExecutable": true, "name": "deactivate", "params": {}, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.silent/commands/deactivate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.silent/commands/deactivate" }, "setDefaultRuntime": { "isDeprecated": true, @@ -562,7 +562,7 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.silent/commands/setDefaultRuntime" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.silent/commands/setDefaultRuntime" }, "setTimeout": { "isDeprecated": true, @@ -579,14 +579,14 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.silent/commands/setTimeout" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.silent/commands/setTimeout" } }, "deprecated": { "info": "none", "removalDate": "2024-09-15" }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.programs.silent", "gatewayId": "################", "isEnabled": true, @@ -607,12 +607,12 @@ } }, "timestamp": "2024-11-07T02:31:12.967Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.silent" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.silent" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.programs.standby", "gatewayId": "################", "isEnabled": true, @@ -629,12 +629,12 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.programs.standby" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.programs.standby" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.operating.state", "gatewayId": "################", "isEnabled": true, @@ -654,7 +654,7 @@ } }, "timestamp": "2024-11-07T07:20:15.814Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.operating.state" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.operating.state" }, { "apiVersion": 1, @@ -673,13 +673,13 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.forcedLevelFour/commands/activate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.forcedLevelFour/commands/activate" }, "deactivate": { "isExecutable": true, "name": "deactivate", "params": {}, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.forcedLevelFour/commands/deactivate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.forcedLevelFour/commands/deactivate" }, "setDefaultRuntime": { "isExecutable": true, @@ -695,7 +695,7 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.forcedLevelFour/commands/setDefaultRuntime" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.forcedLevelFour/commands/setDefaultRuntime" }, "setTimeout": { "isExecutable": true, @@ -711,10 +711,10 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.forcedLevelFour/commands/setTimeout" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.forcedLevelFour/commands/setTimeout" } }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.quickmodes.forcedLevelFour", "gatewayId": "################", "isEnabled": true, @@ -735,7 +735,7 @@ } }, "timestamp": "2024-11-07T02:31:12.967Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.forcedLevelFour" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.forcedLevelFour" }, { "apiVersion": 1, @@ -754,13 +754,13 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.silent/commands/activate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.silent/commands/activate" }, "deactivate": { "isExecutable": true, "name": "deactivate", "params": {}, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.silent/commands/deactivate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.silent/commands/deactivate" }, "setDefaultRuntime": { "isExecutable": true, @@ -776,7 +776,7 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.silent/commands/setDefaultRuntime" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.silent/commands/setDefaultRuntime" }, "setTimeout": { "isExecutable": true, @@ -792,10 +792,10 @@ "type": "number" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.silent/commands/setTimeout" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.silent/commands/setTimeout" } }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.quickmodes.silent", "gatewayId": "################", "isEnabled": true, @@ -816,7 +816,7 @@ } }, "timestamp": "2024-11-07T02:31:12.967Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.quickmodes.silent" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.quickmodes.silent" }, { "apiVersion": 1, @@ -825,7 +825,7 @@ "isExecutable": false, "name": "resetSchedule", "params": {}, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.schedule/commands/resetSchedule" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.schedule/commands/resetSchedule" }, "setSchedule": { "isExecutable": true, @@ -847,10 +847,10 @@ "type": "Schedule" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.schedule/commands/setSchedule" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.schedule/commands/setSchedule" } }, - "deviceId": "################", + "deviceId": "0", "feature": "ventilation.schedule", "gatewayId": "################", "isEnabled": true, @@ -1049,7 +1049,7 @@ } }, "timestamp": "2024-11-07T02:31:11.736Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ventilation.schedule" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ventilation.schedule" } ] } diff --git a/tests/response/Vitocharge05.json b/tests/response/Vitocharge05.json index 1bbe6ad9..59b45f93 100644 --- a/tests/response/Vitocharge05.json +++ b/tests/response/Vitocharge05.json @@ -3,7 +3,7 @@ { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.messages.errors.raw", "gatewayId": "################", "isEnabled": true, @@ -15,12 +15,12 @@ } }, "timestamp": "2024-12-14T19:52:37.544Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.messages.errors.raw" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/device.messages.errors.raw" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.productIdentification", "gatewayId": "################", "isEnabled": true, @@ -37,12 +37,12 @@ } }, "timestamp": "2024-12-14T19:52:37.544Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.productIdentification" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/device.productIdentification" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.serial", "gatewayId": "################", "isEnabled": true, @@ -54,12 +54,12 @@ } }, "timestamp": "2024-12-14T19:52:37.544Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/device.serial" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/device.serial" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.operationState", "gatewayId": "################", "isEnabled": true, @@ -71,12 +71,12 @@ } }, "timestamp": "2024-12-18T15:13:53.165Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ess.operationState" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ess.operationState" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.power", "gatewayId": "################", "isEnabled": true, @@ -89,12 +89,12 @@ } }, "timestamp": "2024-12-18T15:13:54.657Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ess.power" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ess.power" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.stateOfCharge", "gatewayId": "################", "isEnabled": true, @@ -107,12 +107,12 @@ } }, "timestamp": "2024-12-18T13:41:08.478Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ess.stateOfCharge" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ess.stateOfCharge" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.transfer.discharge.cumulated", "gatewayId": "################", "isEnabled": true, @@ -145,12 +145,12 @@ } }, "timestamp": "2024-12-18T15:13:56.163Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/ess.transfer.discharge.cumulated" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/ess.transfer.discharge.cumulated" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "heating.boiler.serial", "gatewayId": "################", "isEnabled": true, @@ -162,12 +162,12 @@ } }, "timestamp": "2024-12-14T19:52:37.544Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/heating.boiler.serial" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/heating.boiler.serial" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.transfer.consumption.total", "gatewayId": "################", "isEnabled": true, @@ -180,12 +180,12 @@ } }, "timestamp": "2024-12-18T16:54:33.546Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.consumption.total" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/pcc.transfer.consumption.total" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.transfer.feedIn.total", "gatewayId": "################", "isEnabled": true, @@ -198,12 +198,12 @@ } }, "timestamp": "2024-12-18T10:00:34.783Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.feedIn.total" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/pcc.transfer.feedIn.total" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.transfer.power.exchange", "gatewayId": "################", "isEnabled": true, @@ -216,12 +216,12 @@ } }, "timestamp": "2024-12-18T16:54:38.941Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.power.exchange" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/pcc.transfer.power.exchange" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.production.cumulated", "gatewayId": "################", "isEnabled": true, @@ -254,12 +254,12 @@ } }, "timestamp": "2024-12-18T15:13:18.692Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/photovoltaic.production.cumulated" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/photovoltaic.production.cumulated" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.production.current", "gatewayId": "################", "isEnabled": true, @@ -272,12 +272,12 @@ } }, "timestamp": "2024-12-18T15:01:39.005Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/photovoltaic.production.current" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/photovoltaic.production.current" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.status", "gatewayId": "################", "isEnabled": true, @@ -289,7 +289,7 @@ } }, "timestamp": "2024-12-18T14:55:21.555Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/################/features/photovoltaic.status" + "uri": "https://api.viessmann-climatesolutions.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/photovoltaic.status" } ] } diff --git a/tests/response/VitochargeVX3.json b/tests/response/VitochargeVX3.json index 60bfd0b0..478d39f8 100644 --- a/tests/response/VitochargeVX3.json +++ b/tests/response/VitochargeVX3.json @@ -3,7 +3,7 @@ { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.etn", "gatewayId": "################", "isEnabled": true, @@ -15,12 +15,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.etn" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.etn" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.messages.info.raw", "gatewayId": "################", "isEnabled": true, @@ -32,12 +32,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.messages.info.raw" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.messages.info.raw" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.messages.service.raw", "gatewayId": "################", "isEnabled": true, @@ -49,12 +49,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.messages.service.raw" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.messages.service.raw" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.messages.status.raw", "gatewayId": "################", "isEnabled": true, @@ -66,12 +66,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.messages.status.raw" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.messages.status.raw" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.parameterIdentification.version", "gatewayId": "################", "isEnabled": true, @@ -83,12 +83,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.parameterIdentification.version" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.parameterIdentification.version" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.productIdentification", "gatewayId": "################", "isEnabled": true, @@ -105,12 +105,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.productIdentification" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.productIdentification" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.productMatrix", "gatewayId": "################", "isEnabled": true, @@ -129,24 +129,24 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.productMatrix" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.productMatrix" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.remoteReset", "gatewayId": "################", "isEnabled": true, "isReady": true, "properties": {}, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.remoteReset" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.remoteReset" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.serial", "gatewayId": "################", "isEnabled": true, @@ -158,12 +158,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.serial" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.serial" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "device.serial.internalComponents", "gatewayId": "################", "isEnabled": true, @@ -178,7 +178,7 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.serial.internalComponents" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.serial.internalComponents" }, { "apiVersion": 1, @@ -202,16 +202,16 @@ "type": "string" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.time.daylightSaving/commands/activate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.time.daylightSaving/commands/activate" }, "deactivate": { "isExecutable": true, "name": "deactivate", "params": {}, - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.time.daylightSaving/commands/deactivate" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.time.daylightSaving/commands/deactivate" } }, - "deviceId": "################", + "deviceId": "0", "feature": "device.time.daylightSaving", "gatewayId": "################", "isEnabled": true, @@ -231,12 +231,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/device.time.daylightSaving" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/device.time.daylightSaving" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.battery.usedAverage", "gatewayId": "################", "isEnabled": true, @@ -279,12 +279,12 @@ } }, "timestamp": "2025-09-29T16:35:50.613Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.battery.usedAverage" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.battery.usedAverage" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.configuration.backupBox", "gatewayId": "################", "isEnabled": true, @@ -297,12 +297,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.configuration.backupBox" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.configuration.backupBox" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.configuration.systemType", "gatewayId": "################", "isEnabled": true, @@ -314,12 +314,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.configuration.systemType" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.configuration.systemType" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.inverter.ac.power", "gatewayId": "################", "isEnabled": true, @@ -337,12 +337,12 @@ } }, "timestamp": "2025-09-29T18:29:06.060Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.inverter.ac.power" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.inverter.ac.power" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.operationState", "gatewayId": "################", "isEnabled": true, @@ -354,12 +354,12 @@ } }, "timestamp": "2025-09-29T16:47:33.784Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.operationState" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.operationState" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.power", "gatewayId": "################", "isEnabled": true, @@ -372,12 +372,12 @@ } }, "timestamp": "2025-09-29T18:28:55.580Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.power" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.power" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.sensors.temperature.ambient", "gatewayId": "################", "isEnabled": true, @@ -394,12 +394,12 @@ } }, "timestamp": "2025-09-29T18:28:23.208Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.sensors.temperature.ambient" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.sensors.temperature.ambient" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.stateOfCharge", "gatewayId": "################", "isEnabled": true, @@ -412,12 +412,12 @@ } }, "timestamp": "2025-09-29T18:26:55.956Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.stateOfCharge" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.stateOfCharge" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.transfer.charge.cumulated", "gatewayId": "################", "isEnabled": true, @@ -450,12 +450,12 @@ } }, "timestamp": "2025-09-29T16:45:15.994Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.transfer.charge.cumulated" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.transfer.charge.cumulated" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.transfer.discharge.cumulated", "gatewayId": "################", "isEnabled": true, @@ -488,12 +488,12 @@ } }, "timestamp": "2025-09-29T18:28:59.827Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.transfer.discharge.cumulated" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.transfer.discharge.cumulated" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "ess.version.hardware", "gatewayId": "################", "isEnabled": true, @@ -521,12 +521,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/ess.version.hardware" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/ess.version.hardware" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "heating.boiler.serial", "gatewayId": "################", "isEnabled": true, @@ -538,12 +538,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/heating.boiler.serial" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/heating.boiler.serial" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "heating.device.mainECU", "gatewayId": "################", "isEnabled": true, @@ -556,7 +556,7 @@ } }, "timestamp": "2025-09-29T13:59:55.128Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/heating.device.mainECU" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/heating.device.mainECU" }, { "apiVersion": 1, @@ -573,22 +573,22 @@ "type": "string" } }, - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/heating.device.time/commands/setTime" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/heating.device.time/commands/setTime" } }, - "deviceId": "################", + "deviceId": "0", "feature": "heating.device.time", "gatewayId": "################", "isEnabled": true, "isReady": true, "properties": {}, "timestamp": "2025-09-29T18:28:09.781Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/heating.device.time" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/heating.device.time" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.ac.active.current", "gatewayId": "################", "isEnabled": true, @@ -616,12 +616,12 @@ } }, "timestamp": "2025-09-29T18:28:47.828Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/pcc.ac.active.current" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/pcc.ac.active.current" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.ac.active.power", "gatewayId": "################", "isEnabled": true, @@ -644,12 +644,12 @@ } }, "timestamp": "2025-09-29T18:28:59.827Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/pcc.ac.active.power" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/pcc.ac.active.power" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.ac.reactive.power", "gatewayId": "################", "isEnabled": true, @@ -672,12 +672,12 @@ } }, "timestamp": "2025-09-29T18:28:59.827Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/pcc.ac.reactive.power" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/pcc.ac.reactive.power" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.state.gridCode", "gatewayId": "################", "isEnabled": true, @@ -689,12 +689,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/pcc.state.gridCode" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/pcc.state.gridCode" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.transfer.consumption.total", "gatewayId": "################", "isEnabled": true, @@ -707,12 +707,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.consumption.total" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/pcc.transfer.consumption.total" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.transfer.feedIn.total", "gatewayId": "################", "isEnabled": true, @@ -725,12 +725,12 @@ } }, "timestamp": "2025-09-29T16:33:09.012Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.feedIn.total" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/pcc.transfer.feedIn.total" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "pcc.transfer.power.exchange", "gatewayId": "################", "isEnabled": true, @@ -743,12 +743,12 @@ } }, "timestamp": "2025-09-29T18:28:59.827Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/pcc.transfer.power.exchange" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/pcc.transfer.power.exchange" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.installedPeakPower", "gatewayId": "################", "isEnabled": true, @@ -761,12 +761,12 @@ } }, "timestamp": "2025-09-29T13:59:30.725Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/photovoltaic.installedPeakPower" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/photovoltaic.installedPeakPower" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.production.cumulated", "gatewayId": "################", "isEnabled": true, @@ -799,12 +799,12 @@ } }, "timestamp": "2025-09-29T17:16:02.355Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/photovoltaic.production.cumulated" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/photovoltaic.production.cumulated" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.production.current", "gatewayId": "################", "isEnabled": true, @@ -817,12 +817,12 @@ } }, "timestamp": "2025-09-29T17:09:38.793Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/photovoltaic.production.current" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/photovoltaic.production.current" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.status", "gatewayId": "################", "isEnabled": true, @@ -834,12 +834,12 @@ } }, "timestamp": "2025-09-29T17:05:21.936Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/photovoltaic.status" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/photovoltaic.status" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.string.current", "gatewayId": "################", "isEnabled": true, @@ -862,12 +862,12 @@ } }, "timestamp": "2025-09-29T16:38:23.020Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/photovoltaic.string.current" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/photovoltaic.string.current" }, { "apiVersion": 1, "commands": {}, - "deviceId": "################", + "deviceId": "0", "feature": "photovoltaic.string.voltage", "gatewayId": "################", "isEnabled": true, @@ -890,7 +890,7 @@ } }, "timestamp": "2025-09-29T18:27:39.817Z", - "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/################/features/photovoltaic.string.voltage" + "uri": "https://api.viessmann-climatesolutions.com/iot/v2/features/installations/#######/gateways/################/devices/0/features/photovoltaic.string.voltage" } ] } From 9589b0c57579a2a272513ad0709ec7ab8d7aa386 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Thu, 23 Oct 2025 17:21:17 +0200 Subject: [PATCH 8/8] fix tests --- tests/ViCareServiceMock.py | 2 +- tests/test_E3_TCU300_ethernet.py | 2 +- tests/test_Ecotronic.py | 2 +- tests/test_GenericDevice.py | 2 +- tests/test_PyViCareCachedService.py | 8 ++++---- tests/test_PyViCareDeviceConfig.py | 2 +- tests/test_PyViCareService.py | 8 ++++---- tests/test_Solar.py | 2 +- tests/test_VitoairFs300E.py | 2 +- tests/test_Vitocal111S.py | 2 +- tests/test_Vitocal151A.py | 2 +- tests/test_Vitocal200.py | 2 +- tests/test_Vitocal200S.py | 2 +- tests/test_Vitocal222S.py | 2 +- tests/test_Vitocal250A.py | 2 +- tests/test_Vitocal300G.py | 2 +- tests/test_Vitocal333G.py | 2 +- tests/test_Vitocaldens222F.py | 2 +- tests/test_Vitocharge05.py | 2 +- tests/test_VitochargeVX3.py | 2 +- tests/test_VitoconnectOpto1.py | 2 +- tests/test_VitoconnectOpto2.py | 2 +- tests/test_Vitodens100W.py | 2 +- tests/test_Vitodens200W.py | 2 +- tests/test_Vitodens200W_2.py | 2 +- tests/test_Vitodens200W_B2HF.py | 2 +- tests/test_Vitodens222W.py | 2 +- tests/test_Vitodens300W.py | 2 +- tests/test_Vitodens333F.py | 2 +- tests/test_VitolaUniferral.py | 2 +- tests/test_Vitoladens300-C_J3RA.py | 2 +- tests/test_Vitopure350.py | 2 +- tests/test_VitovalorPT2.py | 2 +- tests/test_device_error.py | 2 +- tests/test_vitocal-with-vitovent.py | 2 +- tests/test_zigbee_zk03838_fht.py | 4 ++-- tests/test_zigbee_zk03839_cs.py | 2 +- tests/test_zigbee_zk03840_trv.py | 2 +- tests/test_zigbee_zk05390_repeater.py | 2 +- 39 files changed, 46 insertions(+), 46 deletions(-) diff --git a/tests/ViCareServiceMock.py b/tests/ViCareServiceMock.py index 1d2256cd..dce84a8b 100644 --- a/tests/ViCareServiceMock.py +++ b/tests/ViCareServiceMock.py @@ -27,7 +27,7 @@ def __init__(self, filename, rawInput=None): def getProperty(self, accessor: ViCareDeviceAccessor, property_name): entities = self.testData["data"] - return readFeature(entities, property_name) + return readFeature(accessor, entities, property_name) def setProperty(self, accessor: ViCareDeviceAccessor, property_name, action, data): self.setPropertyData.append({ diff --git a/tests/test_E3_TCU300_ethernet.py b/tests/test_E3_TCU300_ethernet.py index de0230ce..769f2f48 100644 --- a/tests/test_E3_TCU300_ethernet.py +++ b/tests/test_E3_TCU300_ethernet.py @@ -8,7 +8,7 @@ class TCU300_ethernet(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "gateway") self.service = ViCareServiceMock('response/TCU300_ethernet.json') self.device = Gateway(self.accessor, self.service) diff --git a/tests/test_Ecotronic.py b/tests/test_Ecotronic.py index 593cef51..2472e572 100644 --- a/tests/test_Ecotronic.py +++ b/tests/test_Ecotronic.py @@ -8,7 +8,7 @@ class Ecotronic(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Ecotronic.json') self.device = PelletsBoiler(self.accessor, self.service) diff --git a/tests/test_GenericDevice.py b/tests/test_GenericDevice.py index 4e246c9c..440cb4b6 100644 --- a/tests/test_GenericDevice.py +++ b/tests/test_GenericDevice.py @@ -7,7 +7,7 @@ class GenericDeviceTest(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock( None, {'data': [MockCircuitsData([0])]}) self.device = HeatingDevice(self.accessor, self.service) diff --git a/tests/test_PyViCareCachedService.py b/tests/test_PyViCareCachedService.py index 55ef5a7a..41b7fd20 100644 --- a/tests/test_PyViCareCachedService.py +++ b/tests/test_PyViCareCachedService.py @@ -14,14 +14,14 @@ class PyViCareCachedServiceTest(unittest.TestCase): def setUp(self): self.oauth_mock = Mock() self.oauth_mock.get.return_value = {'data': [{"feature": "someprop"}]} - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareCachedService( self.oauth_mock, [], self.CACHE_DURATION) def test_getProperty_existing(self): self.service.getProperty(self.accessor, "someprop") self.oauth_mock.get.assert_called_once_with( - '/features/installations/[id]/gateways/[serial]/devices/[device]/features/') + '/features/installations/[id]/gateways/[serial]/devices/0/features/') def test_getProperty_nonexisting_raises_exception(self): @@ -32,7 +32,7 @@ def func(): def test_setProperty_works(self): self.service.setProperty(self.accessor, "someotherprop", "doaction", {'name': 'abc'}) self.oauth_mock.post.assert_called_once_with( - '/features/installations/[id]/gateways/[serial]/devices/[device]/features/someotherprop/commands/doaction', '{"name": "abc"}') + '/features/installations/[id]/gateways/[serial]/devices/0/features/someotherprop/commands/doaction', '{"name": "abc"}') def test_getProperty_existing_cached(self): # time+0 seconds @@ -46,7 +46,7 @@ def test_getProperty_existing_cached(self): self.assertEqual(self.oauth_mock.get.call_count, 1) self.oauth_mock.get.assert_called_once_with( - '/features/installations/[id]/gateways/[serial]/devices/[device]/features/') + '/features/installations/[id]/gateways/[serial]/devices/0/features/') # time+70 seconds (must be more than CACHE_DURATION) with now_is('2000-01-01 00:01:10'): diff --git a/tests/test_PyViCareDeviceConfig.py b/tests/test_PyViCareDeviceConfig.py index 9480ff9f..c35bbfd0 100644 --- a/tests/test_PyViCareDeviceConfig.py +++ b/tests/test_PyViCareDeviceConfig.py @@ -12,7 +12,7 @@ def has_roles(roles): class PyViCareDeviceConfigTest(unittest.TestCase): def setUp(self) -> None: - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = Mock() self.service.hasRoles = has_roles([]) diff --git a/tests/test_PyViCareService.py b/tests/test_PyViCareService.py index de567874..7d26e1d0 100644 --- a/tests/test_PyViCareService.py +++ b/tests/test_PyViCareService.py @@ -8,23 +8,23 @@ class PyViCareServiceTest(unittest.TestCase): def setUp(self): self.oauth_mock = Mock() - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareService(self.oauth_mock, []) def test_getProperty(self): self.service.getProperty(self.accessor, "someprop") self.oauth_mock.get.assert_called_once_with( - '/features/installations/[id]/gateways/[serial]/devices/[device]/features/someprop') + '/features/installations/[id]/gateways/[serial]/devices/0/features/someprop') def test_setProperty_object(self): self.service.setProperty(self.accessor, "someprop", "doaction", {'name': 'abc'}) self.oauth_mock.post.assert_called_once_with( - '/features/installations/[id]/gateways/[serial]/devices/[device]/features/someprop/commands/doaction', '{"name": "abc"}') + '/features/installations/[id]/gateways/[serial]/devices/0/features/someprop/commands/doaction', '{"name": "abc"}') def test_setProperty_string(self): self.service.setProperty(self.accessor, "someprop", "doaction", '{}') self.oauth_mock.post.assert_called_once_with( - '/features/installations/[id]/gateways/[serial]/devices/[device]/features/someprop/commands/doaction', '{}') + '/features/installations/[id]/gateways/[serial]/devices/0/features/someprop/commands/doaction', '{}') def test_getProperty_gateway(self): self.service = ViCareService(self.oauth_mock, ["type:gateway;VitoconnectOpto1"]) diff --git a/tests/test_Solar.py b/tests/test_Solar.py index 617f928c..ad57dd5f 100644 --- a/tests/test_Solar.py +++ b/tests/test_Solar.py @@ -7,7 +7,7 @@ class SolarTest(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Solar.json') self.device = HeatingDevice(self.accessor, self.service) diff --git a/tests/test_VitoairFs300E.py b/tests/test_VitoairFs300E.py index 71bdf5ac..60f02fb5 100644 --- a/tests/test_VitoairFs300E.py +++ b/tests/test_VitoairFs300E.py @@ -7,7 +7,7 @@ class VitoairFs300(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/VitoairFs300E.json') self.device = VentilationDevice(self.accessor, self.service) diff --git a/tests/test_Vitocal111S.py b/tests/test_Vitocal111S.py index 4916980b..0bae3910 100644 --- a/tests/test_Vitocal111S.py +++ b/tests/test_Vitocal111S.py @@ -8,7 +8,7 @@ class Vitocal200(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal111S.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_Vitocal151A.py b/tests/test_Vitocal151A.py index 749fe23f..5d20f9fd 100644 --- a/tests/test_Vitocal151A.py +++ b/tests/test_Vitocal151A.py @@ -7,7 +7,7 @@ class Vitocal200(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal151A.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_Vitocal200.py b/tests/test_Vitocal200.py index 1cb71762..0b383b70 100644 --- a/tests/test_Vitocal200.py +++ b/tests/test_Vitocal200.py @@ -9,7 +9,7 @@ class Vitocal200(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal200.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_Vitocal200S.py b/tests/test_Vitocal200S.py index d082d633..7594e95c 100644 --- a/tests/test_Vitocal200S.py +++ b/tests/test_Vitocal200S.py @@ -7,7 +7,7 @@ class Vitocal200S(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal200S.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_Vitocal222S.py b/tests/test_Vitocal222S.py index 588558cf..89c2661d 100644 --- a/tests/test_Vitocal222S.py +++ b/tests/test_Vitocal222S.py @@ -9,7 +9,7 @@ class Vitocal222S(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal222S.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_Vitocal250A.py b/tests/test_Vitocal250A.py index fc8eac1f..0c808f9b 100644 --- a/tests/test_Vitocal250A.py +++ b/tests/test_Vitocal250A.py @@ -8,7 +8,7 @@ class Vitocal250A(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal250A.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_Vitocal300G.py b/tests/test_Vitocal300G.py index 8d0cd8b3..56a83983 100644 --- a/tests/test_Vitocal300G.py +++ b/tests/test_Vitocal300G.py @@ -7,7 +7,7 @@ class Vitocal300G(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal300G.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_Vitocal333G.py b/tests/test_Vitocal333G.py index da18da16..6a79423e 100644 --- a/tests/test_Vitocal333G.py +++ b/tests/test_Vitocal333G.py @@ -8,7 +8,7 @@ class Vitocal300G(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal333G.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_Vitocaldens222F.py b/tests/test_Vitocaldens222F.py index 47346d8a..c074d9d4 100644 --- a/tests/test_Vitocaldens222F.py +++ b/tests/test_Vitocaldens222F.py @@ -7,7 +7,7 @@ class Vitocaldens222F(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocaldens222F.json') self.device = Hybrid(self.accessor, self.service) diff --git a/tests/test_Vitocharge05.py b/tests/test_Vitocharge05.py index 6faf8253..6b870849 100644 --- a/tests/test_Vitocharge05.py +++ b/tests/test_Vitocharge05.py @@ -7,7 +7,7 @@ class Vitocharge05(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocharge05.json') self.device = ElectricalEnergySystem(self.accessor, self.service) diff --git a/tests/test_VitochargeVX3.py b/tests/test_VitochargeVX3.py index 1b806088..d3fbdeae 100644 --- a/tests/test_VitochargeVX3.py +++ b/tests/test_VitochargeVX3.py @@ -7,7 +7,7 @@ class VitochargeVX3(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/VitochargeVX3.json') self.device = ElectricalEnergySystem(self.accessor, self.service) diff --git a/tests/test_VitoconnectOpto1.py b/tests/test_VitoconnectOpto1.py index 86c261c0..5ec023ec 100644 --- a/tests/test_VitoconnectOpto1.py +++ b/tests/test_VitoconnectOpto1.py @@ -7,7 +7,7 @@ class VitoconnectOpto1(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "gateway") self.service = ViCareServiceMock('response/VitoconnectOpto1.json') self.device = Gateway(self.accessor, self.service) diff --git a/tests/test_VitoconnectOpto2.py b/tests/test_VitoconnectOpto2.py index 3066a4a1..f16463fd 100644 --- a/tests/test_VitoconnectOpto2.py +++ b/tests/test_VitoconnectOpto2.py @@ -7,7 +7,7 @@ class VitoconnectOpto2(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "gateway") self.service = ViCareServiceMock('response/VitoconnectOpto2.json') self.device = Gateway(self.accessor, self.service) diff --git a/tests/test_Vitodens100W.py b/tests/test_Vitodens100W.py index b379555d..828f787b 100644 --- a/tests/test_Vitodens100W.py +++ b/tests/test_Vitodens100W.py @@ -7,7 +7,7 @@ class Vitodens100W(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitodens100W.json') self.device = GazBoiler(self.accessor, self.service) diff --git a/tests/test_Vitodens200W.py b/tests/test_Vitodens200W.py index e8eb9be4..e60dbc3a 100644 --- a/tests/test_Vitodens200W.py +++ b/tests/test_Vitodens200W.py @@ -8,7 +8,7 @@ class Vitodens200W(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitodens200W.json') self.device = GazBoiler(self.accessor, self.service) diff --git a/tests/test_Vitodens200W_2.py b/tests/test_Vitodens200W_2.py index f9598592..2169265b 100644 --- a/tests/test_Vitodens200W_2.py +++ b/tests/test_Vitodens200W_2.py @@ -8,7 +8,7 @@ class Vitodens200W_2(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitodens200W_2.json') self.device = GazBoiler(self.accessor, self.service) diff --git a/tests/test_Vitodens200W_B2HF.py b/tests/test_Vitodens200W_B2HF.py index 50af84f4..56a67a49 100644 --- a/tests/test_Vitodens200W_B2HF.py +++ b/tests/test_Vitodens200W_B2HF.py @@ -7,7 +7,7 @@ class Vitodens200W_B2HF(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitodens200W_B2HF.json') self.device = GazBoiler(self.accessor, self.service) diff --git a/tests/test_Vitodens222W.py b/tests/test_Vitodens222W.py index 8bbf66ae..84fe1c3b 100644 --- a/tests/test_Vitodens222W.py +++ b/tests/test_Vitodens222W.py @@ -8,7 +8,7 @@ class Vitodens222W(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitodens222W.json') self.device = GazBoiler(self.accessor, self.service) diff --git a/tests/test_Vitodens300W.py b/tests/test_Vitodens300W.py index 766d07ca..a198b53f 100644 --- a/tests/test_Vitodens300W.py +++ b/tests/test_Vitodens300W.py @@ -8,7 +8,7 @@ class Vitodens300W(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitodens300W.json') self.device = GazBoiler(self.accessor, self.service) diff --git a/tests/test_Vitodens333F.py b/tests/test_Vitodens333F.py index 98f3ec63..848a0f58 100644 --- a/tests/test_Vitodens333F.py +++ b/tests/test_Vitodens333F.py @@ -8,7 +8,7 @@ class Vitodens333F(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitodens333F.json') self.device = GazBoiler(self.accessor, self.service) diff --git a/tests/test_VitolaUniferral.py b/tests/test_VitolaUniferral.py index 4fe46fb1..5a61ba8b 100644 --- a/tests/test_VitolaUniferral.py +++ b/tests/test_VitolaUniferral.py @@ -7,7 +7,7 @@ class VitolaUniferral(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/VitolaUniferral.json') self.device = OilBoiler(self.accessor, self.service) diff --git a/tests/test_Vitoladens300-C_J3RA.py b/tests/test_Vitoladens300-C_J3RA.py index fec24a49..8cda3067 100644 --- a/tests/test_Vitoladens300-C_J3RA.py +++ b/tests/test_Vitoladens300-C_J3RA.py @@ -7,7 +7,7 @@ class Vitoladens300C(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitoladens300-C_J3RA.json') self.device = OilBoiler(self.accessor, self.service) diff --git a/tests/test_Vitopure350.py b/tests/test_Vitopure350.py index 799e8c74..4476d78c 100644 --- a/tests/test_Vitopure350.py +++ b/tests/test_Vitopure350.py @@ -8,7 +8,7 @@ class Vitopure350(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitopure350.json') self.device = VentilationDevice(self.accessor, self.service) diff --git a/tests/test_VitovalorPT2.py b/tests/test_VitovalorPT2.py index b043e3ae..e873e0c7 100644 --- a/tests/test_VitovalorPT2.py +++ b/tests/test_VitovalorPT2.py @@ -7,7 +7,7 @@ class VitovalorPT2(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/VitovalorPT2.json') self.device = FuelCell(self.accessor, self.service) diff --git a/tests/test_device_error.py b/tests/test_device_error.py index 86eb96d4..15696a1d 100644 --- a/tests/test_device_error.py +++ b/tests/test_device_error.py @@ -7,7 +7,7 @@ class DeviceErrorTest(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/deviceerrors/F.1100.json') self.device = Device(self.accessor, self.service) diff --git a/tests/test_vitocal-with-vitovent.py b/tests/test_vitocal-with-vitovent.py index 65018b80..0de60808 100644 --- a/tests/test_vitocal-with-vitovent.py +++ b/tests/test_vitocal-with-vitovent.py @@ -7,7 +7,7 @@ class Vitocal_with_Vitovent(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "0") self.service = ViCareServiceMock('response/Vitocal-200S-with-Vitovent-300W.json') self.device = HeatPump(self.accessor, self.service) diff --git a/tests/test_zigbee_zk03838_fht.py b/tests/test_zigbee_zk03838_fht.py index 4a31ea35..cf1abced 100644 --- a/tests/test_zigbee_zk03838_fht.py +++ b/tests/test_zigbee_zk03838_fht.py @@ -7,7 +7,7 @@ class ZK03838MainViaHeatbox2(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "zigbee-################") self.service = ViCareServiceMock('response/zigbee_zk03838_fht_main.json') self.device = FloorHeating(self.accessor, self.service) @@ -37,7 +37,7 @@ def test_getZigbeeSignalStrength(self): class ZK03838ChannelViaHeatbox2(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "zigbee-################-2") self.service = ViCareServiceMock('response/zigbee_zk03838_fht_channel.json') self.device = FloorHeatingChannel(self.accessor, self.service) diff --git a/tests/test_zigbee_zk03839_cs.py b/tests/test_zigbee_zk03839_cs.py index f97521b2..f200deb1 100644 --- a/tests/test_zigbee_zk03839_cs.py +++ b/tests/test_zigbee_zk03839_cs.py @@ -7,7 +7,7 @@ class ZK03839ViaHeatbox2(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "zigbee-################") self.service = ViCareServiceMock('response/zigbee_zk03839_cs.json') self.device = RoomSensor(self.accessor, self.service) diff --git a/tests/test_zigbee_zk03840_trv.py b/tests/test_zigbee_zk03840_trv.py index daf5f966..600c9df6 100644 --- a/tests/test_zigbee_zk03840_trv.py +++ b/tests/test_zigbee_zk03840_trv.py @@ -7,7 +7,7 @@ class ZK03840ViaHeatbox2(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "zigbee-################") self.service = ViCareServiceMock('response/zigbee_zk03840_trv.json') self.device = RadiatorActuator(self.accessor, self.service) diff --git a/tests/test_zigbee_zk05390_repeater.py b/tests/test_zigbee_zk05390_repeater.py index a2388fb3..a6d381c1 100644 --- a/tests/test_zigbee_zk05390_repeater.py +++ b/tests/test_zigbee_zk05390_repeater.py @@ -7,7 +7,7 @@ class ZK05390ViaHeatbox2(unittest.TestCase): def setUp(self): - self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "[device]") + self.accessor = ViCareDeviceAccessor("[id]", "[serial]", "zigbee-################") self.service = ViCareServiceMock('response/zigbee_zk05390_repeater.json') self.device = Repeater(self.accessor, self.service)