node-red-contrib-huemagic 4.0.2 → 4.1.0

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.
Files changed (36) hide show
  1. package/README.md +31 -14
  2. package/examples/Hue Bridge.json +1 -1
  3. package/huemagic/hue-bridge-config.html +11 -4
  4. package/huemagic/hue-bridge-config.js +180 -154
  5. package/huemagic/hue-bridge.js +5 -5
  6. package/huemagic/hue-brightness.html +22 -8
  7. package/huemagic/hue-brightness.js +16 -5
  8. package/huemagic/hue-buttons.html +21 -7
  9. package/huemagic/hue-buttons.js +16 -5
  10. package/huemagic/hue-group.html +26 -12
  11. package/huemagic/hue-group.js +8 -3
  12. package/huemagic/hue-light.html +22 -8
  13. package/huemagic/hue-light.js +8 -3
  14. package/huemagic/hue-motion.html +22 -8
  15. package/huemagic/hue-motion.js +16 -5
  16. package/huemagic/hue-rules.html +20 -6
  17. package/huemagic/hue-rules.js +15 -4
  18. package/huemagic/hue-scene.html +20 -6
  19. package/huemagic/hue-scene.js +1 -1
  20. package/huemagic/hue-temperature.html +22 -8
  21. package/huemagic/hue-temperature.js +16 -5
  22. package/huemagic/locales/de/hue-bridge-config.html +8 -0
  23. package/huemagic/locales/de/hue-bridge.json +1 -1
  24. package/huemagic/locales/de/hue-group.html +1 -0
  25. package/huemagic/locales/en-US/hue-bridge-config.html +8 -0
  26. package/huemagic/locales/en-US/hue-bridge.html +1 -1
  27. package/huemagic/locales/en-US/hue-bridge.json +1 -1
  28. package/huemagic/locales/en-US/hue-buttons.html +1 -1
  29. package/huemagic/locales/en-US/hue-group.html +1 -0
  30. package/huemagic/locales/en-US/hue-light.html +1 -1
  31. package/huemagic/locales/en-US/hue-magic.html +3 -3
  32. package/huemagic/locales/en-US/hue-motion.html +1 -1
  33. package/huemagic/locales/en-US/hue-temperature.html +1 -1
  34. package/huemagic/utils/api.js +88 -94
  35. package/huemagic/utils/messages.js +134 -126
  36. package/package.json +2 -1
package/README.md CHANGED
@@ -12,7 +12,6 @@ HueMagic provides several input and output nodes for Node-RED and is the most in
12
12
  * Output and input of multiple color code definitions *(HEX, RGB & human readable color names)*
13
13
  * Automatic color temperature & brightness setting based on the current time
14
14
  * Event-based status messages for all devices connected to the Hue Bridge
15
- * Virtual pressing of the Hue Bridge button (Link Button)
16
15
  * Pairing of new devices without app enforcement (TouchLink)
17
16
  * Automatic firmware updates to the Hue Bridge and connected devices
18
17
  * Activating / deactivating of sensors & rules on the Hue Bridge
@@ -25,7 +24,7 @@ HueMagic provides several input and output nodes for Node-RED and is the most in
25
24
  * Extensively documented in English & German
26
25
 
27
26
  ### Installation
