knxultimate
Advanced tools
Comparing version 1.0.46 to 1.0.47
@@ -10,3 +10,3 @@ ![Sample Node](img/logo.png) | ||
<p> | ||
<b>Version 1.0.46</b> - January 2024<br/> | ||
<b>Version 1.0.47</b> - January 2024<br/> | ||
- NEW: added DPT 275.100.<br/> | ||
@@ -13,0 +13,0 @@ </p> |
{ | ||
"name": "knxultimate", | ||
"description": "KNX IP protocol implementation for Node. This is the ENGINE of Node-Red KNX-Ultimate node.", | ||
"version": "1.0.46", | ||
"version": "1.0.47", | ||
"engines": { | ||
@@ -6,0 +6,0 @@ "node": ">=14" |
@@ -164,12 +164,20 @@ ![Logo](img/logo-big.png) | ||
let _Rawvalue = _datagram.cEMIMessage.npdu.dataValue; | ||
// Decode the telegram. | ||
if (_dst === "0/1/1") { | ||
// We know that 0/1/1 is a boolean DPT 1.001 | ||
// We know, for example, that 0/1/1 is a boolean DPT 1.001 | ||
dpt = dptlib.resolve("1.001"); | ||
jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
} else if (_dst === "0/1/2") { | ||
// We know that 0/1/2 is a boolean DPT 232.600 Color RGB | ||
// We know , for example, that 0/1/2 is a DPT 232.600 Color RGB | ||
dpt = dptlib.resolve("232.600"); | ||
jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
} else { | ||
// All others... assume they are boolean | ||
dpt = dptlib.resolve("1.001"); | ||
jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
if (jsValue === null) { | ||
// Opppsss, it's null. It means that the datapoint isn't 1.001 | ||
// Raise whatever error you want. | ||
} | ||
} | ||
@@ -188,2 +196,6 @@ console.log("src: " + _src + " dest: " + _dst, " event: " + _evt, " value: " + jsValue); | ||
// Connect | ||
try { | ||
knxUltimateClient.removeAllListeners(); | ||
} catch (error) { | ||
} | ||
knxUltimateClient.Connect(); | ||
@@ -285,4 +297,14 @@ ``` | ||
var knxUltimateClient; | ||
// If you're reinstantiating a new knxUltimateClient object, you must remove all listeners. | ||
// If this is the first time you instantiate tne knxUltimateClient object, this part of code throws an error into the try...catch. | ||
try { | ||
if (knxUltimateClient !== null) knxUltimateClient.removeAllListeners(); | ||
} catch (error) { | ||
// New connection, do nothing. | ||
} | ||
// Let's go | ||
var knxUltimateClient = new knx.KNXClient(knxUltimateClientProperties); | ||
knxUltimateClient = new knx.KNXClient(knxUltimateClientProperties); | ||
@@ -374,2 +396,11 @@ // Setting handlers | ||
jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
} else { | ||
// All others... assume they are boolean | ||
dpt = dptlib.resolve("1.001"); | ||
jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
if (jsValue === null) { | ||
// Is null, try if it's a numerical value | ||
dpt = dptlib.resolve("5.001"); | ||
jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
} | ||
} | ||
@@ -397,3 +428,2 @@ console.log("src: " + _src + " dest: " + _dst, " event: " + _evt, " value: " + jsValue); | ||
```javascript | ||
const knx = require("./index.js"); | ||
@@ -400,0 +430,0 @@ const KNXsecureKeyring = require("./src/KNXsecureKeyring.js"); |
@@ -87,5 +87,14 @@ const knx = require("./index.js"); | ||
var knxUltimateClient; | ||
// If you're reinstantiating a new knxUltimateClient object, you must remove all listeners. | ||
// If this is the first time you instantiate tne knxUltimateClient object, this part of code throws an error into the try...catch. | ||
try { | ||
if (knxUltimateClient !== null) knxUltimateClient.removeAllListeners(); | ||
} catch (error) { | ||
// New connection, do nothing. | ||
} | ||
// Let's go | ||
var knxUltimateClient = new knx.KNXClient(knxUltimateClientProperties); | ||
knxUltimateClient = new knx.KNXClient(knxUltimateClientProperties); | ||
@@ -92,0 +101,0 @@ // Setting handlers |
@@ -43,7 +43,7 @@ const knx = require("./index.js"); | ||
if (_dst === "0/1/1") { | ||
// We know that 0/1/1 is a boolean DPT 1.001 | ||
// We know, for example, that 0/1/1 is a boolean DPT 1.001 | ||
dpt = dptlib.resolve("1.001"); | ||
jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
} else if (_dst === "0/1/2") { | ||
// We know that 0/1/2 is a boolean DPT 232.600 Color RGB | ||
// We know , for example, that 0/1/2 is a DPT 232.600 Color RGB | ||
dpt = dptlib.resolve("232.600"); | ||
@@ -56,5 +56,4 @@ jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
if (jsValue === null) { | ||
// Is null, try if it's a numerical value | ||
dpt = dptlib.resolve("5.001"); | ||
jsValue = dptlib.fromBuffer(_Rawvalue, dpt) | ||
// Opppsss, it's null. It means that the datapoint isn't 1.001 | ||
// Raise whatever error you want. | ||
} | ||
@@ -74,3 +73,7 @@ } | ||
// Connect | ||
try { | ||
knxUltimateClient.removeAllListeners(); | ||
} catch (error) { | ||
} | ||
knxUltimateClient.Connect(); | ||
@@ -22,5 +22,4 @@ /* eslint-disable no-prototype-builtins */ | ||
return Buffer.concat([comfort, standby, economy, buildingProtection]); | ||
} else { | ||
knxLog.get().error('DPT275.formatAPDU: Must supply all values, for example {comfort:22, standby:21.5, economy:21, buildingProtection:15}'); | ||
} | ||
knxLog.get().error('DPT275.formatAPDU: Must supply all values, for example {comfort:22, standby:21.5, economy:21, buildingProtection:15}'); | ||
} | ||
@@ -49,3 +48,3 @@ | ||
msg.payload = {comfort:22, standby:21.5, economy:21, buildingProtection:15}; | ||
return msg;` | ||
return msg;`, | ||
} | ||
@@ -55,4 +54,3 @@ | ||
exports.subtypes = { | ||
// 9.001 temperature (oC) | ||
'100': { | ||
100: { | ||
name: 'Quadruple setpoints (comfort,standby,economy,buildingProtection) (4 float with 16 Bit)', | ||
@@ -59,0 +57,0 @@ desc: 'DPT_TempRoomSetpSetF16[4]', |
1497224
9703
592