Skip to content

Commit 3b19608

Browse files
feat: add FUSION_CHARGER_MOCK_PORT configuration option for Modbus TCP port (EVerest#1907)
* feat: add FUSION_CHARGER_MOCK_PORT configuration option for Modbus TCP port Signed-off-by: Manuel Janocha <manuel.janocha@heidelberg.com> * Update modules/HardwareDrivers/PowerSupplies/Huawei_V100R023C10/docs/index.rst Co-authored-by: Piet Gömpel <37657534+Pietfried@users.noreply.github.com> Signed-off-by: ManuelJanocha <73517886+ManuelJanocha@users.noreply.github.com> --------- Signed-off-by: Manuel Janocha <manuel.janocha@heidelberg.com> Signed-off-by: ManuelJanocha <73517886+ManuelJanocha@users.noreply.github.com> Co-authored-by: Piet Gömpel <37657534+Pietfried@users.noreply.github.com>
1 parent 6fbd0d5 commit 3b19608

File tree

2 files changed

+20
-1
lines changed
  • modules/HardwareDrivers/PowerSupplies/Huawei_V100R023C10
    • docs
    • fusion_charger_lib/fusion-charger-dispenser-library/power_stack_mock/src

2 files changed

+20
-1
lines changed

modules/HardwareDrivers/PowerSupplies/Huawei_V100R023C10/docs/index.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ The mock has a few environment variables (enable or disable by setting them to `
155155
messages. This also allows to receive completely unsigned messages.
156156
- ``FUSION_CHARGER_MOCK_ETH``: The ethernet interface to use for receiving and sending goose messages. Defaults to
157157
``veth0``.
158+
- ``FUSION_CHARGER_MOCK_PORT``: The Modbus TCP port to listen on. Defaults to ``8502``.
159+
- ``FUSION_CHARGER_MOCK_MQTT_HOST``: MQTT broker hostname or IP address. When set together with
160+
``FUSION_CHARGER_MOCK_MQTT_PORT``, the mock will publish power request data via MQTT.
161+
- ``FUSION_CHARGER_MOCK_MQTT_PORT``: MQTT broker port. Required together with ``FUSION_CHARGER_MOCK_MQTT_HOST`` to
162+
enable MQTT publishing.
163+
- ``FUSION_CHARGER_MOCK_MQTT_BASE_TOPIC``: Base topic for MQTT publishing. Defaults to ``fusion_charger_mock/``.
164+
Power requests are published to ``<base_topic>/<connector_number>/power_request`` with JSON payload containing
165+
voltage and current values.
158166

159167
It also has one optional command line argument, being the path to a folder with certificates and keys for mTLS.
160168

@@ -172,4 +180,10 @@ corresponding files for the dispenser):
172180

173181
.. code-block:: bash
174182

175-
modules/HardwareDrivers/PowerSupplies/Huawei_V100R023C10/fusion_charger_lib/fusion-charger-dispenser-library/user-acceptance-tests/test_certificates/generate.sh
183+
modules/HardwareDrivers/PowerSupplies/Huawei_V100R023C10/fusion_charger_lib/fusion-charger-dispenser-library/user-acceptance-tests/test_certificates/generate.sh
184+
185+
Then run the mock with the path to the certificates folder:
186+
187+
.. code-block:: bash
188+
189+
./fusion_charger_mock /path/to/certificates

modules/HardwareDrivers/PowerSupplies/Huawei_V100R023C10/fusion_charger_lib/fusion-charger-dispenser-library/power_stack_mock/src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ int main(int argc, char* argv[]) {
308308
printf("Using default Ethernet interface: %s\n", config.eth.c_str());
309309
}
310310

311+
// Set the Modbus TCP port to use
312+
if (std::getenv("FUSION_CHARGER_MOCK_PORT")) {
313+
config.port = std::atoi(std::getenv("FUSION_CHARGER_MOCK_PORT"));
314+
}
315+
311316
printf("Waiting for connections on port %d\n", config.port);
312317

313318
std::shared_ptr<MqttPowerRequestPublisher> mqtt_publisher;

0 commit comments

Comments
 (0)