ocpp icon indicating copy to clipboard operation
ocpp copied to clipboard

v201/Wrong dataclass MeterValueType

Open Shadowsith opened this issue 2 years ago • 2 comments

MeterValueType was implemented correctly in the JSON schema but the dataclass is implemented incorrectly.

current (wrong):

@dataclass
class MeterValueType:
    """
    Collection of one or more sampled values in MeterValuesRequest and
    TransactionEvent. All sampled values in a MeterValue are sampled at the
    same point in time.
    MeterValueType is used by: MeterValuesRequest, TransactionEventRequest
    """

    timestamp: str
    sampled_value: SampledValueType

should:

@dataclass
class MeterValueType:
    """
    Collection of one or more sampled values in MeterValuesRequest and
    TransactionEvent. All sampled values in a MeterValue are sampled at the
    same point in time.
    MeterValueType is used by: MeterValuesRequest, TransactionEventRequest
    """

    timestamp: str
    sampled_value: List[SampledValueType]

See MeterValueType specification https://raw.githubusercontent.com/mobilityhouse/ocpp/master/docs/v201/OCPP-2.0.1_part2_specification.pdf page 381, sampledValue (1...*)

Shadowsith avatar Feb 04 '22 07:02 Shadowsith

Thanks for reporting the issue.

OrangeTux avatar Feb 04 '22 09:02 OrangeTux

I've created a PR for that: https://github.com/mobilityhouse/ocpp/pull/306

Shadowsith avatar Feb 07 '22 08:02 Shadowsith

This was merged into master some time ago, so I will close this

Jared-Newell-Mobility avatar Sep 12 '23 11:09 Jared-Newell-Mobility