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
12 changes: 6 additions & 6 deletions .github/workflows/github-actions-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7
- name: Set up Python 3.9
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.9.12"
- name: Install dependencies
run: |
pip3 install -r "/home/runner/work/core/core/requirements.txt"
- name: Flake8 with annotations in packages folder
uses: TrueBrain/actions-flake8@v2.1
uses: TrueBrain/actions-flake8@v2.4
with:
path: packages
flake8_version: 5.0.4
flake8_version: "7.3.0"
- name: Flake8 with annotations in runs folder
uses: TrueBrain/actions-flake8@v2.1
uses: TrueBrain/actions-flake8@v2.4
with:
path: runs
flake8_version: 5.0.4
flake8_version: "7.3.0"
- name: Test with pytest
run: |
PYTHONPATH=packages python -m pytest packages --log-cli-level=DEBUG
Expand Down
6 changes: 2 additions & 4 deletions docs/samples/sample_modbus/sample_modbus/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from modules.common.configurable_device import ConfigurableDevice, ComponentFactoryByType, MultiComponentUpdater
from modules.common.modbus import ModbusTcpClient_
from modules.devices.sample_modbus.sample_modbus.bat import SampleBat
from modules.devices.sample_modbus.sample_modbus.config import Sample, SampleBatSetup, SampleCounterSetup, SampleInverterSetup
from modules.devices.sample_modbus.sample_modbus.config import (Sample, SampleBatSetup, SampleCounterSetup,
SampleInverterSetup)
from modules.devices.sample_modbus.sample_modbus.counter import SampleCounter
from modules.devices.sample_modbus.sample_modbus.inverter import SampleInverter

Expand All @@ -18,15 +19,12 @@ def create_device(device_config: Sample):
client = None

def create_bat_component(component_config: SampleBatSetup):
nonlocal client
return SampleBat(component_config, device_id=device_config.id, client=client)

def create_counter_component(component_config: SampleCounterSetup):
nonlocal client
return SampleCounter(component_config, device_id=device_config.id, client=client)

def create_inverter_component(component_config: SampleInverterSetup):
nonlocal client
return SampleInverter(component_config, device_id=device_config.id, client=client)

