ra-wifi-proxy
Advanced tools
Comparing version 1.0.2 to 1.0.3
17
index.js
var http = require('http'); | ||
var assert = require('assert'); | ||
@@ -58,3 +59,6 @@ var portalRequestOpts = { | ||
module.exports = function(controllerOptions){ | ||
assert.notStrictEqual(controllerOptions, undefined, 'controllerOptions required') | ||
assert.ok(controllerOptions.hostname, 'controllerOptions.hostname is required'); | ||
controllerOptions.port = controllerOptions.port || 2000; | ||
controllerRequestOpts = controllerOptions; | ||
@@ -67,7 +71,4 @@ | ||
//options.port : Number : The port to set (1-8) | ||
//options.status : Number : Relay status to set (0=off, 1=on, 2=Auto) | ||
if(typeof options.box !== 'number' || typeof options.port !== 'number' | ||
|| typeof options.status !== 'number') cb(new Error('Relay options defined are not well formatted'), null); | ||
//options.status : Number : Relay status to set (0=off, 1=on, 2=Auto) | ||
assert.notStrictEqual(options, undefined, 'options required'); | ||
var mask = '/r' + options.box + options.port + options.status; | ||
@@ -156,4 +157,4 @@ send(mask, cb); | ||
//options.value : Number : The new value to set on the channel | ||
if(typeof options.channel !== 'number' | ||
|| typeof options.value !== 'number') cb(new Error('Override options not well formatted'), null); | ||
assert.notStrictEqual(options, undefined, 'Options required'); | ||
var override = '/po' + options.channel + ',' + options.value; | ||
@@ -160,0 +161,0 @@ send(override, cb, false); |
{ | ||
"name": "ra-wifi-proxy", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "ReefAngel proxy module to query and make commands on the controller at the provided endpoint", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "mocha" | ||
}, | ||
@@ -16,7 +16,11 @@ "repository": { | ||
], | ||
"author": { | ||
"name" : "David Molton", | ||
"email" : "dmolton@gmail.com" | ||
}, | ||
"license": "MIT" | ||
"author": { | ||
"name": "David Molton", | ||
"email": "dmolton@gmail.com" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"mocha": "^2.3.3", | ||
"should": "^7.1.1" | ||
} | ||
} |
# ReefAngel Wifi Proxy | ||
[![Build Status](https://travis-ci.org/davemolton/ra-wifi-proxy.svg?branch=master)](https://travis-ci.org/davemolton/ra-wifi-proxy) | ||
The ReefAngel Wifi Proxy is a Node.js module for connecting to a ReefAngel wifi enabled controller and executing | ||
@@ -3,0 +6,0 @@ queries and commands against it. |
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
7290
9
154
1
45
2