Comments (4)
Each message's response is +1 from the message ID. If you'll notice SLSetHeatSetPoint
has a getResponseId()
that returns MSG_ID
(12528) + 1, which is 12529. index.js catches that and fires the setPointChanged
event with the parsed response from the equipment:
Line 414 in 0834bf4
Can you share the code you're using that isn't working properly? My expectation is that setPointChanged
's argument has the values you're looking for, but there may be a bug.
from node-screenlogic.
Note that if you're still using code similar to #64, that won't work as the library functions off named events rather than promises currently. https://github.com/parnic/node-screenlogic/blob/main/example.js shows how to interact with the library.
from node-screenlogic.
This is running in an AWS lambda, so there's some additional code around the relevant code itself but I'm pasting it as-is here to give context:
const body = JSON.parse(event.body)
const { userName, password, bodyType, temperature } = body;
const remote = new ScreenLogic.RemoteLogin(userName);
const p = new Promise(( resolve, reject) => {
remote.on('gatewayFound', function(unit) {
remote.close();
if (unit && unit.gatewayFound) {
console.log('unit ' + remote.systemName + ' found at ' + unit.ipAddr + ':' + unit.port);
const client = new ScreenLogic.UnitConnection(unit.port, unit.ipAddr, password);
client.on('loggedIn', function() {
client.setSetPoint(0, bodyType, temperature);
}).on('setPointChanged', function(ev) {
// console.log(JSON.stringify(ev));
client.close();
resolve({
statusCode: 200,
headers: { "Content-Type": "text/plain" },
body: JSON.stringify(ev)
});
})
client.connect();
} else {
console.log('no unit found by that name');
}
});
remote.connect();
});
return p;
What I'm doing:
- Creating a RemoteLogin
- Finding the unit
- Connecting to the unit remotely
- Waiting for the loggedIn event
- Call setSetPoint
- Waiting for the setPointChanged event -- which is where I get non-parsed response
from node-screenlogic.
Ah, ok, I see what's going on. This event doesn't provide the new temperature value in its response. From the Pentair equipment, we get the message in your initial post:
[0,0,241,48,0,0,0,0]
The first 2 being the sender id, 0, the second 2 being the message id little-endian (48 << 8 + 241 = 12529), and the final 4 being the size of the payload for the response (0). To get the new temperature, you would probably want to issue a getPoolStatus()
and extract the values from there.
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
- ECONNREFUSED on connect HOT 3
- 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?
- 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.