A set of nodes to communicate via OCPP to a compatible charge box or central system
npm install node-red-contrib-ocpp
[Node-Red][4] nodes for communicating with the EVSE Charge Points and Central Systems via the [Open Charge Point Protocol][6] (hereafter OCPP). These node-red nodes
allow you to take on the role of a Central System (CS) or Charge Point (CP).
Based on the [OCPP 1.5][6] and [OCPP 1.6][8] specifications utilizing the Simple Object Access Protocol (hereafter SOAP) and JavaScript Object Notation (hereafter JSON) protocols.
Run the following command in the root directory of your Node-RED install
npm install node-red-contrib-ocpp
The package currently requires [Node.js 10][1] or higher.
* CS request SOAP
* CP request SOAP
* CS server
* CP server SOAP
* CP client JSON
* server response
* CS request JSON
* examples
_(nodes that begin with CS refer to those that emulate a Central System. Those with CP refer to those that emulate a Charge Point/EVSE)_
---
For example, to set up a Reset command request, you can select the Reset command from the nodes configuration dropdown. The Reset command
also requires sending a parameter indicating the type of reset to be performed, either hard or soft. In the Command Params field of the configuration, you would provide a JSON formatted object similar to this:
``javascript`
{
"type": "Soft"
}
Alternatively, you can pass the node a payload which contains a command and/or data to override the defaults. To make a Reset request
by passing it a message, the message payload (msg.payload) would look as follows:
`javascript`
{
"command": "Reset",
"data" : { "type" : "Hard" }
}
If either the command or the data sections are missing from the message, the defaults that are set up in the node configuration will be used. If you set up an CS request SOAP node
with a default command of Reset, you could pass in just the following:
for hard reset
`javascript`
{
"data": { "type": "Hard" }
}
for soft reset
`javascript`
{
"data": { "type": "Soft"}
}
User Generated Message IDs
For all request nodes the option exists to also pass in a user generated message ID that will be used to identify the message.
`javascript`
{
"command": "Reset",
"data" : { "type" : "Hard" },
"MessageId": "12345678"
}
This may make it easier for you to identify and track your message throughout your flows. By default, the node modules internally generate a unique id for request messages based on UUID v4
Output
The output returned by the node has the following message format:
`javascript`
{
"ocpp": {
"command": "
"chargeBoxIdentity": "
"url": "
"data": "
},
"payload": {
"command": "
"key": "value"
}
}
Example return message from a OCPP 1.5 SOAP
`javascript`
{
"_msgid":"58c0fa49.ecac14",
"topic":"",
"ocpp":{
"command":"Reset",
"MessageId":"f58ec0fb-b6fd-48a3-9a0c-2e0cba143388",
"chargeBoxIdentity":"Chargion6D94",
"url":"http://204.188.169.51:8080/chargePoint",
"ocppVer":"1.5s",
"data":{
"type":"Soft"
}
},
"payload":{
"command":"Reset",
"data":{
"status":"Accepted"
}
}
}
The payload portion varies depending on the command and EVSE charge point vendor specifications.
---
To emulate a EVSE charge point station that utilizes OCPP 1.6 JSON, use the CP client JSON node.
---
`javascript`
{
"ocpp": {
"ocppVersion": "
"command": "
"chargeBoxIdentity": "
"From": "
"MessageID": "
"messageType": "
},
"payload": {
"command": "
"data": "
}
}`
Here is an example of a OCPP 1.6 JSON Heartbeat request message.javascript`
{ "ocpp":{
"ocppVersion": "1.6j",
"chargeBoxIdentity": "veefil-48310","MessageId": "uuid:f1d11de1-5725-9255-854b-da6542b4d9bb",
"msgType": 2,
"command": "Heartbeat"
},
"payload":{
"command": "Heartbeat",
"data":{}
},
"msgId":"e38e0e7f-3db2-4a33-ab80-859175ebfce0","_msgid":"d310afd9.b9de8"
}
The incoming messages require a response (sent through the server response node), and those responses should be sent within
a reasonable amount of time. The ocpp-server node will cancel any outstanding responses after a 2 minute time period. The EVSE side
may timeout awaiting a response even sooner than that depending on their configuration.
---
For example, to accept a BootNotification request, set the payload of the response as:
`javascript``
{
"status": "Accepted",
"currentTime": new Date().toISOString(),
"heartbeatInterval": 60
}
(The message being passed from the server contains a unique identifier contained in msg.msgID. This needs to be present in the response message in order for the message to be returned to the proper request)
---
_Unlike the CS Server this node does not incorporate or support multiple protocols running concurrently, nor does it support JSON. To emulate an EVSE charge point that supports JSON, use the CP client JSON node._
---
In the root of the OCPP node module folder is a folder named examples. This is where you can find example flows that may be useful in setting up your OCCP situation. Currently a single example file exists which you can import into node-red that sets up a Central System node with a few basic Charge Point nodes. This is by no means a full production example, but just a starting point for those who may be interested in a way to set up the nodes.
[Bryan Nystrom][11]
[Jason D. Harper][5]
[Argonne National Laboratory][10]
[1]:https://nodejs.org/
[2]:https://na.chargepoint.com/UI/downloads/en/ChargePoint_Web_Services_API_Guide_Ver4.1_Rev4.pdf
[3]:https://webservices.chargepoint.com/cp_api_4.1.wsdl
[4]:http://nodered.org
[5]:https://github.com/jayharper
[6]:http://www.openchargealliance.org/protocols/ocpp/ocpp-15/
[7]:http://www.openchargealliance.org/uploads/files/protected/ocpp_specification_1.5_final.pdf
[8]:http://www.openchargealliance.org/protocols/ocpp/ocpp-15/
[9]:http://www.openchargealliance.org/uploads/files/protected/ocpp_specification_1.5_final.pdf
[10]:https://www.anl.gov
[11]: https://github.com/bnystrom