You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The messages NotifyChargingLimitRequest, NotifyMonitoringReportRequest, ReportChargingProfilesRequest, RequestStartTransactionRequest and SetChargingProfileRequest fail to be validated and hence to be sent. The bug happen when in all these messages payloads is present a float. Specifcally :
NotifyChargingLimitRequest is when you add the optional filed charging_schedule, that requires ChargingScheduleType, that requires ChargingSchedulePeriodType, that requires the field limit as a float.
NotifyMonitoringReportRequest is when you add the optional filed monitor, that requires MonitoringDataType, that requires VariableMonitoringType, that requires the field value as a float.
ReportChargingProfilesRequest is always present because of the field charging_profile that requires ChargingProfileType, that requires ChargingScheduleType, that requires ChargingSchedulePeriodType, that requires the field limit as a float.
RequestStartTransactionRequest is when you add the optional field charging_profile that requires ChargingProfileType, that requires ChargingScheduleType, that requires ChargingSchedulePeriodType, that requires the field limit as a float.
SetChargingProfileRequest is always present because of the field charging_profile that requires ChargingProfileType, that requires ChargingScheduleType, that requires ChargingSchedulePeriodType, that requires the field limit as a float.
Aftre reading the comment inside your code to my understanding the problem is due to the parser used to parse the floats in the payloads, that a default is float(). Indeed, you left a comment specifying that for some schemas should be used decimal.Decimal. However, as an user of your library I can only access your code up to the call method of your ChargePoint class and there is no possibility for me to sepcify the parser inside call - validate_payload - get_validator. Do you think that adding the possibility to specify the parse_float at the call method will fix the issue or is there another problem with the parsing of the floats?
The text was updated successfully, but these errors were encountered:
I'm curious why validation fails, though. The schemas for OCPP 1.6 limit the decimal points of a few number types to 1. It does so using the JSON Schema keyword multipleOf. See for example the subschema for ChargingSchedulePeriod.limit.
You noticed correctly that this library includes a custom encoder to serialize these floats. See for example here and here.
The schemas of OCPP 2.0.1 don't use the multipleOf JSON keyword. Therefore, I don't understand how you run into validation issues. Can you provide a code example shows the validation issue?
Hello,
The messages NotifyChargingLimitRequest, NotifyMonitoringReportRequest, ReportChargingProfilesRequest, RequestStartTransactionRequest and SetChargingProfileRequest fail to be validated and hence to be sent. The bug happen when in all these messages payloads is present a float. Specifcally :
NotifyChargingLimitRequest is when you add the optional filed charging_schedule, that requires ChargingScheduleType, that requires ChargingSchedulePeriodType, that requires the field limit as a float.
NotifyMonitoringReportRequest is when you add the optional filed monitor, that requires MonitoringDataType, that requires VariableMonitoringType, that requires the field value as a float.
ReportChargingProfilesRequest is always present because of the field charging_profile that requires ChargingProfileType, that requires ChargingScheduleType, that requires ChargingSchedulePeriodType, that requires the field limit as a float.
RequestStartTransactionRequest is when you add the optional field charging_profile that requires ChargingProfileType, that requires ChargingScheduleType, that requires ChargingSchedulePeriodType, that requires the field limit as a float.
SetChargingProfileRequest is always present because of the field charging_profile that requires ChargingProfileType, that requires ChargingScheduleType, that requires ChargingSchedulePeriodType, that requires the field limit as a float.
Aftre reading the comment inside your code to my understanding the problem is due to the parser used to parse the floats in the payloads, that a default is float(). Indeed, you left a comment specifying that for some schemas should be used decimal.Decimal. However, as an user of your library I can only access your code up to the call method of your ChargePoint class and there is no possibility for me to sepcify the parser inside call - validate_payload - get_validator. Do you think that adding the possibility to specify the parse_float at the call method will fix the issue or is there another problem with the parsing of the floats?
The text was updated successfully, but these errors were encountered: