-
Notifications
You must be signed in to change notification settings - Fork 118
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
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Needs #796 to be merged to fix divert_sim build error |
jeremypoulter
approved these changes
Jun 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theConfiguration
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 thenotifyConfigChanged
in ocpp.cpp. In this case the WebSocket reconnect is suppressed by setting the variablesynchronizationLock
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 intoOcppTask
. 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 thestaticFiles
array.TL;DR:
ArduinoOcppTask
intoOcppTask