npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

giotto-api

v1.0.8

Published

NodeJS wrapper for the GIoTTO and BuildingDepot APIs.

Downloads

4

Readme

node-giotto-api

NodeJS wrapper for the GIoTTO and BuildingDepot APIs.

Installation

  1. clone this repo,
  2. run npm install

Usage

This is how you initialize it:

var GIoTTOApi = require('./path/to/the/repo/folder');

var api = new GIoTTOApi({
  clientId: 'wHaTeVeR', # required
  clientSecret: 'wHaTeVeR', # required
  email: '[email protected]', # required, email for the user
  mqUsername: 'wHaTeVeR', # required, username for the RabbitMQ
  mqPassword: 'wHaTeVeR', # required, password for the RabbitMQ

  protocol: 'https', # defaults to https
  hostname: 'bd-exp.andrew.cmu.edu', # defaults to bd-exp.andrew.cmu.edu
  csPort: 81, # defaults to 81, port for the CentralService
  dsPort: 82 # defaults to 82, port for the DataService
});

api.authenticate(function (err) {
  // start using the api here
});

Sending sensor data:

api.createSensor(name, building, identifier, function (err, response, body) {});
api.addSensorMetadata(uuid, {});
api.postTimeseriesValue(sensorUuid, time, value);

Searching for sensors:

api.searchSensorsInBuilding(building, function (err, response, body) {});

Subscribing to sensor data over RabbitMQ:

api.startListeningForSensorData(function (err, sensor, value) {});
api.subscribeToSensor(sensor, function (err) {});
api.unsubscribeFromSensor(sensor);

Reading timeseries of one sensor:

api.readTimeseries(uuid, startTime, endTime, (err, data) => {
  // [ { time: 1484062558.954, value: 12.5 }, ... ]
});

Reading timeseries of multiple sensors:

api.readTimeseriesOfSensors([ uuid1, uuid2 ], startTime, endTime, (err, data) => {
  // [ { time: 1484062558.954, value: 12.5 }, ... ]
});

Using virtual sensors to classify data:

var sensor = api.virtualSensor();
var uuids = [
  [
    '6931acba-cea0-437f-aadf-982334ce583f',
    '288473c1-e809-4da0-85da-b77f53f62df0'
  ], // A group of sensors - their values will be merged and trained together

  [
    '5d952e43-d008-4713-9558-7031f7520e65'
  ] // Second group of sensors
];

sensor.addSample(uuids, 1484067040.554, 1484067050.121, 'light');
sensor.addSample(uuids, 1484067094.361, 1484067105.505, 'dark');
sensor.addSample(uuids, 1484067169.671, 1484067179.671, 'light');
sensor.addSample(uuids, 1484067130.728, 1484067140.500, 'dark');

sensor.train((err) => {
  if (err) { console.log(err); return;  }

  sensor.predict(uuids, 1484067263.748, 1484067273.748, (err, label) => {
    if (err) { console.log(err); return;  }

    console.log(label);
  });
});

Creating, publishing and listening on custom message queues:

api.publishToQueue(queueName, '{}', function (err) {});
api.subscribeToQueue(this.queueName, function (err, msg) {});