0.4.3 • Published 7 years ago

jarvis_node v0.4.3

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Jarvis Node

NodeJS Package to interacting with the Jarvis Server.

Usage

Jarvis

const Jarvis = require('jarvis_node');
Jarvis.URL // the URL to the jarvis server, either JARVIS_URL env var or http://localhost:3000

Device

Load in the default /etc/device.json

const Device = require('jarvis_node').Device;
const device = new Device();

// Register an action with the device
device.registerAction('BREW', () => {
  return 'Brewing Coffee';
});

// Register a Measurement with the device
device.registerMeasurement(
  'COFFEE_LEVEL',
  'http://localhost:3000',
  500,
  () => {
    return {
      value: 6,
      device_label: device.label,
      input_label: 'COFFEE_LEVEL',
      received: new Date()
    }
  }
);

Server

Start the Jarvis server

const Device = require('jarvis_node').Device;
const device = new Device();

// Action and measurement registrations

const Server = require('jarvis_node').Server(device);
0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago