Here you will find helpful scripts accessing energy metering data. To use these scripts you must first be granted access to your municipality's Energy Metering API.
AFter downloading this repository, make sure to complete the credentials.js file with your personal credentials. While each field currently has placeholders, these must all be replaced with your client credentials.
energyconsumption.js is one script which:
- Gets a token using your credentials in credentials.js
- Uses that token to query for all the energy metering assets (sensors) for your tenant.
- Then for each energy metering asset, the script gets the total energy consumed (in kWh) by that node for that period of time and logs it in a csv file saved locally.
- Download the EnergyMetering-API-Solutions Repository
- Modify credentials.js with your credentials
- Download and install NodeJS
- Navigate via your terminal(or command line) to the EnergyMetering-API-Solutions directory and type the following command:
npm install
- This will install the dependent packages documented in package.json.
- Once the above command completes you are now ready to use energyconsumption.js
To Run energyconsumption.js you will need to obtain the Unix start and end times that you want energy metering data for. We recommend using https://www.epochconverter.com/ for start and end input parameters
*Note: * The maximum time span that can be used for this script is 35 days. The minimum time span that can be used for this script is 3 hours.
Once you have your two unix timestamps (in milliseconds), type the following command in the commandline of the EnergyMetering-API-Solutions Directory
node energyconsumption.js startTimestamp endTimestamp
For Example, to obtain data for 1 Nov 2019 to 5 Nov 2019 your command will look like:
node energyconsumption.js 1572580800000 1572930000000