node-red-contrib-knx-ultimate 2.2.1 → 2.2.2

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/.eslintrc.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
- "env": {
3
- "browser": true,
4
- "commonjs": true,
5
- "es2021": true
6
- },
7
- "extends": "airbnb-base",
8
- "parserOptions": {
9
- "ecmaVersion": "latest"
10
- },
11
- "rules": {
12
- "quotes": "off"
13
- }
2
+ "env": {
3
+ "browser": true,
4
+ "commonjs": true,
5
+ "es2021": true
6
+ },
7
+ "extends": "airbnb-base",
8
+ "parserOptions": {
9
+ "ecmaVersion": "latest"
10
+ },
11
+ "rules": {
12
+ "quotes": "off"
13
+ }
14
14
  }
package/CHANGELOG.md CHANGED
@@ -1,10 +1,19 @@
1
1
  ![Sample Node](img/logo.png)
2
2
 
3
- [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square)](https://www.paypal.me/techtoday)
3
+ [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square)](https://www.paypal.me/techtoday)
4
4
 
5
5
  <br/>
6
6
 
7
7
  # CHANGELOG
8
+
9
+ <p>
10
+ <b>Version 2.2.2</b> - October 2023<br/>
11
+ - NEW: HUE Motion: support HUE Camera motion events via the HUE Motion node.<br/>
12
+ - HUE Light: some tweaking to the GUI.<br/>
13
+ - HUE Grouped Light: Fixed relative dimming function.<br/>
14
+ - KNK Alerter node: <a href="https://github.com/Supergiovane/node-red-contrib-knx-ultimate/wiki/SampleAlerter">fixed the wiki sample page</a>.<br/>
15
+ - KNX Viewer: added the help pane in Node-Red.<br/>
16
+ </p>
8
17
  <p>
9
18
  <b>Version 2.2.1</b> - October 2023<br/>
10
19
  - Massive rewrite of the DIM function, for brightness and for color temperature.<br/>
@@ -94,12 +94,12 @@ module.exports = (RED) => {
94
94
  // Query the HUE Bridge to return the resources
95
95
  node.loadResourcesFromHUEBridge = (_callerNode = undefined) => new Promise((resolve, reject) => {
96
96
  (async () => {
97
- // Reload all resources
97
+ // °°°°°° Load ALL resources
98
98
  try {
99
99
  if (_callerNode === undefined) {
100
- node.hueAllResources = await node.hueManager.hueApiV2.get("/resource");
101
- node.hueAllRooms = node.hueAllResources.filter((a) => a.type === "room");
102
- // Update all KNX State of the nodes with the new hue device values
100
+ node.hueAllResources = await node.hueManager.hueApiV2.get("/resource");
101
+ node.hueAllRooms = node.hueAllResources.filter((a) => a.type === "room");
102
+ // Update all KNX State of the nodes with the new hue device values
103
103
  node.nodeClients.forEach((nodeClient) => {
104
104
  if (nodeClient.hueDevice !== undefined) {
105
105
  const oHUEDevice = node.hueAllResources.filter((a) => a.id === nodeClient.hueDevice)[0];
@@ -107,7 +107,7 @@ module.exports = (RED) => {
107
107
  nodeClient.currentHUEDevice = oHUEDevice;
108
108
  for (const [key, value] of Object.entries(oHUEDevice)) {
109
109
  // Update KNX State
110
- let oProperty = { id: oHUEDevice.id }
110
+ const oProperty = { id: oHUEDevice.id };
111
111
  oProperty[key] = value;
112
112
  nodeClient.handleSendHUE(oProperty);
113
113
  }
@@ -115,7 +115,7 @@ module.exports = (RED) => {
115
115
  }
116
116
  });
117
117
  } else {
118
- // Update only one node. The node is requesting an update because it has beeb edited by the user
118
+ // °°°°°° Read ONE resource and update only one node. The node is requesting an update because it has been edited in Node-Red's window by the user
119
119
  try {
120
120
  // Please KEEP THE AWAIT, otherwise al posto dell'oggetto, a Promisse will be returned.
121
121
  const oHUEDevice = await node.hueAllResources.filter((a) => a.id === _callerNode.hueDevice)[0];
@@ -123,7 +123,7 @@ module.exports = (RED) => {
123
123
  _callerNode.currentHUEDevice = oHUEDevice;
124
124
  for (const [key, value] of Object.entries(oHUEDevice)) {
125
125
  // Update KNX State
126
- let oProperty = { id: oHUEDevice.id }
126
+ const oProperty = { id: oHUEDevice.id };
127
127
  oProperty[key] = value;
128
128
  _callerNode.handleSendHUE(oProperty);
129
129
  }
@@ -175,14 +175,14 @@ module.exports = (RED) => {
175
175
  resourceName += "ALL GROUPS and ";
176
176
  } else {
177
177
  resourceName += `${owner.metadata.name} and `;
178
- //const room = node.hueAllRooms.find((child) => child.children.find((a) => a.rid === owner.id));
179
- //sRoom += room !== undefined ? `${room.metadata.name} + ` : " + ";
180
- sType += capStr(owner.type) + ' + ';
178
+ // const room = node.hueAllRooms.find((child) => child.children.find((a) => a.rid === owner.id));
179
+ // sRoom += room !== undefined ? `${room.metadata.name} + ` : " + ";
180
+ sType += `${capStr(owner.type)} + `;
181
181
  }
182
182
  }
183
183
  sType = sType.slice(0, -" + ".length);
184
184
  resourceName = resourceName.slice(0, -" and ".length);
185
- resourceName += sType !== "" ? ' (' + sType + ')' : "";
185
+ resourceName += sType !== "" ? ` (${sType})` : "";
186
186
  retArray.push({
187
187
  name: `${capStr(resource.type)}: ${resourceName}`,
188
188
  id: resource.id,
@@ -207,7 +207,7 @@ module.exports = (RED) => {
207
207
  id: resource.id,
208
208
  });
209
209
  }
210
- if (_rtype === "motion") {
210
+ if (_rtype === "motion" || _rtype === "camera_motion") {
211
211
  const linkedDevName = node.hueAllResources.find((dev) => dev.type === "device" && dev.services.find((serv) => serv.rid === resource.id)).metadata.name || "";
212
212
  retArray.push({
213
213
  name: `${capStr(_rtype)}: ${linkedDevName}`,
@@ -347,7 +347,8 @@ module.exports = (RED) => {
347
347
  });
348
348
 
349
349
  RED.httpAdmin.get("/knxUltimateDpts", RED.auth.needsPermission("hue-config.read"), (req, res) => {
350
- const dpts = Object.entries(dptlib).filter(onlyDptKeys).map(extractBaseNo).sort(sortBy("base")).reduce(toConcattedSubtypes, []);
350
+ const dpts = Object.entries(dptlib).filter(onlyDptKeys).map(extractBaseNo).sort(sortBy("base"))
351
+ .reduce(toConcattedSubtypes, []);
351
352
  res.json(dpts);
352
353
  });
353
354
  }