Smappee nodejs project to read smappee data.
Based on https://support.smappee.com/hc/en-us/articles/202153935-Where-can-I-find-the-API-documentation-
npm install smappee-nodejs --save
var SmappeeAPI = require('smappee-nodejs');
var smappee = new SmappeeAPI({
debug: false,
clientId: "xxx",
clientSecret: "xxx",
username: "xxx",
password: "xxx"
});
module.exports = smappee;
var smappee = require('./my-smappee');
smappee.getServiceLocations(function(output) {
console.log(output);
})
The following functions are available:
getServiceLocations(callback)
, getServiceLocationInfo(serviceLocationId, callback)
, ...
This method will get all smappee devices configured on the account. See https://smappee.atlassian.net/wiki/display/DEVAPI/Get+Servicelocations
smappee.getServiceLocations(function(output) {
console.log(output);
})
Get the details about 1 service location (list of appliances, list of actuators, ...). See https://smappee.atlassian.net/wiki/display/DEVAPI/Get+Servicelocation+Info
smappee.getServiceLocationInfo("0000", function(output) {
console.log(output);
})
Get a list of all consumptions for the specified period and interval. The aggregation can be selected from one of the values of smappee.AGGREGATION_TYPES. See https://smappee.atlassian.net/wiki/display/DEVAPI/Get+Consumption
var moment = require('moment');
//This will get the consumptions for the last year til now.
var from = moment().subtract(1, 'year').utc().valueOf();
var to = moment().utc().valueOf();
smappee.getConsumptions("0000", smappee.AGGREGATION_TYPES.MONTHLY, from, to, function(output) {
console.log(output);
})