parnic / node-screenlogic

Pentair ScreenLogic Javascript library using Node.JS
https://www.npmjs.com/package/node-screenlogic
MIT License
52 stars 14 forks source link

Unit is found but remote connection is hanging? #64

Closed alonweinstein closed 1 year ago

alonweinstein commented 1 year ago

Hi!

Having a weird issue -- the unit is found, but the network connection fails.

const ScreenLogic = require("node-screenlogic");

const username = ".......";
const password = ".......";

const rl = new ScreenLogic.RemoteLogin(username);

rl.on('gatewayFound', function(unit) {
    console.log('Found unit');
    console.log(JSON.stringify(unit));
    const unitConnection = new ScreenLogic.UnitConnection(unit.port, unit.ipAddr, password);
    console.log('trying to connect');
    try {
        unitConnection.on('connected', function() {
            console.log('connected');
            unitConnection.getPoolStatus((status) => {
                console.log(status);
            });
        });
        unitConnection.on('error', function(error) {
            console.log(error);
        });
        unitConnection.connect();

    } catch (error) {
        console.log(error);
    }
});

rl.connect();

The Unit data is sent back properly, the port is open. The connection to the unit itself fails after a few moments:

Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20) { errno: -54, code: 'ECONNRESET', syscall: 'read' }

Any ideas how to debug this?