sharecharge-common
Common code, libraries, conf files for the S&C platform solution
npm install @motionwerk/sharecharge-common
Models
Location
Locations can be deserialized to ensure that they conform to OCPI:
const location = Location.deserialize(/* location object */);
OCPI properties can then be accessed along with helper functions:
location.id
// "LOCATION-1"
location.getEvseIds()
/*
[
"DE-1234-1",
"DE-1234-2"
]
*/
Tariff
Tariffs can also be deserialized as above:
const tariff = Tariff.deserialize(/* tariff object */);
Likewise, additional helper functions are provided:
tariff.currency
// "EUR"
tariff.calculatePrice("ENERGY", 10000);
// 380