webrelay
http wrapper for operating a ControlByWeb relay device
api
#setup.run(host, mac, callback)
add anarp
entry forhost
and test withping
#setup.arp(host, mac, callback)
add anarp
entry forhost
#setup.ping(host, callback)
ping the givenhost
#switch(host, breaker, state, callback)
change the state ofbreaker
tostate
and return the state of the relay (xml)#state(host, callback)
return the state of the relay (xml)
usage
the module is programmed to spy at environment variables and runtime arguments for configuration data. runtime arguments take precedence over environment variables and default values.
var webrelay = host = webrelayconfigRELAY_HOST mac = webrelayconfigRELAY_MAC; // initial set upwebrelaysetup; // toggle a breakerwebrelay; // get the state back (in xml)webrelay;