iobroker.hue 3.7.1 → 3.9.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/README.md +22 -14
- package/admin/i18n/en/translations.json +2 -1
- package/admin/index_m.html +4 -0
- package/build/lib/hueHelper.d.ts +76 -0
- package/{lib → build/lib}/hueHelper.js +118 -82
- package/build/lib/hueHelper.js.map +1 -0
- package/build/lib/tools.d.ts +5 -0
- package/build/lib/tools.js +12 -0
- package/build/lib/tools.js.map +1 -0
- package/build/main.d.ts +1 -0
- package/build/main.js +2225 -0
- package/build/main.js.map +1 -0
- package/io-package.json +30 -26
- package/package.json +21 -15
- package/lib/gulptools.js +0 -98
- package/lib/tools.js +0 -17
- package/main.js +0 -2211
package/README.md
CHANGED
|
@@ -31,19 +31,20 @@ Once you have installed this adapter within ioBroker, create an adapter instance
|
|
|
31
31
|
Please note: Adapter settings button "Find Bridge" will be inactive if field "Bridge Address" is populated, and button "Create User" will be inactive if field "Bridge User" is populated.
|
|
32
32
|
|
|
33
33
|
### Settings
|
|
34
|
-
|Name|Description|
|
|
35
|
-
|
|
36
|
-
|__Bridge address__|IP address of your Hue bridge, you can try to detect it by pressing `Find Bridge` button
|
|
37
|
-
|__Port__|Port of your Hue bridge, normally 443 (SSL) and 80 (non-SSL)
|
|
38
|
-
|__SSL__|If checked, connection is secured via SSL, port will automatically change to 443 (it is strongly recommended to use SSL)
|
|
39
|
-
|__User__|Username of your bridge user. You can create it, by pressing `Create User` button and following the screen instructions
|
|
40
|
-
|__Ignore scenes__|If checked, scenes will not be shown/controlled by the adapter
|
|
41
|
-
|__Ignore groups__|If checked, groups will not be shown/controlled by the adapter
|
|
42
|
-
|__"Legacy" structure__|To support backwards compatibility, it is possible to hold an old object structure in ioBroker. This old structure is `hue.<instance_number>.<bridge_name_channel>.<light_or_group_channel>.<state>`. The new structure removes `<bridge_name_channel>` and thus makes it necessary to adapt old scripts, etc. If an existing old structure is detected by the adapter, the structure will be used without checking the checkbox. However, if migration from old to new structure is desired, delete the whole `hue.<instance_number>` namespace once.
|
|
43
|
-
|__Native turn off/on behaviour__|If checked, the adapter will turn on/off lights in the same fashion as the native Hue app does. Otherwise, lamps will be set to a level of 100 % when switched on. Additionally when a group is already turned on, setting the brightness level will affect only the already turned on lamps and will not turn the lamps on, which are currently turned off
|
|
44
|
-
|__Sync software sensors__|Also sync software sensors. These are virtual sensors, e.g. created by Hue Labs scenes. By controlling the `status` datapoint of such a sensor you can start/stop scenes which follow this logic. In most cases `0` turns scene off and `1` turns it on
|
|
45
|
-
|
|
|
46
|
-
|
|
|
34
|
+
| Name | Description |
|
|
35
|
+
|----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
36
|
+
| __Bridge address__ | IP address of your Hue bridge, you can try to detect it by pressing `Find Bridge` button. |
|
|
37
|
+
| __Port__ | Port of your Hue bridge, normally 443 (SSL) and 80 (non-SSL). |
|
|
38
|
+
| __SSL__ | If checked, connection is secured via SSL, port will automatically change to 443 (it is strongly recommended to use SSL). |
|
|
39
|
+
| __User__ | Username of your bridge user. You can create it, by pressing `Create User` button and following the screen instructions. |
|
|
40
|
+
| __Ignore scenes__ | If checked, scenes will not be shown/controlled by the adapter. |
|
|
41
|
+
| __Ignore groups__ | If checked, groups will not be shown/controlled by the adapter. |
|
|
42
|
+
| __"Legacy" structure__ | To support backwards compatibility, it is possible to hold an old object structure in ioBroker. This old structure is `hue.<instance_number>.<bridge_name_channel>.<light_or_group_channel>.<state>`. The new structure removes `<bridge_name_channel>` and thus makes it necessary to adapt old scripts, etc. If an existing old structure is detected by the adapter, the structure will be used without checking the checkbox. However, if migration from old to new structure is desired, delete the whole `hue.<instance_number>` namespace once. |
|
|
43
|
+
| __Native turn off/on behaviour__ | If checked, the adapter will turn on/off lights in the same fashion as the native Hue app does. Otherwise, lamps will be set to a level of 100 % when switched on. Additionally when a group is already turned on, setting the brightness level will affect only the already turned on lamps and will not turn the lamps on, which are currently turned off. |
|
|
44
|
+
| __Sync software sensors__ | Also sync software sensors. These are virtual sensors, e.g. created by Hue Labs scenes. By controlling the `status` datapoint of such a sensor you can start/stop scenes which follow this logic. In most cases `0` turns scene off and `1` turns it on. |
|
|
45
|
+
| __Turn on with others__ | Turn on lights also with ct state, color state, ... Set to `false` and turn on only with power and brightness state. |
|
|
46
|
+
| __Polling__ | If checked, the adapter will poll state changes, otherwise it can only be used to control lamps, not to show their status. |
|
|
47
|
+
| __Polling interval__ | Defines how often the states will be polled, and thus updated in ioBroker. Low polling intervals can cause performance issues in some settings. Hence, the minimum allowed polling interval is 2 seconds. If polling interval is set to less than 2 seconds it will be set to 2 seconds during runtime. |
|
|
47
48
|
|
|
48
49
|
### Commands
|
|
49
50
|
Command states (e.g. `hue.0.All.command`) can be used to set multiple commands to the bridge.
|
|
@@ -73,6 +74,13 @@ In den Adapter-Settings muss die IP der Hue Bridge sowie ein Username konfigurie
|
|
|
73
74
|
Placeholder for the next version (at the beginning of the line):
|
|
74
75
|
### __WORK IN PROGRESS__
|
|
75
76
|
-->
|
|
77
|
+
### 3.9.0 (2023-06-11)
|
|
78
|
+
* (foxriver76) implemented poll API (closes #227, #343)
|
|
79
|
+
* (foxriver76) fix polling not working (closes #408, #410)
|
|
80
|
+
|
|
81
|
+
### 3.8.0 (2023-06-09)
|
|
82
|
+
* (Schmakus) Possibility to disable turn on lights with states other than `on` and `brightness` [#386]
|
|
83
|
+
|
|
76
84
|
### 3.7.1 (2022-07-12)
|
|
77
85
|
* (Eistee82) also update state for `CLIPGenericFlag` sensors
|
|
78
86
|
|
|
@@ -463,5 +471,5 @@ __ATTENTION: Remove all objects once, ids have changed__
|
|
|
463
471
|
|
|
464
472
|
Apache 2.0
|
|
465
473
|
|
|
466
|
-
Copyright (c) 2017-
|
|
474
|
+
Copyright (c) 2017-2023 Bluefox <dogafox@gmail.com>
|
|
467
475
|
Copyright (c) 2014-2016 hobbyquaker
|
|
@@ -26,5 +26,6 @@
|
|
|
26
26
|
"error finding bridge": "error finding bridge",
|
|
27
27
|
"ignoreOsram": "ignore Osram",
|
|
28
28
|
"link button not pressed": "link button not pressed",
|
|
29
|
-
"polling_warning": "Notice: Adapter may send only 10 commands in 1 second."
|
|
29
|
+
"polling_warning": "Notice: Adapter may send only 10 commands in 1 second.",
|
|
30
|
+
"Turn on with others": "Turn on with others than power and brightness"
|
|
30
31
|
}
|
package/admin/index_m.html
CHANGED
|
@@ -265,6 +265,10 @@
|
|
|
265
265
|
<input type="checkbox" id="syncSoftwareSensors" class="value"/>
|
|
266
266
|
<label class="translate" for="polling">Sync software sensors</label>
|
|
267
267
|
</div>
|
|
268
|
+
<div class="input-field col s10 m4">
|
|
269
|
+
<input type="checkbox" id="turnOnWithOthers" class="value"/>
|
|
270
|
+
<label class="translate" for="turnOnWithOthers">Turn on with others than `on` and `bri` state</label>
|
|
271
|
+
</div>
|
|
268
272
|
</div>
|
|
269
273
|
<div class="row">
|
|
270
274
|
<div class="input-field col s10 m4">
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author of helper functions:
|
|
3
|
+
* https://github.com/ArndBrugman/
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Convert RGB value to XYB format
|
|
8
|
+
*
|
|
9
|
+
* @param Red R-value
|
|
10
|
+
* @param Green G-value
|
|
11
|
+
* @param Blue B-value
|
|
12
|
+
* @param model - Modelname of the Light to Gamutcorrect Px, Py for
|
|
13
|
+
*/
|
|
14
|
+
export declare function RgbToXYB(Red: number, Green: number, Blue: number, model: string): {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
b: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @param Red - Range [0..1]
|
|
21
|
+
* @param Green - Range [0..1]
|
|
22
|
+
* @param Blue - Range [0..1]
|
|
23
|
+
* @returns Ranges [0..1] [0..1]
|
|
24
|
+
*/
|
|
25
|
+
export declare function HelperRGBtoXY(Red: number, Green: number, Blue: number): {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Tests if the Px,Py resides within the Gamut for the model.
|
|
31
|
+
* Otherwise, it will calculate the closest point on the Gamut.
|
|
32
|
+
* @param Px - Range [0..1]
|
|
33
|
+
* @param Py - Range [0..1]
|
|
34
|
+
* @param Model - Modelname of the Light to Gamutcorrect Px, Py for
|
|
35
|
+
* @returns Ranges [0..1] [0..1]
|
|
36
|
+
*/
|
|
37
|
+
export declare function GamutXYforModel(Px: number, Py: number, Model: string): {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
} | void;
|
|
41
|
+
/**
|
|
42
|
+
* @param Red - Range [0..1]
|
|
43
|
+
* @param Green - Range [0..1]
|
|
44
|
+
* @param Blue - Range [0..1]
|
|
45
|
+
* @returns [Ang, Sat, Bri] - Ranges [0..360] [0..1] [0..1]
|
|
46
|
+
*/
|
|
47
|
+
export declare function RgbToHsv(Red: number, Green: number, Blue: number): {
|
|
48
|
+
Ang: number;
|
|
49
|
+
Sat: number;
|
|
50
|
+
Bri: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Converts XYB values to RGB
|
|
54
|
+
*
|
|
55
|
+
* @param x
|
|
56
|
+
* @param y
|
|
57
|
+
* @param Brightness Optional
|
|
58
|
+
* @returns [Red, Green, Blue] - Ranges [0..1] [0..1] [0..1]
|
|
59
|
+
*/
|
|
60
|
+
export declare function XYBtoRGB(x: number, y: number, Brightness?: number): {
|
|
61
|
+
Red: number;
|
|
62
|
+
Green: number;
|
|
63
|
+
Blue: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Convert Mired to Kelvin
|
|
67
|
+
*
|
|
68
|
+
* @param mired mired value
|
|
69
|
+
*/
|
|
70
|
+
export declare function miredToKelvin(mired: number): number;
|
|
71
|
+
/**
|
|
72
|
+
* Convert level to brightness value
|
|
73
|
+
*
|
|
74
|
+
* @param level the level value
|
|
75
|
+
*/
|
|
76
|
+
export declare function levelToBrightness(level: number): number;
|
|
@@ -1,40 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Author of helper functions:
|
|
3
4
|
* https://github.com/ArndBrugman/
|
|
4
5
|
*
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.levelToBrightness = exports.miredToKelvin = exports.XYBtoRGB = exports.RgbToHsv = exports.GamutXYforModel = exports.HelperRGBtoXY = exports.RgbToXYB = void 0;
|
|
9
|
+
/**
|
|
10
|
+
* Convert RGB value to XYB format
|
|
11
|
+
*
|
|
12
|
+
* @param Red R-value
|
|
13
|
+
* @param Green G-value
|
|
14
|
+
* @param Blue B-value
|
|
15
|
+
* @param model - Modelname of the Light to Gamutcorrect Px, Py for
|
|
16
|
+
*/
|
|
17
|
+
function RgbToXYB(Red, Green, Blue, model) {
|
|
9
18
|
const Point = HelperRGBtoXY(Red, Green, Blue);
|
|
10
|
-
const
|
|
11
|
-
const bri = Math.min(255, Math.round(
|
|
12
|
-
const Gamuted =
|
|
19
|
+
const { Bri } = RgbToHsv(Red, Green, Blue);
|
|
20
|
+
const bri = Math.min(255, Math.round(Bri * 255));
|
|
21
|
+
const Gamuted = GamutXYforModel(Point.x, Point.y, model);
|
|
13
22
|
return { x: Gamuted.x, y: Gamuted.y, b: bri };
|
|
14
|
-
}
|
|
15
|
-
|
|
23
|
+
}
|
|
24
|
+
exports.RgbToXYB = RgbToXYB;
|
|
16
25
|
/**
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @returns
|
|
26
|
+
* @param Red - Range [0..1]
|
|
27
|
+
* @param Green - Range [0..1]
|
|
28
|
+
* @param Blue - Range [0..1]
|
|
29
|
+
* @returns Ranges [0..1] [0..1]
|
|
21
30
|
*/
|
|
22
|
-
|
|
31
|
+
function HelperRGBtoXY(Red, Green, Blue) {
|
|
23
32
|
// Source: https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX/blob/master/ApplicationDesignNotes/RGB%20to%20xy%20Color%20conversion.md
|
|
24
33
|
// Apply gamma correction
|
|
25
34
|
if (Red > 0.04045) {
|
|
26
35
|
Red = Math.pow((Red + 0.055) / 1.055, 2.4);
|
|
27
|
-
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
28
38
|
Red = Red / 12.92;
|
|
29
39
|
}
|
|
30
40
|
if (Green > 0.04045) {
|
|
31
41
|
Green = Math.pow((Green + 0.055) / 1.055, 2.4);
|
|
32
|
-
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
33
44
|
Green = Green / 12.92;
|
|
34
45
|
}
|
|
35
46
|
if (Blue > 0.04045) {
|
|
36
47
|
Blue = Math.pow((Blue + 0.055) / 1.055, 2.4);
|
|
37
|
-
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
38
50
|
Blue = Blue / 12.92;
|
|
39
51
|
}
|
|
40
52
|
// RGB to XYZ [M] for Wide RGB D65, http://www.developers.meethue.com/documentation/color-conversions-rgb-xy
|
|
@@ -46,150 +58,153 @@ const HelperRGBtoXY = function (Red, Green, Blue) {
|
|
|
46
58
|
return { x: 0, y: 0 };
|
|
47
59
|
}
|
|
48
60
|
return { x: X / (X + Y + Z), y: Y / (X + Y + Z) };
|
|
49
|
-
}
|
|
50
|
-
|
|
61
|
+
}
|
|
62
|
+
exports.HelperRGBtoXY = HelperRGBtoXY;
|
|
51
63
|
/**
|
|
52
64
|
* Tests if the Px,Py resides within the Gamut for the model.
|
|
53
|
-
* Otherwise it will
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
57
|
-
* @returns
|
|
65
|
+
* Otherwise, it will calculate the closest point on the Gamut.
|
|
66
|
+
* @param Px - Range [0..1]
|
|
67
|
+
* @param Py - Range [0..1]
|
|
68
|
+
* @param Model - Modelname of the Light to Gamutcorrect Px, Py for
|
|
69
|
+
* @returns Ranges [0..1] [0..1]
|
|
58
70
|
*/
|
|
59
|
-
|
|
71
|
+
function GamutXYforModel(Px, Py, Model) {
|
|
60
72
|
let PRed;
|
|
61
73
|
let PGreen;
|
|
62
74
|
let PBlue;
|
|
63
75
|
let NormDot;
|
|
64
|
-
|
|
65
76
|
const gamuts = {
|
|
66
77
|
a: ['LST001', 'LLC010', 'LLC011', 'LLC012', 'LLC006', 'LLC007', 'LLC013'],
|
|
67
78
|
b: ['LCT001', 'LCT007', 'LCT002', 'LCT003', 'LLM001'],
|
|
68
79
|
c: ['LCT010', 'LCT014', 'LCT011', 'LLC020', 'LST002']
|
|
69
80
|
};
|
|
70
|
-
|
|
71
81
|
//http://www.developers.meethue.com/documentation/supported-lights
|
|
72
82
|
if (gamuts.b.indexOf(Model) !== -1) {
|
|
73
83
|
// Gamut B
|
|
74
84
|
PRed = { x: 0.675, y: 0.322 };
|
|
75
85
|
PGreen = { x: 0.409, y: 0.518 };
|
|
76
86
|
PBlue = { x: 0.167, y: 0.04 };
|
|
77
|
-
}
|
|
87
|
+
}
|
|
88
|
+
else if (gamuts.c.indexOf(Model) !== -1) {
|
|
78
89
|
// Gamut C
|
|
79
90
|
PRed = { x: 0.692, y: 0.308 };
|
|
80
91
|
PGreen = { x: 0.17, y: 0.7 };
|
|
81
92
|
PBlue = { x: 0.153, y: 0.048 };
|
|
82
|
-
}
|
|
93
|
+
}
|
|
94
|
+
else if (gamuts.a.indexOf(Model) !== -1) {
|
|
83
95
|
// Gamut A
|
|
84
96
|
PRed = { x: 0.704, y: 0.296 };
|
|
85
97
|
PGreen = { x: 0.2151, y: 0.7106 };
|
|
86
98
|
PBlue = { x: 0.138, y: 0.08 };
|
|
87
|
-
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
88
101
|
PRed = { x: 1.0, y: 0.0 };
|
|
89
102
|
PGreen = { x: 0.0, y: 1.0 };
|
|
90
103
|
PBlue = { x: 0.0, y: 0.0 };
|
|
91
104
|
}
|
|
92
|
-
|
|
93
105
|
const VBR = { x: PRed.x - PBlue.x, y: PRed.y - PBlue.y }; // Blue to Red
|
|
94
106
|
const VRG = { x: PGreen.x - PRed.x, y: PGreen.y - PRed.y }; // Red to Green
|
|
95
107
|
const VGB = { x: PBlue.x - PGreen.x, y: PBlue.y - PGreen.y }; // Green to Blue
|
|
96
|
-
|
|
97
108
|
const GBR = (PGreen.x - PBlue.x) * VBR.y - (PGreen.y - PBlue.y) * VBR.x; // Sign Green on Blue to Red
|
|
98
109
|
const BRG = (PBlue.x - PRed.x) * VRG.y - (PBlue.y - PRed.y) * VRG.x; // Sign Blue on Red to Green
|
|
99
110
|
const RGB = (PRed.x - PGreen.x) * VGB.y - (PRed.y - PGreen.y) * VGB.x; // Sign Red on Green to Blue
|
|
100
|
-
|
|
101
111
|
const VBP = { x: Px - PBlue.x, y: Py - PBlue.y }; // Blue to Point
|
|
102
112
|
const VRP = { x: Px - PRed.x, y: Py - PRed.y }; // Red to Point
|
|
103
113
|
const VGP = { x: Px - PGreen.x, y: Py - PGreen.y }; // Green to Point
|
|
104
|
-
|
|
105
114
|
const PBR = VBP.x * VBR.y - VBP.y * VBR.x; // Sign Point on Blue to Red
|
|
106
115
|
const PRG = VRP.x * VRG.y - VRP.y * VRG.x; // Sign Point on Red to Green
|
|
107
116
|
const PGB = VGP.x * VGB.y - VGP.y * VGB.x; // Sign Point on Green to Blue
|
|
108
|
-
|
|
109
117
|
if (GBR * PBR >= 0 && BRG * PRG >= 0 && RGB * PGB >= 0) {
|
|
110
118
|
// All Signs Match so Px,Py must be in triangle
|
|
111
119
|
return { x: Px, y: Py };
|
|
112
|
-
}
|
|
120
|
+
}
|
|
121
|
+
else if (GBR * PBR <= 0) {
|
|
113
122
|
// Outside Triangle, Find Closesed point on Edge or Pick Vertice...
|
|
114
123
|
// Outside Blue to Red
|
|
115
124
|
NormDot = (VBP.x * VBR.x + VBP.y * VBR.y) / (VBR.x * VBR.x + VBR.y * VBR.y);
|
|
116
125
|
if (NormDot >= 0.0 && NormDot <= 1.0) {
|
|
117
126
|
// Within Edge
|
|
118
127
|
return { x: PBlue.x + NormDot * VBR.x, y: PBlue.y + NormDot * VBR.y };
|
|
119
|
-
}
|
|
128
|
+
}
|
|
129
|
+
else if (NormDot < 0.0) {
|
|
120
130
|
// Outside Edge, Pick Vertice
|
|
121
131
|
return { x: PBlue.x, y: PBlue.y }; // Start
|
|
122
|
-
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
123
134
|
return { x: PRed.x, y: PRed.y }; // End
|
|
124
135
|
}
|
|
125
|
-
}
|
|
136
|
+
}
|
|
137
|
+
else if (BRG * PRG <= 0) {
|
|
126
138
|
// Outside Red to Green
|
|
127
139
|
NormDot = (VRP.x * VRG.x + VRP.y * VRG.y) / (VRG.x * VRG.x + VRG.y * VRG.y);
|
|
128
140
|
if (NormDot >= 0.0 && NormDot <= 1.0) {
|
|
129
141
|
// Within Edge
|
|
130
142
|
return { x: PRed.x + NormDot * VRG.x, y: PRed.y + NormDot * VRG.y };
|
|
131
|
-
}
|
|
143
|
+
}
|
|
144
|
+
else if (NormDot < 0.0) {
|
|
132
145
|
// Outside Edge, Pick Vertice
|
|
133
146
|
return { x: PRed.x, y: PRed.y }; // Start
|
|
134
|
-
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
135
149
|
return { x: PGreen.x, y: PGreen.y }; // End
|
|
136
150
|
}
|
|
137
|
-
}
|
|
151
|
+
}
|
|
152
|
+
else if (RGB * PGB <= 0) {
|
|
138
153
|
// Outside Green to Blue
|
|
139
154
|
NormDot = (VGP.x * VGB.x + VGP.y * VGB.y) / (VGB.x * VGB.x + VGB.y * VGB.y);
|
|
140
155
|
if (NormDot >= 0.0 && NormDot <= 1.0) {
|
|
141
156
|
// Within Edge
|
|
142
157
|
return { x: PGreen.x + NormDot * VGB.x, y: PGreen.y + NormDot * VGB.y };
|
|
143
|
-
}
|
|
158
|
+
}
|
|
159
|
+
else if (NormDot < 0.0) {
|
|
144
160
|
// Outside Edge, Pick Vertice
|
|
145
161
|
return { x: PGreen.x, y: PGreen.y }; // Start
|
|
146
|
-
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
147
164
|
return { x: PBlue.x, y: PBlue.y }; // End
|
|
148
165
|
}
|
|
149
166
|
}
|
|
150
|
-
}
|
|
151
|
-
exports.GamutXYforModel =
|
|
152
|
-
|
|
167
|
+
}
|
|
168
|
+
exports.GamutXYforModel = GamutXYforModel;
|
|
153
169
|
/**
|
|
154
|
-
* @param
|
|
155
|
-
* @param
|
|
156
|
-
* @param
|
|
157
|
-
* @returns
|
|
170
|
+
* @param Red - Range [0..1]
|
|
171
|
+
* @param Green - Range [0..1]
|
|
172
|
+
* @param Blue - Range [0..1]
|
|
173
|
+
* @returns [Ang, Sat, Bri] - Ranges [0..360] [0..1] [0..1]
|
|
158
174
|
*/
|
|
159
|
-
|
|
175
|
+
function RgbToHsv(Red, Green, Blue) {
|
|
160
176
|
let Ang;
|
|
161
|
-
let Sat;
|
|
162
|
-
let Bri;
|
|
163
177
|
const Min = Math.min(Red, Green, Blue);
|
|
164
178
|
const Max = Math.max(Red, Green, Blue);
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
Ang = (4 + (Red - Green) / (Max - Min)) * 60;
|
|
172
|
-
}
|
|
173
|
-
Sat = (Max - Min) / Max;
|
|
174
|
-
Bri = Max;
|
|
175
|
-
} else {
|
|
176
|
-
// Max == Min
|
|
177
|
-
Ang = 0;
|
|
178
|
-
Sat = 0;
|
|
179
|
-
Bri = Max;
|
|
179
|
+
if (Max === Min) {
|
|
180
|
+
return { Ang: 0, Sat: 0, Bri: Max };
|
|
181
|
+
}
|
|
182
|
+
const delta = Max - Min;
|
|
183
|
+
if (Red === Max) {
|
|
184
|
+
Ang = ((Green - Blue) / delta) * 60;
|
|
180
185
|
}
|
|
186
|
+
else if (Green === Max) {
|
|
187
|
+
Ang = (2 + (Blue - Red) / delta) * 60;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
Ang = (4 + (Red - Green) / delta) * 60;
|
|
191
|
+
}
|
|
192
|
+
const Sat = delta / Max;
|
|
193
|
+
const Bri = Max;
|
|
181
194
|
return { Ang, Sat, Bri };
|
|
182
|
-
}
|
|
183
|
-
|
|
195
|
+
}
|
|
196
|
+
exports.RgbToHsv = RgbToHsv;
|
|
184
197
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* @param
|
|
188
|
-
* @
|
|
198
|
+
* Converts XYB values to RGB
|
|
199
|
+
*
|
|
200
|
+
* @param x
|
|
201
|
+
* @param y
|
|
202
|
+
* @param Brightness Optional
|
|
203
|
+
* @returns [Red, Green, Blue] - Ranges [0..1] [0..1] [0..1]
|
|
189
204
|
*/
|
|
190
|
-
|
|
205
|
+
function XYBtoRGB(x, y, Brightness) {
|
|
191
206
|
// Source: https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX/blob/master/ApplicationDesignNotes/RGB%20to%20xy%20Color%20conversion.md
|
|
192
|
-
if (Brightness <= 0) {
|
|
207
|
+
if (Brightness && Brightness <= 0) {
|
|
193
208
|
return { Red: 0, Green: 0, Blue: 0 };
|
|
194
209
|
}
|
|
195
210
|
Brightness = Brightness || 1.0; // Default full brightness
|
|
@@ -232,17 +247,20 @@ const HelperXYBtoRGB = function (x, y, Brightness) {
|
|
|
232
247
|
// Apply reverse gamma correction
|
|
233
248
|
if (Red <= 0.0031308) {
|
|
234
249
|
Red = Red * 12.92;
|
|
235
|
-
}
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
236
252
|
Red = 1.055 * Math.pow(Red, 1.0 / 2.4) - 0.055;
|
|
237
253
|
}
|
|
238
254
|
if (Green <= 0.0031308) {
|
|
239
255
|
Green = Green * 12.92;
|
|
240
|
-
}
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
241
258
|
Green = 1.055 * Math.pow(Green, 1.0 / 2.4) - 0.055;
|
|
242
259
|
}
|
|
243
260
|
if (Blue <= 0.0031308) {
|
|
244
261
|
Blue = Blue * 12.92;
|
|
245
|
-
}
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
246
264
|
Blue = 1.055 * Math.pow(Blue, 1.0 / 2.4) - 0.055;
|
|
247
265
|
}
|
|
248
266
|
// Limit RGB on [0..1]
|
|
@@ -274,6 +292,24 @@ const HelperXYBtoRGB = function (x, y, Brightness) {
|
|
|
274
292
|
Blue = 0;
|
|
275
293
|
}
|
|
276
294
|
return { Red, Green, Blue };
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
295
|
+
}
|
|
296
|
+
exports.XYBtoRGB = XYBtoRGB;
|
|
297
|
+
/**
|
|
298
|
+
* Convert Mired to Kelvin
|
|
299
|
+
*
|
|
300
|
+
* @param mired mired value
|
|
301
|
+
*/
|
|
302
|
+
function miredToKelvin(mired) {
|
|
303
|
+
return Math.round(1e6 / mired);
|
|
304
|
+
}
|
|
305
|
+
exports.miredToKelvin = miredToKelvin;
|
|
306
|
+
/**
|
|
307
|
+
* Convert level to brightness value
|
|
308
|
+
*
|
|
309
|
+
* @param level the level value
|
|
310
|
+
*/
|
|
311
|
+
function levelToBrightness(level) {
|
|
312
|
+
return Math.min(254, Math.max(0, Math.round(level * 2.54)));
|
|
313
|
+
}
|
|
314
|
+
exports.levelToBrightness = levelToBrightness;
|
|
315
|
+
//# sourceMappingURL=hueHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hueHelper.js","sourceRoot":"","sources":["../../src/lib/hueHelper.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;GAOG;AACH,SAAgB,QAAQ,CAAC,GAAW,EAAE,KAAa,EAAE,IAAY,EAAE,KAAa;IAC5E,MA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ACD,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,KAAK,GAAG,CAAC,CAAC;KACb;IACD,IAAI,IAAI,GAAG,GAAG,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,GAAG,EAAE;QAC1C,kBAAkB;QAClB,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;QACjB,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;QACrB,IAAI,GAAG,GAAG,CAAC;KACd;IACD,IAAI,IAAI,GAAG,CAAC,EAAE;QACV,IAAI,GAAG,CAAC,CAAC;KACZ;IACD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAChC,CAAC;AAvFD,4BAuFC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,KAAa;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;AACnC,CAAC;AAFD,sCAEC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,KAAa;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAFD,8CAEC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isObject = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Tests whether the given variable is a real object and not an Array
|
|
6
|
+
* @param it The variable to test
|
|
7
|
+
*/
|
|
8
|
+
function isObject(it) {
|
|
9
|
+
return Object.prototype.toString.call(it) === '[object Object]';
|
|
10
|
+
}
|
|
11
|
+
exports.isObject = isObject;
|
|
12
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/lib/tools.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,QAAQ,CAAC,EAAW;IAChC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,iBAAiB,CAAC;AACpE,CAAC;AAFD,4BAEC"}
|
package/build/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|