@@ -24,6 +24,11 @@ class EvseSignaling:
2424 PWM = "PWM"
2525
2626
27+ class CpInterruptionVersion :
28+ CP_SIGNAL_0V = "0V"
29+ CP_SIGNAL_minus12V = "-12V"
30+
31+
2732class ChargepointModule (AbstractChargepoint ):
2833 WRONG_CHARGE_STATE = "Lade-Status ist nicht aktiv, aber Strom fließt."
2934 WRONG_PLUG_STATE = "Ladepunkt ist nicht angesteckt, aber es wird geladen."
@@ -40,7 +45,7 @@ def __init__(self, config: OpenWBPro) -> None:
4045
4146 with SingleComponentUpdateContext (self .fault_state , update_always = False ):
4247 self .__session .post (
43- 'http://' + self .config .configuration .ip_address + ' /connect.php' ,
48+ f 'http://{ self .config .configuration .ip_address } /connect.php' ,
4449 data = {'heartbeatenabled' : '1' })
4550
4651 def set_internal_context_handlers (self , hierarchy_id : int , internal_cp : InternalChargepoint ):
@@ -58,8 +63,8 @@ def set_current(self, current: float) -> None:
5863 current = 0
5964 with SingleComponentUpdateContext (self .fault_state , update_always = False ):
6065 with self .client_error_context :
61- ip_address = self .config . configuration . ip_address
62- self . __session . post ( 'http://' + ip_address + ' /connect.php' , data = {'ampere' : current })
66+ self .__session . post (
67+ f 'http://{ self . config . configuration . ip_address } /connect.php' , data = {'ampere' : current })
6368
6469 def get_values (self ) -> None :
6570 with SingleComponentUpdateContext (self .fault_state ):
@@ -78,8 +83,7 @@ def get_values(self) -> None:
7883
7984 def request_values (self ) -> ChargepointState :
8085 with self .client_error_context :
81- ip_address = self .config .configuration .ip_address
82- json_rsp = self .__session .get ('http://' + ip_address + '/connect.php' ).json ()
86+ json_rsp = self .__session .get (f'http://{ self .config .configuration .ip_address } /connect.php' ).json ()
8387
8488 chargepoint_state = ChargepointState (
8589 power = json_rsp ["power_all" ],
@@ -131,16 +135,20 @@ def validate_values(self, chargepoint_state: ChargepointState) -> None:
131135 def switch_phases (self , phases_to_use : int , duration : int ) -> None :
132136 with SingleComponentUpdateContext (self .fault_state , update_always = False ):
133137 with self .client_error_context :
134- ip_address = self .config .configuration .ip_address
135- response = self .__session .get ('http://' + ip_address + '/connect.php' )
138+ response = self .__session .get (f'http://{ self .config .configuration .ip_address } /connect.php' )
136139 if response .json ()["phases_target" ] != phases_to_use :
137- ip_address = self .config .configuration .ip_address
138- self .__session .post ('http://' + ip_address + '/connect.php' ,
140+ self .__session .post (f'http://{ self .config .configuration .ip_address } /connect.php' ,
139141 data = {'phasetarget' : str (1 if phases_to_use == 1 else 3 )})
140142 time .sleep (duration )
141143
142144 def clear_rfid (self ) -> None :
143145 pass
144146
147+ def interrupt_cp (self , duration : int ) -> None :
148+ self .__session .post (f'http://{ self .config .configuration .ip_address } /connect.php' ,
149+ data = {'cp_interrupt' : True ,
150+ 'cp_interrupt_version' : CpInterruptionVersion .CP_SIGNAL_0V ,
151+ 'cp_interrupt_duration' : duration })
152+
145153
146154chargepoint_descriptor = DeviceDescriptor (configuration_factory = OpenWBPro )
0 commit comments