Files
node-screenlogic/test.js
Parnic b6ee816fb3 Added decoding of messages
Also moved things out to their own files and setup require()s to bring it all together.
2018-03-30 16:07:56 -05:00

24 lines
701 B
JavaScript
Executable File

const ScreenLogic = require('./index');
var finder = new ScreenLogic.FindUnits();
finder.on('serverFound', function(server) {
var client = new ScreenLogic.UnitConnection(server);
client.on('loggedIn', function() {
this.getPoolStatus();
this.getControllerConfig();
}).on('poolStatus', function(status) {
console.log(" pool ok=" + status.ok);
console.log(" air temp=" + status.airTemp);
console.log(" salt ppm=" + status.saltPPM * 50);
console.log(" pH=" + status.pH / 100);
}).on('controllerConfig', function(config) {
console.log(" controller is in celsius=" + config.degC);
client.close();
finder.close();
});
client.connect();
});
finder.search();