jarvis_node

0.4.3 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i jarvis_node

Weekly Downloads

3

Version

0.4.3

License

MIT

Last publish

Collaborators

  • skylerto