Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
lufihengr

OCPP 1.6 JSON and websockets

Recommended Posts

Posted · Original PosterOP

Hi,

I'm trying to build a backend system using OCPP 1.6 JSON over websockets in Node. I am having some trouble with the whole websockets thing, I have experience with REST api's but this is throwing me for a loop.

 

Essentially where I am at is that I receive a message from the charger like this: 

[2,
   "19223201",
   "BootNotification",
   {"chargePointVendor": "VendorX", "chargePointModel": "SingleSocketCharger"}
]

I need to put this in a database which I can probably figure out myself, but more importantly I need to de-construct the message and generate an appropriate response.

 

In this case it would look something like this: 

[3,
   "19223201",
   {"status":"Accepted", "currentTime":"2013-02-01T20:53:32.486Z", "heartbeatInterval":300}
]

 

And I have no idea how to do it. Essentially I need a lot of if statements like if the massage has "BootNotification" in it, then send the accept message and if it has something else, then respond appropriately.

 

If someone can help, I'll buy you a beer or coffee or beverage of your choosing? :D

 

Edit: the documentation for the OCPP protocol is available here: https://www.openchargealliance.org/downloads/


My PC CPU: 2600K@4.5GHz 1.3v Cooler: Noctua NH-U12P SE2 MB: ASUS Maximus IV RAM: Kingston 1600MHz 8GB & Corsair 1600MHz 16GB GPU: 780Ti Storage: Samsung 850 Evo 500GB SSD, Samsung 830 256GB SSD, Kingston 128GB SSD, WD Black 1TB,WD Green 1TB. PSU: Corsair AX850 Case: CM HAF X. Optical drive: LG Bluray burner  MacBook Pro, Hackintosh

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×