# ocpp-js

> Open Charge Point Protocol Implementation in JS

Latest version **1.1.6** (published 2017-02-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install ocpp-js
pnpm add ocpp-js
yarn add ocpp-js
bun add ocpp-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2017-02-24 |
| First published | 2017-01-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 18 |
| Known vulnerabilities | 0 (+20 in 5 direct dependencies) |
| Install scripts | no |
| GitHub stars | 62 |
| Author | Aymen Mouelhi |
| Maintainers | aymen.mouelhi |
| Keywords | ocpp |

## Links

- npm: https://www.npmjs.com/package/ocpp-js
- Repository: https://github.com/aymen-mouelhi/ocpp-js
- Homepage: https://github.com/aymen-mouelhi/ocpp-js#readme
- Issues: https://github.com/aymen-mouelhi/ocpp-js/issues
- npm.io page: https://npm.io/package/ocpp-js

## Dependencies (18)

- [ip](https://npm.io/package/ip.md) ^1.1.4
- [path](https://npm.io/package/path.md) ^0.12.7
- [soap](https://npm.io/package/soap.md) ^0.18.0
- [async](https://npm.io/package/async.md) ^2.1.4
- [config](https://npm.io/package/config.md) ^1.24.0
- [moment](https://npm.io/package/moment.md) ^2.17.1
- [express](https://npm.io/package/express.md) ^4.14.1
- [promise](https://npm.io/package/promise.md) ^7.1.1
- [request](https://npm.io/package/request.md) ^2.79.0
- [uuid-js](https://npm.io/package/uuid-js.md) ^0.7.5
- [bindings](https://npm.io/package/bindings.md) ^1.2.1
- [firebase](https://npm.io/package/firebase.md) ^3.6.6
- [mongoose](https://npm.io/package/mongoose.md) ^4.8.0
- [externalip](https://npm.io/package/externalip.md) ^1.0.2
- [ip-address](https://npm.io/package/ip-address.md) ^5.8.6
- [portfinder](https://npm.io/package/portfinder.md) ^1.0.12
- [body-parser](https://npm.io/package/body-parser.md) ^1.16.0
- [strong-soap](https://npm.io/package/strong-soap.md) ^1.2.0

## Recent versions

- 1.1.6 (latest) — 2017-02-24
- 1.1.5 — 2017-02-24
- 1.1.4 — 2017-02-24
- 1.1.2 — 2017-02-24
- 1.1.1 — 2017-02-19
- 1.1.0 — 2017-02-02
- 1.0.0 — 2017-01-24

## README

# ocpp-js
Open Charge Point Protocol Implementation in JS

## Installation
`npm install --save ocpp-js`

## Overview

Open Charge Point Protocol (OCPP, <http://ocppforum.net>) is a communication
protocol between multiple charging stations ("charge points") and a single
management software ("central system").

Currently two OCPP versions (1.2 and 1.5) have been released.
There is a draft in progress for a new version (2.0).
Both existing versions use SOAP over HTTP as the RPC/transport protocol:

    +---------------+ soap/http client      soap/http server +----------------+
    |               |--------------------------------------->|                |
    |               |  Operations initiated by ChargePoint   |                |
    |  Charge Point |                                        | Central System |
    |               | soap/http server      soap/http client |                |
    |               |<---------------------------------------|                |
    +---------------+  Operations initiated by CentralSystem +----------------+


## Usage
OCPP JS uses a MongoDB DB to store all the actions received from charge points example: BootNotification, MeterValues, StartTransaction ...
Currently, the project supports MongoDB, firebase and file storage.
In order to specify which DB to use, create a folder config, and then create a file default.json and insert your preferred storage method:

```
{
    "defaultDB": "mongodb",
    "mongodb": {
        "url": "mongodb://localhost/mydb"
    },
    "firebase": {
      "apiKey": "[apiKey]",
      "authDomain": "[authDomain]",
      "databaseURL": "[databaseURL]",
      "storageBucket": "[storageBucket]",
      "messagingSenderId": "[messagingSenderId]"
  }
}
```
You can use Firebase by setting defaultDB : firebase.

To be able to create a Central System, some charging points and a charging point server, you can use this code snippet:

```
var OCPP =  require('ocpp-js');

var options = {
  centralSystem: {
    port: 9220
  },
  chargingPoint: {
    serverURI: 'http://localhost:9221/Ocpp/ChargePointService',
    name: 'Simulator 1'
  },
  chargingPointServer: {
    port: 9221
  }
}

var ocppJS = new OCPP(options);

// Create Central System
var centralSystem = ocppJS.createCentralSystem();

// Create Charging Point Client
var chargingPoint1 = ocppJS.createChargingPoint('http://127.0.0.1:8081/ChargeBox/Ocpp', "chargingPoint1-Simulator");
var chargingPoint2 = ocppJS.createChargingPoint('http://localhost:9221/Ocpp/ChargePointService', "chargingPoint2-Simulator");

// Charging Point Params can be also taken from options
var chargingPoint1 = ocppJS.createChargingPoint();

// Create Charging Point Server
var chargingPointServer = ocppJS.createChargingPointServer(9221);

```

---
_Source: https://npm.io/package/ocpp-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
