From 63e0e3528afd105965a64ad20441a05415e0062a Mon Sep 17 00:00:00 2001 From: Lutz Bender Date: Thu, 10 Aug 2023 08:27:01 +0200 Subject: [PATCH] backport client_factory --- packages/modules/internal_chargepoint_handler/clients.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/modules/internal_chargepoint_handler/clients.py b/packages/modules/internal_chargepoint_handler/clients.py index 346959bb4..e1a808dd4 100644 --- a/packages/modules/internal_chargepoint_handler/clients.py +++ b/packages/modules/internal_chargepoint_handler/clients.py @@ -96,7 +96,14 @@ def client_factory(local_charge_point_num: int, resolved_devices = [str(file.resolve()) for file in tty_devices] log.debug("resolved_devices"+str(resolved_devices)) counter = len(resolved_devices) - if counter == 1 and resolved_devices[0] in BUS_SOURCES: + if counter == 0: + # Wenn kein USB-Gerät gefunden wird, wird der Modbus-Anschluss der AddOn-Platine genutzt (/dev/serial0) + serial_client = ModbusSerialClient_("/dev/serial0") + if local_charge_point_num == 0: + evse_ids = EVSE_ID_CP0 + else: + evse_ids = EVSE_ID_ONE_BUS_CP1 + elif counter == 1 and resolved_devices[0] in BUS_SOURCES: if local_charge_point_num == 0: log.error("LP0 Device: "+str(resolved_devices[0])) serial_client = ModbusSerialClient_(resolved_devices[0])