Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ChargePointConfigPath module param #132

Merged
merged 2 commits into from
Apr 17, 2024
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 everest-testing/src/everest/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__="0.2.2"
__version__="0.2.3"
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

@dataclass
class OCPPModuleConfigurationBase:
ChargePointConfigPath: str
MessageLogPath: str

@dataclass
class OCPPModulePaths16(OCPPModuleConfigurationBase):
ChargePointConfigPath: str
UserConfigPath: str
DatabasePath: str

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def _create_ocpp_module_configuration_strategy(self,
)
elif self._ocpp_config.ocpp_version == OCPPVersion.ocpp201:
ocpp_paths = OCPPModulePaths201(
ChargePointConfigPath=str(temporary_paths.ocpp_config_file),
MessageLogPath=str(temporary_paths.ocpp_message_log_directory),
CoreDatabasePath=str(temporary_paths.ocpp_database_dir),
DeviceModelDatabasePath=str(temporary_paths.ocpp_database_dir / "device_model_storage.db"),
Expand All @@ -193,8 +192,12 @@ def _setup_libocpp_configuration(self, temporary_paths: _EverestEnvironmentTempo

if self._ocpp_config.template_ocpp_config:
source_ocpp_config = self._ocpp_config.template_ocpp_config
else:
elif self._ocpp_config.ocpp_version == OCPPVersion.ocpp16:
source_ocpp_config = self._determine_configured_charge_point_config_path_from_everest_config()
elif self._ocpp_config.ocpp_version == OCPPVersion.ocpp201:
ocpp_dir = self._everest_core.prefix_path / "share/everest/modules/OCPP201"
source_ocpp_config = ocpp_dir / "config.json"


liboccp_configuration_helper.generate_ocpp_config(
central_system_port=self._ocpp_config.central_system_port,
Expand Down Expand Up @@ -243,18 +246,16 @@ def _create_everest_configuration_strategies(self, temporary_paths: _EverestEnvi

def _determine_configured_charge_point_config_path_from_everest_config(self):

everest_template_config = yaml.safe_load(self._core_config.template_everest_config_path.read_text())
if self._ocpp_config.ocpp_version == OCPPVersion.ocpp16:
everest_template_config = yaml.safe_load(self._core_config.template_everest_config_path.read_text())

charge_point_config_path = \
everest_template_config["active_modules"][self._ocpp_config.ocpp_module_id]["config_module"][
charge_point_config_path = \
everest_template_config["active_modules"][self._ocpp_config.ocpp_module_id]["config_module"][
"ChargePointConfigPath"]

if self._ocpp_config.ocpp_version == OCPPVersion.ocpp16:
ocpp_dir = self._everest_core.prefix_path / "share/everest/modules/OCPP"
elif self._ocpp_config.ocpp_version == OCPPVersion.ocpp201:
ocpp_dir = self._everest_core.prefix_path / "share/everest/modules/OCPP201"
else:
raise ValueError(f"unknown OCPP version {self._ocpp_config.ocpp_version}")
raise ValueError(f"Could not determine ChargePointConfigPath for OCPP version {self._ocpp_config.ocpp_version}")
ocpp_config_path = ocpp_dir / charge_point_config_path
return ocpp_config_path

Expand Down
Loading