node-red-contrib-huemagic 4.0.1 → 4.0.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/README.md CHANGED
@@ -143,7 +143,7 @@ If the "fetch" command has been used on the node, the bridge outputs the corresp
143
143
 
144
144
  #### Global status messages under `msg.updated` (optional)
145
145
 
146
- Unless deactivated, the node issues an updated status message for each resource on the bridge. The status message under * msg.updated * follows the pattern of the respective resource and varies depending on the type of device that was last updated.
146
+ Unless deactivated, the node outputs an updated status message for each resource on the bridge. The status message under * msg.updated * follows the pattern of the respective resource and varies depending on the type of device that was last updated.
147
147
 
148
148
  #### Last command under `msg.command` (optional)
149
149
 
@@ -295,9 +295,9 @@ As soon as a change in the light settings has been detected (regardless of wheth
295
295
  | brightnessLevel (int / boolean) | Current brightness from 0-254 or `false`, if the light does not support a brightness setting |
296
296
  | reachable (boolean / string) | `true` if the light is connected to the bridge, `unknown` if the connection status deviates |
297
297
  | connectionStatus (string) | The current connection status with the bridge in the form of a string. Can contain `connected`, `disconnected`, `connectivity_issue` or `unidirectional_incoming` as a value |
298
- | rgb (array [int, int, int] | optional) | Current light color in the form of an RGB value, if the light can display colors |
298
+ | rgb (array [int, int, int] / optional) | Current light color in the form of an RGB value, if the light can display colors |
299
299
  | hex (string / optional) | Current light color in the form of a hexadecimal value if the light can display colors |
300
- | xyColor (object {x [float], y [float]} | optional) | Current light color in the form of an XY value, if the light can display colors |
300
+ | xyColor (object {x [float], y [float]} / optional) | Current light color in the form of an XY value, if the light can display colors |
301
301
  | color (string / optional) | Current light name in English, if the light can display colors and the corresponding setting of the node has been activated |
302
302
  | gradient (object / optional) | Current gradient setting with all available color units in the form of an array, if the light supports gradient settings, where `colors` outputs the colors, `numColors` the number of set colors in the gradient and `totalColors` the maximum possible Number of colors the resource can support in the gradient |
303
303
  | colorTemp (int / boolean / optional) | Current color temperature of the light, if the light can display color temperatures and a color temperature has been set |
@@ -491,8 +491,8 @@ As soon as a key has been pressed, the following status message is returned by t
491
491
  | name (string) | The currently set name of the switch/button |
492
492
  | type (string) | The type of the switch/button (always `button`) |
493
493
  | softwareVersion (string) | The current firmware of the switch/button |
494
- | battery (float) | The current battery level of the switch/button |
495
- | batteryState (string) | The current status of the battery level. Can contain `normal`, `low` or `critical` as a value |
494
+ | battery (float / boolean) | The current battery level of the switch/button, `false`, when there is no battery |
495
+ | batteryState (string / boolean) | The current status of the battery level. Can contain `normal`, `low` or `critical` as a value, `false`, when there is no battery |
496
496
  | model (object) | Contains the model information of the switch/button under `id` , `manufacturer`, `name`, `type` and `certified` |
497
497
 
498
498
  #### Status changes under `msg.updated`
@@ -796,9 +796,9 @@ If the status of the node has changed via a certain command, the entire command
796
796
 
797
797
  # Changelog
798
798
 
799
- ### v4.0.1 (latest)
799
+ ### v4.0.2 (latest)
800
800
 
801
- > **Attention!** HueMagic v4 + has been almost completely rewritten under the hood and requires at least the (square-shaped) Philips Hue Bridge firmware 1948086000+ from November 1st, 2021 ([Upgrade instructions](https://www.lighting.philips.com/content/B2C/en_US/microsites/meethue/marketing-catalog/huewireless_ca/support/security-advisory/general/where-and-how-can-i-update-my-hue-system-with-the-latest-software.html)) and Node-RED v1 + ([Upgrade instructions](https://nodered.org/docs/getting-started/local#upgrading-node-red)). If you are upgrading from a previous HueMagic version to the v4, you will have to reconfigure (not completely rebuild) all nodes by clicking them and selecting the appropriate device from the list. This also applies to nodes / functions that are operated in universal mode, as the numeric identifiers of the latest Philips Hue API version have been replaced in UUIDs. The nodes "Hue Switch", "Hue Button" & "Hue Tap" have been replaced in v4 by the universal and uniform node "Hue Buttons", which works with all button / switch devices that are connected to the Hue Bridge (please note here also the new API in the documentation). The request and return objects of the individual nodes are largely compatible with older HueMagic versions - with the exception of the nodes "Hue Bridge", "Hue Buttons", "Hue Scene" & "Hue Group". These need to be adjusted in the v4. Make sure that you meet the minimum technical requirements and have a quiet minute for the migration before upgrading to the v4.
801
+ > **Attention!** HueMagic v4 + has been almost completely rewritten under the hood and requires at least the (square-shaped) Philips Hue Bridge firmware 1948086000+ from November 1st, 2021 ([Upgrade instructions](https://www.lighting.philips.com/content/B2C/en_US/microsites/meethue/marketing-catalog/huewireless_ca/support/security-advisory/general/where-and-how-can-i-update-my-hue-system-with-the-latest-software.html)) and Node-RED v1+ ([Upgrade instructions](https://nodered.org/docs/getting-started/local#upgrading-node-red)). If you are upgrading from a previous HueMagic version to the v4, you will have to reconfigure (not completely rebuild) all nodes by clicking them and selecting the appropriate device from the list. This also applies to nodes / functions that are operated in universal mode, as the numeric identifiers of the latest Philips Hue API version have been replaced in UUIDs. The nodes "Hue Switch", "Hue Button" & "Hue Tap" have been replaced in v4 by the universal and uniform node "Hue Buttons", which works with all button / switch devices that are connected to the Hue Bridge (please note here also the new API in the documentation). The request and return objects of the individual nodes are largely compatible with older HueMagic versions - with the exception of the nodes "Hue Bridge", "Hue Buttons", "Hue Scene" & "Hue Group". These need to be adjusted in the v4. Make sure that you meet the minimum technical requirements and have a quiet minute for the migration before upgrading to the v4.
802
802
 
803
803
  * HueMagic speaks now directly with the bridge without any submodules *(huejay dependency removed)*
804
804
  * Migrated to the newest CLIP/v2 API version from the Philips Hue bridge
@@ -809,9 +809,9 @@ If the status of the node has changed via a certain command, the entire command
809
809
  * New universal node "Hue Buttons" replaces the following nodes: "Hue Switch", "Hue Button", "Hue Tap"
810
810
  * New "updated" object for all nodes, which only contains the properties that have been updated since the last state
811
811
  * New configuration option to suppress first message after node initialization (for all nodes)
812
- * New gradient color setting for compatible light sources (in "Hue Light node)
812
+ * New gradient color setting for compatible light sources (in "Hue Light" node)
813
813
  * New inject button for almost all nodes, which triggers the current status of a node
814
- * New "universal mode" support for "Hue Rule" nodes
814
+ * New "universal mode" support for the "Hue Rule" node
815
815
  * New SVG-version of each node icon for higher quality rendering in the Node-RED UI
816
816
  * New and full featured examples for each node right inside Node-RED
817
817
  * New color mix feature in "Hue Light" nodes with the ability to mix the current light color with another
@@ -106,7 +106,7 @@ module.exports = function(RED)
106
106
  let patchObject = {};
107
107
 
108
108
  // DEFINE SENSOR ID & CURRENT STATE
109
- const tempSensorID = (msg.topic != null) ? msg.topic : config.sensorid;
109
+ const tempSensorID = (typeof msg.topic != 'undefined' && msg.topic.length > 0) ? msg.topic : config.sensorid;
110
110
  let currentState = bridge.get("light_level", tempSensorID);
111
111
 
112
112
  // GET CURRENT STATE
@@ -124,7 +124,7 @@ module.exports = function(RED)
124
124
  scope.lastCommand = msg;
125
125
 
126
126
  // DEFINE SENSOR ID
127
- const tempSensorID = (msg.topic != null) ? msg.topic : config.sensorid;
127
+ const tempSensorID = (typeof msg.topic != 'undefined' && msg.topic.length > 0) ? msg.topic : config.sensorid;
128
128
  let currentState = bridge.get("button", tempSensorID);
129
129
 
130
130
  // GET CURRENT STATE
@@ -108,7 +108,7 @@ module.exports = function(RED)
108
108
  let patchObject = {};
109
109
 
110
110
  // DEFINE SENSOR ID & CURRENT STATE
111
- const tempGroupID = (msg.topic != null) ? msg.topic : config.groupid;
111
+ const tempGroupID = (typeof msg.topic != 'undefined' && msg.topic.length > 0) ? msg.topic : config.groupid;
112
112
  let currentState = bridge.get("group", tempGroupID, { colornames: config.colornamer ? true : false });
113
113
 
114
114
  // CHECK IF LIGHT ID IS SET
@@ -121,7 +121,7 @@ module.exports = function(RED)
121
121
  let patchObject = {};
122
122
 
123
123
  // DEFINE SENSOR ID & CURRENT STATE
124
- const tempLightID = (msg.topic != null) ? msg.topic : config.lightid;
124
+ const tempLightID = (typeof msg.topic != 'undefined' && msg.topic.length > 0) ? msg.topic : config.lightid;
125
125
  let currentState = bridge.get("light", tempLightID, { colornames: config.colornamer ? true : false });
126
126
 
127
127
  // CHECK IF LIGHT ID IS SET
@@ -100,7 +100,7 @@ module.exports = function(RED)
100
100
  let patchObject = {};
101
101
 
102
102
  // DEFINE SENSOR ID & CURRENT STATE
103
- const tempSensorID = (msg.topic != null) ? msg.topic : config.sensorid;
103
+ const tempSensorID = (typeof msg.topic != 'undefined' && msg.topic.length > 0) ? msg.topic : config.sensorid;
104
104
  let currentState = bridge.get("motion", tempSensorID);
105
105
 
106
106
  // GET CURRENT STATE
@@ -90,7 +90,7 @@ module.exports = function(RED)
90
90
  let patchObject = {};
91
91
 
92
92
  // DEFINE SENSOR ID & CURRENT STATE
93
- const tempRuleID = (msg.topic != null) ? msg.topic : config.ruleid;
93
+ const tempRuleID = (typeof msg.topic != 'undefined' && msg.topic.length > 0) ? msg.topic : config.ruleid;
94
94
  let currentState = bridge.get("rule", "rule_" + tempRuleID);
95
95
 
96
96
  // CONTROL RULE
@@ -108,7 +108,7 @@ module.exports = function(RED)
108
108
  let patchObject = {};
109
109
 
110
110
  // DEFINE SENSOR ID & CURRENT STATE
111
- const tempSensorID = (msg.topic != null) ? msg.topic : config.sensorid;
111
+ const tempSensorID = (typeof msg.topic != 'undefined' && msg.topic.length > 0) ? msg.topic : config.sensorid;
112
112
  let currentState = bridge.get("temperature", tempSensorID);
113
113
 
114
114
  // GET CURRENT STATE
@@ -34,8 +34,8 @@ Sobald eine Taste gedrückt wurde, wird folgende Statusnachricht vom Node zurüc
34
34
  : name (string) : Der aktuell eingestellte Name des Schalters
35
35
  : type (string) : Der Typ des Schalters (immer `button`)
36
36
  : softwareVersion (string) : Die aktuelle Firmware des Schalters
37
- : battery (float) : Der aktuelle Batteriestand des Schalters
38
- : batteryState (string) : Der aktuelle Status des Batteriestands. Kann `normal`, `low` oder `critical` als Wert beinhalten
37
+ : battery (float | boolean) : Der aktuelle Batteriestand des Schalters, `false`, wenn keine Batterie vorhanden
38
+ : batteryState (string | boolean) : Der aktuelle Status des Batteriestands. Kann `normal`, `low` oder `critical` als Wert beinhalten, `false`, wenn keine Batterie vorhanden
39
39
  : model (object) : Beinhaltet die Modellinformationen des Schalters unter `id`, `manufacturer`, `name`, `type` und `certified`
40
40
 
41
41
  #### Zustandsänderungen unter `msg.updated`
@@ -79,7 +79,7 @@ If the "fetch" command has been used on the node, the bridge outputs the corresp
79
79
 
80
80
  #### Global status messages under `msg.updated` (optional)
81
81
 
82
- Unless deactivated, the node issues an updated status message for each resource on the bridge. The status message under * msg.updated * follows the pattern of the respective resource and varies depending on the type of device that was last updated.
82
+ Unless deactivated, the node outputs an updated status message for each resource on the bridge. The status message under * msg.updated * follows the pattern of the respective resource and varies depending on the type of device that was last updated.
83
83
 
84
84
  #### Last command under `msg.command` (optional)
85
85
 
@@ -34,8 +34,8 @@ As soon as a key has been pressed, the following status message is returned by t
34
34
  : name (string): The currently set name of the switch/button
35
35
  : type (string): The type of the switch/button (always `button`)
36
36
  : softwareVersion (string): The current firmware of the switch/button
37
- : battery (float): The current battery level of the switch/button
38
- : batteryState (string): The current status of the battery level. Can contain `normal`, `low` or `critical` as a value
37
+ : battery (float | boolean): The current battery level of the switch/button, `false`, if there is no battery
38
+ : batteryState (string | boolean): The current status of the battery level. Can contain `normal`, `low` or `critical` as a value, `false`, if there is no battery
39
39
  : model (object): Contains the model information of the switch/button under `id` , `manufacturer`, `name`, `type` and `certified`
40
40
 
41
41
  #### Status changes under `msg.updated`
@@ -345,8 +345,8 @@ class HueButtonsMessage
345
345
  this.message.info.name = ressource.metadata.name;
346
346
  this.message.info.type = "button";
347
347
  this.message.info.softwareVersion = ressource.product_data.software_version;
348
- this.message.info.battery = Object.values(ressource.services.device_power)[0].power_state.battery_level;
349
- this.message.info.batteryState = Object.values(ressource.services.device_power)[0].power_state.battery_state; // NEW!
348
+ this.message.info.battery = ressource.services.device_power ? Object.values(ressource.services.device_power)[0].power_state.battery_level : false;
349
+ this.message.info.batteryState = ressource.services.device_power ? Object.values(ressource.services.device_power)[0].power_state.battery_state : false; // NEW!
350
350
 
351
351
  this.message.info.model = {};
352
352
  this.message.info.model.id = ressource.product_data.model_id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-huemagic",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Philips Hue node to control bridges, lights, groups, scenes, rules, taps, switches, buttons, motion sensors, temperature sensors and Lux sensors using Node-RED.",
5
5
  "author": "foddy",
6
6
  "homepage": "https://github.com/Foddy/node-red-contrib-huemagic",