node-red-contrib-huemagic 4.0.1 → 4.0.5
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 +28 -18
- package/examples/Hue Bridge.json +1 -1
- package/huemagic/hue-bridge-config.html +4 -4
- package/huemagic/hue-bridge-config.js +149 -143
- package/huemagic/hue-bridge.js +5 -5
- package/huemagic/hue-brightness.html +7 -7
- package/huemagic/hue-brightness.js +16 -5
- package/huemagic/hue-buttons.html +7 -7
- package/huemagic/hue-buttons.js +16 -5
- package/huemagic/hue-group.html +11 -11
- package/huemagic/hue-group.js +8 -3
- package/huemagic/hue-light.html +7 -7
- package/huemagic/hue-light.js +8 -3
- package/huemagic/hue-motion.html +7 -7
- package/huemagic/hue-motion.js +16 -5
- package/huemagic/hue-rules.html +5 -5
- package/huemagic/hue-rules.js +15 -4
- package/huemagic/hue-scene.html +5 -5
- package/huemagic/hue-scene.js +1 -1
- package/huemagic/hue-temperature.html +7 -7
- package/huemagic/hue-temperature.js +16 -5
- package/huemagic/locales/de/hue-bridge.json +1 -1
- package/huemagic/locales/de/hue-buttons.html +2 -2
- package/huemagic/locales/de/hue-group.html +1 -0
- package/huemagic/locales/en-US/hue-bridge.html +1 -1
- package/huemagic/locales/en-US/hue-bridge.json +1 -1
- package/huemagic/locales/en-US/hue-buttons.html +3 -3
- package/huemagic/locales/en-US/hue-group.html +1 -0
- package/huemagic/locales/en-US/hue-magic.html +2 -2
- package/huemagic/locales/en-US/hue-motion.html +1 -1
- package/huemagic/locales/en-US/hue-temperature.html +1 -1
- package/huemagic/utils/api.js +88 -94
- package/huemagic/utils/messages.js +132 -124
- package/package.json +1 -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 **
|
|
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
|
|
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
|
|
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
|
|
|
@@ -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
|
|
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
|
|
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
|
|
|
@@ -295,9 +294,9 @@ As soon as a change in the light settings has been detected (regardless of wheth
|
|
|
295
294
|
| brightnessLevel (int / boolean) | Current brightness from 0-254 or `false`, if the light does not support a brightness setting |
|
|
296
295
|
| reachable (boolean / string) | `true` if the light is connected to the bridge, `unknown` if the connection status deviates |
|
|
297
296
|
| 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]
|
|
297
|
+
| rgb (array [int, int, int] / optional) | Current light color in the form of an RGB value, if the light can display colors |
|
|
299
298
|
| 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]}
|
|
299
|
+
| xyColor (object {x [float], y [float]} / optional) | Current light color in the form of an XY value, if the light can display colors |
|
|
301
300
|
| 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
301
|
| 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
302
|
| colorTemp (int / boolean / optional) | Current color temperature of the light, if the light can display color temperatures and a color temperature has been set |
|
|
@@ -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
|
|
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
|
|
|
@@ -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`
|
|
@@ -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
|
|
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
|
|
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,19 @@ 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.
|
|
799
|
+
### v4.0.5 (latest)
|
|
800
|
+
|
|
801
|
+
* The "Hue Group" node now contains the "resources" information with all linked resources behind the group/zone
|
|
802
|
+
* Fixed an issue that caused Node-RED to restart if a command was sent before a node was initialized
|
|
803
|
+
|
|
804
|
+
### v4.0.4
|
|
805
|
+
|
|
806
|
+
* 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))
|
|
807
|
+
* Fixed an issue with multiple bridges configured
|
|
808
|
+
|
|
809
|
+
### v4.0.3
|
|
800
810
|
|
|
801
|
-
> **Attention!** HueMagic v4
|
|
811
|
+
> **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
812
|
|
|
803
813
|
* HueMagic speaks now directly with the bridge without any submodules *(huejay dependency removed)*
|
|
804
814
|
* Migrated to the newest CLIP/v2 API version from the Philips Hue bridge
|
|
@@ -809,9 +819,9 @@ If the status of the node has changed via a certain command, the entire command
|
|
|
809
819
|
* New universal node "Hue Buttons" replaces the following nodes: "Hue Switch", "Hue Button", "Hue Tap"
|
|
810
820
|
* New "updated" object for all nodes, which only contains the properties that have been updated since the last state
|
|
811
821
|
* 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)
|
|
822
|
+
* New gradient color setting for compatible light sources (in "Hue Light" node)
|
|
813
823
|
* New inject button for almost all nodes, which triggers the current status of a node
|
|
814
|
-
* New "universal mode" support for "Hue Rule"
|
|
824
|
+
* New "universal mode" support for the "Hue Rule" node
|
|
815
825
|
* New SVG-version of each node icon for higher quality rendering in the Node-RED UI
|
|
816
826
|
* New and full featured examples for each node right inside Node-RED
|
|
817
827
|
* New color mix feature in "Hue Light" nodes with the ability to mix the current light color with another
|
package/examples/Hue Bridge.json
CHANGED
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
// GET THE SENSORS
|
|
92
92
|
$.get('hue/bridges')
|
|
93
93
|
.done( function(data) {
|
|
94
|
-
var
|
|
95
|
-
if(
|
|
94
|
+
var allResources = JSON.parse(data);
|
|
95
|
+
if(allResources.length <= 0)
|
|
96
96
|
{
|
|
97
97
|
notification.close();
|
|
98
98
|
RED.notify(scope._("hue-bridge-config.config.none-found"), { type: "error" });
|
|
@@ -100,9 +100,9 @@
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// SET OPTIONS
|
|
103
|
-
|
|
103
|
+
allResources.forEach(function(resource)
|
|
104
104
|
{
|
|
105
|
-
options[
|
|
105
|
+
options[resource.ip] = { value: resource.ip, label: resource.ip };
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
// SELECT CURRENT VALUE
|