Closed itsxallwater closed 3 years ago
Unless I'm reading that wrong, it looks like it's trying to connect to the local host (127.0.0.1) which I assume is not where the pool equipment is located. Is this a local or remote connection? Can you share some code?
A remote. Code isn't too exciting, just slightly adapted from your sample and tucked behind an Express.js server so I can make REST calls from the Vue.js app.
Here's the weird and totally classic tech thing--today, it is working again. Was away from the house for work the last two days so I can't really celebrate anything as the resolution but I'll keep an eye on this. When I reported, I didn't think to bother debugging @ the connect(...)
call to validate the IP it was resolving but your point about the peculiarity of localhost was well made. Tossed a break point in there this morning to test and, well yeah, remote IP and a working application. Best guess I've got is perhaps some local network issues that were impacting things when I reported.
:shrug:
const express = require('express')
const ScreenLogic = require('node-screenlogic')
const cors = require('cors')
const bodyParser = require("body-parser");
const app = express()
const port = 3000
const systemName = "Pentair: ##-##-##"
const password = "##########"
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(cors())
app.get('/', (req, res) => {
const returnData = {
systemName: systemName
}
var remote = new ScreenLogic.RemoteLogin(systemName);
remote.on("gatewayFound", function (unit) {
remote.close()
if (unit && unit.gatewayFound) {
getUnitData(unit)
connect(new ScreenLogic.UnitConnection(unit.port, unit.ipAddr, password))
} else {
console.log("no unit found by that name")
}
})
remote.connect()
// generic connection method used by all above examples
function connect(client) {
client
.on("loggedIn", function () {
this.getVersion()
})
...
.on("loginFailed", function () {
console.log(" unable to login (wrong password?)")
res.send(returnData)
client.close()
})
.on('error', function(error) {
console.log("an error occurred")
console.error(error)
returnData.error = error
res.send(returnData)
client.close()
})
client.connect()
}
})
Glad it's working now. If it turns out that the remote host sometimes returns an invalid IP (perhaps when the local equipment is offline or something?) then that would be good for the library to catch and signal in some well-formed way.
First of all, this library is great! I've been working on a little smart dashboard for various things at our house and have had this plumbed in for a while now going back to last year when we had our pool put in. Things have been working with little issue until earlier this week and now I'm having a tough time getting connectivity to the pump. Base connection attempts are erroring out with the below:
We still have connectivity via the mobile apps but I'm a little stumped as to what has changed. I verified that the credentials are still the same so just curious if you've got any insight or if anyone else may have experienced this.
Thanks!