mobilityhouse / ocpp

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

Bug: in data class definitions for connector_id (not as per specification) #614

Closed no-veternarian23 closed 3 months ago

no-veternarian23 commented 5 months ago

I am not sure if this is a bug, also my python knowledge is a little weak (i am mostly a Java programmer). But i noticed that all the dataclass definitions in the call.py file has incorrectly named the field connectorId as connector_id which is not as per the specification (this is for v16).

And this is causing issues when building the payload objects using these data classes. For example when i am calling the below code, the code itself works. But since this is not as per the specification, when testing with a live charging station, this is failing.

cpRequestPayload = call.TriggerMessagePayload(requested_message="TriggerMessage",connector_id=1)

    cpRequest = Call(
        unique_id=str(uuid.uuid4()),
        action=cpRequestPayload.__class__.__name__[:-7],
        payload=cpRequestPayload
    )

Since i couldn't find anyone raising an issue over this, i am guessing im doing something wrong OR is it that my charging station is not designed correctly?

Yoshida-Taisei commented 4 months ago

@no-veternarian23

I don't think this is a bug. In CP, the naming convention changes from camel case to snake case at this point . Therefore, when writing CP code, you essentially write in snake_case.

no-veternarian23 commented 3 months ago

Thanks, missed that.