mobilityhouse / ocpp

Python implementation of the Open Charge Point Protocol (OCPP).
MIT License
782 stars 306 forks source link

Modifiying any payload dataclass #624

Open arahman33 opened 6 months ago

arahman33 commented 6 months ago

Hi,

I am currently trying to test whether more arguments can be added to the already built payloads, for example, adding transaction_id in RequestStartTransactionPayload. Part of the reason I am trying to add this is because other available implementations of ocpp2.0.1 do include these fields. My initial attempts include adding the transaction_id in the class definition of the payload as follows:

@dataclass class RequestStartTransactionPayload: id_token: Dict remote_start_id: int evse_id: Optional[int] = None group_id_token: Optional[Dict] = None charging_profile: Optional[Dict] = None custom_data: Optional[Dict[str, Any]] = None transaction_id: str

I have bolded what I added into the class definition. However, when I try to run this, it gives me the following error:

request = call.RequestStartTransactionPayload( TypeError: RequestStartTransactionPayload.init() got an unexpected keyword argument 'transaction_id'

What other files should be edited in order to make the test successful?