From 195c4868b031c19b4c84a05fa133b99d30d4d6e3 Mon Sep 17 00:00:00 2001 From: uhi22 Date: Mon, 27 May 2024 18:40:35 +0200 Subject: [PATCH] EvseMode: show data of the power supply --- fsmEvse.py | 6 +++--- pyPlc.py | 20 +++++++++++++++++++- pyPlcHomeplug.py | 16 ++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/fsmEvse.py b/fsmEvse.py index a802cd1..f7f2d7b 100644 --- a/fsmEvse.py +++ b/fsmEvse.py @@ -262,7 +262,7 @@ class fsmEvse(): self.simulatedPresentVoltage += 20 if (self.simulatedPresentVoltage0): lblStatus['text']=s root.update() @@ -101,8 +107,19 @@ if (myMode == C_EVSE_MODE): print("starting in EvseMode") root = tk.Tk() -root.geometry("400x350") +#root.geometry("400x350") +root.geometry("600x350") lastKey = '' +if (myMode == C_EVSE_MODE): + frmPowerSupply = tk.Frame(root, bg='lightblue', bd=3) + frmPowerSupply.pack(side='right', fill='both', expand='True') + lblPowerSupplyUTarget = tk.Label(frmPowerSupply, text="(UTarget)", bg='lightblue') + lblPowerSupplyUTarget.config(font=('Helvetica bold', 18)) + lblPowerSupplyUTarget.pack() + lblPowerSupplyUPresent = tk.Label(frmPowerSupply, text="(PowerSupplyUPresent)", bg='lightblue') + lblPowerSupplyUPresent.config(font=('Helvetica bold', 18)) + lblPowerSupplyUPresent.pack() + lblHelp = tk.Label(root, justify= "left") lblHelp['text']="x=exit \nS=GET_SW \nP=PEV mode \nE=EVSE mode \nL=Listen mode \ns=SET_KEY \nG=GET_KEY (try twice) \nt=SET_KEY modified \n space=stop charging" lblHelp.pack() @@ -124,6 +141,7 @@ lblEVSEPresentVoltage = tk.Label(root, text="(EVSEPresentVoltage)") lblEVSEPresentVoltage.config(font=('Helvetica bold', 16)) lblEVSEPresentVoltage.pack() + if (myMode == C_EVSE_MODE): lblTestcase = tk.Label(root, text="(test case)") lblTestcase.pack() diff --git a/pyPlcHomeplug.py b/pyPlcHomeplug.py index c0520c2..4b4cd93 100644 --- a/pyPlcHomeplug.py +++ b/pyPlcHomeplug.py @@ -730,6 +730,19 @@ class pyPlcHomeplug(): self.addToTrace("[EVSE] transmitting ATTEN_CHAR.IND") self.sniffer.sendpacket(bytes(self.mytransmitbuffer)) + def evaluateStartAttenCharInd(self): + # self.addToTrace("received START_ATTEN_CHAR.IND") + # nothing to do as PEV or EVSE. + # interpretation just in case we use it as special message in EVSE mode to get information from the power supply + if (self.iAmEvse==1): + if ((self.myreceivebuffer[38] == 0xDC) and (self.myreceivebuffer[39] == 0x55) and (self.myreceivebuffer[40] == 0xAA)): + uPresent = self.myreceivebuffer[43] + uPresent*=256 + uPresent+=self.myreceivebuffer[44] + uPresent/=10 # scaling in the message is 0.1V + self.callbackShowStatus(str(uPresent), "PowerSupplyUPresent") + # Todo: evaluate other information of the power supply, like cable check result, current, temperature, ... + def evaluateAttenCharInd(self): self.addToTrace("received ATTEN_CHAR.IND") if (self.iAmPev==1): @@ -804,6 +817,8 @@ class pyPlcHomeplug(): self.evaluateSlacParamReq() if (mmt == CM_SLAC_PARAM + MMTYPE_CNF): self.evaluateSlacParamCnf() + if (mmt == CM_START_ATTEN_CHAR + MMTYPE_IND): + self.evaluateStartAttenCharInd() if (mmt == CM_MNBC_SOUND + MMTYPE_IND): self.evaluateMnbcSoundInd() if (mmt == CM_ATTEN_CHAR + MMTYPE_IND): @@ -1130,6 +1145,7 @@ class pyPlcHomeplug(): self.composeSpecialMessage() self.addToTrace("transmitting SpecialMessage to control the power supply") self.transmit(self.mytransmitbuffer) + self.callbackShowStatus(str(targetVoltage), "PowerSupplyUTarget") def enterPevMode(self): self.iAmEvse = 0 # not emulating a charging station