Skip to content

Commit

Permalink
backport client_factory
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutz Bender committed Aug 10, 2023
1 parent 28ca87c commit 63e0e35
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/modules/internal_chargepoint_handler/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 63e0e35

Please sign in to comment.