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.
- package/CHANGELOG.md +229 -0
- package/README.md +806 -729
- package/examples/Hue Bridge.json +189 -35
- package/examples/Hue Brightness.json +124 -14
- package/examples/Hue Buttons.json +88 -0
- package/examples/Hue Group.json +575 -63
- package/examples/Hue Light.json +805 -58
- package/examples/Hue Magic.json +69 -24
- package/examples/Hue Motion.json +110 -42
- package/examples/Hue Rules.json +105 -37
- package/examples/Hue Scene.json +145 -28
- package/examples/Hue Temperature.json +124 -14
- package/huemagic/animations/001-sunny.json +22 -22
- package/huemagic/animations/002-cloudy.json +46 -46
- package/huemagic/animations/003-nightsky.json +20 -20
- package/huemagic/animations/004-sunrise.json +54 -54
- package/huemagic/animations/005-sunset.json +46 -46
- package/huemagic/animations/006-fireplace.json +74 -74
- package/huemagic/animations/007-spring.json +31 -31
- package/huemagic/animations/008-autmn.json +23 -23
- package/huemagic/animations/009-winter.json +23 -23
- package/huemagic/animations/010-dirtyfog.json +23 -23
- package/huemagic/animations/011-lgbt.json +49 -50
- package/huemagic/animations/012-rasta.json +28 -29
- package/huemagic/animations/013-strobo.json +30 -31
- package/huemagic/animations/014-randomrainbow.json +30 -31
- package/huemagic/animations/015-sos.json +158 -159
- package/huemagic/animations/016-milkyway.json +83 -0
- package/huemagic/animations/017-beach.json +40 -0
- package/huemagic/animations/018-forest.json +43 -0
- package/huemagic/animations/019-christmas.json +30 -0
- package/huemagic/animations/020-superhero.json +56 -0
- package/huemagic/animations/021-neoncity.json +52 -0
- package/huemagic/animations/previews/001-sunny.gif +0 -0
- package/huemagic/animations/previews/002-cloudy.gif +0 -0
- package/huemagic/animations/previews/003-nightsky.gif +0 -0
- package/huemagic/animations/previews/004-sunrise.gif +0 -0
- package/huemagic/animations/previews/005-sunset.gif +0 -0
- package/huemagic/animations/previews/006-fireplace.gif +0 -0
- package/huemagic/animations/previews/007-spring.gif +0 -0
- package/huemagic/animations/previews/008-autmn.gif +0 -0
- package/huemagic/animations/previews/009-winter.gif +0 -0
- package/huemagic/animations/previews/010-dirtyfog.gif +0 -0
- package/huemagic/animations/previews/011-lgbt.gif +0 -0
- package/huemagic/animations/previews/012-rasta.gif +0 -0
- package/huemagic/animations/previews/013-strobo.gif +0 -0
- package/huemagic/animations/previews/014-randomrainbow.gif +0 -0
- package/huemagic/animations/previews/015-sos.gif +0 -0
- package/huemagic/animations/previews/016-milkyway.gif +0 -0
- package/huemagic/animations/previews/017-beach.gif +0 -0
- package/huemagic/animations/previews/018-forest.gif +0 -0
- package/huemagic/animations/previews/019-christmas.gif +0 -0
- package/huemagic/animations/previews/020-superhero.gif +0 -0
- package/huemagic/animations/previews/021-neoncity.gif +0 -0
- package/huemagic/hue-bridge-config.html +105 -61
- package/huemagic/hue-bridge-config.js +629 -319
- package/huemagic/hue-bridge.html +41 -21
- package/huemagic/hue-bridge.js +191 -398
- package/huemagic/hue-brightness.html +130 -49
- package/huemagic/hue-brightness.js +131 -35
- package/huemagic/hue-buttons.html +197 -0
- package/huemagic/hue-buttons.js +152 -0
- package/huemagic/hue-group.html +137 -60
- package/huemagic/hue-group.js +394 -367
- package/huemagic/hue-light.html +133 -59
- package/huemagic/hue-light.js +551 -336
- package/huemagic/hue-magic.html +91 -237
- package/huemagic/hue-magic.js +57 -27
- package/huemagic/hue-motion.html +128 -50
- package/huemagic/hue-motion.js +116 -87
- package/huemagic/hue-rules.html +121 -50
- package/huemagic/hue-rules.js +84 -64
- package/huemagic/hue-scene.html +96 -115
- package/huemagic/hue-scene.js +65 -96
- package/huemagic/hue-temperature.html +130 -49
- package/huemagic/hue-temperature.js +136 -32
- package/huemagic/icons/hue-bridge.png +0 -0
- package/huemagic/icons/hue-bridge.svg +3 -0
- package/huemagic/icons/hue-brightness.png +0 -0
- package/huemagic/icons/hue-brightness.svg +11 -0
- package/huemagic/icons/hue-buttons.png +0 -0
- package/huemagic/icons/hue-buttons.svg +4 -0
- package/huemagic/icons/hue-group.png +0 -0
- package/huemagic/icons/hue-group.svg +12 -0
- package/huemagic/icons/hue-light.png +0 -0
- package/huemagic/icons/hue-light.svg +3 -0
- package/huemagic/icons/hue-magic.png +0 -0
- package/huemagic/icons/hue-magic.svg +3 -0
- package/huemagic/icons/hue-motion.png +0 -0
- package/huemagic/icons/hue-motion.svg +9 -0
- package/huemagic/icons/hue-rules.png +0 -0
- package/huemagic/icons/hue-rules.svg +4 -0
- package/huemagic/icons/hue-scene.png +0 -0
- package/huemagic/icons/hue-scene.svg +5 -0
- package/huemagic/icons/hue-temperature.png +0 -0
- package/huemagic/icons/hue-temperature.svg +7 -0
- package/huemagic/locales/de/hue-bridge-config.html +17 -12
- package/huemagic/locales/de/hue-bridge-config.json +7 -5
- package/huemagic/locales/de/hue-bridge.html +64 -145
- package/huemagic/locales/de/hue-bridge.json +6 -17
- package/huemagic/locales/de/hue-brightness.html +52 -38
- package/huemagic/locales/de/hue-brightness.json +7 -2
- package/huemagic/locales/de/hue-buttons.html +58 -0
- package/huemagic/locales/de/hue-buttons.json +28 -0
- package/huemagic/locales/de/hue-group.html +46 -122
- package/huemagic/locales/de/hue-group.json +4 -2
- package/huemagic/locales/de/hue-light.html +68 -116
- package/huemagic/locales/de/hue-light.json +5 -2
- package/huemagic/locales/de/hue-magic.html +65 -57
- package/huemagic/locales/de/hue-magic.json +2 -1
- package/huemagic/locales/de/hue-motion.html +48 -44
- package/huemagic/locales/de/hue-motion.json +6 -3
- package/huemagic/locales/de/hue-rules.html +68 -73
- package/huemagic/locales/de/hue-rules.json +5 -2
- package/huemagic/locales/de/hue-scene.html +23 -32
- package/huemagic/locales/de/hue-scene.json +5 -2
- package/huemagic/locales/de/hue-temperature.html +53 -36
- package/huemagic/locales/de/hue-temperature.json +7 -2
- package/huemagic/locales/en-US/hue-bridge-config.html +17 -12
- package/huemagic/locales/en-US/hue-bridge-config.json +5 -3
- package/huemagic/locales/en-US/hue-bridge.html +64 -145
- package/huemagic/locales/en-US/hue-bridge.json +5 -16
- package/huemagic/locales/en-US/hue-brightness.html +52 -38
- package/huemagic/locales/en-US/hue-brightness.json +10 -3
- package/huemagic/locales/en-US/hue-buttons.html +58 -0
- package/huemagic/locales/en-US/hue-buttons.json +34 -0
- package/huemagic/locales/en-US/hue-group.html +46 -122
- package/huemagic/locales/en-US/hue-group.json +7 -3
- package/huemagic/locales/en-US/hue-light.html +68 -116
- package/huemagic/locales/en-US/hue-light.json +8 -3
- package/huemagic/locales/en-US/hue-magic.html +65 -57
- package/huemagic/locales/en-US/hue-magic.json +3 -1
- package/huemagic/locales/en-US/hue-motion.html +48 -44
- package/huemagic/locales/en-US/hue-motion.json +9 -4
- package/huemagic/locales/en-US/hue-rules.html +68 -73
- package/huemagic/locales/en-US/hue-rules.json +5 -2
- package/huemagic/locales/en-US/hue-scene.html +23 -32
- package/huemagic/locales/en-US/hue-scene.json +5 -2
- package/huemagic/locales/en-US/hue-temperature.html +53 -36
- package/huemagic/locales/en-US/hue-temperature.json +10 -3
- package/huemagic/utils/api.js +290 -0
- package/huemagic/utils/color.js +382 -0
- package/{utils → huemagic/utils}/merge.js +9 -6
- package/huemagic/utils/messages.js +447 -0
- package/package.json +12 -12
- package/examples/Hue Switch.json +0 -40
- package/examples/Hue Tap.json +0 -40
- package/huemagic/assets/anime.js +0 -8
- package/huemagic/hue-switch.html +0 -119
- package/huemagic/hue-switch.js +0 -113
- package/huemagic/hue-tap.html +0 -119
- package/huemagic/hue-tap.js +0 -74
- package/huemagic/icons/hue-button.png +0 -0
- package/huemagic/icons/hue-switch.png +0 -0
- package/huemagic/icons/hue-tap.png +0 -0
- package/huemagic/locales/de/hue-switch.html +0 -50
- package/huemagic/locales/de/hue-switch.json +0 -31
- package/huemagic/locales/de/hue-tap.html +0 -41
- package/huemagic/locales/de/hue-tap.json +0 -23
- package/huemagic/locales/en-US/hue-switch.html +0 -50
- package/huemagic/locales/en-US/hue-switch.json +0 -31
- package/huemagic/locales/en-US/hue-tap.html +0 -41
- package/huemagic/locales/en-US/hue-tap.json +0 -23
- package/utils/messages.js +0 -571
- package/utils/rgb.js +0 -188
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info":{
|
|
3
|
+
"name":"Superhero",
|
|
4
|
+
"author":"HueMagic"
|
|
5
|
+
},
|
|
6
|
+
"steps":[
|
|
7
|
+
{
|
|
8
|
+
"delay":1000,
|
|
9
|
+
"animation":{
|
|
10
|
+
"hex":"#000000",
|
|
11
|
+
"brightness":1,
|
|
12
|
+
"transitionTime":2
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"delay":500,
|
|
17
|
+
"animation":{
|
|
18
|
+
"hex":"#09387A",
|
|
19
|
+
"brightness":50,
|
|
20
|
+
"transitionTime":0.5
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"delay":500,
|
|
25
|
+
"animation":{
|
|
26
|
+
"hex":"#126CB3",
|
|
27
|
+
"brightness":70,
|
|
28
|
+
"transitionTime":0.5
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"delay":500,
|
|
33
|
+
"animation":{
|
|
34
|
+
"hex":"#D4E226",
|
|
35
|
+
"brightness":70,
|
|
36
|
+
"transitionTime":0.5
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"delay":500,
|
|
41
|
+
"animation":{
|
|
42
|
+
"hex":"#FFF024",
|
|
43
|
+
"brightness":100,
|
|
44
|
+
"transitionTime":2
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"delay":2000,
|
|
49
|
+
"animation":{
|
|
50
|
+
"hex":"#F5131F",
|
|
51
|
+
"brightness":100,
|
|
52
|
+
"transitionTime":0.5
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info":{
|
|
3
|
+
"name":"Neon City",
|
|
4
|
+
"author":"HueMagic"
|
|
5
|
+
},
|
|
6
|
+
"specials":{
|
|
7
|
+
"randomOrder": true
|
|
8
|
+
},
|
|
9
|
+
"steps":
|
|
10
|
+
[
|
|
11
|
+
{
|
|
12
|
+
"delay":700,
|
|
13
|
+
"animation":{
|
|
14
|
+
"hex":"#fa448c",
|
|
15
|
+
"brightness":100,
|
|
16
|
+
"transitionTime":0.5
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"delay":500,
|
|
21
|
+
"animation":{
|
|
22
|
+
"hex":"#fec859",
|
|
23
|
+
"brightness":100,
|
|
24
|
+
"transitionTime":0.5
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"delay":1000,
|
|
29
|
+
"animation":{
|
|
30
|
+
"hex":"#0a1045",
|
|
31
|
+
"brightness":100,
|
|
32
|
+
"transitionTime":0.5
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"delay":700,
|
|
37
|
+
"animation":{
|
|
38
|
+
"hex":"#43b5a0",
|
|
39
|
+
"brightness":100,
|
|
40
|
+
"transitionTime":0.5
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"delay":1000,
|
|
45
|
+
"animation":{
|
|
46
|
+
"hex":"#491d88",
|
|
47
|
+
"brightness":90,
|
|
48
|
+
"transitionTime":0.6
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
<script type="text/x-red" data-template-name="hue-bridge">
|
|
2
2
|
<div class="form-row">
|
|
3
3
|
<label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="hue-bridge-config.config.name"></span></label>
|
|
4
|
-
<input type="text" id="node-config-input-name">
|
|
4
|
+
<input type="text" id="node-config-input-name" style="width: calc(100% - 105px)">
|
|
5
5
|
</div>
|
|
6
6
|
<div class="form-row">
|
|
7
7
|
<label for="node-config-input-bridge"><i class="fa fa-server"></i> Bridge IP</label>
|
|
8
|
-
<div style="display: inline-
|
|
9
|
-
<div style="
|
|
8
|
+
<div style="display: inline-flex; width: calc(100% - 105px)">
|
|
9
|
+
<div id="input-select-toggle" style="flex-grow: 1;">
|
|
10
10
|
<input type="text" id="node-config-input-bridge" placeholder="X.X.X.X[:PORT]" style="width: 100%"/>
|
|
11
11
|
</div>
|
|
12
|
-
<
|
|
12
|
+
<button id="node-config-input-scan" type="button" class="red-ui-button" style="margin-left: 10px;">
|
|
13
13
|
<i class="fa fa-search"></i>
|
|
14
|
-
</
|
|
14
|
+
</button>
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
17
|
<div class="form-row">
|
|
18
18
|
<label for="node-config-input-key"><i class="fa fa-key"></i> <span data-i18n="hue-bridge-config.config.apikey"></span></label>
|
|
19
|
-
<div style="display: inline-
|
|
20
|
-
<div style="
|
|
19
|
+
<div style="display: inline-flex; width: calc(100% - 105px)">
|
|
20
|
+
<div style="flex-grow: 1;">
|
|
21
21
|
<input type="text" id="node-config-input-key" style="width: 100%"/>
|
|
22
22
|
</div>
|
|
23
|
-
<
|
|
23
|
+
<button id="node-config-input-register" type="button" class="red-ui-button" style="margin-left: 10px;">
|
|
24
24
|
<i class="fa fa-user-circle-o"></i>
|
|
25
|
-
</
|
|
25
|
+
</button>
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
|
+
<div class="form-row" style="margin-top: 30px">
|
|
29
|
+
<div style="display: inline-flex; width: calc(100% - 105px)">
|
|
30
|
+
<input type="checkbox" id="node-input-autoupdates" style="flex: 15px;">
|
|
31
|
+
<span data-i18n="hue-bridge-config.config.autoupdates" style="width: 100%; margin-left: 10px;"></span>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
28
34
|
<div class="form-row">
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<label for="node-config-input-disableupdates"><i class="fa fa-sign-out"></i> <span data-i18n="hue-bridge-config.config.disable-events"></span></label>
|
|
34
|
-
<input type="checkbox" id="node-config-input-disableupdates" style="display:inline-block; width:22px; vertical-align:baseline;"><span data-i18n="hue-bridge-config.config.disable-events-info"></span>
|
|
35
|
-
</label>
|
|
35
|
+
<div style="display: inline-flex; width: calc(100% - 105px)">
|
|
36
|
+
<input type="checkbox" id="node-config-input-disableupdates" style="flex: 15px;">
|
|
37
|
+
<span data-i18n="hue-bridge-config.config.disable-events-info" style="width: 100%; margin-left: 10px;"></span>
|
|
38
|
+
</div>
|
|
36
39
|
</div>
|
|
37
40
|
</script>
|
|
38
41
|
|
|
@@ -41,93 +44,134 @@
|
|
|
41
44
|
category: "config",
|
|
42
45
|
color: '#c7d8d8',
|
|
43
46
|
defaults: {
|
|
44
|
-
name: {value:"Hue Bridge", required: true},
|
|
45
|
-
bridge: {value:"", required: true},
|
|
46
|
-
key: {value:"", required: true},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
required: true,
|
|
50
|
-
validate: function(v) {
|
|
51
|
-
return (/^[0-9]+/.test(v) && parseInt(v,10) >= 500);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
disableupdates: {value: false}
|
|
47
|
+
name: { value:"Hue Bridge", required: true },
|
|
48
|
+
bridge: { value:"", required: true },
|
|
49
|
+
key: { value:"", required: true },
|
|
50
|
+
autoupdates: { value: true },
|
|
51
|
+
disableupdates: { value: false }
|
|
55
52
|
},
|
|
56
53
|
icon: "hue-bridge-config.png",
|
|
57
|
-
paletteLabel: function() {
|
|
58
|
-
return this._("hue-bridge-config.node.title");
|
|
59
|
-
},
|
|
60
54
|
label: function() {
|
|
61
55
|
return this.name;
|
|
62
56
|
},
|
|
57
|
+
paletteLabel: function() {
|
|
58
|
+
return this._("hue-bridge-config.node.title");
|
|
59
|
+
},
|
|
63
60
|
oneditprepare: function()
|
|
64
61
|
{
|
|
65
|
-
|
|
62
|
+
const scope = this;
|
|
63
|
+
let options = [];
|
|
66
64
|
|
|
67
|
-
function
|
|
65
|
+
function manualInput()
|
|
68
66
|
{
|
|
67
|
+
// GET CURRENT SELECTED VALUE
|
|
69
68
|
var current = $('#node-config-input-bridge').val();
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
|
|
70
|
+
// REMOVE SELECT FIELD
|
|
71
|
+
$('#input-select-toggle').empty();
|
|
72
|
+
|
|
73
|
+
// CREATE NEW INPUT FIELD
|
|
74
|
+
$('#input-select-toggle').append('<input type="text" id="node-config-input-bridge" placeholder="X.X.X.X[:PORT]" style="width: 100%" value="'+current+'" />');
|
|
75
|
+
|
|
76
|
+
// CHANGE BUTTON ICON
|
|
77
|
+
var button = $("#node-config-input-scan");
|
|
78
|
+
var buttonIcon = button.find("i");
|
|
79
|
+
buttonIcon.removeClass("fa-pencil");
|
|
80
|
+
buttonIcon.addClass("fa-search");
|
|
72
81
|
}
|
|
73
82
|
|
|
74
|
-
function
|
|
83
|
+
function searchAndSelect()
|
|
75
84
|
{
|
|
85
|
+
// GET CURRENT SELECTED VALUE
|
|
76
86
|
var current = $('#node-config-input-bridge').val();
|
|
77
|
-
$('#node-config-input-bridge').replaceWith('<select id="node-config-input-bridge" style="width: 100%"></select>');
|
|
78
|
-
$('#node-config-input-bridge').append('<option selected="selected" value="null">'+scope._("hue-bridge-config.config.searching")+'</option>');
|
|
79
87
|
|
|
88
|
+
// TRIGGER SEARCHING NOTIFICATION
|
|
89
|
+
var notification = RED.notify(scope._("hue-bridge-config.config.searching"), { type: "compact", modal: true, fixed: true });
|
|
90
|
+
|
|
91
|
+
// GET THE SENSORS
|
|
80
92
|
$.get('hue/bridges')
|
|
81
93
|
.done( function(data) {
|
|
82
|
-
|
|
94
|
+
var allRessources = JSON.parse(data);
|
|
95
|
+
if(allRessources.length <= 0)
|
|
96
|
+
{
|
|
97
|
+
notification.close();
|
|
98
|
+
RED.notify(scope._("hue-bridge-config.config.none-found"), { type: "error" });
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
83
101
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
102
|
+
// SET OPTIONS
|
|
103
|
+
allRessources.forEach(function(ressource)
|
|
104
|
+
{
|
|
105
|
+
options[ressource.ip] = { value: ressource.ip, label: ressource.ip };
|
|
106
|
+
});
|
|
88
107
|
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
// SELECT CURRENT VALUE
|
|
109
|
+
$("#node-config-input-bridge").typedInput({
|
|
110
|
+
types: [
|
|
111
|
+
{
|
|
112
|
+
value: current,
|
|
113
|
+
options: Object.values(options)
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
});
|
|
91
117
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
118
|
+
// CHANGE BUTTON ICON
|
|
119
|
+
var button = $("#node-config-input-scan");
|
|
120
|
+
var buttonIcon = button.find("i");
|
|
121
|
+
buttonIcon.removeClass("fa-search");
|
|
122
|
+
buttonIcon.addClass("fa-pencil");
|
|
97
123
|
|
|
98
|
-
|
|
99
|
-
|
|
124
|
+
// CLOSE SEARCH NOTIFICATION
|
|
125
|
+
notification.close();
|
|
100
126
|
})
|
|
101
127
|
.fail(function()
|
|
102
128
|
{
|
|
103
|
-
|
|
129
|
+
notification.close();
|
|
130
|
+
RED.notify(scope._("hue-bridge-config.config.unknown-error"), "error");
|
|
104
131
|
});
|
|
105
132
|
}
|
|
106
133
|
|
|
107
|
-
|
|
134
|
+
// CHANGED BRIDGE IP? -> GET NAME (IF POSSIBLE)
|
|
135
|
+
$(document).off('change', '#node-config-input-bridge');
|
|
136
|
+
$(document).on('change', '#node-config-input-bridge', function(e)
|
|
108
137
|
{
|
|
109
|
-
|
|
110
|
-
if(currentBridgeIP.length >
|
|
138
|
+
let currentBridgeIP = $(e.currentTarget).val();
|
|
139
|
+
if(currentBridgeIP.length > 3)
|
|
111
140
|
{
|
|
112
|
-
|
|
141
|
+
// TRIGGER SEARCHING NOTIFICATION
|
|
142
|
+
var notification = RED.notify(scope._("hue-bridge-config.config.connecting"), { type: "compact", modal: true, fixed: true });
|
|
143
|
+
|
|
144
|
+
$.ajax({
|
|
145
|
+
url: 'hue/name',
|
|
146
|
+
type: "GET",
|
|
147
|
+
data: { ip: currentBridgeIP },
|
|
148
|
+
timeout: 3000
|
|
149
|
+
})
|
|
113
150
|
.done( function(data)
|
|
114
151
|
{
|
|
115
152
|
$('#node-config-input-name').val(data);
|
|
153
|
+
setTimeout(function() { notification.close(); }, 500);
|
|
116
154
|
})
|
|
117
155
|
.fail(function(err)
|
|
118
156
|
{
|
|
119
|
-
|
|
157
|
+
// CLOSE SEARCH NOTIFICATION
|
|
158
|
+
notification.close();
|
|
159
|
+
|
|
160
|
+
RED.notify(scope._("hue-bridge-config.config.invalid") + err.statusText, "error");
|
|
120
161
|
});
|
|
121
162
|
}
|
|
122
163
|
});
|
|
123
164
|
|
|
165
|
+
// TOGGLE SELECT/INPUT FIELD
|
|
124
166
|
$('#node-config-input-scan').click(function()
|
|
125
167
|
{
|
|
126
|
-
if($('#
|
|
168
|
+
if($('#input-select-toggle').find(".red-ui-typedInput-container").length > 0)
|
|
169
|
+
{
|
|
170
|
+
manualInput();
|
|
171
|
+
}
|
|
172
|
+
else
|
|
127
173
|
{
|
|
128
|
-
|
|
129
|
-
} else {
|
|
130
|
-
manualBridgeIP();
|
|
174
|
+
searchAndSelect();
|
|
131
175
|
}
|
|
132
176
|
});
|
|
133
177
|
|