sensorpush
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

sensorpush

This is a JavaScript/TypeScript npm module for the SensorPush API. It is lightweight; this module requires ZERO external modules, especially no big request or node-fetch module.

It is unofficial and I'm happy to hand ownership over to the sensorpush.com team, or another engineer they approve of.

SensorPush

Installation

npm install sensorpush
# or
yarn add sensorpush

A quick example

It's very easy to get all your sensorpush data in a NodeJs program.

const sensorpush = require('sensorpush').api
const email = 'you@foo.com'
const password = 'BO000yAH!'
 
async function main() {
  try {
    // autorize ourselves
    const {authorization} = await sensorpush.oauth.authorize(email, password)
    const {accesstoken} = await sensorpush.oauth.accesstoken(authorization)
 
    // get and print some data
    const sensors = await sensorpush.devices.sensors(accesstoken)
    const gateways = await sensorpush.devices.gateways(accesstoken)
    const samples = await sensorpush.samples(accesstoken, new Date(Date.now() - 3600000), 5)
    console.log({sensors, gateways, samples})
  } catch (err) {
    console.error(err)
  }
}
 
main()

Package Sidebar

Install

npm i sensorpush

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

8.4 kB

Total Files

5

Last publish

Collaborators

  • malgorithms