项目作者: elifTech

项目描述 :
Open Charge Point Protocol
高级语言: JavaScript
项目地址: git://github.com/elifTech/cpd-ocpp.git
创建时间: 2018-01-24T19:52:37Z
项目社区:https://github.com/elifTech/cpd-ocpp

开源协议:MIT License

下载


Open Charge Point Protocol 1.6

Build Status

This repository contain abstraction layer for easy work with OCPP and validate input and output requests.
Currently implemented only version 1.6 JSON. Whereas OCPP2.0 will support only JSON have no plans to implement SOAP.

Article

https://www.eliftech.com/blog/48-a-diy-charging-point-for-an-electric-car-perspective-protocol-and-prototype

Installation

  1. npm install --save ocpp-eliftech

Overview

Open Charge Point Protocol (OCPP, http://www.openchargealliance.org) is a communication protocol between multiple charging stations (“charge points”) and a single management software (“central system”).

Usage

Server

  1. import { OCPPServer, OCPPCommands } from 'ocpp-eliftech';
  2. const server = new OCPPServer();
  3. server.listen(9220);
  4. server.onRequest = async function(command) {
  5. // Handle different commands
  6. if (command instanceof OCPPCommands.BootNotification) {
  7. return {
  8. status: 'Accepted',
  9. currentTime: new Date().toISOString(),
  10. interval: 60
  11. };
  12. }
  13. }

Client

  1. import { OCPPClient, OCPPCommands } from 'ocpp-eliftech';
  2. const client = new OCPPClient({
  3. serverUrl: 'http://localhost:9220/webServices/ocpp/CP1111'
  4. });
  5. await client.connect();
  6. const boot = new OCPPCommands.BootNotification({
  7. chargePointVendor: 'BrandX',
  8. chargeBoxSerialNumber: 'AQ1234VB5678',
  9. chargePointSerialNumber: '123',
  10. chargePointModel: '12'
  11. });
  12. let answer = await client.send(boot);
  13. console.info(answer);

P.S.

If you need professional support with your IOT projects contact us http://www.eliftech.com/.