Comments (3)
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?
from node-screenlogic.
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.
🤷
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()
}
})
from node-screenlogic.
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.
from node-screenlogic.
Related Issues (20)
- Unable to set salt level for pool or spa individually HOT 2
- Differentiate the callback event for getScheduleData(0) vs (1) HOT 4
- Schedule Create/Delete is a very long operation (15-20 seconds) HOT 23
- Calling getPumpStatus() is timing out. HOT 4
- SenderID's don't work with an old version of the library ... duh. HOT 3
- History messages HOT 2
- Can Intellibrite "save" and "recall" functionality from the mobile app be leveraged to store and set custom light colors? HOT 12
- Uncaught Exception crashing node-red HOT 13
- Can you tell if a scheduled event is running or not? HOT 2
- CoolSetpoint on Spa tracks outdoor air temp? HOT 2
- getNumPumps() returns number of available pump slots, not actual number of pumps HOT 8
- feature request: Access "history" data HOT 1
- Integration with nodejs-poolController HOT 54
- Set pump speeds HOT 7
- Unit is found but remote connection is hanging?
- SLSetHeatSetPoint not parsing API response HOT 4
- FEATURE: Set Timeout HOT 4
- Timeout / Parameter Failure on setCircuitAsync HOT 3
- Is UDP Broadcast the same as mdns/dns service discovery? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-screenlogic.