parnic / node-screenlogic

Pentair ScreenLogic Javascript library using Node.JS

Home Page:https://www.npmjs.com/package/node-screenlogic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unit is found but remote connection is hanging?

alonweinstein opened this issue · comments

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?