Socket
Socket
Sign inDemoInstall

ocpi-library

Package Overview
Dependencies
6
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ocpi-library

An OCPI library for Node.js


Version published
Maintainers
1
Created

Readme

Source

node-ocpi

A Node.js library for handling Open Charge Point Interface (OCPI) data structures, including Location, EVSE, Connector, and CDR (Charge Detail Record) classes. This library helps in creating OCPI-compliant charging station management applications by providing structured data models and validation.

Features

  • Models for key OCPI entities: Location, EVSE, Connector, CDR.
  • Data validation for OCPI-compliant structure and format.
  • Easy integration into Node.js projects.

Installation

To install the node-ocpi library, use npm:

npm install https://github.com/hyndex/node-ocpi

Usage

Here's how to use the node-ocpi library in your project:

Importing the Library

const { Location, EVSE, Connector, CDR } = require('node-ocpi');

Creating and Using an OCPI Object

Location
const location = new Location(/* parameters */);
// Validate location data
location.validate();
EVSE
const evse = new EVSE(/* parameters */);
// Validate EVSE data
evse.validate();
Connector
const connector = new Connector(/* parameters */);
// Validate connector data
connector.validate();
CDR
const cdr = new CDR(/* parameters */);
// Validate CDR data
cdr.validate();

API Reference

Location Class

  • Constructor parameters: id, type, name, address, city, postalCode, country, coordinates, relatedLocations, parkingType, evse, facilities, time_zone, opening_times, charging_when_closed, images, energy_mix, business_details, operator, suboperator, owner, clearinghouse.
  • Methods: validate().

EVSE Class

  • Constructor parameters: uid, evse_id, status, capabilities, connectors, floor_level, coordinates, physical_reference, directions, parking_restrictions, images, charging_when_closed, last_updated, energy_mix, accessibility, related_evses, group_id, pricing_policy, realtime_data.
  • Methods: validate().

Connector Class

  • Constructor parameters: id, standard, format, powerType, maxVoltage, maxAmperage, maxElectricPower, voltage, amperage, tariff_id, last_updated, terms_and_conditions, phase_to_phase_voltage, phase, pricing, parking_spot, accessibility, authentication_modes, identification_restrictions, payment_methods, supported_energy_mix.
  • Methods: validate().

CDR Class

  • Constructor parameters: id, startDateTime, endDateTime, authId, authMethod, location, evseId, connectorId, meterId, currency, totalCost, chargingPeriods, totalEnergy, totalTime, lastUpdated, stopReason, totalParkingTime, totalReservationCost, remark, signedData, relatedCDRs, locationReference, productData, chargingPreferences, environmentalImpact.
  • Methods: validate().

Contributing

Contributions to node-ocpi are welcome! Please refer to the contributing guidelines for details on how to contribute to this project.

License

This project is licensed under the MIT License.

FAQs

Last updated on 24 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc