-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic question from a novice: Truncated example.js output #40
Comments
Can you share a gist or something with your example.js contents? Are you sure you're still on the correct remote? Additionally, it looks like you've got node-screenlogic stored as a node module under node_screenlogic, which is also odd. Make sure your environment is setup the way you expect it to be ( |
Might be my novice approach. On a new windows 10 machine I installed
node.js from installer on nodejs.org.
Once done I check versions of node and npm.
Then I created a nide-screenlogic directory on my desktop.
navigated there,
Did npm init
Then I ran command at npm repository....webpage:
https://www.npmjs.com/package/node-screenlogic
https://www.npmjs.com/package/node-screenlogic
it gave some warning I dont recall. I then had the following in the
directory: (the exception of the new file example chris.
[image: image.png]
[image: image.png]
the example file was then modified with the lan IP of my screenlogic.
and ran....node example
below is the file:
'use strict';
const ScreenLogic = require('./index');
// use this to find and connect to units local to the network this is
running on
// var finder = new ScreenLogic.FindUnits();
// finder.on('serverFound', function(server) {
// finder.close();
// console.log('server found.');
// console.log(' gatewayName=' + server.gatewayName);
// console.log(' address=' + server.address);
// connect(new ScreenLogic.UnitConnection(server));
// });
// finder.search();
// use this if you want to use a direct connection to a known unit
connect(new ScreenLogic.UnitConnection(80, '192.168.1.131'));
// use this to remote connect to a system by name (going through the
Pentair servers)
// const systemName = 'Pentair: 07-E1-E6';
// const password = '1235';
// var remote = new ScreenLogic.RemoteLogin(systemName);
// remote.on('gatewayFound', function(unit) {
// remote.close();
// if (unit && unit.gatewayFound) {
// console.log('unit ' + remote.systemName + ' found at ' + unit.ipAddr
+ ':' + unit.port);
// connect(new ScreenLogic.UnitConnection(unit.port, unit.ipAddr,
password));
// } else {
// console.log('no unit found by that name');
// }
// });
// remote.connect();
var count = 0;
// generic connection method used by all above examples
function connect(client) {
client.on('loggedIn', function() {
// this.getVersion();
// this.getControllerConfig();
this.getEquipmentConfiguration();
}).on('version', function(version) {
this.getPoolStatus();
console.log(' version=' + version.version);
}).on('equipmentConfiguration', function(config) {
console.log(`version = ${config.getVersion()}`);
console.log(`secondaries = ${config.getSecondariesCount()}`);
console.log(`pump 1 type=${config.getPumpType(0)}, pump 2
type=${config.getPumpType(1)}`);
console.log(`pump 1 pool rpm=${config.getCircuitRPMs(0, 6)}`);
console.log(`pump 2 waterfall rpm=${config.getCircuitRPMs(1, 8)}`);
console.log(`num pumps=${config.getNumPumps()}`);
// this.getControllerConfig();
this.getPoolStatus();
//client.close();
}).on('poolStatus', function(status) {
this.getChemicalData();
console.log(' pool ok=' + status.ok);
console.log(' pool temp=' + status.currentTemp[0]);
console.log(' air temp=' + status.airTemp);
console.log(' salt ppm=' + status.saltPPM);
console.log(' pH=' + status.pH);
console.log(' saturation=' + status.saturation);
console.log(' spa active=' + status.isSpaActive());
console.log(' pool active=' + status.isPoolActive());
}).on('chemicalData', function(chemData) {
// this.setSaltCellOutput(0, 18, 0);
this.getSaltCellConfig();
console.log(' calcium=' + chemData.calcium);
console.log(' cyanuric acid=' + chemData.cyanuricAcid);
console.log(' alkalinity=' + chemData.alkalinity);
}).on('setSaltCellConfig', function() {
this.getSaltCellConfig();
console.log(' set salt cell config');
}).on('saltCellConfig', function(saltCellConfig) {
this.getControllerConfig();
console.log(' salt cell installed=' + saltCellConfig.installed);
console.log(' salt cell status=' + saltCellConfig.status);
console.log(' salt cell level1=' + saltCellConfig.level1);
console.log(' salt cell level2=' + saltCellConfig.level2);
console.log(' salt cell salt=' + saltCellConfig.salt);
console.log(' salt cell flags=' + saltCellConfig.flags);
console.log(' salt cell superChlorTimer=' +
saltCellConfig.superChlorTimer);
}).on('controllerConfig', function(config) {
console.log(' controller is in celsius=' + config.degC);
console.log(' hasSolar=' + config.hasSolar());
console.log(' hasSolarAsHeatpump=' + config.hasSolarAsHeatpump());
console.log(' hasChlorinator=' + config.hasChlorinator());
console.log(' hasCooling=' + config.hasCooling());
console.log(' hasIntellichem=' + config.hasIntellichem());
// this.setSetPoint(0, 0, 100);
this.controllerConfig = config;
this.getPumpStatus(count);
// client.close();
}).on('setPointChanged', function(config) {
console.log(' setpoint changed');
client.close();
}).on('getPumpStatus', function(status) {
console.log('--------- PUMP STATUS ---------');
// console.log('pump status', status);
console.log('pump RPMs = ' + status.pumpRPMs);
console.log('pump GPMs = ' + status.pumpGPMs);
console.log('pump Watts = ' + status.pumpWatts);
for (var i = 0; i < status.pumpSetting.length; i++) {
var circuitName;
if (status.pumpSetting[i].circuitId !== 132 &&
status.pumpSetting[i].circuitId !== 0) {
circuitName =
this.controllerConfig.getCircuitByDeviceId(status.pumpSetting[i].circuitId).name;
} else if (status.pumpSetting[i].circuitId === 132) {
circuitName = 'Freeze Mode';
} else if (status.pumpSetting[i].circuitId === 0) {
circuitName = 'Unassigned';
}
console.log(`pump ${count} ${circuitName} SetPoint=
${status.pumpSetting[i].pumpSetPoint} isRPMs =
${status.pumpSetting[i].isRPMs}`);
}
count++;
if (count === 1) {
this.getPumpStatus(count);
} else {
client.close();
}
}).on('loginFailed', function() {
console.log(' unable to login (wrong password?)');
client.close();
}).on('badParameter', function() {
console.log(' bad parameter');
client.close();
});
client.connect();
}
…On Wed, Jul 15, 2020 at 10:07 AM parnic ***@***.***> wrote:
Can you share a gist or something with your example.js contents? Are you
sure you're still on the correct remote? secondaries = # isn't in the
example.js that's in the repo, so it should not be able to print that.
Additionally, it looks like you've got node-screenlogic stored as a node
module under node_screenlogic, which is also odd. Make sure your
environment is setup the way you expect it to be (npm install from a
clean node-screenlogic sync shouldn't cause it to install itself as a node
module).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#40 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM3QU5YA5D6DA3AUEVOXKQTR3WZZFANCNFSM4O2OM2SA>
.
|
command on npm page is:
npm i node-screenlogic
…On Wed, Jul 15, 2020 at 10:47 AM Chris Iannello ***@***.***> wrote:
Might be my novice approach. On a new windows 10 machine I installed
node.js from installer on nodejs.org.
Once done I check versions of node and npm.
Then I created a nide-screenlogic directory on my desktop.
navigated there,
Did npm init
Then I ran command at npm repository....webpage:
https://www.npmjs.com/package/node-screenlogic
https://www.npmjs.com/package/node-screenlogic
it gave some warning I dont recall. I then had the following in the
directory: (the exception of the new file example chris.
[image: image.png]
[image: image.png]
the example file was then modified with the lan IP of my screenlogic.
and ran....node example
below is the file:
'use strict';
const ScreenLogic = require('./index');
// use this to find and connect to units local to the network this is
running on
// var finder = new ScreenLogic.FindUnits();
// finder.on('serverFound', function(server) {
// finder.close();
// console.log('server found.');
// console.log(' gatewayName=' + server.gatewayName);
// console.log(' address=' + server.address);
// connect(new ScreenLogic.UnitConnection(server));
// });
// finder.search();
// use this if you want to use a direct connection to a known unit
connect(new ScreenLogic.UnitConnection(80, '192.168.1.131'));
// use this to remote connect to a system by name (going through the
Pentair servers)
// const systemName = 'Pentair: 07-E1-E6';
// const password = '1235';
// var remote = new ScreenLogic.RemoteLogin(systemName);
// remote.on('gatewayFound', function(unit) {
// remote.close();
// if (unit && unit.gatewayFound) {
// console.log('unit ' + remote.systemName + ' found at ' +
unit.ipAddr + ':' + unit.port);
// connect(new ScreenLogic.UnitConnection(unit.port, unit.ipAddr,
password));
// } else {
// console.log('no unit found by that name');
// }
// });
// remote.connect();
var count = 0;
// generic connection method used by all above examples
function connect(client) {
client.on('loggedIn', function() {
// this.getVersion();
// this.getControllerConfig();
this.getEquipmentConfiguration();
}).on('version', function(version) {
this.getPoolStatus();
console.log(' version=' + version.version);
}).on('equipmentConfiguration', function(config) {
console.log(`version = ${config.getVersion()}`);
console.log(`secondaries = ${config.getSecondariesCount()}`);
console.log(`pump 1 type=${config.getPumpType(0)}, pump 2
type=${config.getPumpType(1)}`);
console.log(`pump 1 pool rpm=${config.getCircuitRPMs(0, 6)}`);
console.log(`pump 2 waterfall rpm=${config.getCircuitRPMs(1, 8)}`);
console.log(`num pumps=${config.getNumPumps()}`);
// this.getControllerConfig();
this.getPoolStatus();
//client.close();
}).on('poolStatus', function(status) {
this.getChemicalData();
console.log(' pool ok=' + status.ok);
console.log(' pool temp=' + status.currentTemp[0]);
console.log(' air temp=' + status.airTemp);
console.log(' salt ppm=' + status.saltPPM);
console.log(' pH=' + status.pH);
console.log(' saturation=' + status.saturation);
console.log(' spa active=' + status.isSpaActive());
console.log(' pool active=' + status.isPoolActive());
}).on('chemicalData', function(chemData) {
// this.setSaltCellOutput(0, 18, 0);
this.getSaltCellConfig();
console.log(' calcium=' + chemData.calcium);
console.log(' cyanuric acid=' + chemData.cyanuricAcid);
console.log(' alkalinity=' + chemData.alkalinity);
}).on('setSaltCellConfig', function() {
this.getSaltCellConfig();
console.log(' set salt cell config');
}).on('saltCellConfig', function(saltCellConfig) {
this.getControllerConfig();
console.log(' salt cell installed=' + saltCellConfig.installed);
console.log(' salt cell status=' + saltCellConfig.status);
console.log(' salt cell level1=' + saltCellConfig.level1);
console.log(' salt cell level2=' + saltCellConfig.level2);
console.log(' salt cell salt=' + saltCellConfig.salt);
console.log(' salt cell flags=' + saltCellConfig.flags);
console.log(' salt cell superChlorTimer=' +
saltCellConfig.superChlorTimer);
}).on('controllerConfig', function(config) {
console.log(' controller is in celsius=' + config.degC);
console.log(' hasSolar=' + config.hasSolar());
console.log(' hasSolarAsHeatpump=' + config.hasSolarAsHeatpump());
console.log(' hasChlorinator=' + config.hasChlorinator());
console.log(' hasCooling=' + config.hasCooling());
console.log(' hasIntellichem=' + config.hasIntellichem());
// this.setSetPoint(0, 0, 100);
this.controllerConfig = config;
this.getPumpStatus(count);
// client.close();
}).on('setPointChanged', function(config) {
console.log(' setpoint changed');
client.close();
}).on('getPumpStatus', function(status) {
console.log('--------- PUMP STATUS ---------');
// console.log('pump status', status);
console.log('pump RPMs = ' + status.pumpRPMs);
console.log('pump GPMs = ' + status.pumpGPMs);
console.log('pump Watts = ' + status.pumpWatts);
for (var i = 0; i < status.pumpSetting.length; i++) {
var circuitName;
if (status.pumpSetting[i].circuitId !== 132 &&
status.pumpSetting[i].circuitId !== 0) {
circuitName =
this.controllerConfig.getCircuitByDeviceId(status.pumpSetting[i].circuitId).name;
} else if (status.pumpSetting[i].circuitId === 132) {
circuitName = 'Freeze Mode';
} else if (status.pumpSetting[i].circuitId === 0) {
circuitName = 'Unassigned';
}
console.log(`pump ${count} ${circuitName} SetPoint=
${status.pumpSetting[i].pumpSetPoint} isRPMs =
${status.pumpSetting[i].isRPMs}`);
}
count++;
if (count === 1) {
this.getPumpStatus(count);
} else {
client.close();
}
}).on('loginFailed', function() {
console.log(' unable to login (wrong password?)');
client.close();
}).on('badParameter', function() {
console.log(' bad parameter');
client.close();
});
client.connect();
}
On Wed, Jul 15, 2020 at 10:07 AM parnic ***@***.***> wrote:
> Can you share a gist or something with your example.js contents? Are you
> sure you're still on the correct remote? secondaries = # isn't in the
> example.js that's in the repo, so it should not be able to print that.
>
> Additionally, it looks like you've got node-screenlogic stored as a node
> module under node_screenlogic, which is also odd. Make sure your
> environment is setup the way you expect it to be (npm install from a
> clean node-screenlogic sync shouldn't cause it to install itself as a node
> module).
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#40 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AM3QU5YA5D6DA3AUEVOXKQTR3WZZFANCNFSM4O2OM2SA>
> .
>
|
Okay, I don't know how npm is getting the files it's getting, then, because node-screenlogic shouldn't be a module under node-screenlogic. Regardless, this is why your example output is what it is:
This is the version from the repository that you should be seeing: https://github.com/parnic/node-screenlogic/blob/main/example.js You should probably look into some npm docs if that's where the problem is originating. You may want to see if there's a copy of the repo at |
Okay, I figured out how that |
Thanks very much will try it tomorrow with clean install.
…On Wed, Jul 15, 2020, 9:48 PM parnic ***@***.***> wrote:
Okay, I figured out how that example.js got onto npm and have published a
new version, 1.6.0-1, that contains the expected example.js.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#40 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM3QU5YD25AYE3M6TZYNX53R3ZL7BANCNFSM4O2OM2SA>
.
|
when I first used this example function months ago I saw the full result to console. Now when I run the example I see only the result of the first get equipment config only. What am I missing? I dont see in example anything that would prevent the subsequent functions to display their data to console.
C:\Users\Chris\Desktop\node_screenlogic\node_modules\node-screenlogic>node example
version = 1180
secondaries = 0
pump 1 type=0, pump 2 type=2
pump 1 pool rpm=2000
pump 2 waterfall rpm=0
num pumps=7
C:\Users\Chris\Desktop\node_screenlogic\node_modules\node-screenlogic>
The text was updated successfully, but these errors were encountered: