smart-nodes 0.4.12 → 0.4.13

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.
package/CHANGELOG.md CHANGED
@@ -132,3 +132,7 @@
132
132
  ## Version 0.4.12:
133
133
 
134
134
  - Fixed text exec node.
135
+
136
+ ## Version 0.4.13:
137
+
138
+ - Fixed text exec node again.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-nodes",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "Smart Nodes",
5
5
  "keywords": [
6
6
  "node-red",
@@ -44,7 +44,7 @@ module.exports = function (RED)
44
44
 
45
45
  // Holds references to the nodes to access them by room name
46
46
  // Format: RoomName => [Node1, Node2, ..., NodeX]
47
- let lookup = [];
47
+ let lookup = new Map();
48
48
 
49
49
 
50
50
  node.status({});
@@ -214,9 +214,9 @@ module.exports = function (RED)
214
214
  let room = rooms[parseInt(word.substring(1), 10)];
215
215
  // node.log("Found room " + room);
216
216
 
217
- if (lookup[room] && Array.isArray(lookup[room]))
217
+ if (lookup.has(room))
218
218
  {
219
- for (const node of lookup[room])
219
+ for (const node of lookup.get(room))
220
220
  {
221
221
  if (without && affectedNodes.includes(node))
222
222
  affectedNodes.splice(affectedNodes.indexOf(node), 1);
@@ -265,7 +265,7 @@ module.exports = function (RED)
265
265
  {
266
266
  for (const link of config.links)
267
267
  {
268
- // node.log("Check node = " + link);
268
+ node.log("Check node = " + link);
269
269
  let linkedNode = RED.nodes.getNode(link);
270
270
 
271
271
  if (linkedNode == null || linkedNode.exec_text_names == null || linkedNode.exec_text_names.length == 0)
@@ -280,23 +280,23 @@ module.exports = function (RED)
280
280
  case "smart_scene-control":
281
281
  case "smart_shutter-control":
282
282
  case "smart_shutter-complex-control":
283
- // node.log("Add room " + name);
284
- if (!lookup[name])
285
- lookup[name] = [];
283
+ node.log("Add room: " + name);
284
+ if (!lookup.has(name))
285
+ lookup.set(name, []);
286
286
 
287
- if (!lookup[name].includes(linkedNode))
288
- lookup[name].push(linkedNode);
287
+ if (!lookup.get(name).includes(linkedNode))
288
+ lookup.get(name).push(linkedNode);
289
+
290
+ if (!rooms.includes(name))
291
+ {
292
+ node.log("Add room to room list: " + name);
293
+ rooms.push(name);
294
+ }
289
295
  break;
290
296
 
291
297
  default:
292
298
  break;
293
299
  }
294
-
295
- if (!rooms.includes(name))
296
- {
297
- // node.log("Add room " + name);
298
- rooms.push(name);
299
- }
300
300
  }
301
301
  }
302
302