From 7c468243097d8466a78cf043866e5d23e6c47ffd Mon Sep 17 00:00:00 2001 From: stephanu Date: Sun, 8 Mar 2026 07:34:50 +0100 Subject: [PATCH 1/4] Changed class attributes to instance attributes. --- PyMyGekko/data_provider.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PyMyGekko/data_provider.py b/PyMyGekko/data_provider.py index a84d205..5955e89 100644 --- a/PyMyGekko/data_provider.py +++ b/PyMyGekko/data_provider.py @@ -1,4 +1,5 @@ """Base implementation of the data provider""" + import json import logging import pkgutil @@ -43,9 +44,10 @@ def get_value(self, entity: Entity, value_name: str) -> str | None: class DataProviderBase(ABC): """Base class for data providers""" - _subscriber: list[DataSubscriberInterface] = [] - _status = None - _resources = None + def __init__(self): + self._subscriber: list[DataSubscriberInterface] = [] + self._status = None + self._resources = None @property def resources(self): @@ -101,6 +103,9 @@ async def try_connect(self) -> None: class DummyDataProvider(DataProviderBase): """Dummy data provider returning static test data""" + def __init__(self): + super().__init__() + async def try_connect(self) -> None: _LOGGER.debug("try_connect in DummyDataProvider") @@ -122,6 +127,7 @@ class DataProvider(DataProviderBase): def __init__( self, url: URL, authentication_params: dict[str, str], session: ClientSession ): + super().__init__() self._url = url self._authentication_params = authentication_params self._session = session From a041d3623ff51d838accfccf24dd8f84ba8e3be4 Mon Sep 17 00:00:00 2001 From: stephanu Date: Sun, 8 Mar 2026 07:44:58 +0100 Subject: [PATCH 2/4] Changed class attributes to instance attributes. --- PyMyGekko/data_provider.py | 3 ++- PyMyGekko/resources/AccessDoors.py | 3 ++- PyMyGekko/resources/Actions.py | 3 ++- PyMyGekko/resources/AlarmsLogics.py | 3 ++- PyMyGekko/resources/Blinds.py | 3 ++- PyMyGekko/resources/Cams.py | 3 ++- PyMyGekko/resources/DoorInterComs.py | 3 ++- PyMyGekko/resources/EnergyCosts.py | 3 ++- PyMyGekko/resources/HotWaterSystems.py | 3 ++- PyMyGekko/resources/Lights.py | 3 ++- PyMyGekko/resources/Loads.py | 3 ++- PyMyGekko/resources/Meteo.py | 3 ++- PyMyGekko/resources/RoomTemps.py | 3 ++- PyMyGekko/resources/Vents.py | 3 ++- 14 files changed, 28 insertions(+), 14 deletions(-) diff --git a/PyMyGekko/data_provider.py b/PyMyGekko/data_provider.py index 5955e89..407044f 100644 --- a/PyMyGekko/data_provider.py +++ b/PyMyGekko/data_provider.py @@ -27,7 +27,8 @@ def update_resources(self, resources): class EntityValueAccessor(DataSubscriberInterface): """Base class for entity values accessors""" - _data = {} + def __init__(self): + self._data = {} def get_value(self, entity: Entity, value_name: str) -> str | None: """Returns a data value of this entity""" diff --git a/PyMyGekko/resources/AccessDoors.py b/PyMyGekko/resources/AccessDoors.py index 4eaa15e..de0b12a 100644 --- a/PyMyGekko/resources/AccessDoors.py +++ b/PyMyGekko/resources/AccessDoors.py @@ -1,4 +1,5 @@ """MyGekko AccessDoors implementation""" + from __future__ import annotations from enum import IntEnum @@ -103,7 +104,7 @@ class AccessDoorValueAccessor(EntityValueAccessor): """AccessDoor value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider self._data_provider.subscribe(self) diff --git a/PyMyGekko/resources/Actions.py b/PyMyGekko/resources/Actions.py index bf4fc88..e9789a3 100644 --- a/PyMyGekko/resources/Actions.py +++ b/PyMyGekko/resources/Actions.py @@ -1,4 +1,5 @@ """MyGekko Actions implementation""" + from __future__ import annotations from enum import IntEnum @@ -57,7 +58,7 @@ class ActionValueAccessor(EntityValueAccessor): """Action value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider data_provider.subscribe(self) diff --git a/PyMyGekko/resources/AlarmsLogics.py b/PyMyGekko/resources/AlarmsLogics.py index d6a4981..174c462 100644 --- a/PyMyGekko/resources/AlarmsLogics.py +++ b/PyMyGekko/resources/AlarmsLogics.py @@ -1,4 +1,5 @@ """MyGekko AlarmsLogics implementation""" + from __future__ import annotations from PyMyGekko.data_provider import DataProviderBase @@ -26,7 +27,7 @@ class AlarmsLogicValueAccessor(EntityValueAccessor): """AlarmsLogic value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider data_provider.subscribe(self) diff --git a/PyMyGekko/resources/Blinds.py b/PyMyGekko/resources/Blinds.py index 8b7bec1..5edd7f8 100644 --- a/PyMyGekko/resources/Blinds.py +++ b/PyMyGekko/resources/Blinds.py @@ -1,4 +1,5 @@ """MyGekko Blinds implementation""" + from __future__ import annotations from enum import IntEnum @@ -93,7 +94,7 @@ class BlindValueAccessor(EntityValueAccessor): """Blind value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider self._data_provider.subscribe(self) diff --git a/PyMyGekko/resources/Cams.py b/PyMyGekko/resources/Cams.py index f587f5e..cd7b919 100644 --- a/PyMyGekko/resources/Cams.py +++ b/PyMyGekko/resources/Cams.py @@ -1,4 +1,5 @@ """MyGekko Cams implementation""" + from __future__ import annotations from enum import IntEnum @@ -52,7 +53,7 @@ class CamValueAccessor(EntityValueAccessor): """Cam value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider self._data_provider.subscribe(self) diff --git a/PyMyGekko/resources/DoorInterComs.py b/PyMyGekko/resources/DoorInterComs.py index ac8e1e7..2881526 100644 --- a/PyMyGekko/resources/DoorInterComs.py +++ b/PyMyGekko/resources/DoorInterComs.py @@ -1,4 +1,5 @@ """MyGekko DoorInterComs implementation""" + from __future__ import annotations from datetime import datetime @@ -114,7 +115,7 @@ class DoorInterComValueAccessor(EntityValueAccessor): """DoorInterCom value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider self._data_provider.subscribe(self) diff --git a/PyMyGekko/resources/EnergyCosts.py b/PyMyGekko/resources/EnergyCosts.py index c0c36b2..9efc096 100644 --- a/PyMyGekko/resources/EnergyCosts.py +++ b/PyMyGekko/resources/EnergyCosts.py @@ -1,4 +1,5 @@ """MyGekko EnergyCosts implementation""" + from __future__ import annotations import logging @@ -31,7 +32,7 @@ class EnergyCostValueAccessor(EntityValueAccessor): """EnergyCost value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider self._data_provider.subscribe(self) diff --git a/PyMyGekko/resources/HotWaterSystems.py b/PyMyGekko/resources/HotWaterSystems.py index 85784b2..fbaabae 100644 --- a/PyMyGekko/resources/HotWaterSystems.py +++ b/PyMyGekko/resources/HotWaterSystems.py @@ -1,4 +1,5 @@ """MyGekko Hotwater_systems implementation""" + from __future__ import annotations from enum import IntEnum @@ -76,7 +77,7 @@ class HotWaterSystemValueAccessor(EntityValueAccessor): """HotWaterSystem value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider data_provider.subscribe(self) diff --git a/PyMyGekko/resources/Lights.py b/PyMyGekko/resources/Lights.py index 574ba91..87bfd7d 100644 --- a/PyMyGekko/resources/Lights.py +++ b/PyMyGekko/resources/Lights.py @@ -1,4 +1,5 @@ """MyGekko Lights implementation""" + from __future__ import annotations from enum import IntEnum @@ -74,7 +75,7 @@ class LightValueAccessor(EntityValueAccessor): """Lights value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider data_provider.subscribe(self) diff --git a/PyMyGekko/resources/Loads.py b/PyMyGekko/resources/Loads.py index d45bdc6..66ba563 100644 --- a/PyMyGekko/resources/Loads.py +++ b/PyMyGekko/resources/Loads.py @@ -1,4 +1,5 @@ """MyGekko Loads implementation""" + from __future__ import annotations from enum import IntEnum @@ -52,7 +53,7 @@ class LoadValueAccessor(EntityValueAccessor): """Loads value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider data_provider.subscribe(self) diff --git a/PyMyGekko/resources/Meteo.py b/PyMyGekko/resources/Meteo.py index be71e1e..130f9fb 100644 --- a/PyMyGekko/resources/Meteo.py +++ b/PyMyGekko/resources/Meteo.py @@ -1,4 +1,5 @@ """MyGekko Meteos implementation""" + from __future__ import annotations import logging @@ -31,7 +32,7 @@ class MeteoValueAccessor(EntityValueAccessor): """Meteo value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider self._data_provider.subscribe(self) diff --git a/PyMyGekko/resources/RoomTemps.py b/PyMyGekko/resources/RoomTemps.py index 84cc11c..599f92f 100644 --- a/PyMyGekko/resources/RoomTemps.py +++ b/PyMyGekko/resources/RoomTemps.py @@ -1,4 +1,5 @@ """MyGekko RoomTemps implementation""" + from __future__ import annotations from enum import IntEnum @@ -84,7 +85,7 @@ class RoomTempsValueAccessor(EntityValueAccessor): """RoomTemps value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider self._data_provider.subscribe(self) diff --git a/PyMyGekko/resources/Vents.py b/PyMyGekko/resources/Vents.py index 4d9a671..c926da5 100644 --- a/PyMyGekko/resources/Vents.py +++ b/PyMyGekko/resources/Vents.py @@ -1,4 +1,5 @@ """MyGekko Vents implementation""" + from __future__ import annotations from enum import IntEnum @@ -284,7 +285,7 @@ class VentValueAccessor(EntityValueAccessor): """Vent value accessor""" def __init__(self, data_provider: DataProviderBase): - self._data = {} + super().__init__() self._data_provider = data_provider self._data_provider.subscribe(self) From ce3092d0f629ed681c70e3f887d98f2f64572a79 Mon Sep 17 00:00:00 2001 From: stephanu Date: Sun, 8 Mar 2026 10:16:36 +0100 Subject: [PATCH 3/4] Formatting --- PyMyGekko/__init__.py | 1 - PyMyGekko/resources/AccessDoors.py | 1 - PyMyGekko/resources/Actions.py | 1 - PyMyGekko/resources/AlarmsLogics.py | 1 - PyMyGekko/resources/Blinds.py | 1 - PyMyGekko/resources/Cams.py | 1 - PyMyGekko/resources/DoorInterComs.py | 1 - PyMyGekko/resources/EnergyCosts.py | 2 -- PyMyGekko/resources/HotWaterSystems.py | 1 - PyMyGekko/resources/Lights.py | 1 - PyMyGekko/resources/Loads.py | 1 - PyMyGekko/resources/Meteo.py | 2 -- PyMyGekko/resources/RoomTemps.py | 1 - PyMyGekko/resources/Vents.py | 1 - 14 files changed, 16 deletions(-) diff --git a/PyMyGekko/__init__.py b/PyMyGekko/__init__.py index dc23f0c..110e97d 100644 --- a/PyMyGekko/__init__.py +++ b/PyMyGekko/__init__.py @@ -36,7 +36,6 @@ from .data_provider import DataProvider from .data_provider import DummyDataProvider - _LOGGER: logging.Logger = logging.getLogger(__name__) diff --git a/PyMyGekko/resources/AccessDoors.py b/PyMyGekko/resources/AccessDoors.py index de0b12a..4eee49c 100644 --- a/PyMyGekko/resources/AccessDoors.py +++ b/PyMyGekko/resources/AccessDoors.py @@ -1,5 +1,4 @@ """MyGekko AccessDoors implementation""" - from __future__ import annotations from enum import IntEnum diff --git a/PyMyGekko/resources/Actions.py b/PyMyGekko/resources/Actions.py index e9789a3..616292a 100644 --- a/PyMyGekko/resources/Actions.py +++ b/PyMyGekko/resources/Actions.py @@ -1,5 +1,4 @@ """MyGekko Actions implementation""" - from __future__ import annotations from enum import IntEnum diff --git a/PyMyGekko/resources/AlarmsLogics.py b/PyMyGekko/resources/AlarmsLogics.py index 174c462..8d21ef7 100644 --- a/PyMyGekko/resources/AlarmsLogics.py +++ b/PyMyGekko/resources/AlarmsLogics.py @@ -1,5 +1,4 @@ """MyGekko AlarmsLogics implementation""" - from __future__ import annotations from PyMyGekko.data_provider import DataProviderBase diff --git a/PyMyGekko/resources/Blinds.py b/PyMyGekko/resources/Blinds.py index 5edd7f8..fe5055d 100644 --- a/PyMyGekko/resources/Blinds.py +++ b/PyMyGekko/resources/Blinds.py @@ -1,5 +1,4 @@ """MyGekko Blinds implementation""" - from __future__ import annotations from enum import IntEnum diff --git a/PyMyGekko/resources/Cams.py b/PyMyGekko/resources/Cams.py index cd7b919..8154cea 100644 --- a/PyMyGekko/resources/Cams.py +++ b/PyMyGekko/resources/Cams.py @@ -1,5 +1,4 @@ """MyGekko Cams implementation""" - from __future__ import annotations from enum import IntEnum diff --git a/PyMyGekko/resources/DoorInterComs.py b/PyMyGekko/resources/DoorInterComs.py index 2881526..68824fb 100644 --- a/PyMyGekko/resources/DoorInterComs.py +++ b/PyMyGekko/resources/DoorInterComs.py @@ -1,5 +1,4 @@ """MyGekko DoorInterComs implementation""" - from __future__ import annotations from datetime import datetime diff --git a/PyMyGekko/resources/EnergyCosts.py b/PyMyGekko/resources/EnergyCosts.py index 9efc096..c81c7d8 100644 --- a/PyMyGekko/resources/EnergyCosts.py +++ b/PyMyGekko/resources/EnergyCosts.py @@ -1,5 +1,4 @@ """MyGekko EnergyCosts implementation""" - from __future__ import annotations import logging @@ -9,7 +8,6 @@ from PyMyGekko.data_provider import EntityValueAccessor from PyMyGekko.resources import Entity - _LOGGER: logging.Logger = logging.getLogger(__name__) diff --git a/PyMyGekko/resources/HotWaterSystems.py b/PyMyGekko/resources/HotWaterSystems.py index fbaabae..3b4c43e 100644 --- a/PyMyGekko/resources/HotWaterSystems.py +++ b/PyMyGekko/resources/HotWaterSystems.py @@ -1,5 +1,4 @@ """MyGekko Hotwater_systems implementation""" - from __future__ import annotations from enum import IntEnum diff --git a/PyMyGekko/resources/Lights.py b/PyMyGekko/resources/Lights.py index 87bfd7d..3ecbe7e 100644 --- a/PyMyGekko/resources/Lights.py +++ b/PyMyGekko/resources/Lights.py @@ -1,5 +1,4 @@ """MyGekko Lights implementation""" - from __future__ import annotations from enum import IntEnum diff --git a/PyMyGekko/resources/Loads.py b/PyMyGekko/resources/Loads.py index 66ba563..eb89925 100644 --- a/PyMyGekko/resources/Loads.py +++ b/PyMyGekko/resources/Loads.py @@ -1,5 +1,4 @@ """MyGekko Loads implementation""" - from __future__ import annotations from enum import IntEnum diff --git a/PyMyGekko/resources/Meteo.py b/PyMyGekko/resources/Meteo.py index 130f9fb..8916244 100644 --- a/PyMyGekko/resources/Meteo.py +++ b/PyMyGekko/resources/Meteo.py @@ -1,5 +1,4 @@ """MyGekko Meteos implementation""" - from __future__ import annotations import logging @@ -9,7 +8,6 @@ from PyMyGekko.data_provider import EntityValueAccessor from PyMyGekko.resources import ReadOnlyEntity - _LOGGER: logging.Logger = logging.getLogger(__name__) diff --git a/PyMyGekko/resources/RoomTemps.py b/PyMyGekko/resources/RoomTemps.py index 599f92f..4cebd83 100644 --- a/PyMyGekko/resources/RoomTemps.py +++ b/PyMyGekko/resources/RoomTemps.py @@ -1,5 +1,4 @@ """MyGekko RoomTemps implementation""" - from __future__ import annotations from enum import IntEnum diff --git a/PyMyGekko/resources/Vents.py b/PyMyGekko/resources/Vents.py index c926da5..928afee 100644 --- a/PyMyGekko/resources/Vents.py +++ b/PyMyGekko/resources/Vents.py @@ -1,5 +1,4 @@ """MyGekko Vents implementation""" - from __future__ import annotations from enum import IntEnum From ef7880a00d06278e6e4857d77bd1c38d48e65601 Mon Sep 17 00:00:00 2001 From: stephanu Date: Sun, 8 Mar 2026 10:19:25 +0100 Subject: [PATCH 4/4] Formatting --- PyMyGekko/data_provider.py | 1 - 1 file changed, 1 deletion(-) diff --git a/PyMyGekko/data_provider.py b/PyMyGekko/data_provider.py index 407044f..108d0d0 100644 --- a/PyMyGekko/data_provider.py +++ b/PyMyGekko/data_provider.py @@ -1,5 +1,4 @@ """Base implementation of the data provider""" - import json import logging import pkgutil