@hypericon/revpi-lib
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

RevPi Lib

npm (scoped)

Library to interact with Kunbus RevPi hardware from Nodejs applications.

Installation

$ npm i @hypericon/revpi-lib

Usage

Simple example:

// The `model` parameter helps catch errors when attempting to interact with non-existent hardware
const revpi = new RevPiLib({ model: "Core" });

// The last value written to the LEDs is tracked, allowing LEDs to have their colours individually
// controlled by the application
await revpi.ledSetA1("green");
await wait(1000);
await revpi.ledSetA2("red");
await wait(1000);
await revpi.ledSetA1("orange");
await wait(1000);
await revpi.ledSetA2("off");
await wait(1000);
await revpi.ledsAllOff();

/** Simple wait function for example code */
async function wait(ms) {
  return new Promise((resolve, reject) => {
    setTimeout(() => resolve(), ms);
  });
}

Optionally override the default logger by passing another as a parameter to the RevPiLib constructor options:

import { RevPiLogger } from "@hypericon/revpi-lib";

const myLogger: RevPiLogger = {
  // etc.
};

const revpi = new RevPiLib({
  model: "Core",
  logger: myLogger,
});

Details

The library executes commands using piTest which comes pre-installed on RevPi units.

More info here: https://revolutionpi.com/tutorials/overview-revpi-core/on-revpi-core/

Development

$ npm run dev

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i @hypericon/revpi-lib

    Weekly Downloads

    0

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    7.5 kB

    Total Files

    6

    Last publish

    Collaborators

    • dyenamic
    • neonfish
    • unany