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

Update OCPP lib, fix building on Windows #747

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

matth-x
Copy link
Collaborator

@matth-x matth-x commented Oct 22, 2023

This PR updates the OpenEVSE OCPP integration to the latest version and contains a fix for building on Windows (see #708, sorry for not creating a separate PR).

In the latest version I changed the class structure of Configs so that they are represented by an interface instead of only a concrete class. This allows to wrap OpenEVSE configs into an adapter (OcppConfigAdapter) which implements the Configuration interface and to pass this adapter to the OCPP lib. Now, the OCPP lib accesses the OpenEVSE configs directly instead of only synchronizing OpenEVSE configs with OCPP configs. This also means that there is a "single source of truth" - the value of each config exists in only one place now.

A special case is updating the OCPP backend URL. If this is done by the user through the GUI, it should apply immediately, resetting the WebSocket connection and reconnecting to the new URL. When the OCPP backend changes the URL, then the connection shouldn't reset immediately, but wait for the next reboot. But when the OcppConfigAdapter updates the OpenEVSE config, the config_changed() handler in app_config.cpp gets triggered and finally the notifyConfigChanged in ocpp.cpp. In this case the WebSocket reconnect is suppressed by setting the variable synchronizationLock and resetting it afterwards.

Still, I think that managing the configs has become much simpler now.

Btw. I renamed the library into MicroOcpp. This PR also reflects this change. Moreover, the previous class name ArduinoOcppTask has become outdated and I changed it into OcppTask. The same goes for the logo of the OCPP panel for which I will open a separate PR in the gui repo.

The Windows fix is related to generating staticFiles array in extra_script.py. When running on Windows it concatenates dir and filename with \ which leads to compilation errors in the web_server_static_files.h header. E.g. I got the string "/assets\components-aa3d0296.js", but the patch changes all \ into / in the final step of generating the staticFiles array.

TL;DR:

@matth-x matth-x marked this pull request as ready for review October 23, 2023 11:03
@matth-x
Copy link
Collaborator Author

matth-x commented Oct 23, 2023

Thanks for accepting the PR in the gui repo. I think there's no real dependency between both PRs so I leave the gui update to #748.

@jeremypoulter
Copy link
Collaborator

Needs #796 to be merged to fix divert_sim build error

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.

None yet

3 participants