Skip to content

Latest commit

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Smappee-NodeJS

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-

Installation

npm install smappee-nodejs --save

Usage

Create a new file 'my-smappee.js'

varSmappeeAPI=require('smappee-nodejs');varsmappee=newSmappeeAPI({debug: false,clientId: "xxx",clientSecret: "xxx",username: "xxx",password: "xxx"});module.exports=smappee;

In another nodejs file

varsmappee=require('./my-smappee');smappee.getServiceLocations(function(output){console.log(output);})

The following functions are available: getServiceLocations(callback), getServiceLocationInfo(serviceLocationId, callback), ...

API

getServiceLocations(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);})

getServiceLocationInfo(serviceLocationId, callback)

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);})

getConsumptions(serviceLocationId,aggregation, from, to, callback)

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

varmoment=require('moment');//This will get the consumptions for the last year til now.varfrom=moment().subtract(1,'year').utc().valueOf();varto=moment().utc().valueOf();smappee.getConsumptions("0000",smappee.AGGREGATION_TYPES.MONTHLY,from,to,function(output){console.log(output);})

About

Smappee Node JS API

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages