Closed gitibeyonde closed 5 years ago
Not sure about $NK 0 0 - When openevse returns an error it is without the trailing 0's (Returns "$NK" only)
Added a random reply of "$NK 0 0" from the emulator to simulate errors
@kernelkraut i have added $NK handling on openevse.py. Also modified the emulator to return $NK for about 50% of the commands.
I'll run a new clone and test from scratch.
Unfortunately it still gives the same response. Which command is being sent to generate the response? openevse.py should be sending an $ST every few seconds but I cant find it in the code anywhere?
('Line=', u'$NK \r') ('810 response', u'$NK \r') ('812 response_match', None) Unhandled exception in thread started by <function checkOpenEvse at 0x76258cb0> Traceback (most recent call last): File "ocpp.py", line 183, in checkOpenEvse openevse_serial = openevse.SerialOpenEVSE() File "/root/evdevice/openevse/openevse.py", line 723, in init self.echo(False) File "/root/evdevice/openevse/openevse.py", line 407, in echo if self._request('FF', 'E', '1' if enabled else '0')[0]: File "/root/evdevice/openevse/openevse.py", line 843, in _request return self._get_response() File "/root/evdevice/openevse/openevse.py", line 826, in _get_response return self._get_response() File "/root/evdevice/openevse/openevse.py", line 809, in _get_response response = self._read_line() File "/root/evdevice/openevse/openevse.py", line 790, in _read_line raise EvseTimeoutError openevse.EvseTimeoutError
$ST command is initiated from occp.py line 187.
Ok the problem with the $NK returned from openevse is that it is not following the specs. When our emulator sends the $NK it pads it like ('810 response', u'$NK 0 0^21\r') to comply with checksum rules, while the one received from the opneevse that you are testing with sends ('810 response', u'$NK \r'). Note there is no checksum. This does not even match the response format that is coded in the openevse implemenation. What kind of hardware are you using ? In the emulator_serial.py if you just remove the encode as shown below:
diff --git a/openevse/emulator_serial.py b/openevse/emulator_serial.py index db82a98..6974a05 100755 --- a/openevse/emulator_serial.py +++ b/openevse/emulator_serial.py @@ -299,7 +299,7 @@ class Serial: print(p1, p2) if random.random() > 0.5: - return self.encode("$NK 0 0") + return (u'$NK 0 0') if request_for == '$FF': response = "$OK 20" elif request_for == '$FB':
I get the error as in your logs !
Now that we know it is because of XOR checksum, I assume that your hardware is setup in testing mode and as such does not send the XOR checksum of command as per following directive in RAPI documentation:
I was just busy reading that documentation :) I'm going to have to try figure out how to get my unit out of testing mode? I never enabled anything like that. I'll get back to you shortly. Thanks again for all your help - I'm trying to learn as we go along...
What kind of hardware are you using ?
To confirm, I'm using a standard OpenEVSE 40A Kit, with Wifi module added on (All bought from the store, no custom hardware). The Wifi ESP is now removed to make space for the RasPi. OpenEVSE Board v.4, Firmware 3.11.3
I think this is the issue:
$OK 3.11.3 1.0.3 (Not sure what the 1.0.3 refers to? I know the unit displays 3.11.3 when it boots up)
response format (v1.0.3-) $OK [optional parameters]\r - success $NK [optional parameters]\r - failure
I think this is the issue:
$OK 3.11.3 1.0.3 (Not sure what the 1.0.3 refers to? I know the unit displays 3.11.3 when it boots up)
response format (v1.0.3-) $OK [optional parameters]\r - success $NK [optional parameters]\r - failure
Ok so the 1.0.3 must relate to the RAPI version - I'm going to have to upgrade the firmware to try get the RAPI version higher.
Yes try that. Meanwhile I will check if a “test” mode can be added so that the XOR checksum part is ignored.
On 20-Aug-2019, at 1:53 PM, kernelkraut notifications@github.com wrote:
I think this is the issue:
$OK 3.11.3 1.0.3 (Not sure what the 1.0.3 refers to? I know the unit displays 3.11.3 when it boots up)
response format (v1.0.3-) $OK [optional parameters]\r - success $NK [optional parameters]\r - failure
Ok so the 1.0.3 must relate to the RAPI version - I'm going to have to uprgade the firmware to try get the RAPI version higher.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gitibeyonde/openevse-ocpp/pull/6?email_source=notifications&email_token=AE2QF3H33I3GOKNQ32LWFXTQFOSYVA5CNFSM4IM5KPAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4VPQZI#issuecomment-522909797, or mute the thread https://github.com/notifications/unsubscribe-auth/AE2QF3GASU2C4JSYPXDWZLTQFOSYVANCNFSM4IM5KPAA.
Added a random reply of "$NK 0 0" from the emulator to simulate errors
@kernelkraut i have added $NK handling on openevse.py. Also modified the emulator to return $NK for about 50% of the commands.