Hi,
Running some test using the simulator and it seems the output of the MeterValuesRequest message does not follow the ocpp 1.6 schema, which specifies that meterValue should be an array.
Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "urn:OCPP:1.6:2019:12:MeterValuesRequest",
"title": "MeterValuesRequest",
"type": "object",
"properties": {
"connectorId": {
"type": "integer"
},
"transactionId": {
"type": "integer"
},
"meterValue": {
"type": "array",
"items": {
"type": "object",
"properties": {
"timestamp": {
"type": "string",
"format": "date-time"
},
"sampledValue": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"context": {
"type": "string",
"additionalProperties": false,
"enum": [
"Interruption.Begin",
"Interruption.End",
"Sample.Clock",
"Sample.Periodic",
"Transaction.Begin",
"Transaction.End",
"Trigger",
"Other"
]
},
"format": {
"type": "string",
"additionalProperties": false,
"enum": [
"Raw",
"SignedData"
]
},
"measurand": {
"type": "string",
"additionalProperties": false,
"enum": [
"Energy.Active.Export.Register",
"Energy.Active.Import.Register",
"Energy.Reactive.Export.Register",
"Energy.Reactive.Import.Register",
"Energy.Active.Export.Interval",
"Energy.Active.Import.Interval",
"Energy.Reactive.Export.Interval",
"Energy.Reactive.Import.Interval",
"Power.Active.Export",
"Power.Active.Import",
"Power.Offered",
"Power.Reactive.Export",
"Power.Reactive.Import",
"Power.Factor",
"Current.Import",
"Current.Export",
"Current.Offered",
"Voltage",
"Frequency",
"Temperature",
"SoC",
"RPM"
]
},
"phase": {
"type": "string",
"additionalProperties": false,
"enum": [
"L1",
"L2",
"L3",
"N",
"L1-N",
"L2-N",
"L3-N",
"L1-L2",
"L2-L3",
"L3-L1"
]
},
"location": {
"type": "string",
"additionalProperties": false,
"enum": [
"Cable",
"EV",
"Inlet",
"Outlet",
"Body"
]
},
"unit": {
"type": "string",
"additionalProperties": false,
"enum": [
"Wh",
"kWh",
"varh",
"kvarh",
"W",
"kW",
"VA",
"kVA",
"var",
"kvar",
"A",
"V",
"K",
"Celcius",
"Celsius",
"Fahrenheit",
"Percent"
]
}
},
"additionalProperties": false,
"required": [
"value"
]
}
}
},
"additionalProperties": false,
"required": [
"timestamp",
"sampledValue"
]
}
}
},
"additionalProperties": false,
"required": [
"connectorId",
"meterValue"
]
}
Received output:
{'connectorId': 1,
'transactionId': 5555,
'meterValue':
{'timestamp': '2021-08-15T17:17:41.305Z',
'sampledValue':
[{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14'},
{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L1-N'},
{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L2-N'},
{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L3-N'},
{'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '17232.22'},
{'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '3799.31', 'phase': 'L1-N'},
{'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '7107.15', 'phase': 'L2-N'},
{'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '6325.76', 'phase': 'L3-N'},
{'unit': 'A', 'measurand': 'Current.Import', 'value': '12.47'},
{'unit': 'A', 'measurand': 'Current.Import', 'value': '8.8', 'phase': 'L1'},
{'unit': 'A', 'measurand': 'Current.Import', 'value': '25.19', 'phase': 'L2'},
{'unit': 'A', 'measurand': 'Current.Import', 'value': '3.42', 'phase': 'L3'},
{'unit': 'Wh', 'value': '163'}
]
}
}
Expected output:
{'connectorId': 1,
'transactionId': 5555,
'meterValue':
[{'timestamp': '2021-08-15T17:17:41.305Z',
'sampledValue':
[{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14'},
{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L1-N'},
{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L2-N'},
{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L3-N'},
{'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '17232.22'},
{'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '3799.31', 'phase': 'L1-N'},
{'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '7107.15', 'phase': 'L2-N'},
{'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '6325.76', 'phase': 'L3-N'},
{'unit': 'A', 'measurand': 'Current.Import', 'value': '12.47'},
{'unit': 'A', 'measurand': 'Current.Import', 'value': '8.8', 'phase': 'L1'},
{'unit': 'A', 'measurand': 'Current.Import', 'value': '25.19', 'phase': 'L2'},
{'unit': 'A', 'measurand': 'Current.Import', 'value': '3.42', 'phase': 'L3'},
{'unit': 'Wh', 'value': '163'}
]
}]
}
Hi,
Running some test using the simulator and it seems the output of the MeterValuesRequest message does not follow the ocpp 1.6 schema, which specifies that meterValue should be an array.
Schema:
{ "$schema": "http://json-schema.org/draft-04/schema#", "id": "urn:OCPP:1.6:2019:12:MeterValuesRequest", "title": "MeterValuesRequest", "type": "object", "properties": { "connectorId": { "type": "integer" }, "transactionId": { "type": "integer" }, "meterValue": { "type": "array", "items": { "type": "object", "properties": { "timestamp": { "type": "string", "format": "date-time" }, "sampledValue": { "type": "array", "items": { "type": "object", "properties": { "value": { "type": "string" }, "context": { "type": "string", "additionalProperties": false, "enum": [ "Interruption.Begin", "Interruption.End", "Sample.Clock", "Sample.Periodic", "Transaction.Begin", "Transaction.End", "Trigger", "Other" ] }, "format": { "type": "string", "additionalProperties": false, "enum": [ "Raw", "SignedData" ] }, "measurand": { "type": "string", "additionalProperties": false, "enum": [ "Energy.Active.Export.Register", "Energy.Active.Import.Register", "Energy.Reactive.Export.Register", "Energy.Reactive.Import.Register", "Energy.Active.Export.Interval", "Energy.Active.Import.Interval", "Energy.Reactive.Export.Interval", "Energy.Reactive.Import.Interval", "Power.Active.Export", "Power.Active.Import", "Power.Offered", "Power.Reactive.Export", "Power.Reactive.Import", "Power.Factor", "Current.Import", "Current.Export", "Current.Offered", "Voltage", "Frequency", "Temperature", "SoC", "RPM" ] }, "phase": { "type": "string", "additionalProperties": false, "enum": [ "L1", "L2", "L3", "N", "L1-N", "L2-N", "L3-N", "L1-L2", "L2-L3", "L3-L1" ] }, "location": { "type": "string", "additionalProperties": false, "enum": [ "Cable", "EV", "Inlet", "Outlet", "Body" ] }, "unit": { "type": "string", "additionalProperties": false, "enum": [ "Wh", "kWh", "varh", "kvarh", "W", "kW", "VA", "kVA", "var", "kvar", "A", "V", "K", "Celcius", "Celsius", "Fahrenheit", "Percent" ] } }, "additionalProperties": false, "required": [ "value" ] } } }, "additionalProperties": false, "required": [ "timestamp", "sampledValue" ] } } }, "additionalProperties": false, "required": [ "connectorId", "meterValue" ] }Received output:
{'connectorId': 1, 'transactionId': 5555, 'meterValue': {'timestamp': '2021-08-15T17:17:41.305Z', 'sampledValue': [{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14'}, {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L1-N'}, {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L2-N'}, {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L3-N'}, {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '17232.22'}, {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '3799.31', 'phase': 'L1-N'}, {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '7107.15', 'phase': 'L2-N'}, {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '6325.76', 'phase': 'L3-N'}, {'unit': 'A', 'measurand': 'Current.Import', 'value': '12.47'}, {'unit': 'A', 'measurand': 'Current.Import', 'value': '8.8', 'phase': 'L1'}, {'unit': 'A', 'measurand': 'Current.Import', 'value': '25.19', 'phase': 'L2'}, {'unit': 'A', 'measurand': 'Current.Import', 'value': '3.42', 'phase': 'L3'}, {'unit': 'Wh', 'value': '163'} ] } }Expected output:
{'connectorId': 1, 'transactionId': 5555, 'meterValue': [{'timestamp': '2021-08-15T17:17:41.305Z', 'sampledValue': [{'unit': 'V', 'measurand': 'Voltage', 'value': '239.14'}, {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L1-N'}, {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L2-N'}, {'unit': 'V', 'measurand': 'Voltage', 'value': '239.14', 'phase': 'L3-N'}, {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '17232.22'}, {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '3799.31', 'phase': 'L1-N'}, {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '7107.15', 'phase': 'L2-N'}, {'unit': 'W', 'measurand': 'Power.Active.Import', 'value': '6325.76', 'phase': 'L3-N'}, {'unit': 'A', 'measurand': 'Current.Import', 'value': '12.47'}, {'unit': 'A', 'measurand': 'Current.Import', 'value': '8.8', 'phase': 'L1'}, {'unit': 'A', 'measurand': 'Current.Import', 'value': '25.19', 'phase': 'L2'}, {'unit': 'A', 'measurand': 'Current.Import', 'value': '3.42', 'phase': 'L3'}, {'unit': 'Wh', 'value': '163'} ] }] }