Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/modules/common/configurable_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self,
consumer_config: T_CONSUMER,
initializer: Optional[Callable] = lambda: None,
error_handler: Optional[Callable] = lambda: None,
update: Optional[Callable[[], ConsumerState]] = lambda: None,
update: Optional[Callable[[], ConsumerState]] = None,
send_values: Optional[Callable[[CurrentValues], None]] = lambda _values: None,
set_power_limit: Optional[Callable] = lambda: None,
switch_on: Optional[Callable] = lambda: None,
Expand Down
Empty file.
24 changes: 24 additions & 0 deletions packages/modules/consumers/generic/extra_meter_only/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from typing import Optional, Tuple
from control.consumer.consumer_data import ConsumerUsage
from helpermodules.auto_str import auto_str
from modules.common.consumer_setup import ConsumerSetup
from ..vendor import vendor_descriptor


@auto_str
class ExtraMeterOnlyConfiguration:
def __init__(self) -> None:
pass


@auto_str
class ExtraMeterOnly(ConsumerSetup[ExtraMeterOnlyConfiguration]):
def __init__(self,
name: str = "Rein passive Messung",
type: str = "extra_meter_only",
id: int = 0,
configuration: Optional[ExtraMeterOnlyConfiguration] = None,
usage: Tuple[ConsumerUsage, ...] = (ConsumerUsage.METER_ONLY,),
**kwargs) -> None:
super().__init__(name, type, id, vendor=vendor_descriptor.configuration_factory(
).type, configuration=configuration or ExtraMeterOnlyConfiguration(), usage=usage, **kwargs)
11 changes: 11 additions & 0 deletions packages/modules/consumers/generic/extra_meter_only/consumer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python3
from modules.common.abstract_device import DeviceDescriptor
from modules.common.configurable_consumer import ConfigurableConsumer
from modules.consumers.generic.extra_meter_only.config import ExtraMeterOnly


def create_consumer(config: ExtraMeterOnly):
return ConfigurableConsumer(consumer_config=config)


device_descriptor = DeviceDescriptor(configuration_factory=ExtraMeterOnly)
9 changes: 3 additions & 6 deletions packages/modules/loadvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import List

from control import data
from control.consumer.usage import ConsumerUsage
from modules.common.abstract_io import AbstractIoDevice
from modules.common.store._tariff import get_price_value_store
from modules.utils import wait_for_module_update_completed
Expand Down Expand Up @@ -65,11 +64,9 @@ def _set_values(self) -> List[str]:
log.exception(f"Fehler im loadvars-Modul bei Element {cp.num}")
for consumer in data.data.consumer_data.values():
try:
if ConsumerUsage.METER_ONLY.value in consumer.module.config.usage:
# Nur Verbraucher mit eingebautem Zähler haben eine update-Funktion.
modules_threads.append(Thread(target=consumer.module.update,
args=(),
name=f"set values consumer{consumer.data.module.id}"))
modules_threads.append(Thread(target=consumer.module.update,
args=(),
name=f"set values consumer{consumer.data.module.id}"))
Comment on lines +67 to +69
except Exception:
log.exception(f"Fehler im loadvars-Modul bei Element {consumer.num}")
return joined_thread_handler(modules_threads, data.data.general_data.data.control_interval/3)
Expand Down