Initial commit

This commit is contained in:
2018-09-30 14:10:06 +08:00
commit e3af2bd74a
22 changed files with 2240 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
if (process.argv.length<3) {
console.log('Call: test_upsvars.js <ip> <port> <ups-name>');
process.exit();
}
var Nut = require('node-nut');
//oNut = new Nut(3493, 'localhost');
oNut = new Nut(process.argv[3], process.argv[2]);
oNut.on('error', function(err) {
console.log('There was an error: ' + err);
});
oNut.on('close', function() {
console.log('Connection closed.');
});
oNut.on('ready', function() {
self = this;
this.GetUPSVars(process.argv[4],function(varlist) {
console.log(varlist);
self.close();
});
});
oNut.start();