node-red-contrib-huemagic 2.8.2 → 4.0.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 (165) hide show
  1. package/CHANGELOG.md +229 -0
  2. package/README.md +806 -729
  3. package/examples/Hue Bridge.json +189 -35
  4. package/examples/Hue Brightness.json +124 -14
  5. package/examples/Hue Buttons.json +88 -0
  6. package/examples/Hue Group.json +575 -63
  7. package/examples/Hue Light.json +805 -58
  8. package/examples/Hue Magic.json +69 -24
  9. package/examples/Hue Motion.json +110 -42
  10. package/examples/Hue Rules.json +105 -37
  11. package/examples/Hue Scene.json +145 -28
  12. package/examples/Hue Temperature.json +124 -14
  13. package/huemagic/animations/001-sunny.json +22 -22
  14. package/huemagic/animations/002-cloudy.json +46 -46
  15. package/huemagic/animations/003-nightsky.json +20 -20
  16. package/huemagic/animations/004-sunrise.json +54 -54
  17. package/huemagic/animations/005-sunset.json +46 -46
  18. package/huemagic/animations/006-fireplace.json +74 -74
  19. package/huemagic/animations/007-spring.json +31 -31
  20. package/huemagic/animations/008-autmn.json +23 -23
  21. package/huemagic/animations/009-winter.json +23 -23
  22. package/huemagic/animations/010-dirtyfog.json +23 -23
  23. package/huemagic/animations/011-lgbt.json +49 -50
  24. package/huemagic/animations/012-rasta.json +28 -29
  25. package/huemagic/animations/013-strobo.json +30 -31
  26. package/huemagic/animations/014-randomrainbow.json +30 -31
  27. package/huemagic/animations/015-sos.json +158 -159
  28. package/huemagic/animations/016-milkyway.json +83 -0
  29. package/huemagic/animations/017-beach.json +40 -0
  30. package/huemagic/animations/018-forest.json +43 -0
  31. package/huemagic/animations/019-christmas.json +30 -0
  32. package/huemagic/animations/020-superhero.json +56 -0
  33. package/huemagic/animations/021-neoncity.json +52 -0
  34. package/huemagic/animations/previews/001-sunny.gif +0 -0
  35. package/huemagic/animations/previews/002-cloudy.gif +0 -0
  36. package/huemagic/animations/previews/003-nightsky.gif +0 -0
  37. package/huemagic/animations/previews/004-sunrise.gif +0 -0
  38. package/huemagic/animations/previews/005-sunset.gif +0 -0
  39. package/huemagic/animations/previews/006-fireplace.gif +0 -0
  40. package/huemagic/animations/previews/007-spring.gif +0 -0
  41. package/huemagic/animations/previews/008-autmn.gif +0 -0
  42. package/huemagic/animations/previews/009-winter.gif +0 -0
  43. package/huemagic/animations/previews/010-dirtyfog.gif +0 -0
  44. package/huemagic/animations/previews/011-lgbt.gif +0 -0
  45. package/huemagic/animations/previews/012-rasta.gif +0 -0
  46. package/huemagic/animations/previews/013-strobo.gif +0 -0
  47. package/huemagic/animations/previews/014-randomrainbow.gif +0 -0
  48. package/huemagic/animations/previews/015-sos.gif +0 -0
  49. package/huemagic/animations/previews/016-milkyway.gif +0 -0
  50. package/huemagic/animations/previews/017-beach.gif +0 -0
  51. package/huemagic/animations/previews/018-forest.gif +0 -0
  52. package/huemagic/animations/previews/019-christmas.gif +0 -0
  53. package/huemagic/animations/previews/020-superhero.gif +0 -0
  54. package/huemagic/animations/previews/021-neoncity.gif +0 -0
  55. package/huemagic/hue-bridge-config.html +105 -61
  56. package/huemagic/hue-bridge-config.js +629 -319
  57. package/huemagic/hue-bridge.html +41 -21
  58. package/huemagic/hue-bridge.js +191 -398
  59. package/huemagic/hue-brightness.html +130 -49
  60. package/huemagic/hue-brightness.js +131 -35
  61. package/huemagic/hue-buttons.html +197 -0
  62. package/huemagic/hue-buttons.js +152 -0
  63. package/huemagic/hue-group.html +137 -60
  64. package/huemagic/hue-group.js +394 -367
  65. package/huemagic/hue-light.html +133 -59
  66. package/huemagic/hue-light.js +551 -336
  67. package/huemagic/hue-magic.html +91 -237
  68. package/huemagic/hue-magic.js +57 -27
  69. package/huemagic/hue-motion.html +128 -50
  70. package/huemagic/hue-motion.js +116 -87
  71. package/huemagic/hue-rules.html +121 -50
  72. package/huemagic/hue-rules.js +84 -64
  73. package/huemagic/hue-scene.html +96 -115
  74. package/huemagic/hue-scene.js +65 -96
  75. package/huemagic/hue-temperature.html +130 -49
  76. package/huemagic/hue-temperature.js +136 -32
  77. package/huemagic/icons/hue-bridge.png +0 -0
  78. package/huemagic/icons/hue-bridge.svg +3 -0
  79. package/huemagic/icons/hue-brightness.png +0 -0
  80. package/huemagic/icons/hue-brightness.svg +11 -0
  81. package/huemagic/icons/hue-buttons.png +0 -0
  82. package/huemagic/icons/hue-buttons.svg +4 -0
  83. package/huemagic/icons/hue-group.png +0 -0
  84. package/huemagic/icons/hue-group.svg +12 -0
  85. package/huemagic/icons/hue-light.png +0 -0
  86. package/huemagic/icons/hue-light.svg +3 -0
  87. package/huemagic/icons/hue-magic.png +0 -0
  88. package/huemagic/icons/hue-magic.svg +3 -0
  89. package/huemagic/icons/hue-motion.png +0 -0
  90. package/huemagic/icons/hue-motion.svg +9 -0
  91. package/huemagic/icons/hue-rules.png +0 -0
  92. package/huemagic/icons/hue-rules.svg +4 -0
  93. package/huemagic/icons/hue-scene.png +0 -0
  94. package/huemagic/icons/hue-scene.svg +5 -0
  95. package/huemagic/icons/hue-temperature.png +0 -0
  96. package/huemagic/icons/hue-temperature.svg +7 -0
  97. package/huemagic/locales/de/hue-bridge-config.html +17 -12
  98. package/huemagic/locales/de/hue-bridge-config.json +7 -5
  99. package/huemagic/locales/de/hue-bridge.html +64 -145
  100. package/huemagic/locales/de/hue-bridge.json +6 -17
  101. package/huemagic/locales/de/hue-brightness.html +52 -38
  102. package/huemagic/locales/de/hue-brightness.json +7 -2
  103. package/huemagic/locales/de/hue-buttons.html +58 -0
  104. package/huemagic/locales/de/hue-buttons.json +28 -0
  105. package/huemagic/locales/de/hue-group.html +46 -122
  106. package/huemagic/locales/de/hue-group.json +4 -2
  107. package/huemagic/locales/de/hue-light.html +68 -116
  108. package/huemagic/locales/de/hue-light.json +5 -2
  109. package/huemagic/locales/de/hue-magic.html +65 -57
  110. package/huemagic/locales/de/hue-magic.json +2 -1
  111. package/huemagic/locales/de/hue-motion.html +48 -44
  112. package/huemagic/locales/de/hue-motion.json +6 -3
  113. package/huemagic/locales/de/hue-rules.html +68 -73
  114. package/huemagic/locales/de/hue-rules.json +5 -2
  115. package/huemagic/locales/de/hue-scene.html +23 -32
  116. package/huemagic/locales/de/hue-scene.json +5 -2
  117. package/huemagic/locales/de/hue-temperature.html +53 -36
  118. package/huemagic/locales/de/hue-temperature.json +7 -2
  119. package/huemagic/locales/en-US/hue-bridge-config.html +17 -12
  120. package/huemagic/locales/en-US/hue-bridge-config.json +5 -3
  121. package/huemagic/locales/en-US/hue-bridge.html +64 -145
  122. package/huemagic/locales/en-US/hue-bridge.json +5 -16
  123. package/huemagic/locales/en-US/hue-brightness.html +52 -38
  124. package/huemagic/locales/en-US/hue-brightness.json +10 -3
  125. package/huemagic/locales/en-US/hue-buttons.html +58 -0
  126. package/huemagic/locales/en-US/hue-buttons.json +34 -0
  127. package/huemagic/locales/en-US/hue-group.html +46 -122
  128. package/huemagic/locales/en-US/hue-group.json +7 -3
  129. package/huemagic/locales/en-US/hue-light.html +68 -116
  130. package/huemagic/locales/en-US/hue-light.json +8 -3
  131. package/huemagic/locales/en-US/hue-magic.html +65 -57
  132. package/huemagic/locales/en-US/hue-magic.json +3 -1
  133. package/huemagic/locales/en-US/hue-motion.html +48 -44
  134. package/huemagic/locales/en-US/hue-motion.json +9 -4
  135. package/huemagic/locales/en-US/hue-rules.html +68 -73
  136. package/huemagic/locales/en-US/hue-rules.json +5 -2
  137. package/huemagic/locales/en-US/hue-scene.html +23 -32
  138. package/huemagic/locales/en-US/hue-scene.json +5 -2
  139. package/huemagic/locales/en-US/hue-temperature.html +53 -36
  140. package/huemagic/locales/en-US/hue-temperature.json +10 -3
  141. package/huemagic/utils/api.js +290 -0
  142. package/huemagic/utils/color.js +382 -0
  143. package/{utils → huemagic/utils}/merge.js +9 -6
  144. package/huemagic/utils/messages.js +447 -0
  145. package/package.json +12 -12
  146. package/examples/Hue Switch.json +0 -40
  147. package/examples/Hue Tap.json +0 -40
  148. package/huemagic/assets/anime.js +0 -8
  149. package/huemagic/hue-switch.html +0 -119
  150. package/huemagic/hue-switch.js +0 -113
  151. package/huemagic/hue-tap.html +0 -119
  152. package/huemagic/hue-tap.js +0 -74
  153. package/huemagic/icons/hue-button.png +0 -0
  154. package/huemagic/icons/hue-switch.png +0 -0
  155. package/huemagic/icons/hue-tap.png +0 -0
  156. package/huemagic/locales/de/hue-switch.html +0 -50
  157. package/huemagic/locales/de/hue-switch.json +0 -31
  158. package/huemagic/locales/de/hue-tap.html +0 -41
  159. package/huemagic/locales/de/hue-tap.json +0 -23
  160. package/huemagic/locales/en-US/hue-switch.html +0 -50
  161. package/huemagic/locales/en-US/hue-switch.json +0 -31
  162. package/huemagic/locales/en-US/hue-tap.html +0 -41
  163. package/huemagic/locales/en-US/hue-tap.json +0 -23
  164. package/utils/messages.js +0 -571
  165. package/utils/rgb.js +0 -188
