node-red-contrib-huemagic 4.0.4 → 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 +7 -1
- package/huemagic/hue-brightness.js +5 -0
- package/huemagic/hue-buttons.js +5 -0
- package/huemagic/hue-group.js +5 -0
- package/huemagic/hue-light.js +5 -0
- package/huemagic/hue-motion.js +5 -0
- package/huemagic/hue-rules.js +5 -0
- package/huemagic/hue-temperature.js +5 -0
- package/huemagic/locales/de/hue-group.html +1 -0
- package/huemagic/locales/en-US/hue-group.html +1 -0
- package/huemagic/utils/messages.js +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -395,6 +395,7 @@ In contrast to the "Hue Light" node, you have much less status information avail
|
|
|
395
395
|
| id (string) | Indicates the new ID of the group |
|
|
396
396
|
| idV1 (string / boolean) | Indicates the old ID of the group |
|
|
397
397
|
| name (string) | The currently set name of the group |
|
|
398
|
+
| resources (object) | Contains all devices/resources behind the group
|
|
398
399
|
| type (string) | The type of the group (always `group`) |
|
|
399
400
|
|
|
400
401
|
#### Status changes under `msg.updated`
|
|
@@ -795,7 +796,12 @@ If the status of the node has changed via a certain command, the entire command
|
|
|
795
796
|
|
|
796
797
|
# Changelog
|
|
797
798
|
|
|
798
|
-
### 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
|
|
799
805
|
|
|
800
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))
|
|
801
807
|
* Fixed an issue with multiple bridges configured
|
|
@@ -114,6 +114,11 @@ module.exports = function(RED)
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
let currentState = bridge.get("light_level", tempSensorID);
|
|
117
|
+
if(!currentState)
|
|
118
|
+
{
|
|
119
|
+
scope.error("The sensor in not yet available. Please wait for the bridge to connect before sending any command.");
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
117
122
|
|
|
118
123
|
// GET CURRENT STATE
|
|
119
124
|
if( (typeof msg.payload != 'undefined' && typeof msg.payload.status != 'undefined') || (typeof msg.__user_inject_props__ != 'undefined' && msg.__user_inject_props__ == "status") )
|
package/huemagic/hue-buttons.js
CHANGED
|
@@ -42,6 +42,11 @@ module.exports = function(RED)
|
|
|
42
42
|
bridge.subscribe("button", config.sensorid, function(info)
|
|
43
43
|
{
|
|
44
44
|
let currentState = bridge.get("button", info.id);
|
|
45
|
+
if(!currentState)
|
|
46
|
+
{
|
|
47
|
+
scope.error("The button/switch in not yet available. Please wait for the bridge to connect before sending any command.");
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
45
50
|
|
|
46
51
|
// RESOURCE FOUND?
|
|
47
52
|
if(currentState !== false)
|
package/huemagic/hue-group.js
CHANGED
|
@@ -110,6 +110,11 @@ module.exports = function(RED)
|
|
|
110
110
|
// DEFINE SENSOR ID & CURRENT STATE
|
|
111
111
|
const tempGroupID = (!config.groupid && typeof msg.topic != 'undefined' && bridge.validResourceID.test(msg.topic) === true) ? msg.topic : config.groupid;
|
|
112
112
|
let currentState = bridge.get("group", tempGroupID, { colornames: config.colornamer ? true : false });
|
|
113
|
+
if(!currentState)
|
|
114
|
+
{
|
|
115
|
+
scope.error("The group in not yet available. Please wait for the bridge to connect before sending any command.");
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
113
118
|
|
|
114
119
|
// CHECK IF LIGHT ID IS SET
|
|
115
120
|
if(!tempGroupID)
|
package/huemagic/hue-light.js
CHANGED
|
@@ -123,6 +123,11 @@ module.exports = function(RED)
|
|
|
123
123
|
// DEFINE SENSOR ID & CURRENT STATE
|
|
124
124
|
const tempLightID = (!config.lightid && typeof msg.topic != 'undefined' && bridge.validResourceID.test(msg.topic) === true) ? msg.topic : config.lightid;
|
|
125
125
|
let currentState = bridge.get("light", tempLightID, { colornames: config.colornamer ? true : false });
|
|
126
|
+
if(!currentState)
|
|
127
|
+
{
|
|
128
|
+
scope.error("The light in not yet available. Please wait for the bridge to connect before sending any command.");
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
126
131
|
|
|
127
132
|
// CHECK IF LIGHT ID IS SET
|
|
128
133
|
if(!tempLightID)
|
package/huemagic/hue-motion.js
CHANGED
|
@@ -108,6 +108,11 @@ module.exports = function(RED)
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
let currentState = bridge.get("motion", tempSensorID);
|
|
111
|
+
if(!currentState)
|
|
112
|
+
{
|
|
113
|
+
scope.error("The sensor in not yet available. Please wait for the bridge to connect before sending any command.");
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
111
116
|
|
|
112
117
|
// GET CURRENT STATE
|
|
113
118
|
if( (typeof msg.payload != 'undefined' && typeof msg.payload.status != 'undefined') || (typeof msg.__user_inject_props__ != 'undefined' && msg.__user_inject_props__ == "status") )
|
package/huemagic/hue-rules.js
CHANGED
|
@@ -98,6 +98,11 @@ module.exports = function(RED)
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
let currentState = bridge.get("rule", "rule_" + tempRuleID);
|
|
101
|
+
if(!currentState)
|
|
102
|
+
{
|
|
103
|
+
scope.error("The rule in not yet available. Please wait for the bridge to connect before sending any command.");
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
101
106
|
|
|
102
107
|
// CONTROL RULE
|
|
103
108
|
if(msg.payload === true || msg.payload === false)
|
|
@@ -39,6 +39,11 @@ module.exports = function(RED)
|
|
|
39
39
|
bridge.subscribe("temperature", config.sensorid, function(info)
|
|
40
40
|
{
|
|
41
41
|
let currentState = bridge.get("temperature", info.id);
|
|
42
|
+
if(!currentState)
|
|
43
|
+
{
|
|
44
|
+
scope.error("The sensor in not yet available. Please wait for the bridge to connect before sending any command.");
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
42
47
|
|
|
43
48
|
// RESOURCE FOUND?
|
|
44
49
|
if(currentState !== false)
|
|
@@ -53,6 +53,7 @@ Anders als beim „Hue Licht“-Node, stehen Ihnen hier viel weniger Statusinfor
|
|
|
53
53
|
: id (string) : Gibt die neue ID der Gruppe an
|
|
54
54
|
: idV1 (string | boolean) : Gibt die alte ID der Gruppe an
|
|
55
55
|
: name (string) : Der aktuell eingestellte Name des Gruppe
|
|
56
|
+
: resources (object) : Enthält alle Geräte/Ressourcen hinter der Gruppe
|
|
56
57
|
: type (string) : Der Typ des Gruppe (immer `group`)
|
|
57
58
|
|
|
58
59
|
#### Zustandsänderungen unter `msg.updated`
|
|
@@ -53,6 +53,7 @@ In contrast to the "Hue Light" node, you have much less status information avail
|
|
|
53
53
|
: id (string): Indicates the new ID of the group
|
|
54
54
|
: idV1 (string | boolean): Indicates the old ID of the group
|
|
55
55
|
: name (string): The currently set name of the group
|
|
56
|
+
: resources (object) : Contains all devices/resources behind the group
|
|
56
57
|
: type (string): The type of the group (always `group`)
|
|
57
58
|
|
|
58
59
|
#### Status changes under `msg.updated`
|
|
@@ -119,6 +119,13 @@ class HueGroupMessage
|
|
|
119
119
|
let service = Object.values(resource["services"]["grouped_light"])[0];
|
|
120
120
|
service = options.resources[service.id];
|
|
121
121
|
|
|
122
|
+
// GET ALL RESOURCES
|
|
123
|
+
let allResourcesInsideGroup = {};
|
|
124
|
+
for (const [type, resources] of Object.entries(resource["services"]))
|
|
125
|
+
{
|
|
126
|
+
allResourcesInsideGroup[type] = Object.keys(resource["services"][type]);
|
|
127
|
+
}
|
|
128
|
+
|
|
122
129
|
this.message = {};
|
|
123
130
|
this.message.payload = {};
|
|
124
131
|
this.message.payload.on = service.on.on;
|
|
@@ -128,6 +135,7 @@ class HueGroupMessage
|
|
|
128
135
|
this.message.info.id = resource.id;
|
|
129
136
|
this.message.info.idV1 = resource.id_v1 ? resource.id_v1 : false; // NEW
|
|
130
137
|
this.message.info.name = resource.metadata ? resource.metadata.name : "all";
|
|
138
|
+
this.message.info.resources = allResourcesInsideGroup; // NEW
|
|
131
139
|
this.message.info.type = "group";
|
|
132
140
|
}
|
|
133
141
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-huemagic",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
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",
|