From 1088b737429fc3bd449893ee8487fe8494164c61 Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Thu, 30 Jul 2026 10:10:47 +0200 Subject: [PATCH 1/2] fix colors, lookup dict names and colors for consumers --- packages/helpermodules/constants.py | 1 + packages/helpermodules/measurement_logging/conftest.py | 6 ++++++ .../helpermodules/measurement_logging/write_log.py | 8 ++++++-- .../measurement_logging/write_log_test.py | 1 + packages/modules/common/consumer_setup.py | 10 ++++++++-- packages/modules/consumers/askoma/askoheat/config.py | 5 +++-- packages/modules/consumers/avm/avm/config.py | 5 +++-- packages/modules/consumers/generic/dac/config.py | 5 +++-- packages/modules/consumers/generic/http/config.py | 5 +++-- packages/modules/consumers/generic/json/config.py | 5 +++-- packages/modules/consumers/generic/mqtt/config.py | 5 +++-- packages/modules/consumers/idm/idm/config.py | 5 +++-- packages/modules/consumers/lambda_/lambda_/config.py | 5 +++-- packages/modules/consumers/my_pv/acthor/config.py | 5 +++-- packages/modules/consumers/my_pv/elwa_e/config.py | 5 +++-- packages/modules/consumers/mystrom/mystrom/config.py | 5 +++-- .../modules/consumers/nibe/nibe_s_series/config.py | 5 +++-- .../modules/consumers/ratiotherm/ratiotherm/config.py | 5 +++-- packages/modules/consumers/shelly/shelly_em/config.py | 5 +++-- packages/modules/consumers/shelly/shelly_pm/config.py | 5 +++-- packages/modules/consumers/solvis/solvis/config.py | 5 +++-- packages/modules/consumers/stiebel/stiebel/config.py | 5 +++-- .../consumers/viessmann/viessmann_heat_pump/config.py | 5 +++-- 23 files changed, 76 insertions(+), 40 deletions(-) diff --git a/packages/helpermodules/constants.py b/packages/helpermodules/constants.py index e493371fd5..c364a8a948 100644 --- a/packages/helpermodules/constants.py +++ b/packages/helpermodules/constants.py @@ -9,6 +9,7 @@ class DEFAULT_COLORS(Enum): CHARGEPOINT = "#007bff" + CONSUMER = "#9C65FF" VEHICLE = "#17a2b8" INVERTER = "#28a745" COUNTER = "#dc3545" diff --git a/packages/helpermodules/measurement_logging/conftest.py b/packages/helpermodules/measurement_logging/conftest.py index 950222bfd1..43c64d4f3d 100644 --- a/packages/helpermodules/measurement_logging/conftest.py +++ b/packages/helpermodules/measurement_logging/conftest.py @@ -6,12 +6,18 @@ from control.chargepoint.chargepoint_all import AllChargepoints from control import bat_all, counter, pv_all, pv from control import data +from control.consumer.consumer import Consumer +from control.consumer.consumer_all import AllConsumers +from modules.consumers.generic.mqtt.config import Mqtt @pytest.fixture(autouse=True) def data_module() -> None: data.data_init(Event()) data.data.bat_data.update({"all": bat_all.BatAll(), "bat2": Bat(2)}) + data.data.consumer_all_data = AllConsumers() + data.data.consumer_data.update({"consumer6": Consumer(6)}) + data.data.consumer_data["consumer6"].data.module = Mqtt() data.data.counter_data.update({"counter0": counter.Counter(0)}) data.data.cp_all_data = AllChargepoints() data.data.cp_data.update({"cp4": chargepoint.Chargepoint( diff --git a/packages/helpermodules/measurement_logging/write_log.py b/packages/helpermodules/measurement_logging/write_log.py index beabf58b53..8d631b80db 100644 --- a/packages/helpermodules/measurement_logging/write_log.py +++ b/packages/helpermodules/measurement_logging/write_log.py @@ -380,7 +380,7 @@ def get_names(elements: Dict, sh_names: Dict, valid_names: Optional[Dict] = None """ names = sh_names for group in elements.items(): - if group[0] not in ("bat", "counter", "cp", "pv", "ev", "sh"): + if group[0] not in ("bat", "consumer", "counter", "cp", "pv", "ev", "sh"): continue for entry in group[1]: # valid_names wird aus update_config übergeben, da dort noch kein Zugriff auf data möglich ist @@ -396,6 +396,8 @@ def get_names(elements: Dict, sh_names: Dict, valid_names: Optional[Dict] = None try: if "ev" in entry: names.update({entry: data.data.ev_data[entry].data.name}) + elif "consumer" in entry: + names.update({entry: data.data.consumer_data[entry].data.module.name}) elif "cp" in entry: names.update({entry: data.data.cp_data[entry].data.config.name}) elif "all" != entry: @@ -416,13 +418,15 @@ def get_colors(elements: Dict) -> Dict: """ colors = {} for group in elements.items(): - if group[0] not in ("ev", "cp", "counter", "pv", "bat"): + if group[0] not in ("ev", "cp", "counter", "consumer", "pv", "bat"): continue for entry in group[1]: if "all" != entry: try: if "ev" in entry: colors.update({entry: data.data.ev_data[entry].data.color}) + elif "consumer" in entry: + colors.update({entry: data.data.consumer_data[entry].data.module.color}) elif "cp" in entry: colors.update({entry: data.data.cp_data[entry].data.config.color}) else: diff --git a/packages/helpermodules/measurement_logging/write_log_test.py b/packages/helpermodules/measurement_logging/write_log_test.py index a491716c85..11421bc76b 100644 --- a/packages/helpermodules/measurement_logging/write_log_test.py +++ b/packages/helpermodules/measurement_logging/write_log_test.py @@ -13,6 +13,7 @@ def test_get_names(daily_log_totals, monkeypatch): # evaluation assert names == {'bat2': "Speicher", + "consumer6": "MQTT-Verbraucher", 'counter0': "Zähler", 'cp3': "cp3", 'cp4': "neuer Ladepunkt", diff --git a/packages/modules/common/consumer_setup.py b/packages/modules/common/consumer_setup.py index 153c906e27..e4fcc9da04 100644 --- a/packages/modules/common/consumer_setup.py +++ b/packages/modules/common/consumer_setup.py @@ -1,6 +1,7 @@ -from typing import Generic, List, TypeVar +from typing import Generic, List, Optional, TypeVar from control.consumer.usage import ConsumerUsage +from helpermodules.constants import DEFAULT_COLORS T = TypeVar("T") @@ -13,7 +14,8 @@ def __init__(self, id: int, vendor: str, configuration: T, - usage: List[ConsumerUsage]) -> None: + usage: List[ConsumerUsage], + color: Optional[str] = None) -> None: self.name = name self.info = {"manufacturer": None, "model": None} self.type = type @@ -21,3 +23,7 @@ def __init__(self, self.configuration = configuration self.vendor = vendor self.usage = usage + if color: + self.color = color + else: + self.color = DEFAULT_COLORS.CONSUMER.value diff --git a/packages/modules/consumers/askoma/askoheat/config.py b/packages/modules/consumers/askoma/askoheat/config.py index 5669b2b194..3ea9dfe3bf 100644 --- a/packages/modules/consumers/askoma/askoheat/config.py +++ b/packages/modules/consumers/askoma/askoheat/config.py @@ -25,6 +25,7 @@ def __init__(self, id: int = 0, configuration: AskoheatConfiguration = None, usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY]) -> None: + ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or AskoheatConfiguration(), usage=usage) + ).type, configuration=configuration or AskoheatConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/avm/avm/config.py b/packages/modules/consumers/avm/avm/config.py index c8d5407d83..b26bc8a299 100644 --- a/packages/modules/consumers/avm/avm/config.py +++ b/packages/modules/consumers/avm/avm/config.py @@ -31,6 +31,7 @@ def __init__(self, id: int = 0, configuration: AvmConfiguration = None, usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY]) -> None: + ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or AvmConfiguration(), usage=usage) + ).type, configuration=configuration or AvmConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/generic/dac/config.py b/packages/modules/consumers/generic/dac/config.py index 7ab286282a..52d55fd240 100644 --- a/packages/modules/consumers/generic/dac/config.py +++ b/packages/modules/consumers/generic/dac/config.py @@ -27,6 +27,7 @@ def __init__(self, type: str = "dac", id: int = 0, configuration: DacConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE]) -> None: + usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or DacConfiguration(), usage=usage) + ).type, configuration=configuration or DacConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/generic/http/config.py b/packages/modules/consumers/generic/http/config.py index a35d62a217..7a9bbbf1a2 100644 --- a/packages/modules/consumers/generic/http/config.py +++ b/packages/modules/consumers/generic/http/config.py @@ -43,6 +43,7 @@ def __init__(self, usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY, ConsumerUsage.CONTINUOUS, ConsumerUsage.SUSPENDABLE_ONOFF, - ConsumerUsage.SUSPENDABLE_TUNABLE]) -> None: + ConsumerUsage.SUSPENDABLE_TUNABLE], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or HttpConfiguration(), usage=usage) + ).type, configuration=configuration or HttpConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/generic/json/config.py b/packages/modules/consumers/generic/json/config.py index feb0f1ce18..84adfd6a61 100644 --- a/packages/modules/consumers/generic/json/config.py +++ b/packages/modules/consumers/generic/json/config.py @@ -43,6 +43,7 @@ def __init__(self, usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY, ConsumerUsage.CONTINUOUS, ConsumerUsage.SUSPENDABLE_ONOFF, - ConsumerUsage.SUSPENDABLE_TUNABLE]) -> None: + ConsumerUsage.SUSPENDABLE_TUNABLE], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or JsonConfiguration(), usage=usage) + ).type, configuration=configuration or JsonConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/generic/mqtt/config.py b/packages/modules/consumers/generic/mqtt/config.py index 4986e3d5eb..0b1e77c2b6 100644 --- a/packages/modules/consumers/generic/mqtt/config.py +++ b/packages/modules/consumers/generic/mqtt/config.py @@ -22,6 +22,7 @@ def __init__(self, usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY, ConsumerUsage.CONTINUOUS, ConsumerUsage.SUSPENDABLE_ONOFF, - ConsumerUsage.SUSPENDABLE_TUNABLE]) -> None: + ConsumerUsage.SUSPENDABLE_TUNABLE], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or MqttConfiguration(), usage=usage) + ).type, configuration=configuration or MqttConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/idm/idm/config.py b/packages/modules/consumers/idm/idm/config.py index 2d10083600..83d081577e 100644 --- a/packages/modules/consumers/idm/idm/config.py +++ b/packages/modules/consumers/idm/idm/config.py @@ -27,6 +27,7 @@ def __init__(self, id: int = 0, configuration: IdmConfiguration = None, usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY]) -> None: + ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or IdmConfiguration(), usage=usage) + ).type, configuration=configuration or IdmConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/lambda_/lambda_/config.py b/packages/modules/consumers/lambda_/lambda_/config.py index 476639d569..20bc8556c6 100644 --- a/packages/modules/consumers/lambda_/lambda_/config.py +++ b/packages/modules/consumers/lambda_/lambda_/config.py @@ -27,6 +27,7 @@ def __init__(self, id: int = 0, configuration: LambdaConfiguration = None, usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY]) -> None: + ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or LambdaConfiguration(), usage=usage) + ).type, configuration=configuration or LambdaConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/my_pv/acthor/config.py b/packages/modules/consumers/my_pv/acthor/config.py index 2429eccc4c..6119abcc71 100644 --- a/packages/modules/consumers/my_pv/acthor/config.py +++ b/packages/modules/consumers/my_pv/acthor/config.py @@ -29,6 +29,7 @@ def __init__(self, id: int = 0, configuration: ActhorConfiguration = None, usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY]) -> None: + ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or ActhorConfiguration(), usage=usage) + ).type, configuration=configuration or ActhorConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/my_pv/elwa_e/config.py b/packages/modules/consumers/my_pv/elwa_e/config.py index c5f1e7e1fc..aa48bc6d50 100644 --- a/packages/modules/consumers/my_pv/elwa_e/config.py +++ b/packages/modules/consumers/my_pv/elwa_e/config.py @@ -25,6 +25,7 @@ def __init__(self, id: int = 0, configuration: ElwaConfiguration = None, usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY]) -> None: + ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or ElwaConfiguration(), usage=usage) + ).type, configuration=configuration or ElwaConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/mystrom/mystrom/config.py b/packages/modules/consumers/mystrom/mystrom/config.py index 642b7d8b55..95b8e321c1 100644 --- a/packages/modules/consumers/mystrom/mystrom/config.py +++ b/packages/modules/consumers/mystrom/mystrom/config.py @@ -20,6 +20,7 @@ def __init__(self, id: int = 0, configuration: MyStromConfiguration = None, usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_ONOFF, - ConsumerUsage.METER_ONLY]) -> None: + ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or MyStromConfiguration(), usage=usage) + ).type, configuration=configuration or MyStromConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/nibe/nibe_s_series/config.py b/packages/modules/consumers/nibe/nibe_s_series/config.py index dc1da37b8f..f75eb5bdd2 100644 --- a/packages/modules/consumers/nibe/nibe_s_series/config.py +++ b/packages/modules/consumers/nibe/nibe_s_series/config.py @@ -22,6 +22,7 @@ def __init__(self, type: str = "nibe_s_series", id: int = 0, configuration: NibeConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY]) -> None: + usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or NibeConfiguration(), usage=usage) + ).type, configuration=configuration or NibeConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/ratiotherm/ratiotherm/config.py b/packages/modules/consumers/ratiotherm/ratiotherm/config.py index 6167b5d300..21ba7a843e 100644 --- a/packages/modules/consumers/ratiotherm/ratiotherm/config.py +++ b/packages/modules/consumers/ratiotherm/ratiotherm/config.py @@ -24,6 +24,7 @@ def __init__(self, type: str = "ratiotherm", id: int = 0, configuration: RatiothermConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE]) -> None: + usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or RatiothermConfiguration(), usage=usage) + ).type, configuration=configuration or RatiothermConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/shelly/shelly_em/config.py b/packages/modules/consumers/shelly/shelly_em/config.py index e01b5f6b0c..60f60a3e9b 100644 --- a/packages/modules/consumers/shelly/shelly_em/config.py +++ b/packages/modules/consumers/shelly/shelly_em/config.py @@ -28,6 +28,7 @@ def __init__(self, type: str = "shelly_em", id: int = 0, configuration: ShellyConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY]) -> None: + usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or ShellyConfiguration(), usage=usage) + ).type, configuration=configuration or ShellyConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/shelly/shelly_pm/config.py b/packages/modules/consumers/shelly/shelly_pm/config.py index 4f28d0c1f7..31df5c9b18 100644 --- a/packages/modules/consumers/shelly/shelly_pm/config.py +++ b/packages/modules/consumers/shelly/shelly_pm/config.py @@ -31,6 +31,7 @@ def __init__(self, id: int = 0, configuration: ShellyConfiguration = None, usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY, - ConsumerUsage.SUSPENDABLE_ONOFF]) -> None: + ConsumerUsage.SUSPENDABLE_ONOFF], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or ShellyConfiguration(), usage=usage) + ).type, configuration=configuration or ShellyConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/solvis/solvis/config.py b/packages/modules/consumers/solvis/solvis/config.py index e51fd7156e..84e2c0022d 100644 --- a/packages/modules/consumers/solvis/solvis/config.py +++ b/packages/modules/consumers/solvis/solvis/config.py @@ -21,6 +21,7 @@ def __init__(self, type: str = "solvis", id: int = 0, configuration: SolvisConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY]) -> None: + usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or SolvisConfiguration(), usage=usage) + ).type, configuration=configuration or SolvisConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/stiebel/stiebel/config.py b/packages/modules/consumers/stiebel/stiebel/config.py index 17e629b03b..b55c2d3137 100644 --- a/packages/modules/consumers/stiebel/stiebel/config.py +++ b/packages/modules/consumers/stiebel/stiebel/config.py @@ -24,6 +24,7 @@ def __init__(self, type: str = "stiebel", id: int = 0, configuration: StiebelConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_ONOFF]) -> None: + usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_ONOFF], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or StiebelConfiguration(), usage=usage) + ).type, configuration=configuration or StiebelConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/viessmann/viessmann_heat_pump/config.py b/packages/modules/consumers/viessmann/viessmann_heat_pump/config.py index ddc8be0fd0..392e395c91 100644 --- a/packages/modules/consumers/viessmann/viessmann_heat_pump/config.py +++ b/packages/modules/consumers/viessmann/viessmann_heat_pump/config.py @@ -21,6 +21,7 @@ def __init__(self, type: str = "viessmann_heat_pump", id: int = 0, configuration: ViessmannConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_ONOFF]) -> None: + usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_ONOFF], + **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( - ).type, configuration=configuration or ViessmannConfiguration(), usage=usage) + ).type, configuration=configuration or ViessmannConfiguration(), usage=usage, **kwargs) From e54f966d3696f7ada56a00d0ccdac9a32ce1eba9 Mon Sep 17 00:00:00 2001 From: LKuemmel Date: Thu, 30 Jul 2026 10:33:19 +0200 Subject: [PATCH 2/2] review --- packages/modules/common/consumer_setup.py | 4 ++-- packages/modules/consumers/askoma/askoheat/config.py | 6 +++--- packages/modules/consumers/avm/avm/config.py | 6 +++--- packages/modules/consumers/generic/dac/config.py | 4 ++-- packages/modules/consumers/generic/http/config.py | 10 +++++----- packages/modules/consumers/generic/json/config.py | 10 +++++----- packages/modules/consumers/generic/mqtt/config.py | 10 +++++----- packages/modules/consumers/idm/idm/config.py | 6 +++--- packages/modules/consumers/lambda_/lambda_/config.py | 6 +++--- packages/modules/consumers/my_pv/acthor/config.py | 6 +++--- packages/modules/consumers/my_pv/elwa_e/config.py | 6 +++--- packages/modules/consumers/mystrom/mystrom/config.py | 6 +++--- .../modules/consumers/nibe/nibe_s_series/config.py | 4 ++-- .../modules/consumers/ratiotherm/ratiotherm/config.py | 4 ++-- packages/modules/consumers/shelly/shelly_em/config.py | 4 ++-- packages/modules/consumers/shelly/shelly_pm/config.py | 6 +++--- packages/modules/consumers/solvis/solvis/config.py | 4 ++-- packages/modules/consumers/stiebel/stiebel/config.py | 4 ++-- .../consumers/viessmann/viessmann_heat_pump/config.py | 4 ++-- 19 files changed, 55 insertions(+), 55 deletions(-) diff --git a/packages/modules/common/consumer_setup.py b/packages/modules/common/consumer_setup.py index e4fcc9da04..c5563b69fb 100644 --- a/packages/modules/common/consumer_setup.py +++ b/packages/modules/common/consumer_setup.py @@ -1,4 +1,4 @@ -from typing import Generic, List, Optional, TypeVar +from typing import Generic, Optional, TypeVar, Tuple from control.consumer.usage import ConsumerUsage from helpermodules.constants import DEFAULT_COLORS @@ -14,7 +14,7 @@ def __init__(self, id: int, vendor: str, configuration: T, - usage: List[ConsumerUsage], + usage: Tuple[ConsumerUsage, ...], color: Optional[str] = None) -> None: self.name = name self.info = {"manufacturer": None, "model": None} diff --git a/packages/modules/consumers/askoma/askoheat/config.py b/packages/modules/consumers/askoma/askoheat/config.py index 3ea9dfe3bf..1c52a288e8 100644 --- a/packages/modules/consumers/askoma/askoheat/config.py +++ b/packages/modules/consumers/askoma/askoheat/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -24,8 +24,8 @@ def __init__(self, type: str = "askoheat", id: int = 0, configuration: AskoheatConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_TUNABLE, + ConsumerUsage.METER_ONLY), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or AskoheatConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/avm/avm/config.py b/packages/modules/consumers/avm/avm/config.py index b26bc8a299..40c6998564 100644 --- a/packages/modules/consumers/avm/avm/config.py +++ b/packages/modules/consumers/avm/avm/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -30,8 +30,8 @@ def __init__(self, type: str = "avm", id: int = 0, configuration: AvmConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_TUNABLE, + ConsumerUsage.METER_ONLY), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or AvmConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/generic/dac/config.py b/packages/modules/consumers/generic/dac/config.py index 52d55fd240..ac9e34cd40 100644 --- a/packages/modules/consumers/generic/dac/config.py +++ b/packages/modules/consumers/generic/dac/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -27,7 +27,7 @@ def __init__(self, type: str = "dac", id: int = 0, configuration: DacConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_TUNABLE,), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or DacConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/generic/http/config.py b/packages/modules/consumers/generic/http/config.py index 7a9bbbf1a2..6fe3eef212 100644 --- a/packages/modules/consumers/generic/http/config.py +++ b/packages/modules/consumers/generic/http/config.py @@ -1,4 +1,4 @@ -from typing import List +from typing import Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -40,10 +40,10 @@ def __init__(self, type: str = "http", id: int = 0, configuration: HttpConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY, - ConsumerUsage.CONTINUOUS, - ConsumerUsage.SUSPENDABLE_ONOFF, - ConsumerUsage.SUSPENDABLE_TUNABLE], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.METER_ONLY, + ConsumerUsage.CONTINUOUS, + ConsumerUsage.SUSPENDABLE_ONOFF, + ConsumerUsage.SUSPENDABLE_TUNABLE), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or HttpConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/generic/json/config.py b/packages/modules/consumers/generic/json/config.py index 84adfd6a61..fda50af220 100644 --- a/packages/modules/consumers/generic/json/config.py +++ b/packages/modules/consumers/generic/json/config.py @@ -1,4 +1,4 @@ -from typing import List +from typing import Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -40,10 +40,10 @@ def __init__(self, type: str = "json", id: int = 0, configuration: JsonConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY, - ConsumerUsage.CONTINUOUS, - ConsumerUsage.SUSPENDABLE_ONOFF, - ConsumerUsage.SUSPENDABLE_TUNABLE], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.METER_ONLY, + ConsumerUsage.CONTINUOUS, + ConsumerUsage.SUSPENDABLE_ONOFF, + ConsumerUsage.SUSPENDABLE_TUNABLE), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or JsonConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/generic/mqtt/config.py b/packages/modules/consumers/generic/mqtt/config.py index 0b1e77c2b6..b2ab560af1 100644 --- a/packages/modules/consumers/generic/mqtt/config.py +++ b/packages/modules/consumers/generic/mqtt/config.py @@ -1,4 +1,4 @@ -from typing import List +from typing import Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -19,10 +19,10 @@ def __init__(self, type: str = "mqtt", id: int = 0, configuration: MqttConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY, - ConsumerUsage.CONTINUOUS, - ConsumerUsage.SUSPENDABLE_ONOFF, - ConsumerUsage.SUSPENDABLE_TUNABLE], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.METER_ONLY, + ConsumerUsage.CONTINUOUS, + ConsumerUsage.SUSPENDABLE_ONOFF, + ConsumerUsage.SUSPENDABLE_TUNABLE), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or MqttConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/idm/idm/config.py b/packages/modules/consumers/idm/idm/config.py index 83d081577e..baf3c7bcc0 100644 --- a/packages/modules/consumers/idm/idm/config.py +++ b/packages/modules/consumers/idm/idm/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -26,8 +26,8 @@ def __init__(self, type: str = "idm", id: int = 0, configuration: IdmConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_TUNABLE, + ConsumerUsage.METER_ONLY), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or IdmConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/lambda_/lambda_/config.py b/packages/modules/consumers/lambda_/lambda_/config.py index 20bc8556c6..f72ec12455 100644 --- a/packages/modules/consumers/lambda_/lambda_/config.py +++ b/packages/modules/consumers/lambda_/lambda_/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -26,8 +26,8 @@ def __init__(self, type: str = "lambda", id: int = 0, configuration: LambdaConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_TUNABLE, + ConsumerUsage.METER_ONLY), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or LambdaConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/my_pv/acthor/config.py b/packages/modules/consumers/my_pv/acthor/config.py index 6119abcc71..2e8f785058 100644 --- a/packages/modules/consumers/my_pv/acthor/config.py +++ b/packages/modules/consumers/my_pv/acthor/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -28,8 +28,8 @@ def __init__(self, type: str = "acthor", id: int = 0, configuration: ActhorConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_TUNABLE, + ConsumerUsage.METER_ONLY), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or ActhorConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/my_pv/elwa_e/config.py b/packages/modules/consumers/my_pv/elwa_e/config.py index aa48bc6d50..c41b65881f 100644 --- a/packages/modules/consumers/my_pv/elwa_e/config.py +++ b/packages/modules/consumers/my_pv/elwa_e/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -24,8 +24,8 @@ def __init__(self, type: str = "elwa_e", id: int = 0, configuration: ElwaConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE, - ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_TUNABLE, + ConsumerUsage.METER_ONLY), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or ElwaConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/mystrom/mystrom/config.py b/packages/modules/consumers/mystrom/mystrom/config.py index 95b8e321c1..3532dff044 100644 --- a/packages/modules/consumers/mystrom/mystrom/config.py +++ b/packages/modules/consumers/mystrom/mystrom/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -19,8 +19,8 @@ def __init__(self, type: str = "mystrom", id: int = 0, configuration: MyStromConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_ONOFF, - ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_ONOFF, + ConsumerUsage.METER_ONLY), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or MyStromConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/nibe/nibe_s_series/config.py b/packages/modules/consumers/nibe/nibe_s_series/config.py index f75eb5bdd2..5168d0de78 100644 --- a/packages/modules/consumers/nibe/nibe_s_series/config.py +++ b/packages/modules/consumers/nibe/nibe_s_series/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -22,7 +22,7 @@ def __init__(self, type: str = "nibe_s_series", id: int = 0, configuration: NibeConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.METER_ONLY,), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or NibeConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/ratiotherm/ratiotherm/config.py b/packages/modules/consumers/ratiotherm/ratiotherm/config.py index 21ba7a843e..4c325d0500 100644 --- a/packages/modules/consumers/ratiotherm/ratiotherm/config.py +++ b/packages/modules/consumers/ratiotherm/ratiotherm/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -24,7 +24,7 @@ def __init__(self, type: str = "ratiotherm", id: int = 0, configuration: RatiothermConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_TUNABLE], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_TUNABLE,), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or RatiothermConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/shelly/shelly_em/config.py b/packages/modules/consumers/shelly/shelly_em/config.py index 60f60a3e9b..2d3169acfa 100644 --- a/packages/modules/consumers/shelly/shelly_em/config.py +++ b/packages/modules/consumers/shelly/shelly_em/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -28,7 +28,7 @@ def __init__(self, type: str = "shelly_em", id: int = 0, configuration: ShellyConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.METER_ONLY,), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or ShellyConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/shelly/shelly_pm/config.py b/packages/modules/consumers/shelly/shelly_pm/config.py index 31df5c9b18..d0676e9a84 100644 --- a/packages/modules/consumers/shelly/shelly_pm/config.py +++ b/packages/modules/consumers/shelly/shelly_pm/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -30,8 +30,8 @@ def __init__(self, type: str = "shelly_pm", id: int = 0, configuration: ShellyConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY, - ConsumerUsage.SUSPENDABLE_ONOFF], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.METER_ONLY, + ConsumerUsage.SUSPENDABLE_ONOFF), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or ShellyConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/solvis/solvis/config.py b/packages/modules/consumers/solvis/solvis/config.py index 84e2c0022d..564832c8da 100644 --- a/packages/modules/consumers/solvis/solvis/config.py +++ b/packages/modules/consumers/solvis/solvis/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -21,7 +21,7 @@ def __init__(self, type: str = "solvis", id: int = 0, configuration: SolvisConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.METER_ONLY], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.METER_ONLY,), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or SolvisConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/stiebel/stiebel/config.py b/packages/modules/consumers/stiebel/stiebel/config.py index b55c2d3137..aa940eef11 100644 --- a/packages/modules/consumers/stiebel/stiebel/config.py +++ b/packages/modules/consumers/stiebel/stiebel/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -24,7 +24,7 @@ def __init__(self, type: str = "stiebel", id: int = 0, configuration: StiebelConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_ONOFF], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_ONOFF,), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or StiebelConfiguration(), usage=usage, **kwargs) diff --git a/packages/modules/consumers/viessmann/viessmann_heat_pump/config.py b/packages/modules/consumers/viessmann/viessmann_heat_pump/config.py index 392e395c91..6274b60698 100644 --- a/packages/modules/consumers/viessmann/viessmann_heat_pump/config.py +++ b/packages/modules/consumers/viessmann/viessmann_heat_pump/config.py @@ -1,4 +1,4 @@ -from typing import List, Optional +from typing import Optional, Tuple from control.consumer.consumer_data import ConsumerUsage from helpermodules.auto_str import auto_str @@ -21,7 +21,7 @@ def __init__(self, type: str = "viessmann_heat_pump", id: int = 0, configuration: ViessmannConfiguration = None, - usage: List[ConsumerUsage] = [ConsumerUsage.SUSPENDABLE_ONOFF], + usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.SUSPENDABLE_ONOFF,), **kwargs) -> None: super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory( ).type, configuration=configuration or ViessmannConfiguration(), usage=usage, **kwargs)