@@ -1,119 +0,0 @@
1
- <script type="text/x-red" data-template-name="hue-switch">
2
- <div class="form-row">
3
- <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="hue-switch.config.name"></span></label>
4
- <input type="text" id="node-input-name" data-i18n="[placeholder]hue-switch.config.input-name">
5
- </div>
6
- <div class="form-row">
7
- <label for="node-input-bridge"><i class="fa fa-server"></i> Bridge</label>
8
- <input type="text" id="node-input-bridge">
9
- </div>
10
- <div class="form-row">
11
- <label for="node-input-sensorid"><i class="fa fa-hand-pointer-o"></i> <span data-i18n="hue-switch.config.switch"></span></label>
12
- <div style="display: inline-block; position: relative; width: 70%; height: 20px;">
13
- <div style="position: absolute; left: 0px; right: 40px;">
14
- <input type="text" id="node-input-sensorid" placeholder="1" style="width: 100%"/>
15
- </div>
16
- <a id="node-config-input-scan-switches-sensors" class="editor-button" style="position: absolute; right: 0px; top: 0px;">
17
- <i class="fa fa-search"></i>
18
- </a>
19
- </div>
20
- </div>
21
- <div class="form-row">
22
- <label for="node-input-skipevents"><i class="fa fa-sign-out"></i> <span data-i18n="hue-switch.config.skipevents"></span></label>
23
- <input type="checkbox" id="node-input-skipevents" style="display:inline-block; width:22px; vertical-align:baseline;"><span data-i18n="hue-switch.config.skipevents-node"></span>
24
- </label>
25
- </div>
26
- </script>
27
-
28
- <script type="text/javascript">
29
- RED.nodes.registerType('hue-switch',{
30
- category: 'HueMagic',
31
- color: '#65bff7',
32
- defaults: {
33
- name: {value:""},
34
- bridge: {type: "hue-bridge", required: true},
35
- sensorid: {value:"", required: true, validate: RED.validators.number()},
36
- skipevents: {value: false}
37
- },
38
- inputs: 0,
39
- outputs: 1,
40
- outputLabels: function() {
41
- return this._("hue-switch.node.output");
42
- },
43
- align: 'right',
44
- icon: "hue-switch.png",
45
- paletteLabel: function() {
46
- return this._("hue-switch.node.title");
47
- },
48
- label: function() {
49
- return this.name || this._("hue-switch.node.title");
50
- },
51
- oneditprepare: function()
52
- {
53
- var scope = this;
54
-
55
- function manualSwitchID()
56
- {
57
- var current = $('#node-input-sensorid').val();
58
- $('#node-input-sensorid').replaceWith('<input type="text" id="node-input-sensorid" style="width: 100%"/>');
59
- $('#node-input-sensorid').val(current);
60
- }
61
-
62
- function searchAndSelectHueSwitchID()
63
- {
64
- var current = $('#node-input-sensorid').val();
65
- $('#node-input-sensorid').replaceWith('<select id="node-input-sensorid" style="width: 100%"></select>');
66
- $('#node-input-sensorid').append('<option selected="selected" value="null">'+scope._("hue-switch.config.searching")+'</option>');
67
-
68
- var bridgeConfig = RED.nodes.node($('#node-input-bridge option:selected').val());
69
- $.get('hue/sensors', {bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "ZLLSwitch"})
70
- .done( function(data) {
71
- var hueSwitches = JSON.parse(data);
72
-
73
- if(hueSwitches.length <= 0)
74
- {
75
- RED.notify(scope._("hue-switch.config.none-found"), "error");
76
- }
77
-
78
- // RESET OPTIONS
79
- $('#node-input-sensorid').empty();
80
-
81
- // SET SWITCHES AS OPTIONS
82
- hueSwitches.forEach(function(sensor)
83
- {
84
- if(sensor.model == "Hue Wireless Dimmer Switch")
85
- {
86
- $('#node-input-sensorid').append('<option value="' + sensor.id + '">' + sensor.name + '</option>');
87
- }
88
- });
89
-
90
- // SELECT CURRENT VALUE
91
- $('#node-input-sensorid').val(current);
92
- })
93
- .fail(function()
94
- {
95
- RED.notify("Something went wrong. Please retry.", "error");
96
- });
97
- }
98
-
99
- $(document).on('change', '#node-input-sensorid', function()
100
- {
101
- var sensorName = $('#node-input-sensorid option:selected').text();
102
- if(sensorName.length > 0)
103
- {
104
- $('#node-input-name').val(sensorName);
105
- }
106
- });
107
-
108
- $('#node-config-input-scan-switches-sensors').click(function()
109
- {
110
- if($('#node-input-sensorid').prop("tagName") === "INPUT")
111
- {
112
- searchAndSelectHueSwitchID();
113
- } else {
114
- manualSwitchID();
115
- }
116
- });
117
- }
118
- });
119
- </script>
@@ -1,113 +0,0 @@
1
- module.exports = function(RED)
2
- {
3
- "use strict";
4
-
5
- function HueSwitch(config)
6
- {
7
- RED.nodes.createNode(this, config);
8
-
9
- var scope = this;
10
- let bridge = RED.nodes.getNode(config.bridge);
11
- let { HueSwitchMessage } = require('../utils/messages');
12
-
13
- // SAVE LAST STATE
14
- var lastState = false;
15
-
16
- //
17
- // MEMORY
18
- this.lastUpdated = false;
19
-
20
- //
21
- // CHECK CONFIG
22
- if(!config.sensorid || bridge == null)
23
- {
24
- this.status({fill: "red", shape: "ring", text: "hue-switch.node.not-configured"});
25
- return false;
26
- }
27
-
28
- //
29
- // UPDATE STATE
30
- scope.status({fill: "grey", shape: "dot", text: "hue-switch.node.waiting"});
31
-
32
- //
33
- // ON UPDATE
34
- bridge.events.on('sensor' + config.sensorid, function(sensor)
35
- {
36
- var lastUpdated = scope.lastUpdated || false;
37
- if(sensor.state.lastUpdated != lastUpdated)
38
- {
39
- scope.lastUpdated = sensor.state.lastUpdated;
40
-
41
- // RETURN ON FIRST DEPLOY
42
- if (lastUpdated === false) {
43
- return;
44
- }
45
-
46
- // DEFINE HUMAN READABLE BUTTON NAME
47
- var buttonNameLocalized = "";
48
- if(sensor.state.buttonEvent < 2000)
49
- {
50
- buttonNameLocalized = RED._("hue-switch.node.button-on");
51
- }
52
- else if(sensor.state.buttonEvent < 3000)
53
- {
54
- buttonNameLocalized = RED._("hue-switch.node.button-dimup");
55
- }
56
- else if(sensor.state.buttonEvent < 4000)
57
- {
58
- buttonNameLocalized = RED._("hue-switch.node.button-dimdown");
59
- }
60
- else
61
- {
62
- buttonNameLocalized = RED._("hue-switch.node.button-off");
63
- }
64
-
65
- // DEFINE HUMAN READABLE BUTTON ACTION
66
- var buttonActionLocalized = "";
67
- var buttonActionRaw = parseInt(sensor.state.buttonEvent.toString().substring(3));
68
- if(buttonActionRaw == 0)
69
- {
70
- buttonActionLocalized = RED._("hue-switch.node.action-pressed");
71
- }
72
- else if(buttonActionRaw == 1)
73
- {
74
- buttonActionLocalized = RED._("hue-switch.node.action-holded");
75
- }
76
- else if(buttonActionRaw == 2)
77
- {
78
- buttonActionLocalized = RED._("hue-switch.node.action-shortreleased");
79
- }
80
- else
81
- {
82
- buttonActionLocalized = RED._("hue-switch.node.action-longreleased");
83
- }
84
-
85
- // SEND STATUS
86
- scope.status({fill: "green", shape: "dot", text: buttonNameLocalized + " " + buttonActionLocalized});
87
-
88
- // SEND MESSAGE
89
- if(!config.skipevents)
90
- {
91
- var hueSwitch = new HueSwitchMessage(sensor, lastState);
92
- scope.send(hueSwitch.msg);
93
- }
94
-
95
- // SAVE LAST STATE
96
- lastState = sensor;
97
- }
98
- else
99
- {
100
- scope.status({fill: "grey", shape: "dot", text: "hue-switch.node.waiting"});
101
- }
102
- });
103
-
104
- //
105
- // CLOSE NODE / REMOVE EVENT LISTENER
106
- this.on('close', function()
107
- {
108
- bridge.events.removeAllListeners('sensor' + config.sensorid);
109
- });
110
- }
111
-
112
- RED.nodes.registerType("hue-switch", HueSwitch);
113
- }
@@ -1,119 +0,0 @@
1
- <script type="text/x-red" data-template-name="hue-tap">
2
- <div class="form-row">
3
- <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="hue-tap.config.name"></span></label>
4
- <input type="text" id="node-input-name" data-i18n="[placeholder]hue-tap.config.input-name">
5
- </div>
6
- <div class="form-row">
7
- <label for="node-input-bridge"><i class="fa fa-server"></i> Bridge</label>
8
- <input type="text" id="node-input-bridge">
9
- </div>
10
- <div class="form-row">
11
- <label for="node-input-sensorid"><i class="fa fa-hand-pointer-o"></i> Tap</label>
12
- <div style="display: inline-block; position: relative; width: 70%; height: 20px;">
13
- <div style="position: absolute; left: 0px; right: 40px;">
14
- <input type="text" id="node-input-sensorid" placeholder="1" style="width: 100%"/>
15
- </div>
16
- <a id="node-config-input-scan-tap-sensors" class="editor-button" style="position: absolute; right: 0px; top: 0px;">
17
- <i class="fa fa-search"></i>
18
- </a>
19
- </div>
20
- </div>
21
- <div class="form-row">
22
- <label for="node-input-skipevents"><i class="fa fa-sign-out"></i> <span data-i18n="hue-tap.config.skipevents"></span></label>
23
- <input type="checkbox" id="node-input-skipevents" style="display:inline-block; width:22px; vertical-align:baseline;"><span data-i18n="hue-tap.config.skipevents-node"></span>
24
- </label>
25
- </div>
26
- </script>
27
-
28
- <script type="text/javascript">
29
- RED.nodes.registerType('hue-tap',{
30
- category: 'HueMagic',
31
- color: '#46d6ca',
32
- defaults: {
33
- name: {value:""},
34
- bridge: {type: "hue-bridge", required: true},
35
- sensorid: {value:"", required: true, validate: RED.validators.number()},
36
- skipevents: {value: false}
37
- },
38
- inputs: 0,
39
- outputs: 1,
40
- outputLabels: function() {
41
- return this._("hue-tap.node.output");
42
- },
43
- align: 'right',
44
- icon: "hue-tap.png",
45
- paletteLabel: function() {
46
- return this._("hue-tap.node.title");
47
- },
48
- label: function() {
49
- return this.name || this._("hue-tap.node.title");
50
- },
51
- oneditprepare: function()
52
- {
53
- var scope = this;
54
-
55
- function manualTapID()
56
- {
57
- var current = $('#node-input-sensorid').val();
58
- $('#node-input-sensorid').replaceWith('<input type="text" id="node-input-sensorid" style="width: 100%"/>');
59
- $('#node-input-sensorid').val(current);
60
- }
61
-
62
- function searchAndSelectHueTap()
63
- {
64
- var current = $('#node-input-sensorid').val();
65
- $('#node-input-sensorid').replaceWith('<select id="node-input-sensorid" style="width: 100%"></select>');
66
- $('#node-input-sensorid').append('<option selected="selected" value="null">'+scope._("hue-tap.config.searching")+'</option>');
67
-
68
- var bridgeConfig = RED.nodes.node($('#node-input-bridge option:selected').val());
69
- $.get('hue/sensors', {bridge: bridgeConfig.bridge, key: bridgeConfig.key, type: "ZGPSwitch"})
70
- .done( function(data) {
71
- var hueTaps = JSON.parse(data);
72
-
73
- if(hueTaps.length <= 0)
74
- {
75
- RED.notify(scope._("hue-tap.config.none-found"), "error");
76
- }
77
-
78
- // RESET OPTIONS
79
- $('#node-input-sensorid').empty();
80
-
81
- // SET TAPS AS OPTIONS
82
- hueTaps.forEach(function(sensor)
83
- {
84
- if(sensor.model == "Hue Tap")
85
- {
86
- $('#node-input-sensorid').append('<option value="' + sensor.id + '">' + sensor.name + '</option>');
87
- }
88
- });
89
-
90
- // SELECT CURRENT VALUE
91
- $('#node-input-sensorid').val(current);
92
- })
93
- .fail(function()
94
- {
95
- RED.notify(scope._("hue-tap.config.unknown-error"), "error");
96
- });
97
- }
98
-
99
- $(document).on('change', '#node-input-sensorid', function()
100
- {
101
- var sensorName = $('#node-input-sensorid option:selected').text();
102
- if(sensorName.length > 0)
103
- {
104
- $('#node-input-name').val(sensorName);
105
- }
106
- });
107
-
108
- $('#node-config-input-scan-tap-sensors').click(function()
109
- {
110
- if($('#node-input-sensorid').prop("tagName") === "INPUT")
111
- {
112
- searchAndSelectHueTap();
113
- } else {
114
- manualTapID();
115
- }
116
- });
117
- }
118
- });
119
- </script>
@@ -1,74 +0,0 @@
1
- module.exports = function(RED)
2
- {
3
- "use strict";
4
-
5
- function HueTap(config)
6
- {
7
- RED.nodes.createNode(this, config);
8
-
9
- var scope = this;
10
- var bridge = RED.nodes.getNode(config.bridge);
11
- let { HueTapMessage } = require('../utils/messages');
12
-
13
- // SAVE LAST STATE
14
- var lastState = false;
15
-
16
- //
17
- // MEMORY
18
- this.lastUpdated = false;
19
-
20
- //
21
- // CHECK CONFIG
22
- if(!config.sensorid || bridge == null)
23
- {
24
- this.status({fill: "red", shape: "ring", text: "hue-tap.node.not-configured"});
25
- return false;
26
- }
27
-
28
- //
29
- // UPDATE STATE
30
- scope.status({fill: "grey", shape: "dot", text: "hue-tap.node.waiting"});
31
-
32
- //
33
- // ON UPDATE
34
- bridge.events.on('sensor' + config.sensorid, function(sensor)
35
- {
36
- var lastUpdated = scope.lastUpdated || false;
37
-
38
- if(sensor.state.lastUpdated != lastUpdated)
39
- {
40
- scope.lastUpdated = sensor.state.lastUpdated;
41
-
42
- // RETURN ON FIRST DEPLOY
43
- if (lastUpdated === false)
44
- {
45
- return;
46
- }
47
-
48
- // SEND MESSAGE
49
- var hueTap = new HueTapMessage(sensor, lastState);
50
- if(!config.skipevents) { scope.send(hueTap.msg); }
51
-
52
- // SAVE LAST STATE
53
- lastState = sensor;
54
-
55
- // SEND STATUS
56
- scope.status({fill: "green", shape: "dot", text: RED._("hue-tap.node.pressed-button",{button: hueTap.msg.payload.button}) });
57
- }
58
- else
59
- {
60
- scope.status({fill: "grey", shape: "dot", text: "hue-tap.node.waiting"});
61
- }
62
- });
63
-
64
-
65
- //
66
- // CLOSE NODE / REMOVE EVENT LISTENER
67
- this.on('close', function()
68
- {
69
- bridge.events.removeAllListeners('sensor' + config.sensorid);
70
- });
71
- }
72
-
73
- RED.nodes.registerType("hue-tap", HueTap);
74
- }
Binary file
Binary file
Binary file
@@ -1,50 +0,0 @@
1
- <script type="text/x-red" data-help-name="hue-switch">
2
- <p>Hue Dimmschalter um Schaltererignisse zu empfangen.</p>
3
-
4
- <h3>Einrichtung</h3>
5
- <p>Wählen Sie die vorkonfigurierte Hue Bridge und klicken Sie auf die Suchschaltfläche, um alle verfügbaren Dimmschalter zu finden. Geben Sie den Namen manuell ein oder behalten Sie den Standardgerätenamen bei. Beachten Sie, dass Ereignisse nur bei der Bereitstellung (einmalig) und auf Knopfdruck gesendet werden. Bei Bedarf können alle Statusaktualisierungen dieses Nodes durch Aktivieren der Option "Mitteilungen ignorieren" ignoriert werden.</p>
6
-
7
- <h3>Dimmschalter-Ereignisse</h3>
8
- <p>Die vom Dimmschalter gesendete Ereignismeldung enthält die folgenden Daten im Objekt <b>msg.payload</b>:</p>
9
- <dl class="message-properties">
10
- <dt>button<span class="property-type">int</span></dt>
11
- <dd>ID der gedrückten Taste</dd>
12
-
13
- <dt>name<span class="property-type">string</span></dt>
14
- <dd>Lesbarer Name der gedrückten Taste (On, Dim Up, Dim Down, Off)</dd>
15
-
16
- <dt>action<span class="property-type">string</span></dt>
17
- <dd>Lesbare gedrückte Tastenaktion (pressed, holded, short released, long released)</dd>
18
-
19
- <dt>updated<span class="property-type">string</span></dt>
20
- <dd>ISO 8601 Datum des letzten Zeitpunkts, zu dem eine Taste gedrückt wurde</dd>
21
- </dl>
22
-
23
- <h3>Zusätzliche Sensorinformationen</h3>
24
- <p>Zusätzliche Informationen zum Gerät werden an das Objekt <b>msg.info</b> gesendet:</p>
25
- <dl class="message-properties">
26
- <dt>id<span class="property-type">int</span></dt>
27
- <dd>Numerische ID des Sensors, wie auf der Bridge registriert</dd>
28
-
29
- <dt>uniqueId<span class="property-type">string</span></dt>
30
- <dd>Eindeutige ID des Sensors (normalerweise Hardware-ID)</dd>
31
-
32
- <dt>name<span class="property-type">string</span></dt>
33
- <dd>Name des Sensors</dd>
34
-
35
- <dt>type<span class="property-type">string</span></dt>
36
- <dd>Sensor-Typ (z.B. Daylight, CLIPTemperature, ZGPSwitch)</dd>
37
-
38
- <dt>softwareVersion<span class="property-type">float</span></dt>
39
- <dd>Softwareversion des Sensors</dd>
40
-
41
- <dt>battery<span class="property-type">int</span></dt>
42
- <dd>Aktueller Batteriestand des Sensors in Prozent</dd>
43
-
44
- <dt>model<span class="property-type">object</span></dt>
45
- <dd>Das Modellobjekt des Sensors enthält modellspezifische Informationen wie model.id, model.manufacturer, model.name und model.type</dd>
46
- </dl>
47
-
48
- <h3>Letzte Zustandsinformationen</h3>
49
- <p>Dieser Node schickt auch die gesamten letzten Zustandsinformationen (vor dem Update) in das <b>msg.lastState</b>-Objekt. Dieses kann entweder false (Boolean) or die Objekte payload (msg.lastState.payload) und info (msg.lastState.info) beinhalten. Der Rückgabewert "false" wird nur dann gesendet, wenn es keinen letzten Zustand gab oder der Node neu erstellt oder gestartet wurde.</p>
50
- </script>
@@ -1,31 +0,0 @@
1
- {
2
- "hue-switch":
3
- {
4
- "config":
5
- {
6
- "name": "Name",
7
- "input-name": "Name des Dimmschalters",
8
- "skipevents": "Mitteilungen ignorieren",
9
- "skipevents-node": "Ignoriere die Mitteilungen des Nodes",
10
- "searching": "Suche nach Dimmschaltern…",
11
- "none-found": "Keine Dimmschalter gefunden!",
12
- "unknown-error": "Etwas ist schief gelaufen. Bitte versuchen Sie es erneut.",
13
- "switch": "Schalter"
14
- },
15
- "node":
16
- {
17
- "title": "Hue Dimmschalter",
18
- "not-configured": "nicht konfiguriert",
19
- "waiting": "warte…",
20
- "button-on": "An",
21
- "button-dimup": "Dimmen (heller)",
22
- "button-dimdown": "Dimmen (dunkler)",
23
- "button-off": "Aus",
24
- "action-pressed": "gedrückt",
25
- "action-holded": "gehalten",
26
- "action-shortreleased": "kurz gedrückt",
27
- "action-longreleased": "lange gedruckt",
28
- "output": "gedrückte Taste"
29
- }
30
- }
31
- }
@@ -1,41 +0,0 @@
1
- <script type="text/x-red" data-help-name="hue-tap">
2
- <p>Hue Tap Schalter um Schaltererignisse zu empfangen.</p>
3
-
4
- <h3>Einrichtung</h3>
5
- <p>Wählen Sie die vorkonfigurierte Hue Bridge und klicken Sie auf die Suchschaltfläche, um alle verfügbaren Tap Schalter zu finden. Geben Sie den Namen manuell ein oder behalten Sie den Standardgerätenamen bei. Beachten Sie, dass Ereignisse nur bei der Bereitstellung (einmalig) und auf Knopfdruck gesendet werden. Bei Bedarf können alle Statusaktualisierungen dieses Nodes durch Aktivieren der Option "Mitteilungen ignorieren" ignoriert werden.</p>
6
-
7
- <h3>Tap-Ereignisse</h3>
8
- <p>Die vom Tap Schalter gesendete Ereignismeldung enthält die folgenden Daten im Objekt <b>msg.payload</b>:</p>
9
- <dl class="message-properties">
10
- <dt>button<span class="property-type">int</span></dt>
11
- <dd>Gedrückte Tastennummer von 1-4</dd>
12
-
13
- <dt>buttonAlt<span class="property-type">int</span></dt>
14
- <dd>Alternative Tastennummer (Rohversion)</dd>
15
-
16
- <dt>updated<span class="property-type">string</span></dt>
17
- <dd>ISO 8601 Datum des letzten Zeitpunkts, zu dem eine Taste gedrückt wurde</dd>
18
- </dl>
19
-
20
- <h3>Zusätzliche Sensorinformationen</h3>
21
- <p>Zusätzliche Informationen zum Sensor werden an das Objekt <b>msg.info</b> gesendet:</p>
22
- <dl class="message-properties">
23
- <dt>id<span class="property-type">int</span></dt>
24
- <dd>Numerische ID des Sensors, wie auf der Bridge registriert</dd>
25
-
26
- <dt>uniqueId<span class="property-type">string</span></dt>
27
- <dd>Eindeutige ID des Sensors (normalerweise Hardware-ID)</dd>
28
-
29
- <dt>name<span class="property-type">string</span></dt>
30
- <dd>Name des Sensors</dd>
31
-
32
- <dt>type<span class="property-type">string</span></dt>
33
- <dd>Sensor-Typ (z.B. Daylight, CLIPTemperature, ZGPSwitch)</dd>
34
-
35
- <dt>model<span class="property-type">object</span></dt>
36
- <dd>Das Modellobjekt des Sensors enthält modellspezifische Informationen wie model.id, model.manufacturer, model.name und model.type</dd>
37
- </dl>
38
-
39
- <h3>Letzte Zustandsinformationen</h3>
40
- <p>Dieser Node schickt auch die gesamten letzten Zustandsinformationen (vor dem Update) in das <b>msg.lastState</b>-Objekt. Dieses kann entweder false (Boolean) or die Objekte payload (msg.lastState.payload) und info (msg.lastState.info) beinhalten. Der Rückgabewert "false" wird nur dann gesendet, wenn es keinen letzten Zustand gab oder der Node neu erstellt oder gestartet wurde.</p>
41
- </script>
@@ -1,23 +0,0 @@
1
- {
2
- "hue-tap":
3
- {
4
- "config":
5
- {
6
- "name": "Name",
7
- "input-name": "Name des Tap Schalters…",
8
- "skipevents": "Mitteilungen ignorieren",
9
- "skipevents-node": "Ignoriere die Mitteilungen des Nodes",
10
- "searching": "Suche nach Tap Schaltern…",
11
- "none-found": "Keine Tap Schalter gefunden!",
12
- "unknown-error": "Etwas ist schief gelaufen. Bitte versuchen Sie es erneut."
13
- },
14
- "node":
15
- {
16
- "title": "Hue Tap Schalter",
17
- "not-configured": "nicht konfiguriert",
18
- "waiting": "warte…",
19
- "pressed-button": "Taste #__button__ gedrückt",
20
- "output": "gedrückte Taste"
21
- }
22
- }
23
- }
@@ -1,50 +0,0 @@
1
- <script type="text/x-red" data-help-name="hue-switch">
2
- <p>Hue Switch node to receive button events.</p>
3
-
4
- <h3>Setup</h3>
5
- <p>Select the preconfigured Hue Bridge and hit the search button to find all available Hue Switch devices. Type in the name manually or keep the default device name. Note that events will only sent on deploy (once) and if a button is pressed. If necessary, all status updates of this node can be ignored by activating the "Skip events" option.</p>
6
-
7
- <h3>Switch Events</h3>
8
- <p>The event message that the Hue Switch sends contains the following data in the <b>msg.payload</b> object:</p>
9
- <dl class="message-properties">
10
- <dt>button<span class="property-type">int</span></dt>
11
- <dd>Pressed button id</dd>
12
-
13
- <dt>name<span class="property-type">string</span></dt>
14
- <dd>Human readable pressed button name (On, Dim Up, Dim Down, Off)</dd>
15
-
16
- <dt>action<span class="property-type">string</span></dt>
17
- <dd>Human readable pressed button action (pressed, holded, short released, long released)</dd>
18
-
19
- <dt>updated<span class="property-type">string</span></dt>
20
- <dd>ISO 8601 date string of the last time when a button was pressed</dd>
21
- </dl>
22
-
23
- <h3>Additional Sensor Info</h3>
24
- <p>Additional information about the device is going to be sent to the <b>msg.info</b> object:</p>
25
- <dl class="message-properties">
26
- <dt>id<span class="property-type">int</span></dt>
27
- <dd>Numerical id of the sensor as registered on the bridge</dd>
28
-
29
- <dt>uniqueId<span class="property-type">string</span></dt>
30
- <dd>Unique Id of the sensor (typically hardware id)</dd>
31
-
32
- <dt>name<span class="property-type">string</span></dt>
33
- <dd>Name for the sensor</dd>
34
-
35
- <dt>type<span class="property-type">string</span></dt>
36
- <dd>Sensor type (e.g. Daylight, CLIPTemperature, ZGPSwitch)</dd>
37
-
38
- <dt>softwareVersion<span class="property-type">float</span></dt>
39
- <dd>Software version of the sensor</dd>
40
-
41
- <dt>battery<span class="property-type">int</span></dt>
42
- <dd>Current battery level of the Hue Switch in percent</dd>
43
-
44
- <dt>model<span class="property-type">object</span></dt>
45
- <dd>The model object of the sensor includes model specific information like the model.id, model.manufacturer, model.name and model.type</dd>
46
- </dl>
47
-
48
- <h3>Last State Information</h3>
49
- <p>This node also sends the entire last state data (before the update) in the <b>msg.lastState</b> object. It can either contain false (boolean) or the objects payload (msg.lastState.payload) and info (msg.lastState.info). The return value "false" is only sent if there was no last state, e.g. when the node was newly created or restarted.</p>
50
- </script>
@@ -1,31 +0,0 @@
1
- {
2
- "hue-switch":
3
- {
4
- "config":
5
- {
6
- "name": "Name",
7
- "input-name": "Switch name",
8
- "skipevents": "Skip events",
9
- "skipevents-node": "Skip events from node",
10
- "searching": "Searching Hue Switches…",
11
- "none-found": "No Hue Switches found!",
12
- "unknown-error": "Something went wrong. Please retry.",
13
- "switch": "Switch"
14
- },
15
- "node":
16
- {
17
- "title": "Hue Switch",
18
- "not-configured": "not configured",
19
- "waiting": "waiting…",
20
- "button-on": "On",
21
- "button-dimup": "Dim Up",
22
- "button-dimdown": "Dim Down",
23
- "button-off": "Off",
24
- "action-pressed": "pressed",
25
- "action-holded": "holded",
26
- "action-shortreleased": "short released",
27
- "action-longreleased": "long released",
28
- "output": "pressed button"
29
- }
30
- }
31
- }