28
- HueMagic was written for **Node.js 14+** and **Node-RED v2.1+**. It supports the square-shaped Hue Bridge with the **FW 1948086000+** or higher. You can install HueMagic directly via the [Node-RED Palette Manager](https://nodered.org/docs/user-guide/editor/palette/manager) or manually using [yarn / npm](https://nodered.org/docs/user-guide/runtime/adding-nodes).
27
+ HueMagic was written for **Node.js 14+** and **Node-RED v2.1+**. It supports the square-shaped Hue Bridge with the **firmware 1948086000+** or higher. You can install HueMagic directly via the [Node-RED Palette Manager](https://nodered.org/docs/user-guide/editor/palette/manager) or manually using [npm / yarn](https://nodered.org/docs/user-guide/runtime/adding-nodes).
29
28
 
30
29
  `npm install node-red-contrib-huemagic`
31
30
 
@@ -46,9 +45,9 @@ _Please make sure that you deactivate other Hue-related nodes in Node-RED and me
46
45
 
47
46
  ### Examples
48
47
 
49
- HueMagic provides a large selection of full featured sample flows for all nodes. You can find these examples in the "[examples](https://github.com/Foddy/node-red-contrib-huemagic/tree/master/examples)" folder on GitHub or directly in Node-RED. To import a full featured example into your Node-RED interface, click on the Node-RED menu icon, then select "Import" and navigate to "Examples" in the sidebar of the popup. Then select the HueMagic folder and your desired node to import a sample flow.
48
+ HueMagic provides a large selection of full featured sample flows for all nodes. You can find these examples in the [examples folder on GitHub](https://github.com/Foddy/node-red-contrib-huemagic/tree/master/examples) or directly in Node-RED. To import a full featured example into your Node-RED interface, click on the Node-RED menu icon, then select "Import" and navigate to "Examples" in the sidebar of the popup. Then select the HueMagic folder and your desired node to import a sample flow.
50
49
 
51
- <img alt="Instructions to import examples in Node-RED" src="https://user-images.githubusercontent.com/5302050/148696808-f730ad36-8d0b-4b5b-99b2-1917831f8916.gif" width="100%">
50
+ <a href="https://github.com/Foddy/node-red-contrib-huemagic/tree/master/examples"><img alt="Instructions to import examples in Node-RED" src="https://user-images.githubusercontent.com/5302050/148696808-f730ad36-8d0b-4b5b-99b2-1917831f8916.gif" width="100%"></a>
52
51
 
53
52
  ## Hue Bridge
54
53
  The "Hue Bridge" node is a universal node that can output all settings of the bridge and status messages from other nodes.
@@ -143,7 +142,7 @@ If the "fetch" command has been used on the node, the bridge outputs the corresp
143
142
 
144
143
  #### Global status messages under `msg.updated` (optional)
145
144
 
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.
145
+ 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
146
 
148
147
  #### Last command under `msg.command` (optional)
149
148
 
@@ -173,7 +172,7 @@ To play or stop an animation, pass an object with the following content to the n
173
172
  |--|--|
174
173
  | payload (boolean) | `true`, starts the animation, `false`, stops the animation |
175
174
 
176
- ### Own animations
175
+ ### Custom animations
177
176
 
178
177
  If you pass your own animation to the node, the preselected, pre-defined animation (if set) will be temporarily replaced by yours. Own HueMagic animations are a sequence of commands that have been combined in an array. Each array element forms a step - whereby a step can also consist of several frames (transition effects).
179
178
 
@@ -186,11 +185,11 @@ Create an `array` with the respective animation steps in the form of an object a
186
185
 
187
186
  If you have created your own animation that you would like to share with others, add it at `/huemagic/animations/XXX-youranimationname.json` and create a pull request. Take a look at [this directory](https://github.com/Foddy/node-red-contrib-huemagic/tree/master/huemagic/animations) for structure help.
188
187
 
189
- ### Example of your own animation
188
+ ### Example of a custom animation
190
189
 
191
190
  This example shows what a simple animation could look like. In the first step, the delay of 500 milliseconds is waited for. The color of the light is then slowly changed to red over a period of one second. As soon as the light has completely changed to red, the second step is carried out, which also has a delay of 500 milliseconds. Finally the color changes to blue.
192
191
 
193
- If you have set the animation to play indefinitely, this process is repeated indefinitely until you manually stop the animation or redeploy the node.
192
+ If you have set the animation to loop, this process is repeated indefinitely until you manually stop the animation or redeploy the node.
194
193
 
195
194
  Pass the following object in `msg.payload` to play the example animation.
196
195
 
@@ -274,7 +273,7 @@ In addition to simply switching it on and off, there are also many other options
274
273
  | gradient (object {hex […]}) | An object with a supported color object (e.g. `hex`,` rgb`, ...) and several colors to set a gradient to supported lights |
275
274
  | mixColor (object) | A color to be mixed with the current light color. Can accept `color`, `hex`, `rgb` or `xyColor` objects and optionally `amount` (int) to indicate the mixing ratio in percent |
276
275
  | image (string) | Path of an image (local or on the web) to set the current color of the light to the average color of the image |
277
- | saturation (int) | percentage of the saturation of the current color (beta) |
276
+ | saturation (int) | Percentage of the saturation of the current color (beta) |
278
277
  | colorTemp (int / string) | Value between 153 and 500 to set the color temperature of the light or the values `cold`, `normal`, `warm`, `hot` and `auto` - where `auto` is the color temperature based on the current time |
279
278
  | incrementColorTemp (int / boolean) | Value by how much the color temperature should be warmer or `true` to make the color temperature warmer in steps of 50 |
280
279
  | decrementColorTemp (int / boolean) | Value by how much the color temperature should be colder or `true` to make the color temperature colder in steps of 50 |
@@ -396,6 +395,7 @@ In contrast to the "Hue Light" node, you have much less status information avail
396
395
  | id (string) | Indicates the new ID of the group |
397
396
  | idV1 (string / boolean) | Indicates the old ID of the group |
398
397
  | name (string) | The currently set name of the group |
398
+ | resources (object) | Contains all devices/resources behind the group
399
399
  | type (string) | The type of the group (always `group`) |
400
400
 
401
401
  #### Status changes under `msg.updated`
@@ -454,7 +454,7 @@ The "Hue Buttons" node receives switching events from input devices connected to
454
454
 
455
455
  ### Node-RED Setup Instructions
456
456
 
457
- Select the pre-configured Hue Bridge and hit the search button to find all the available switches/buttons. If you already know the ID of the switch, you can also enter it here manually. You can either assign a new name for the switch internally or keep the predefined name of the device. Optionally, you can also deactivate all automatic status messages for this node by clicking the setting "Skip events from node". The node will then no longer output any switching events. Alternatively, you can also choose whether the node's initialization message should not be suppressed when Node-RED is started. If you activate this setting, you will receive a status message for the currently selected switch after each deployment.
457
+ Select the pre-configured Hue Bridge and hit the search button to find all the available switches/buttons. If you already know the ID of the switches/buttons, you can also enter it here manually. You can either assign a new name for the switches/buttons internally or keep the predefined name of the device. Optionally, you can also deactivate all automatic status messages for this node by clicking the setting "Skip events from node". The node will then no longer output any switching events. Alternatively, you can also choose whether the node's initialization message should not be suppressed when Node-RED is started. If you activate this setting, you will receive a status message for the currently selected switches/buttons after each deployment.
458
458
 
459
459
  If you do not select a switch/button and use the node configuration in this way, the node works in the so-called "universal mode". In this mode, the node receives and outputs all status messages of the same type.
460
460
 
@@ -532,7 +532,7 @@ If necessary, the sensor can be turned on and off remotely. If the sensor has be
532
532
 
533
533
  |Property|Description|
534
534
  |--|--|
535
- | payload (boolean) | `true` turns the sensor on,` false` turns it off |
535
+ | payload (boolean) | `true` turns the sensor on, `false` turns it off |
536
536
 
537
537
  ### Status messages from the node
538
538
 
@@ -615,7 +615,7 @@ As soon as the sensor has registered a temperature change, the following status
615
615
  | 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 |
616
616
  | celsius (float) | Indicates the current ambient temperature in °C (degrees Celsius) |
617
617
  | fahrenheit (float) | Indicates the current ambient temperature in °F (degrees Fahrenheit) |
618
- | temperatureIs (string) | Describes the current temperature with the values ´very cold´, ´cold´, ´slightly cold´, ´comfortable´, ´slightly warm´, ´warm´, ´hot´ or ´very hot´ |
618
+ | temperatureIs (string) | Describes the current temperature with the values `very cold`, `cold`, `slightly cold`, `comfortable`, `slightly warm`, `warm`, `hot` or `very hot` |
619
619
  | deviceValue (float) | The original value of the temperature from the sensor |
620
620
  | updated (string) | Time of the last update of the resource by HueMagic (ISO 8601) |
621
621
 
@@ -796,9 +796,26 @@ 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.2 (latest)
799
+ ### v4.1.0 (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
+ * New queue worker throttles the number of parallel requests to the bridge to avoid 503 API limit errors (can be configured in the Bridge configuration)
802
+ * Resources are now alphabetically sorted in the node´s configuration inetrface ([#282](https://github.com/Foddy/node-red-contrib-huemagic/pull/282)) (thx)
803
+ * "Hue Bridghtness" node was optimized to output more accurate "dark" and "dayLight" values
804
+ * Several optimizations in the documentation of some nodes
805
+
806
+ ### v4.0.5
807
+
808
+ * The "Hue Group" node now contains the "resources" information with all linked resources behind the group/zone
809
+ * Fixed an issue that caused Node-RED to restart if a command was sent before a node was initialized
810
+
811
+ ### v4.0.4
812
+
813
+ * Fixed an issue with the bridge config node checking for updates too frequently ([#246](https://github.com/Foddy/node-red-contrib-huemagic/issues/246#issuecomment-1009376442))
814
+ * Fixed an issue with multiple bridges configured
815
+
816
+ ### v4.0.3
817
+
818
+ > **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
819
 
803
820
  * HueMagic speaks now directly with the bridge without any submodules *(huejay dependency removed)*
804
821
  * Migrated to the newest CLIP/v2 API version from the Philips Hue bridge
@@ -122,7 +122,7 @@
122
122
  "id": "a1d6fdeca2c9c014",
123
123
  "type": "comment",
124
124
  "z": "bf04a073.be4428",
125
- "name": "Fetch specific bridge ressources",
125
+ "name": "Fetch specific bridge resources",
126
126
  "info": "",
127
127
  "x": 150,
128
128
  "y": 420,
@@ -25,6 +25,10 @@
25
25
  </button>
26
26
  </div>
27
27
  </div>
28
+ <div class="form-row">
29
+ <label for="node-config-input-worker"><i class="fa fa-cogs"></i> <span>Worker</span></label>
30
+ <input type="text" id="node-config-input-worker" placeholder="10" style="width: calc(100% - 105px)">
31
+ </div>
28
32
  <div class="form-row" style="margin-top: 30px">
29
33
  <div style="display: inline-flex; width: calc(100% - 105px)">
30
34
  <input type="checkbox" id="node-input-autoupdates" style="flex: 15px;">
@@ -47,6 +51,9 @@
47
51
  name: { value:"Hue Bridge", required: true },
48
52
  bridge: { value:"", required: true },
49
53
  key: { value:"", required: true },
54
+ worker: { value: 10, required: true, validate:function(v) {
55
+ return (!isNaN(v) && v > 0)
56
+ }},
50
57
  autoupdates: { value: true },
51
58
  disableupdates: { value: false }
52
59
  },
@@ -91,8 +98,8 @@
91
98
  // GET THE SENSORS
92
99
  $.get('hue/bridges')
93
100
  .done( function(data) {
94
- var allRessources = JSON.parse(data);
95
- if(allRessources.length <= 0)
101
+ var allResources = JSON.parse(data);
102
+ if(allResources.length <= 0)
96
103
  {
97
104
  notification.close();
98
105
  RED.notify(scope._("hue-bridge-config.config.none-found"), { type: "error" });
@@ -100,9 +107,9 @@
100
107
  }
101
108
 
102
109
  // SET OPTIONS
103
- allRessources.forEach(function(ressource)
110
+ allResources.forEach(function(resource)
104
111
  {
105
- options[ressource.ip] = { value: ressource.ip, label: ressource.ip };
112
+ options[resource.ip] = { value: resource.ip, label: resource.ip };
106
113
  });
107
114
 
108
115
  // SELECT CURRENT VALUE