New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-knx-ultimate

Package Overview
Dependencies
Maintainers
0
Versions
461
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-knx-ultimate - npm Package Compare versions

Comparing version

to
3.1.6

img/youtube-logo.jpeg

109

nodes/knxUltimate.js

@@ -149,11 +149,74 @@

if (found !== undefined) {
if (_dpt === undefined && found.dpt === undefined) throw new Error('No CSV file imported. Please provide the dpt manually.');
if (_dpt === undefined && found.dpt === undefined) {
const errM = 'knxUltimate: getGaValue: node ID:' + node.id + ' ' + 'No CSV file imported. Please provide the dpt manually';
RED.log.error(errM);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(errM);
return;
};
return dptlib.fromBuffer(found.rawValue, dptlib.resolve(_dpt || found.dpt));
} else {
throw new Error('Group Address not yet read, try later.');
const errM = 'knxUltimate: getGaValue: node ID:' + node.id + ' ' + 'Group Address not yet read, try later.';
RED.log.error(errM);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(errM);
return;
}
} catch (error) {
throw error;
const errM = 'knxUltimate: getGaValue: node ID:' + node.id + ' ' + error.stack;
RED.log.error(errM);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(errM);
}
}
// Used in the KNX Function TAB
let setGAValue = function setGAValue(_ga = undefined, _value = undefined, _dpt = undefined) {
try {
if (_ga === undefined) return;
// The GA can have the devicename as well, separated by a blank space (1/1/0 light table ovest),
// I must take the GA only
const blankSpacePosition = _ga.indexOf(" ");
if (blankSpacePosition > -1) _ga = _ga.substring(0, blankSpacePosition);
if (_dpt === undefined) {
// Try getting dpt from ETS CSV
const found = node.server.exposedGAs.find(a => a.ga === _ga);
if (found === undefined || found.dpt === undefined) {
const errM = 'knxUltimate: setGAValue: node ID:' + node.id + ' ' + 'No CSV file imported. Please provide the dpt manually';
RED.log.error(errM);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(errM);
return;
}
}
node.server.writeQueueAdd({
grpaddr: _ga, payload: _value, dpt: _dpt, outputtype: 'write', nodecallerid: node.id,
});
} catch (error) {
const errM = 'knxUltimate: setGAValue: node ID:' + node.id + ' ' + error.stack;
RED.log.error(errM);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(errM);
}
}
// Used in the KNX Function TAB
let self = function self(_value) {
try {
node.server.writeQueueAdd({
grpaddr: node.topic, payload: _value, dpt: node.dpt, outputtype: 'write', nodecallerid: node.id,
});
} catch (error) {
const errM = 'knxUltimate: self: node ID:' + node.id + ' ' + error.stack;
RED.log.error(errM);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(errM);
}
}
// Used in the KNX Function TAB
let toggle = function toggle() {
if (node.currentPayload === true || node.currentPayload === false) {
try {
node.server.writeQueueAdd({
grpaddr: node.topic, payload: !node.currentPayload, dpt: node.dpt, outputtype: 'write', nodecallerid: node.id,
});
} catch (error) {
const errM = 'knxUltimate: toggle: node ID:' + node.id + ' ' + error.stack;
RED.log.error(errM);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(errM);
}
}
}

@@ -180,10 +243,12 @@ // This function is called by the knx-ultimate config node, to output a msg.payload.

if (node.receiveMsgFromKNXCode !== undefined) {
try {
let receiveMsgFromKNXCode = new Function('msg', 'getGAValue', 'node', 'RED', node.receiveMsgFromKNXCode)
msg = receiveMsgFromKNXCode(msg, getGAValue, node, RED);
} catch (error) {
RED.log.error('knxUltimate: receiveMsgFromKNXCode: node ID:' + node.id + ' ' + error.message);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`knxUltimate: receiveMsgFromKNXCode: node id ${node.id} ` || ' ' + error.stack);
return;
}
(async () => {
try {
let receiveMsgFromKNXCode = new Function('msg', 'getGAValue', 'node', 'RED', 'self', 'toggle', 'setGAValue', node.receiveMsgFromKNXCode)
msg = await receiveMsgFromKNXCode(msg, getGAValue, node, RED, self, toggle, setGAValue);
} catch (error) {
RED.log.error('knxUltimate: receiveMsgFromKNXCode: node ID:' + node.id + ' ' + error.message);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`knxUltimate: receiveMsgFromKNXCode: node id ${node.id} ` || ' ' + error.stack);
return;
}
})();
}

