@energy-mutual/data-ingester-js
v1.0.7
Published
NodeJS library for pushing data to Energy Mutual platform
Downloads
2
Readme
About Energy Mutual
Energy Mutual helps owners of distributed energy assets make the most of their renewable resources. Check us out at energymutual.com
Getting Started
Prerequisites
You will need the following. Please contact Energy Mutual Support if you do not have them already.
- Certificate files
Installation
npm i @energy-mutual/data-ingester-js
Usage
All examples below assume the following:
clientId
ofEM123456
topicName
ofMyTopicName
- All required key/certificate files in a
certificates/
subdirectory
Creating EMDataIngester object and connecting
// Create Client
const client = new EMDataIngester(
"EM123456",
'MyTopicName',
{
key:'certificates/private.pem.key',
cert: 'certificates/certificate.pem.crt',
ca: 'certificates/CA.pem'
}
);
// Connect
await client.connect()
Adding parameters to payload
// Add powerOutput value to payload
client.addToPayload('powerOutput', '123', new Date(), 'kW')
// Add reservoirLevel value to payload
client.addToPayload('reservoirLevel', 10, new Date(), 'm')
Note that adding the same attribute name to the payload will rewrite the previous value
Sending payload
await client.sendPayload()
Note that this will clear the payload
Clearing payload
await client.clearPayload()
Viewing payload
console.log(client.payload)
Closing Connection (Important!)
client.end()
Contact
Energy Mutual - [email protected]