Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of ArduinoOcpp #182

Merged
merged 22 commits into from
Jul 15, 2021
Merged

Integration of ArduinoOcpp #182

merged 22 commits into from
Jul 15, 2021

Conversation

matth-x
Copy link
Collaborator

@matth-x matth-x commented Apr 16, 2021

First draft integration of OCPP 1.6. This code is able to make a test-connection to SteVe, and to handle some basic OCPP operations (Start- and StopTransaction, MeterValues, SmartCharging)

Copy link
Collaborator

@jeremypoulter jeremypoulter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments

MongooseOcppSocketClient::MongooseOcppSocketClient(String &ws_url) {
this->ws_url = String(ws_url);

if (DEBUG_OUT) Serial.print(F("[MongooseOcppSocketClient] Create connection to "));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For OpenEVSE code, use the MicroDebug library for debug, handles compiling out the code as well as viewing via the web interface

src/evse_man.h Outdated
@@ -39,12 +40,13 @@ typedef uint32_t EvseClient;
#define EvseManager_Priority_Timer 100
#define EvseManager_Priority_Boost 200
#define EvseManager_Priority_Ohm 500
#define EvseManager_Priority_Ocpp 700
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May need to be higher to override the manual control

src/evse_man.h Outdated
#define EvseManager_Priority_Manual 1000
#define EvseManager_Priority_Limit 1100
#define EvseManager_Priority_Error 10000

#ifndef EVSE_MANAGER_MAX_CLIENT_CLAIMS
#define EVSE_MANAGER_MAX_CLIENT_CLAIMS 10
#define EVSE_MANAGER_MAX_CLIENT_CLAIMS 11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need to change this

readme.md Outdated
@@ -1,556 +1,4 @@
# OpenEVSE WiFi Gateway v4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore the original Readme

platformio.ini Outdated
@@ -42,6 +43,8 @@ lib_deps =
MicroTasks@0.0.1
ESP32 AnalogWrite@0.2
lorol/LittleFS_esp32@1.0.5
https://github.com/matth-x/ArduinoOcpp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you publish to the Platform IO registry?

@@ -33,7 +33,8 @@ version = -DBUILD_TAG=4.0.0
monitor_speed = 115200
lib_deps =
ArduinoJson@6.15.1
ArduinoMongoose@0.0.15
; ArduinoMongoose@0.0.15
https://github.com/matth-x/ArduinoMongoose
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need updating when ArduinoMongoose PR is merged and released

}

MongooseOcppSocketClient::~MongooseOcppSocketClient() {
if (DEBUG_OUT) Serial.print(F("[MongooseOcppSocketClient] Close and destroy connection to "));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the DBUG... macros, debug is not always sent to Serial

@@ -293,6 +312,28 @@ config_save_mqtt(bool enable, int protocol, String server, uint16_t port, String
config.commit();
}

void
config_save_ocpp(bool enable, String server, String ocpp_chargeBoxId, String ocpp_idTag, String tx_start_point, bool ocpp_suspend_evse, bool ocpp_energize_plug) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need to write specific functions to save, should be handled by the generic code

src/ocpp.cpp Outdated
return 50;
}

void ArduinoOcppTask::poll() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need a poll function, can all be in loop

// url: /saveocpp
// -------------------------------------------------------------------
void
handleSaveOcpp(MongooseHttpServerRequest *request) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be adding explicit endpoint for OCPP, should use the generic config code

@jeremypoulter jeremypoulter reopened this Jun 5, 2021
@jeremypoulter jeremypoulter marked this pull request as ready for review June 5, 2021 12:01
@matth-x
Copy link
Collaborator Author

matth-x commented Jun 10, 2021

Thank you, I implemented all changes from your comments. Everything looked very reasonable to me.

@glynhudson
Copy link
Collaborator

glynhudson commented Jul 23, 2021

Hi @matth-x

Nice work with this OCPP implementation 👍

I've had a go at testing it, I've been able to successfully connect it to an OCPP server. However, I've not had any luck sending commands to the unit, but this is probably because I'm not too familiar with using Steve and the options available on OpenEVSE OCPP config page.

Would it be possible to arrange a video chat with you to go over the feature? I think it would be good to add some pop-out info boxes on the UI, to help explain what all the options do.

Screenshot 2021-07-23 01 35 54

I've been unable to push a remote start transaction, Steve throws error "User ID Tag is required", but doesn't list any tags for me to select, the tag test is set in the OpenEVSE interface.

Screenshot 2021-07-23 13 24 18

I've created a beta build (V4.1.0) with includes your OCPP PR: https://github.com/OpenEVSE/ESP32_WiFi_V4.x/releases/tag/4.1.0

@matth-x
Copy link
Collaborator Author

matth-x commented Jul 23, 2021

Hi Glyn, thank you for the compliment :)

Yes, some documentation on the configurations would definitely be a good idea. We can have a call next week, I send you the possible time slots per pm.

The ID Tag is used to identify the user who is about to start the charging session. In our case that function is obsolete (because the CP doesn't have an RFID reader) but SteVe requires a valid user entry in its DB nevertheless. You can activate it in the ID Tag page by searching for the blocked ones (SteVe creates a "default entry" for each unknown tag) and setting its maximal concurrent usages from 0 to 1.

@glynhudson
Copy link
Collaborator

Thanks! After creating a tag and user in Steve I was able to send a remote start request 👍

Screenshot 2021-07-23 15 22 45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants