Skip to content

Commit af0b2c8

Browse files
authored
Merge pull request #2654 from ndrsnhs/chargepoint-identification-with-wildcards
chargepoint: identification with wildcards
2 parents d4aa282 + 588dd49 commit af0b2c8

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

packages/control/chargepoint/chargepoint.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from threading import Thread, Event
2121
import traceback
2222
from typing import Dict, Optional, Tuple
23+
from fnmatch import fnmatch
2324

2425
from control.algorithm.utils import get_medium_charging_current
2526
from control.chargelog import chargelog
@@ -154,11 +155,18 @@ def _is_autolock_inactive(self) -> Tuple[bool, Optional[str]]:
154155
def _is_manual_lock_inactive(self) -> Tuple[bool, Optional[str]]:
155156
# Die Pro schickt je nach Timing auch nach Abstecken noch ein paar Zyklen den Tag. Dann darf der Ladepunkt
156157
# nicht wieder entsperrt werden.
157-
if (self.data.get.rfid or
158-
self.data.get.vehicle_id or
159-
self.data.set.rfid) in self.template.data.valid_tags:
160-
Pub().pub(f"openWB/set/chargepoint/{self.num}/set/manual_lock", False)
161-
elif self.template.data.disable_after_unplug and self.data.get.plug_state is False:
158+
159+
# Prüfung auf ein passendes Muster
160+
# Vergleiche werden case-insensitive durchgeführt
161+
# das vereinfacht die Eingabe, kann aber auch für falsche Treffer sorgen.
162+
# 'fnmatch()' ist case-insensitive
163+
for tag_id in self.template.data.valid_tags:
164+
if ((self.data.get.rfid is not None and fnmatch(self.data.get.rfid, tag_id)) or
165+
(self.data.get.vehicle_id is not None and fnmatch(self.data.get.vehicle_id, tag_id)) or
166+
(self.data.set.rfid is not None and fnmatch(self.data.set.rfid, tag_id))):
167+
Pub().pub(f"openWB/svet/chargepoint/{self.num}/set/manual_lock", False)
168+
# Wenn der Ladepunkt nach dem Abstecken gesperrt werden soll, und kein Fahrzeug angeschlossen ist wird gesperrt
169+
if self.template.data.disable_after_unplug and self.data.get.plug_state is False:
162170
Pub().pub(f"openWB/set/chargepoint/{self.num}/set/manual_lock", True)
163171

164172
if self.data.set.manual_lock:

0 commit comments

Comments
 (0)