Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
# ChargeFlow

A CLI tool for analyzing your raw OCPP JSON messages. Useful for debugging and compatibility checks
with various Charge Point Management Systems or Charge Point implementations.
A CLI tool for analyzing your raw OCPP JSON messages. Useful for debugging and compatibility checks with various Charge
Point Management Systems or Charge Point implementations.

## Features

- [x] Validate Raw OCPP JSON messages against multiple OCPP schemas
- [x] Generate human-readable reports
- [x] Support for remote schema registries using Kafka-compatible Schemas Registry APIs
- [x] Bring your own OCPP schemas for vendor-specific extensions
- [x] Validating OCMF-compatible meter values

## Compatibility matrix

| OCPP specification | Supported |
|----------------------------:|:---------:|
| OCPP 1.6 | ✅ |
| OCPP 1.6 Security Extension | ✅ |
| OCPP 2.0.1 | ✅ |
| OCPP 2.1 | ✅ |
| OCPP 1.6 | ✅ |
| OCPP 1.6 Security Extension | ✅ |
| OCPP 2.0.1 | ✅ |
| OCPP 2.1 | ✅ |

### Roadmap

- [ ] Support for signed messages
- [ ] Compatibility checks

## Installation

### Binary

Download the latest release for your platform from the [releases page](https://github.com/chargepi/chargeflow/releases/latest).
Download the latest release for your platform from
the [releases page](https://github.com/chargepi/chargeflow/releases/latest).

**Linux / macOS**

Expand Down
344 changes: 344 additions & 0 deletions pkg/ocmf/OCMF.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,344 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:OCMF:1.0.1-DRAFT:OCMF",
"title": "Open Charge Metering Format (OCMF)",
"comment": "Based on SAFE-eV/OCMF-Open-Charge-Metering-Format, Datenformat_OCMF_v1.0.1-DRAFT. ",
"type": "object",
"additionalProperties": false,
"properties": {
"header": {
"description": "Header identifying the transfer format. Always the literal string 'OCMF'.",
"type": "string",
"const": "OCMF"
},
"payload": {
"$ref": "#/$defs/PayloadType"
},
"signature": {
"$ref": "#/$defs/SignatureType"
}
},
"required": [
"header",
"payload",
"signature"
],
"$defs": {
"PayloadType": {
"description": "the signed payload data (section 4.2). Top-level property names starting with U, V, W, X, Y or Z are reserved for vendor-specific extensions.",
"type": "object",
"patternProperties": {
"^[UVWXYZ]": {}
},
"properties": {
"FV": {
"description": "Format-Version: version of this data format as <major>.<minor>.",
"type": "string",
"examples": [
"1.0"
]
},
"GI": {
"description": "Gateway-Identification: identifier of the manufacturer for the signature-generating system (manufacturer, model, variant, etc.).",
"type": "string"
},
"GS": {
"description": "Gateway-Serial: serial number of the signature-generating system. Conditionally mandatory - required if the signing component is not otherwise uniquely identified (see section 4.4).",
"type": "string"
},
"GV": {
"description": "Gateway-Version: version designation of the manufacturer for the software of the signature-generating system.",
"type": "string"
},
"PG": {
"description": "Pagination: reference of the whole record within a stream of readings sharing one signature. Format <context><number>, without leading zeros. Context 'T' (Transaction) is mandatory to support; 'F' (Fiscal) is optional.",
"type": "string",
"pattern": "^[FT](0|[1-9][0-9]*)$",
"examples": [
"T12345"
]
},
"MV": {
"description": "Meter-Vendor: manufacturer identification of the meter.",
"type": "string"
},
"MM": {
"description": "Meter-Model: model identification of the meter.",
"type": "string"
},
"MS": {
"description": "Meter-Serial: serial number of the meter. Mandatory whenever the meter-identification field group (MV/MM/MS/MF) is used.",
"type": "string"
},
"MF": {
"description": "Meter-Firmware: firmware version of the meter.",
"type": "string"
},
"IS": {
"description": "Identification-Status: whether a user could be assigned to the reading (true) or not (false). Present if, and only if, there is a transaction reference.",
"type": "boolean"
},
"IL": {
"description": "Identification-Level: overall status of the user assignment.",
"type": "string",
"enum": [
"NONE",
"HEARSAY",
"TRUSTED",
"VERIFIED",
"CERTIFIED",
"SECURE",
"MISMATCH",
"INVALID",
"OUTDATED",
"UNKNOWN"
]
},
"IF": {
"description": "Identification-Flags: detail information about the user assignment.",
"type": "array",
"maxItems": 4,
"items": {
"type": "string",
"enum": [
"RFID_NONE",
"RFID_PLAIN",
"RFID_RELATED",
"RFID_PSK",
"OCPP_NONE",
"OCPP_RS",
"OCPP_AUTH",
"OCPP_RS_TLS",
"OCPP_AUTH_TLS",
"OCPP_CACHE",
"OCPP_WHITELIST",
"OCPP_CERTIFIED",
"ISO15118_NONE",
"ISO15118_PNC",
"PLMN_NONE",
"PLMN_RING",
"PLMN_SMS"
]
}
},
"IT": {
"description": "Identification-Type: type of the identification data carried in ID.",
"type": "string",
"enum": [
"NONE",
"DENIED",
"UNDEFINED",
"ISO14443",
"ISO15693",
"EMAID",
"EVCCID",
"EVCOID",
"ISO7812",
"CARD_TXN_NR",
"CENTRAL",
"CENTRAL_1",
"CENTRAL_2",
"LOCAL",
"LOCAL_1",
"LOCAL_2",
"PHONE_NUMBER",
"KEY_CODE"
]
},
"ID": {
"description": "Identification-Data: the actual identification data, formatted according to IT, e.g. a hex-encoded UID per ISO 14443.",
"type": "string",
"maxLength": 40
},
"CT": {
"description": "Charge-Point-Identification-Type: type of the charge point identification carried in CI.",
"type": "string",
"enum": [
"EVSEID",
"CBIDC"
]
},
"CI": {
"description": "Charge-Point-Identification: identification of the charge point, formatted according to CT.",
"type": "string"
},
"RD": {
"description": "Readings: one or more meter readings.",
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/ReadingType"
}
}
},
"required": [
"FV",
"PG",
"RD"
],
"dependentRequired": {
"MV": [
"MS"
],
"MM": [
"MS"
],
"MF": [
"MS"
],
"IS": [
"IT"
],
"IT": [
"IS"
],
"IL": [
"IS",
"IT"
],
"IF": [
"IS",
"IT"
],
"ID": [
"IS",
"IT"
]
}
},
"ReadingType": {
"description": "A single reading entry within the RD array (section 4.2.6). Fields with a value identical to the previous reading in the array may be omitted.",
"type": "object",
"additionalProperties": false,
"properties": {
"TM": {
"description": "Time: system time of the reading and its synchronization status, ISO 8601 with millisecond resolution followed by a single-letter time-status code.",
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2},\\d{3}[+-]\\d{4} [UISR]$",
"examples": [
"2018-07-24T13:22:04,000+0200 S"
]
},
"TX": {
"description": "Transaction: reason for the reading in relation to a transaction. B=Begin, C=Charging, X=Exception, E=End, L=Ended locally, R=Ended remotely, A=Aborted, P=Ended by power outage, S=Suspended, T=Tariff change. Absent if there is no transaction reference (Fiscal metering).",
"type": "string",
"enum": [
"B",
"C",
"X",
"E",
"L",
"R",
"A",
"P",
"S",
"T"
]
},
"RV": {
"description": "Reading-Value: the measured value. May be omitted together with RI, RU and RT if the reading only signals a meter error/event.",
"type": "number"
},
"RI": {
"description": "Reading-Identification: designation of the measurand, as an OBIS code (IEC 62056-6-1/-2). Forms a group with RU: both present or both absent.",
"type": "string"
},
"RU": {
"description": "Reading-Unit: unit of the reading. Forms a group with RI: both present or both absent.",
"type": "string",
"enum": [
"kWh",
"Wh"
]
},
"RT": {
"description": "Reading-Current-Type: type of current measured by the meter.",
"type": "string",
"enum": [
"AC",
"DC"
]
},
"EF": {
"description": "Error-Flags: which quantities are no longer usable for billing due to an error. 'E' = Energy, 't' = Time.",
"type": "string",
"pattern": "^[Et]*$"
},
"ST": {
"description": "Status: state of the meter at the time of the reading.",
"type": "string",
"enum": [
"N",
"G",
"T",
"D",
"R",
"M",
"X",
"I",
"O",
"S",
"E",
"F"
]
}
},
"required": [
"TM",
"ST"
],
"dependentRequired": {
"RI": [
"RU"
],
"RU": [
"RI"
]
}
},
"SignatureType": {
"description": "Signatursektion: the signature over the payload data (section 4.3).",
"type": "object",
"patternProperties": {
"^[UVWXYZABCDEF]": {}
},
"properties": {
"SA": {
"description": "Signature-Algorithm: algorithm (including curve and hash) used to create the signature. Defaults to ECDSA-secp256r1-SHA256 if omitted.",
"type": "string",
"enum": [
"ECDSA-secp192k1-SHA256",
"ECDSA-secp256k1-SHA256",
"ECDSA-secp192r1-SHA256",
"ECDSA-secp256r1-SHA256",
"ECDSA-brainpool256r1-SHA256",
"ECDSA-secp384r1-SHA256",
"ECDSA-brainpool384r1-SHA256"
]
},
"SE": {
"description": "Signature-Encoding: encoding of SD. Defaults to 'hex' if omitted.",
"type": "string",
"enum": [
"hex",
"base64"
]
},
"SM": {
"description": "Signature-Mime-Type: how to interpret the signature data. Defaults to 'application/x-der' if omitted.",
"type": "string",
"enum": [
"application/x-der"
]
},
"SD": {
"description": "Signature-Data: the actual signature data, encoded per SE and formatted per SM.",
"type": "string"
}
},
"required": [
"SD"
]
}
}
}
Loading
Loading