nkristoffersen / node-webrelay

Node module to control these relays http://www.controlbyweb.com/webrelay/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-webrelay

Node module to control these sweet ethernet controlled relays http://www.controlbyweb.com/webrelay/

installation

npm install nkristoffersen/node-webrelay

usage

  • Add to your node project and include the local IP address of the web relay.
const webRelay = require('@nkristoffersen/node-webrelay').webRelay;
  • Get relay status. The callback is the status returned from the web relay in JSON format.
webRelay.status(relayIpAddress)
  .then(function (result) {
    console.log(result);
  })
  .fail(function (error) {
    console.log(error);
  });
  • Close relay (on). The callback is the state returned from the web relay in JSON format.
webRelay.close(relayIpAddress)
  .then(function (result) {
    console.log(result);
  })
  .fail(function (error) {
    console.log(error);
  });
  • Open relay (off). The callback is the state returned from the web relay in JSON format.
webRelay.open(relayIpAddress)
  .then(function (result) {
    console.log(result);
  })
  .fail(function (error) {
    console.log(error);
  });

About

Node module to control these relays http://www.controlbyweb.com/webrelay/

License:MIT License


Languages

Language:JavaScript 100.0%