@@ -244,11 +309,13 @@ // -+++++++++++++++++++++++++++++++++++++++++++

if (node.sendMsgToKNXCode !== undefined) {
try {
let sendMsgToKNXCode = new Function('msg', 'getGAValue', 'node', 'RED', node.sendMsgToKNXCode)
msg = sendMsgToKNXCode(msg, getGAValue, node, RED);
if (msg === undefined) return;
} catch (error) {
RED.log.error('knxUltimate: sendMsgToKNXCode: node ID:' + node.id + ' ' + error.message);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`knxUltimate: sendMsgToKNXCode: node id ${node.id} ` || ' ' + error.stack);
return;
}
(async () => {
try {
let sendMsgToKNXCode = new Function('msg', 'getGAValue', 'node', 'RED', 'self', 'toggle', 'setGAValue', node.sendMsgToKNXCode)
msg = await sendMsgToKNXCode(msg, getGAValue, node, RED, self, toggle, setGAValue);
if (msg === undefined) return;
} catch (error) {
RED.log.error('knxUltimate: sendMsgToKNXCode: node ID:' + node.id + ' ' + error.message);
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`knxUltimate: sendMsgToKNXCode: node id ${node.id} ` || ' ' + error.stack);
return;
}
})();
}

@@ -258,2 +325,4 @@ // -+++++++++++++++++++++++++++++++++++++++++++

// 25/07/2019 if payload is read or the Telegram type is set to "read", do a read, otherwise, write to the bus

@@ -260,0 +329,0 @@ if ((msg.hasOwnProperty('readstatus') && msg.readstatus === true) || node.outputtype === 'read') {

2

package.json

@@ -6,3 +6,3 @@ {

},
"version": "3.1.5",
"version": "3.1.6",
"description": "Control your KNX intallation via Node-Red! A bunch of KNX nodes, with integrated Philips HUE control and ETS group address importer. Easy to use and highly configurable.",

@@ -9,0 +9,0 @@ "dependencies": {

@@ -69,14 +69,9 @@ ![Logo](img/logo-big.png)

## LESSONS FROM BEGINNER TO CERTIFIED KNX-ULTIMATE GURU STATUS
## YOUTUBE CHANNEL
* <a href="https://youtu.be/4rjrMqszhP8" target="_blank">Lesson 01 - Introduction to KNX Device<br/>
<img width="200px" src="https://img.youtube.com/vi/4rjrMqszhP8/0.jpg" ></a>
<a href="https://www.youtube.com/playlist?list=PL9Yh1bjbLAYpfy1Auz6CKDfXUusgMwOQr" target="_blank"><br/>
<img width="200px" src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-knx-ultimate/master/img/youtube-logo.jpeg" ></a>
* <a href="https://youtu.be/sRW5sHPnYi0" target="_blank">Lesson 02 - Working with ETS file importer<br/>
<img width="200px" src="https://img.youtube.com/vi/sRW5sHPnYi0/0.jpg" ></a>
Please subscribe to the [Youtube channel](https://www.youtube.com/playlist?list=PL9Yh1bjbLAYpfy1Auz6CKDfXUusgMwOQr) and watch the node in action.
[More to come...](https://github.com/Supergiovane/node-red-contrib-knx-ultimate)
<br/>

@@ -88,3 +83,2 @@ <br/>

* [Wiki and Help](https://github.com/Supergiovane/node-red-contrib-knx-ultimate/wiki)
* [Youtube channel](https://www.youtube.com/playlist?list=PL9Yh1bjbLAYpfy1Auz6CKDfXUusgMwOQr)
* [FAQ + Troubleshoot](https://github.com/Supergiovane/node-red-contrib-knx-ultimate/wiki/5.-FAQ-Troubleshoot)

@@ -91,0 +85,0 @@ * [Security best practices](https://github.com/Supergiovane/node-red-contrib-knx-ultimate/wiki/SECURITY)

@@ -9,3 +9,4 @@ // 31/03/2020 Search Helper

}else{
// Both values are identical, so i don't send the msg.
// Both values are identical, so i don't send the msg.
node.status({fill:"grey",shape:"dot",text:"Not sent"});
return;

@@ -12,0 +13,0 @@ }`;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet