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

TransactionEventPayload total_cost should be a floating point number #657

Closed
maaikez opened this issue Sep 5, 2024 · 2 comments · Fixed by #663
Closed

TransactionEventPayload total_cost should be a floating point number #657

maaikez opened this issue Sep 5, 2024 · 2 comments · Fixed by #663
Assignees
Labels
bug Something isn't working ocpp2.1 Issues related to OCPP 2.1 support

Comments

@maaikez
Copy link

maaikez commented Sep 5, 2024

@dataclass
class TransactionEventPayload:
    total_cost: Optional[int] = None
    charging_priority: Optional[int] = None
    id_token_info: Optional[Dict] = None
    updated_personal_message: Optional[Dict] = None
    custom_data: Optional[Dict[str, Any]] = None

According to the ocpp 2.0.1 spec, total_cost should be a 'decimal', not an int.

@maaikez maaikez added the bug Something isn't working label Sep 5, 2024
@maaikez
Copy link
Author

maaikez commented Sep 5, 2024

Hmm I wanted to create a pull request with the change but I can not commit here. Here you have the diff:

diff --git a/ocpp/v201/call_result.py b/ocpp/v201/call_result.py
index 520537c..9bf387b 100644
--- a/ocpp/v201/call_result.py
+++ b/ocpp/v201/call_result.py
@@ -387,11 +387,11 @@ class StatusNotification:
     custom_data: Optional[Dict[str, Any]] = None
 
 
 @dataclass
 class TransactionEvent:
-    total_cost: Optional[int] = None
+    total_cost: Optional[float] = None
     charging_priority: Optional[int] = None
     id_token_info: Optional[Dict] = None
     updated_personal_message: Optional[Dict] = None
     custom_data: Optional[Dict[str, Any]] = None

@jainmohit2001
Copy link
Collaborator

Image from official documentation for reference:

image

@jainmohit2001 jainmohit2001 self-assigned this Sep 24, 2024
@jainmohit2001 jainmohit2001 added the ocpp2.1 Issues related to OCPP 2.1 support label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ocpp2.1 Issues related to OCPP 2.1 support
Development

Successfully merging a pull request may close this issue.

2 participants