def update_components(components: Iterable[Union[SampleBat, SampleCounter, SampleInverter]]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from modules.common.fault_state import ComponentInfo, FaultState
from modules.common.simcount import SimCounter
from modules.common.store import get_bat_value_store
from modules.devices.sample_request_by_component.sample_request_by_component.config import SampleBatSetup, SampleConfiguration
from modules.devices.sample_request_by_component.sample_request_by_component.config import SampleBatSetup
from modules.common.utils.peak_filter import PeakFilter
from modules.common.component_type import ComponentType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from modules.common.abstract_device import DeviceDescriptor
from modules.common.configurable_device import ConfigurableDevice, ComponentFactoryByType, IndependentComponentUpdater
from modules.devices.sample_request_by_component.sample_request_by_component.bat import SampleBat
from modules.devices.sample_request_by_component.sample_request_by_component.config import Sample, SampleBatSetup, SampleCounterSetup, SampleInverterSetup
from modules.devices.sample_request_by_component.sample_request_by_component.config import (Sample, SampleBatSetup,
SampleCounterSetup,
SampleInverterSetup)
from modules.devices.sample_request_by_component.sample_request_by_component.counter import SampleCounter
from modules.devices.sample_request_by_component.sample_request_by_component.inverter import SampleInverter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from modules.common.component_context import SingleComponentUpdateContext
from modules.common.configurable_device import ConfigurableDevice, ComponentFactoryByType, MultiComponentUpdater
from modules.devices.sample_request_by_device.sample_request_by_device.bat import SampleBat
from modules.devices.sample_request_by_device.sample_request_by_device.config import Sample, SampleBatSetup, SampleCounterSetup, SampleInverterSetup
from modules.devices.sample_request_by_device.sample_request_by_device.config import (Sample, SampleBatSetup,
SampleCounterSetup,
SampleInverterSetup)
from modules.devices.sample_request_by_device.sample_request_by_device.counter import SampleCounter
from modules.devices.sample_request_by_device.sample_request_by_device.inverter import SampleInverter

Expand Down
2 changes: 1 addition & 1 deletion packages/control/chargepoint/chargepoint_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Set:
@dataclass
class Config:
configuration: Dict = field(default_factory=empty_dict_factory)
ev: int = 0
_ev: int = 0
name: str = "neuer Ladepunkt"
color: str = DEFAULT_COLORS.CHARGEPOINT.value
type: Optional[str] = None
Expand Down
1 change: 0 additions & 1 deletion packages/control/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ def __init__(self, event_module_update_completed):
self.event_module_update_completed = event_module_update_completed

def __enter__(self):
global data
try:
timeout = data.general_data.data.control_interval/2
except KeyError:
Expand Down
3 changes: 0 additions & 3 deletions packages/helpermodules/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def clear(self):


def clear_in_memory_log_handler(logger_name: str = None) -> None:
global in_memory_log_handlers
if logger_name is None:
# Clear all in-memory log handlers
for handler in in_memory_log_handlers.values():
Expand All @@ -168,8 +167,6 @@ def clear_in_memory_log_handler(logger_name: str = None) -> None:


def write_logs_to_file(logger_name: str = None) -> None:
global in_memory_log_handlers

def rotate_logs(base_path: str, name: str):
# Rotate the log files
for i in range(NUMBER_OF_LOGFILES-1, 0, -1):
Expand Down
3 changes: 0 additions & 3 deletions packages/modules/devices/algodue/algodue/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ def create_device(device_config: Algodue):
client = None

def create_counter_component(component_config: AlgodueCounterSetup):
nonlocal client
return counter.AlgodueCounter(component_config=component_config, device_id=device_config.id,
tcp_client=client, modbus_id=device_config.configuration.modbus_id)

def create_inverter_component(component_config: AlgodueInverterSetup):
nonlocal client
return inverter.AlgodueInverter(component_config=component_config, device_id=device_config.id,
tcp_client=client, modbus_id=device_config.configuration.modbus_id)

def create_bat_component(component_config: AlgodueBatSetup):
nonlocal client
return bat.AlgodueBat(component_config=component_config, device_id=device_config.id,
tcp_client=client, modbus_id=device_config.configuration.modbus_id)

Expand Down
4 changes: 0 additions & 4 deletions packages/modules/devices/alpha_ess/alpha_ess/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,25 @@ def create_device(device_config: AlphaEss):
client = None

def create_bat_component(component_config: AlphaEssBatSetup):
nonlocal client
return bat.AlphaEssBat(component_config,
device_id=device_config.id,
tcp_client=client,
modbus_id=device_config.configuration.modbus_id)

def create_counter_component(component_config: AlphaEssCounterSetup):
nonlocal client
return counter.AlphaEssCounter(component_config,
tcp_client=client,
device_config=device_config.configuration,
modbus_id=device_config.configuration.modbus_id)

def create_inverter_component(component_config: AlphaEssInverterSetup):
nonlocal client
return inverter.AlphaEssInverter(component_config=component_config,
device_id=device_config.id,
tcp_client=client,
device_config=device_config.configuration,
modbus_id=device_config.configuration.modbus_id)

def update_components(components: Iterable[Union[alpha_ess_component_classes]]):
nonlocal client
with client:
for component in components:
with SingleComponentUpdateContext(component.fault_state):
Expand Down
3 changes: 0 additions & 3 deletions packages/modules/devices/ampere/ampere/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@ def create_device(device_config: Ampere):
client = None

def create_bat_component(component_config: AmpereBatSetup):
nonlocal client
return AmpereBat(component_config=component_config,
device_id=device_config.id,
modbus_id=device_config.configuration.modbus_id,
client=client)

def create_counter_component(component_config: AmpereCounterSetup):
nonlocal client
return AmpereCounter(component_config=component_config,
device_id=device_config.id,
modbus_id=device_config.configuration.modbus_id,
client=client)

def create_inverter_component(component_config: AmpereInverterSetup):
nonlocal client
return AmpereInverter(component_config=component_config,
device_id=device_config.id,
modbus_id=device_config.configuration.modbus_id,
Expand Down
4 changes: 0 additions & 4 deletions packages/modules/devices/anker/anker_solix/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@ def create_device(device_config: Anker):
client = None

def create_bat_component(component_config: AnkerBatSetup):
nonlocal client
return AnkerBat(component_config, device_id=device_config.id, client=client)

def create_counter_component(component_config: AnkerCounterSetup):
nonlocal client
return AnkerCounter(component_config, device_id=device_config.id, client=client)

def create_inverter_component(component_config: AnkerInverterSetup):
nonlocal client
return AnkerInverter(component_config, device_id=device_config.id, client=client)

def update_components(components: Iterable[Union[AnkerBat, AnkerCounter, AnkerInverter]]):
nonlocal client
with client:
for component in components:
with SingleComponentUpdateContext(component.fault_state):
Expand Down
4 changes: 0 additions & 4 deletions packages/modules/devices/azzurro_zcs/azzurro_zcs/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,19 @@ def create_device(device_config: ZCS):
client = None

def create_bat_component(component_config: ZCSBatSetup):
nonlocal client
return ZCSBat(component_config=component_config, modbus_id=device_config.configuration.modbus_id, client=client)

def create_counter_component(component_config: ZCSCounterSetup):
nonlocal client
return ZCSCounter(component_config=component_config,
modbus_id=device_config.configuration.modbus_id,
client=client)

def create_inverter_component(component_config: ZCSInverterSetup):
nonlocal client
return ZCSInverter(component_config=component_config,
modbus_id=device_config.configuration.modbus_id,
client=client)

def update_components(components: Iterable[Union[ZCSBat, ZCSCounter, ZCSInverter]]):
nonlocal client
with client:
for component in components:
with SingleComponentUpdateContext(component.fault_state):
Expand Down
2 changes: 0 additions & 2 deletions packages/modules/devices/azzurro_zcs/azzurro_zcs_3p/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ def create_device(device_config: ZCS3P):
client = None

def create_pv_inverter_component(component_config: ZCSPvInverterSetup):
nonlocal client
return ZCSPvInverter(component_config=component_config,
modbus_id=device_config.configuration.modbus_id,
client=client)

def update_components(components: Iterable[ZCSPvInverter]):
nonlocal client
with client:
for component in components:
with SingleComponentUpdateContext(component.fault_state):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ def create_device(device_config: CarloGavazzi):
client = None

def create_counter_component(component_config: CarloGavazziCounterSetup):
nonlocal client
return counter.CarloGavazziCounter(component_config=component_config, device_id=device_config.id,
tcp_client=client, modbus_id=device_config.configuration.modbus_id)

def update_components(components: Iterable[counter.CarloGavazziCounter]):
nonlocal client
with client:
for component in components:
with SingleComponentUpdateContext(component.fault_state):
Expand Down
1 change: 0 additions & 1 deletion packages/modules/devices/chint/chint/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def create_device(device_config: CHINT):
client = None

def create_counter_component(component_config: CHINTCounterSetup):
nonlocal client
return CHINTCounter(component_config=component_config, client=client)

def update_components(components: Iterable[Union[CHINTCounter]]):
Expand Down
4 changes: 0 additions & 4 deletions packages/modules/devices/deye/deye/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,15 @@ def create_device(device_config: Deye):
client = None

def create_bat_component(component_config: DeyeBatSetup):
nonlocal client
return DeyeBat(component_config=component_config, device_id=device_config.id, client=client)

def create_counter_component(component_config: DeyeCounterSetup):
nonlocal client
return DeyeCounter(component_config=component_config, device_id=device_config.id, client=client)

def create_inverter_component(component_config: DeyeInverterSetup):
nonlocal client
return DeyeInverter(component_config=component_config, device_id=device_config.id, client=client)

def update_components(components: Iterable[Union[DeyeBat, DeyeCounter, DeyeInverter]]):
nonlocal client
with client:
for component in components:
with SingleComponentUpdateContext(component.fault_state):
Expand Down
4 changes: 0 additions & 4 deletions packages/modules/devices/deye/deye_solarman/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,15 @@ def create_device(device_config: DeyeSolarman):
client = None

def create_bat_component(component_config: DeyeSolarmanBatSetup):
nonlocal client
return DeyeSolarmanBat(component_config=component_config, device_id=device_config.id, client=client)

def create_counter_component(component_config: DeyeSolarmanCounterSetup):
nonlocal client
return DeyeSolarmanCounter(component_config=component_config, device_id=device_config.id, client=client)

def create_inverter_component(component_config: DeyeSolarmanInverterSetup):
nonlocal client
return DeyeSolarmanInverter(component_config=component_config, device_id=device_config.id, client=client)

def update_components(components: Iterable[Union[DeyeSolarmanBat, DeyeSolarmanCounter, DeyeSolarmanInverter]]):
nonlocal client
for component in components:
with SingleComponentUpdateContext(component.fault_state):
component.update()
Expand Down
5 changes: 0 additions & 5 deletions packages/modules/devices/e3dc/e3dc/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,31 @@ def create_device(device_config: E3dc) -> ConfigurableDevice:
client = None

def create_bat_component(component_config: E3dcBatSetup) -> E3dcBat:
nonlocal client
return E3dcBat(component_config=component_config,
device_id=device_config.id,
modbus_id=device_config.configuration.modbus_id,
client=client)

def create_counter_component(component_config: E3dcCounterSetup) -> E3dcCounter:
nonlocal client
return E3dcCounter(component_config=component_config,
device_id=device_config.id,
modbus_id=device_config.configuration.modbus_id,
client=client)

def create_inverter_component(component_config: E3dcInverterSetup) -> E3dcInverter:
nonlocal client
return E3dcInverter(component_config=component_config,
device_id=device_config.id,
modbus_id=device_config.configuration.modbus_id,
client=client)

def create_external_inverter_component(component_config: E3dcExternalInverterSetup) -> E3dcExternalInverter:
nonlocal client
return E3dcExternalInverter(component_config=component_config,
device_id=device_config.id,
modbus_id=device_config.configuration.modbus_id,
client=client)

def update_components(components: Iterable[Union[E3dcBat, E3dcCounter, E3dcInverter,
E3dcExternalInverter]]) -> None:
nonlocal client
with client:
for component in components:
with SingleComponentUpdateContext(component.fault_state):
Expand Down
3 changes: 0 additions & 3 deletions packages/modules/devices/elgris/elgris/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ def create_device(device_config: Elgris):
client = None

def create_bat_component(component_config: ElgrisBatSetup):
nonlocal client
return bat.ElgrisBat(component_config=component_config, tcp_client=client,
modbus_id=device_config.configuration.modbus_id)

def create_counter_component(component_config: ElgrisCounterSetup):
nonlocal client
return counter.ElgrisCounter(component_config=component_config, tcp_client=client,
modbus_id=device_config.configuration.modbus_id)

def create_inverter_component(component_config: ElgrisInverterSetup):
nonlocal client
return inverter.ElgrisInverter(component_config=component_config, tcp_client=client,
modbus_id=device_config.configuration.modbus_id)

Expand Down
3 changes: 0 additions & 3 deletions packages/modules/devices/fems/fems/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ def create_device(device_config: Fems):
session = None

def create_bat_component(component_config: FemsBatSetup):
nonlocal session
return bat.FemsBat(component_config, ip_address=device_config.configuration.ip_address, session=session)

def create_counter_component(component_config: FemsCounterSetup):
nonlocal session
return counter.FemsCounter(component_config, ip_address=device_config.configuration.ip_address, session=session)

def create_inverter_component(component_config: FemsInverterSetup):
nonlocal session
return inverter.FemsInverter(component_config, ip_address=device_config.configuration.ip_address,
session=session)

Expand Down
Loading