Ocpp Message¶
IMPORTANT. :class: warning
This message is under development and is unstable.This message currently supports the following OCPP messages:
GetVariables
GetInstalledCertificateIds
SetVariables
InstallCertificate
DeleteCertificate
SetNetworkProfile
CertificateSigned
SignCertificate
OcppMessageRequest¶
Description.
Used to embed OCPP request and response messages, allowing the OEM to exchange OCPP messages with Josev.
OCPP request messages can be sent by OEM or Josev using the MQTT OcppMessageRequest, where the CALL fields “Action” and “Payload” as defined in the OCPP specification (OCPP Ed.3 part 4 section 4.2.1) correspond to the “message_name” and the “payload” fields in the MQTT message.
OcppRequest¶
Topic: cs/josev or josev/cs. Used this message to embed an OCPP request message. |
|||
type |
object |
||
properties |
|||
|
type |
string |
|
format |
uuid |
||
|
const |
ocpp_message |
|
|
const |
request |
|
|
type |
object |
|
properties |
|||
|
type |
string |
|
enum |
ocpp1.6, ocpp2.0.1, ocpp2.1 |
||
|
type |
string |
|
enum |
GetVariables, GetInstalledCertificateIds, SetVariables, InstallCertificate, DeleteCertificate, SetNetworkProfile, CertificateSigned, SignCertificate |
||
|
The payload is the OCPP request message payload. It is an object with the properties defined by the OCPP message schema. |
||
type |
object |
Example:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "request",
"data": {
"ocpp_version": "ocpp2.0.1",
"message_name": "GetVariables",
"payload": {
"getVariableData": [
{"component": {"name": "TxCtrlr"}, "variable": {"name": "TxStartPoint"}}
]
}
}
}
OcppMessageResponse¶
Ocpp response messages can be sent by OEM or Josev using the MQTT OcppMessageResponse, where the CALLRESULT field “Payload” as defined in the OCPP specification (OCPP Ed.3 part 4 section 4.2.2) corresponds to the “payload” field in the MQTT message.
OcppResponse¶
Topic: josev/cs or cs/josev. Used this message to embed an OCPP response message. |
|||
type |
object |
||
properties |
|||
|
type |
string |
|
format |
uuid |
||
|
const |
ocpp_message |
|
|
const |
response |
|
|
type |
object |
|
properties |
|||
|
type |
string |
|
enum |
ocpp1.6, ocpp2.0.1, ocpp2.1 |
||
|
type |
string |
|
enum |
CallResult, CallError |
||
|
The payload is the OCPP response message payload. It is an object with the properties defined by the OCPP message schema. |
||
type |
object |
||
|
The field must contain a string from the RPC Framework Error Codes Table. |
||
type |
string |
||
|
The field must contain a string with a human-readable description of the error. |
||
type |
string |
||
maxLength |
255 |
||
|
The field must contain an object with additional information about the error. The object can contain any additional information that can help to understand the error. |
||
type |
object |
Example:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "response",
"data": {
"message_type": "CallResult", # or "CallError"
"ocpp_version": "ocpp2.0.1",
"payload": {
"getVariableResult":[
{
"attributeStatus":"Accepted",
"component":{"name":"TxCtrlr"},
"variable":{"name":"TxStartPoint"},
"attributeType":"Actual",
"attributeValue":"Authorized,EVConnected"
}
]
}
}
}
If an error is encounter while processing the request, the response will contain a message type CallError as described in the example below.
Example:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "response",
"data": {
"message_type": "CallError",
"ocpp_version": "ocpp2.0.1",
"error_code": "FormatViolation",
"error_description": "Payload for Action is syntactically incorrect or structure for Action"
"error_details": {
"details": "An internal error occurred"
}
}
}
OcppMessageRequest message examples:¶
Example GetVariables Multiple Variables:
message = {
"id":"2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name":"ocpp_message",
"type":"request",
"data":{
"ocpp_version":"ocpp2.0.1",
"message_name":"GetVariables",
"payload":{
"getVariableData":[
{
"attributeType":"Actual",
"component":{
"name":"OCPPCommCtrlr"
},
"variable":{
"name":"OfflineThreshold"
}
},
{
"attributeType":"Actual",
"component":{
"name":"AuthCtrlr"
},
"variable":{
"name":"LocalAuthorizeOffline"
}
}
]
}
}
}
Example GetInstalledCertificateIds:
message = {
"id":"2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name":"ocpp_message",
"type":"request",
"data":{
"ocpp_version":"ocpp2.0.1",
"message_name":"GetInstalledCertificateIds",
"payload":{
"certificateType": [
"CSMSRootCertificate"
]
}
}
}
Example SetVariables:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "request",
"data": {
"ocpp_version": "ocpp2.0.1",
"message_name": "SetVariables",
"payload": {
"setVariableData": [
{
"attributeType": "Actual",
"attributeValue": "300",
"component": {
"name": "OCPPCommCtrlr"
},
"variable": {
"name": "OfflineThreshold"
}
},
{
"attributeType": "Actual",
"attributeValue": "true",
"component": {
"name": "AuthCtrlr"
},
"variable": {
"name": "LocalAuthorizeOffline"
}
}
]
}
}
}
Example InstallCertificate:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "request",
"data": {
"ocpp_version": "ocpp2.0.1",
"message_name": "InstallCertificate",
"payload": {
"certificate": "-----BEGIN CERTIFICATE-----\nMIIB6TCCAY+gAwIBAgIBBDAKBggqhkjOPQQDAjBbMRcwFQYDVQQDDA5PQ1RUIFJv\nb3QgQ0EgMjEdMBsGA1UECgwUT3BlbiBDaGFyZ2UgQWxsaWFuY2UxCzAJBgNVBAYT\nAk5MMRQwEgYKCZImiZPyLGQBGRYET0NUVDAgFw0yNDA1MzAxMzE3MjBaGA8yMDY0\nMDUyMDEzMTcyMFowWzEXMBUGA1UEAwwOT0NUVCBSb290IENBIDIxHTAbBgNVBAoM\nFE9wZW4gQ2hhcmdlIEFsbGlhbmNlMQswCQYDVQQGEwJOTDEUMBIGCgmSJomT8ixk\nARkWBE9DVFQwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATuV4ikq+qqgURL2m4g\ncWRNHvUffxvZQVf2W66PIMAcIUShWQBGxeoTh4dA50lppIZ9VnCGqqUPuzp9o76K\nZh0jo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4E\nFgQUofbdHSg6eZ0gV58pJ9cGYcj9AgEwCgYIKoZIzj0EAwIDSAAwRQIgMxFfJo32\nXJMda8wNqIa5InptZd1uqBT6RUgItUBEi7QCIQDZywzquLFUV2xWPzm4vV2jWUlZ\nyS1DpSC11DclzOkvUw==\n-----END CERTIFICATE-----\n",
"certificateType": "CSMSRootCertificate"
}
}
}
Example DeleteCertificate:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "request",
"data": {
"ocpp_version": "ocpp2.0.1",
"message_name": "DeleteCertificate",
"payload": {
"certificateHashData": {
"hashAlgorithm": "SHA256",
"issuerKeyHash": "6fb6606900c9143982873363e815ae67163667c5792cd919afd37783bbff3095",
"issuerNameHash": "d1c53ae0a9d11dda803bf38fc580dc9869ffb234b561fa624a20e618ce4bb656",
"serialNumber": "4"
}
}
}
}
Example SetNetworkProfile:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "request",
"data": {
"ocpp_version": "ocpp2.0.1",
"message_name": "SetNetworkProfile",
"payload": {
"configurationSlot": 2,
"connectionData": {
"messageTimeout": 75,
"ocppCsmsUrl": "wss://324595e6999a17ae.octt.openchargealliance.org:18603",
"ocppInterface": "Wired0",
"ocppTransport": "JSON",
"ocppVersion": "OCPP20",
"securityProfile": 2
}
}
}
}
Example CertificateSigned:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "request",
"data": {
"ocpp_version": "ocpp2.0.1",
"message_name": "CertificateSigned",
"payload": {
"certificateChain": "-----BEGIN CERTIFICATE-----\nMIIBjzCCATagAwIBAgIBATAKBggqhkjOPQQDAjBZMRUwEwYDVQQDDAxPQ1RUIFJv\nb3QgQ0ExHTAbBgNVBAoMFE9wZW4gQ2hhcmdlIEFsbGlhbmNlMQswCQYDVQQGEwJO\nTDEUMBIGCgmSJomT8ixkARkWBE9DVFQwHhcNMjUwNDAzMTIyNzA5WhcNMjYwNDAz\nMTIyNzA5WjBKMRYwFAYDVQQDDA05NzgzMTYxNDg0MTAwMQ8wDQYDVQQKDAZTd2l0\nY2gxCzAJBgNVBAYTAkdCMRIwEAYKCZImiZPyLGQBGRYCQ1MwWTATBgcqhkjOPQIB\nBggqhkjOPQMBBwNCAARoXZcBZ1c6zGw0aXBYq3vSsFMFYIXe9H8MJRnWXb2ha0Hh\nGW8tzH4VGk3+NFOBZdbvg2FaXzrGSYSsLgTQNObuMAoGCCqGSM49BAMCA0cAMEQC\nIHQLQ5rtbakvDYA43IDhfDR8zU+BT01SFy7ViCLs5++xAiBrRkvMA0ZbtUNS81RA\nrgqq1n32rktoZEUzP2W29xmKkQ==\n-----END CERTIFICATE-----",
"certificateType": "V2GCertificate"
}
}
}
Example SignCertificate:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "request",
"data": {
"ocpp_version": "ocpp2.0.1",
"message_name": "SignCertificate",
"payload": {
"csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIIBNTCB2wIBADBKMRYwFAYDVQQDDA05NzgzMTYxNDg0MTAwMQ8wDQYDVQQKDAZT\nd2l0Y2gxCzAJBgNVBAYTAkdCMRIwEAYKCZImiZPyLGQBGRYCQ1MwWTATBgcqhkjO\nPQIBBggqhkjOPQMBBwNCAARoXZcBZ1c6zGw0aXBYq3vSsFMFYIXe9H8MJRnWXb2h\na0HhGW8tzH4VGk3+NFOBZdbvg2FaXzrGSYSsLgTQNObuoC8wLQYJKoZIhvcNAQkO\nMSAwHjAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0TAQH/BAIwADAKBggqhkjOPQQDAgNJ\nADBGAiEAsQIGFrb+KkXhpwRHoNA9g/7dp9rKzmhxLvSH81Zwj+MCIQC9RiTISte0\nSnBGle3oydnj7SskFtucdCqA7jeomE0fNw==\n-----END CERTIFICATE REQUEST-----\n",
"certificateType": "ChargingStationCertificate"
}
}
}
OcppMessageResponse message examples:¶
Example GetInstalledCertificateIds response:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "response",
"data": {
"message_type": "CallResult", # or "CallError"
"ocpp_version": "ocpp2.0.1",
"payload": {
"status":"Accepted",
"certificateHashDataChain":[{
"certificateType":
"CSMSRootCertificate",
"certificateHashData":{
"hashAlgorithm":"SHA256",
"issuerNameHash":"de61235ee2958b67c7a47469cccb7ccbf77501d57af72c437ca092467fa00cac",
"issuerKeyHash":"84c8c4dfdec3696e58c124c76ed430f20c6fbcfaec0c4fbbe77b834c54d12e27",
"serialNumber":"2"
}
}]
}
}
}
Example SetVariables response:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "response",
"data": {
"message_type": "CallResult", # or "CallError"
"ocpp_version": "ocpp2.0.1",
"payload": {
"setVariableResult": [
{
"attributeStatus": "Accepted",
"component": {
"name": "OCPPCommCtrlr"
},
"variable": {
"name": "OfflineThreshold"
},
"attributeType": "Actual"
},
{
"attributeStatus": "Accepted",
"component": {
"name": "AuthCtrlr"
},
"variable": {
"name": "LocalAuthorizeOffline"
},
"attributeType": "Actual"
}
]
}
}
}
Example CertificateSigned response:
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "response",
"data": {
"message_type": "CallResult", # or "CallError"
"ocpp_version": "ocpp2.0.1",
"payload": {
"status": "Accepted"
}
}
}
Example CertificateSigned response::
message = {
"id": "2b0aa109-21a1-4f2f-bdbd-6cdf139e7bb1",
"name": "ocpp_message",
"type": "response",
"data": {
"message_type": "CallResult", # or "CallError"
"ocpp_version": "ocpp2.0.1",
"payload": {
"status": "Accepted"
}
}