-
Notifications
You must be signed in to change notification settings - Fork 329
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
Use dataclasses for ChargingProfile usage #648
Use dataclasses for ChargingProfile usage #648
Conversation
In order for remove_nones to work with the charging profile data structures it needs to be able to remove nones of nested dictionaries, as well as dictionaries made of lists of dictionaries (for example, a list of charging schedules represented as dicts). This commit modifies the logic, and adds tests
For now, dicts are acceptable to maintain backwards compatibility. Perhaps in v1.0 only the dataclass will be accepted.
* Change Decimal to float * Move dataclasses to separate charging_profile module * Add ChargingProfile type to RemoteStartTransaction payload
…drian/add_charging_profile_types Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
@jerome-benoit would you like me to create unit tests similar to #684 so that its clearer to the community that these kind of changes are non-breaking? hopefully, that'll allow the new maintainers confidence in accepting these changes as well as the changes in #680 |
If your time permits, it will be helpful. I think that PR is editable by maintainers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the charging profile datatypes that are added in charging_profile.py
already exist in ocpp/v16/datatypes.py
and shouldn't be duplicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
charging_profile field is optional; typing it as None
makes it a required field.
Signed-off-by: Jérôme Benoit <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
@jainmohit2001 any feedback for this PR? |
Looks good. Just remove the comments. I don't think they would be necessary. |
LGTM. We can merge this. |
PR #172 updated with master.
Smart charging algos conception and validation has become a requirement for charging infrastructure. Every single code lines that can help at implementing and testing it worse the effort.
closes #172
Associated unit tests PR: #690