node-red-contrib-knx-ultimate 2.2.4 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,6 +35,8 @@ module.exports = function (RED) {
35
35
  node.DayTime = true;
36
36
  node.isGrouped_light = config.hueDevice.split("#")[1] === "grouped_light";
37
37
  node.hueDevice = config.hueDevice.split("#")[0];
38
+ node.readStatusAtStartup = config.readStatusAtStartup;
39
+ if (config.readStatusAtStartup === undefined) node.readStatusAtStartup = "yes";
38
40
 
39
41
  // Used to call the status update from the config node.
40
42
  node.setNodeStatus = ({
@@ -58,7 +60,7 @@ module.exports = function (RED) {
58
60
  node.handleSend = (msg) => {
59
61
  if (node.currentHUEDevice === undefined) {
60
62
  node.setNodeStatusHue({
61
- fill: "grey",
63
+ fill: "red",
62
64
  shape: "ring",
63
65
  text: "Currently not ready.",
64
66
  payload: "",
@@ -419,6 +421,9 @@ module.exports = function (RED) {
419
421
  });
420
422
  return;
421
423
  }
424
+ // IMPORTANT: exit if no button last_event present.
425
+ if (_event.initializingAtStart === true && node.readStatusAtStartup === "no") return;
426
+
422
427
  if (_event.hasOwnProperty("on")) {
423
428
  node.updateKNXLightState(_event.on.on);
424
429
  // In case of switch off, set the dim to zero
@@ -621,13 +626,7 @@ module.exports = function (RED) {
621
626
  }
622
627
  if (node.serverHue) {
623
628
  node.serverHue.removeClient(node);
624
- if (node.serverHue !== null && node.serverHue.hueManager !== null) {
625
- try {
626
- node.serverHue.addClient(node);
627
- } catch (err) {
628
- RED.log.error(`Errore knxUltimateHueLight node.currentHUEDevice ${err.message}`);
629
- }
630
- }
629
+ node.serverHue.addClient(node);
631
630
  }
632
631
 
633
632
  node.on("input", (msg) => { });
@@ -11,6 +11,7 @@
11
11
  namelightsensor: { value: "" },
12
12
  GAlightsensor: { value: "" },
13
13
  dptlightsensor: { value: "" },
14
+ readStatusAtStartup: { value: "no" },
14
15
 
15
16
  hueDevice: { value: "" }
16
17
  },
@@ -211,7 +212,13 @@
211
212
  <input type="text" id="node-input-namelightsensor" style="width:200px;margin-left: 5px; text-align: left;">
212
213
  </div>
213
214
 
214
-
215
+ <div class="form-row">
216
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
217
+ <select id="node-input-readStatusAtStartup">
218
+ <option value="no">No</option>
219
+ <option value="yes">Yes, and emit KNX telegrams.</option>
220
+ </select>
221
+ </div>
215
222
 
216
223
 
217
224
  <br/>
@@ -234,6 +241,7 @@ Start typing in the GA field, the name or group address of your KNX device, the
234
241
  | KNX GW | Select the KNX gateway to be used |
235
242
  | HUE Bridge | Select the HUE Bridge to be used |
236
243
  | Hue Sensor | HUE sensor to be used. The avaiable buttons start showing up while you're typing.|
244
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
237
245
 
238
246
  |Property|Description|
239
247
  |--|--|
@@ -22,6 +22,7 @@ module.exports = function (RED) {
22
22
  node.formatmultiplyvalue = 1;
23
23
  node.formatnegativevalue = 'leave';
24
24
  node.formatdecimalsvalue = 2;
25
+ node.hueDevice = config.hueDevice;
25
26
 
26
27
  // Used to call the status update from the config node.
27
28
  node.setNodeStatus = ({ fill, shape, text, payload }) => {
@@ -42,6 +43,11 @@ module.exports = function (RED) {
42
43
  node.handleSendHUE = _event => {
43
44
  try {
44
45
  if (_event.id === config.hueDevice) {
46
+
47
+ // IMPORTANT: exit if no event presen.
48
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
49
+ if (!_event.hasOwnProperty('light') || _event.light.light_level === undefined) return;
50
+
45
51
  const knxMsgPayload = {};
46
52
  knxMsgPayload.topic = config.GAlightsensor;
47
53
  knxMsgPayload.dpt = config.dptlightsensor;
@@ -76,11 +82,7 @@ module.exports = function (RED) {
76
82
  }
77
83
  if (node.serverHue) {
78
84
  node.serverHue.removeClient(node);
79
- // I must get the object, to store read the status
80
- // I queue the state request, by passing the callback to call whenever the HUE bridge send me the light status async
81
- if (node.serverHue !== null && node.serverHue.hueManager !== null) {
82
- node.serverHue.addClient(node);
83
- }
85
+ node.serverHue.addClient(node);
84
86
  }
85
87
 
86
88
  node.on('input', function (msg) {
@@ -11,6 +11,7 @@
11
11
  namemotion: { value: "" },
12
12
  GAmotion: { value: "" },
13
13
  dptmotion: { value: "" },
14
+ readStatusAtStartup: { value: "no" },
14
15
 
15
16
  hueDevice: { value: "" }
16
17
  },
@@ -211,6 +212,14 @@
211
212
  <input type="text" id="node-input-namemotion" style="width:200px;margin-left: 5px; text-align: left;">
212
213
  </div>
213
214
 
215
+ <div class="form-row">
216
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
217
+ <select id="node-input-readStatusAtStartup">
218
+ <option value="no">No</option>
219
+ <option value="yes">Yes, and emit KNX telegrams.</option>
220
+ </select>
221
+ </div>
222
+
214
223
  <br/>
215
224
  <br/>
216
225
  <br/>
@@ -235,7 +244,8 @@ Start typing in the GA field, the name or group address of your KNX device, the
235
244
  |Property|Description|
236
245
  |--|--|
237
246
  | Motion | As soon as someone moves in the motion device's range, a *true* KNX value is sent to this group address, otherwise *false* is sent. |
238
-
247
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
248
+
239
249
  ### Outputs
240
250
 
241
251
  1. Standard output
@@ -22,6 +22,7 @@ module.exports = function (RED) {
22
22
  node.formatmultiplyvalue = 1;
23
23
  node.formatnegativevalue = "leave";
24
24
  node.formatdecimalsvalue = 2;
25
+ node.hueDevice = config.hueDevice;
25
26
 
26
27
  // Used to call the status update from the config node.
27
28
  node.setNodeStatus = ({ fill, shape, text, payload }) => { };
@@ -39,6 +40,12 @@ module.exports = function (RED) {
39
40
  node.handleSendHUE = (_event) => {
40
41
  try {
41
42
  if (_event.id === config.hueDevice) {
43
+
44
+ // IMPORTANT: exit if no event presen.
45
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
46
+ if (!_event.hasOwnProperty("motion") || _event.motion.motion === undefined) return;
47
+
48
+
42
49
  const knxMsgPayload = {};
43
50
  knxMsgPayload.topic = config.GAmotion;
44
51
  knxMsgPayload.dpt = config.dptmotion;
@@ -12,6 +12,7 @@
12
12
  GAscene: { value: "" },
13
13
  dptscene: { value: "" },
14
14
  valscene: { value: 0 }, // the scene number or true/false
15
+ readStatusAtStartup: { value: "no" },
15
16
 
16
17
  hueDevice: { value: "" },
17
18
  hueSceneRecallType: { value: "active" }
@@ -251,6 +252,14 @@
251
252
  <select id="node-input-valscene" style="width:180px;margin-left: 5px; text-align: left;"></select>
252
253
  </div>
253
254
 
255
+ <div class="form-row">
256
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
257
+ <select id="node-input-readStatusAtStartup">
258
+ <option value="no">No</option>
259
+ <option value="yes">Yes, and emit KNX telegrams.</option>
260
+ </select>
261
+ </div>
262
+
254
263
  <br/>
255
264
  <br/>
256
265
  <br/>
@@ -276,6 +285,7 @@ Start typing in the GA field, the name or group address of your KNX device, the
276
285
  |--|--|
277
286
  | Recall | Choose your group address to be used for recalling the HUE scene. In case of Datapoint 1.x, send *true* to that group address to recall the scene, *false* to switch off all lights belonging to the scene. |
278
287
  | # | Select the KNX scene number. Visible only with datapoint 18.001. |
288
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
279
289
 
280
290
  <br/>
281
291
 
@@ -24,6 +24,7 @@ module.exports = function (RED) {
24
24
  node.formatmultiplyvalue = 1;
25
25
  node.formatnegativevalue = 'leave';
26
26
  node.formatdecimalsvalue = 2;
27
+ node.hueDevice = config.hueDevice;
27
28
 
28
29
  // Used to call the status update from the config node.
29
30
  node.setNodeStatus = ({ fill, shape, text, payload }) => {
@@ -77,6 +78,10 @@ module.exports = function (RED) {
77
78
  node.handleSendHUE = _event => {
78
79
  try {
79
80
  if (_event.id === config.hueDevice) {
81
+
82
+ // IMPORTANT: exit if no event presen.
83
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
84
+
80
85
  // const knxMsgPayload = {}
81
86
  // knxMsgPayload.topic = config.GAmotion
82
87
  // knxMsgPayload.dpt = config.dptmotion
@@ -11,6 +11,7 @@
11
11
  namerepeat: { value: "" },
12
12
  GArepeat: { value: "" },
13
13
  dptrepeat: { value: "" },
14
+ readStatusAtStartup: { value: "no" },
14
15
 
15
16
  hueDevice: { value: "" }
16
17
  },
@@ -214,7 +215,13 @@
214
215
  </div>
215
216
 
216
217
 
217
-
218
+ <div class="form-row">
219
+ <label style="width:180px" for="node-input-readStatusAtStartup"><i class="fa fa-play-circle"></i> Read status at startup</label>
220
+ <select id="node-input-readStatusAtStartup">
221
+ <option value="no">No</option>
222
+ <option value="yes">Yes, and emit KNX telegrams.</option>
223
+ </select>
224
+ </div>
218
225
 
219
226
 
220
227
  <br/>
@@ -245,6 +252,7 @@ or a random color (Datapoint 232.600) to the selected group address.
245
252
  |Property|Description|
246
253
  |--|--|
247
254
  | Rotate | This command is used either to send DIM (increase/decrease), aboslute brightness, or a random color, depending on the selected datapoint. If the random color (datapoint 232.600) is selected, **clockwise rotation** changes random colors and **counterclockwise rotation** set the light to **white** |
255
+ | Read status at startup | Read the status at startup and emit the event to the KNX bus at startup/reconnection. (Default "no")|
248
256
 
249
257
  ### Outputs
250
258
 
@@ -25,6 +25,7 @@ module.exports = function (RED) {
25
25
  node.formatdecimalsvalue = 2;
26
26
  node.brightnessState = 0;
27
27
  node.isTimerDimStopRunning = false;
28
+ node.hueDevice = config.hueDevice;
28
29
 
29
30
  // Used to call the status update from the config node.
30
31
  node.setNodeStatus = ({
@@ -48,6 +49,17 @@ module.exports = function (RED) {
48
49
  node.handleSendHUE = (_event) => {
49
50
  try {
50
51
  if (_event.id === config.hueDevice) {
52
+
53
+ // IMPORTANT: exit if no event presen.
54
+ if (_event.initializingAtStart === true && (config.readStatusAtStartup === undefined || config.readStatusAtStartup === "no")) return;
55
+ if (!_event.hasOwnProperty("relative_rotary")
56
+ || !_event.relative_rotary.hasOwnProperty("last_event")
57
+ || _event.relative_rotary.last_event === undefined
58
+ || !_event.relative_rotary.last_event.hasOwnProperty("rotation")
59
+ || !_event.relative_rotary.last_event.rotation.direction === undefined
60
+ || _event.relative_rotary.last_event.action === undefined) return;
61
+
62
+
51
63
  const knxMsgPayload = {};
52
64
  knxMsgPayload.topic = config.GArepeat;
53
65
  knxMsgPayload.dpt = config.dptrepeat;
@@ -22,6 +22,7 @@ module.exports = function (RED) {
22
22
  node.formatmultiplyvalue = 1;
23
23
  node.formatnegativevalue = 'leave';
24
24
  node.formatdecimalsvalue = 2;
25
+ node.hueDevice = config.hueDevice;
25
26
 
26
27
  // Used to call the status update from the config node.
27
28
  node.setNodeStatus = ({
@@ -84,9 +85,7 @@ module.exports = function (RED) {
84
85
  }
85
86
  if (node.serverHue) {
86
87
  node.serverHue.removeClient(node);
87
- if (node.serverHue !== null && node.serverHue.hueManager !== null) {
88
- node.serverHue.addClient(node);
89
- }
88
+ node.serverHue.addClient(node);
90
89
  }
91
90
 
92
91
  node.on('input', (msg) => {
@@ -334,7 +334,7 @@ module.exports = function (RED) {
334
334
  node.send({ topic: node.name || node.topic, operation: 'Enabled', payload: node.sheddingStage })
335
335
  }
336
336
 
337
- // 24/04/2021 if payload is read or the output type is set to "read", do a read
337
+ // 24/04/2021 if payload is read or the Telegram type is set to "read", do a read
338
338
  if ((msg.hasOwnProperty('readstatus') && msg.readstatus === true)) {
339
339
  node.initialReadAllDevicesInRules()
340
340
  }
@@ -8,21 +8,21 @@
8
8
  "node-input-topic": "Group Addr.",
9
9
  "node-input-outputtopic": "Topic",
10
10
  "node-input-dpt": "Datapoint",
11
- "node-input-initialread": "Read status upon connection",
11
+ "node-input-initialread": "Read status on start",
12
12
  "node-input-initialread0": "No",
13
- "node-input-initialread1": "Read from KNX BUS (to receive the response from BUS, enable also -React to event GroupValue response-)",
13
+ "node-input-initialread1": "Read from KNX BUS (to receive the response from BUS, enable also -React to response telegrams-)",
14
14
  "node-input-initialread2": "Read the last value saved to file prior to disconnection",
15
- "node-input-initialread3": "Read the last value saved to file prior to disconnection. If the file is missing, read from KNX BUS (to receive the response from BUS, enable also -React to event GroupValue response-)",
16
- "node-input-notifyreadrequest": "React to event GroupValue read",
17
- "node-input-notifyresponse": "React to event GroupValue response",
18
- "node-input-notifywrite": "React to event GroupValue write",
15
+ "node-input-initialread3": "Read the last value saved to file prior to disconnection. If the file is missing, read from KNX BUS (to receive the response from BUS, enable also -React to response telegrams-)",
16
+ "node-input-notifyreadrequest": "React to read telegrams",
17
+ "node-input-notifyresponse": "React to response telegrams",
18
+ "node-input-notifywrite": "React to write telegrams",
19
19
  "node-input-notifyreadrequestalsorespondtobus": "Auto send node value as response to the BUS",
20
20
  "node-input-notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "If value is undefined, send",
21
21
  "node-input-listenallga": "Universal mode (listen to all Group Addresses)",
22
22
  "node-input-name": "Node Name",
23
- "node-input-outputtype": "Output Type",
24
- "node-input-outputRBE": "Send payload to BUS only if changed (RBE filter)",
25
- "node-input-inputRBE": "React only if payload from BUS is changed (RBE filter)",
23
+ "node-input-outputtype": "Telegram type",
24
+ "node-input-outputRBE": "Send payload to KNX only if changed (RBE filter)",
25
+ "node-input-inputRBE": "React only by changed payload (RBE filter)",
26
26
  "node-input-formatmultiplyvalue": "Multiply",
27
27
  "node-input-formatnegativevalue": "Negatives",
28
28
  "node-input-formatdecimalsvalue": "Decimals",
@@ -36,8 +36,8 @@
36
36
  "Advancedoptions": "Advanced options",
37
37
  "Formatting": "Format INPUT (datagram coming from the KNX BUS)",
38
38
  "Operations": "NUMERIC VALUES (operations are performed in order)",
39
- "OUTPUT": "OUTPUT (sends datagram to the KNX BUS)",
40
- "INPUT": "INPUT (listen to datagram from the KNX BUS)",
39
+ "OUTPUT": "CONTROL (payload to KNX bus)",
40
+ "INPUT": "STATUS (payload from KNX BUS)",
41
41
  "NUMERICVALUES": "NUMERIC VALUES (operations are performed in order)",
42
42
  "noETSWarning": "You haven't imported the ETS csv file. <br/> The node will work as blind transmitter/receiver. <a href=\"https://github.com/Supergiovane/node-red-contrib-knx-ultimate/wiki/2.-Node-Configuration\" target='_blank'>Click here for help about that</a>.",
43
43
  "notify-DPT3007": "You selected a relative DIM. Please <a target='_blank' href='https://github.com/Supergiovane/node-red-contrib-knx-ultimate/wiki/-Sample---Dimming'>click here to view this sample</a> and learn how to handle such payload.",
@@ -11,7 +11,7 @@
11
11
  <table style="font-size:12px">
12
12
  <tr>
13
13
  <td><img src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-knx-ultimate/master/img/greendot.png"></img></td>
14
- <td>React to event GroupValue write</td>
14
+ <td>React to write telegrams</td>
15
15
  </tr>
16
16
  <tr>
17
17
  <td><img src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-knx-ultimate/master/img/greenring.png"></img></td>
@@ -19,7 +19,7 @@
19
19
  </tr>
20
20
  <tr>
21
21
  <td><img src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-knx-ultimate/master/img/bluedot.png"></img></td>
22
- <td>React to event GroupValue response.</td>
22
+ <td>React to response telegrams.</td>
23
23
  </tr>
24
24
  <tr>
25
25
  <td><img src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-knx-ultimate/master/img/bluering.png"></img></td>
@@ -27,7 +27,7 @@
27
27
  </tr>
28
28
  <tr>
29
29
  <td><img src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-knx-ultimate/master/img/greudot.png"></img></td>
30
- <td>React to event GroupValue read.</td>
30
+ <td>React to read telegrams.</td>
31
31
  </tr>
32
32
  <tr>
33
33
  <td><img src="https://raw.githubusercontent.com/Supergiovane/node-red-contrib-knx-ultimate/master/img/greyring.png"></img></td>
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": ">=16.0.0"
5
5
  },
6
- "version": "2.2.4",
6
+ "version": "2.2.6",
7
7
  "description": "Control your KNX intallation via Node-Red! Single Node KNX IN/OUT with optional ETS group address importer. Easy to use and highly configurable. With integrated Philips HUE devices control.",
8
8
  "dependencies": {
9
9
  "binary-parser": "2.2.1",