@switchbot/homebridge-switchbot 3.5.0-beta.4 → 3.5.0-beta.40
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 +4 -1
- package/config.schema.json +120 -17
- package/dist/device/blindtilt.d.ts +21 -94
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +349 -756
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +25 -71
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +584 -759
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +13 -67
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +211 -587
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +13 -74
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +252 -632
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +14 -65
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +206 -531
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +17 -86
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +337 -786
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +59 -0
- package/dist/device/device.d.ts.map +1 -0
- package/dist/device/device.js +671 -0
- package/dist/device/device.js.map +1 -0
- package/dist/device/fan.d.ts +51 -0
- package/dist/device/fan.d.ts.map +1 -0
- package/dist/device/fan.js +503 -0
- package/dist/device/fan.js.map +1 -0
- package/dist/device/hub.d.ts +15 -59
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +244 -596
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +10 -65
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +209 -571
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +11 -64
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +176 -584
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +10 -68
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +254 -568
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +15 -62
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +212 -542
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +13 -63
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +172 -577
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +13 -64
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +161 -577
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +13 -69
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +138 -518
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +9 -57
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +84 -452
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +11 -62
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +142 -451
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +9 -70
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +123 -664
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +2 -2
- package/dist/index.js +1 -1
- package/dist/irdevice/airconditioner.d.ts +8 -48
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +309 -419
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +7 -38
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +72 -304
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +6 -35
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +34 -278
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +6 -39
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +67 -311
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +40 -0
- package/dist/irdevice/irdevice.d.ts.map +1 -0
- package/dist/irdevice/irdevice.js +512 -0
- package/dist/irdevice/irdevice.js.map +1 -0
- package/dist/irdevice/light.d.ts +6 -34
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +23 -272
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +18 -47
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +352 -546
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +7 -39
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +82 -321
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +6 -35
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +41 -284
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +6 -35
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +42 -287
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +14 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +343 -198
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +41 -11
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +0 -552
- package/dist/settings.js.map +1 -1
- package/dist/utils.d.ts +77 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +638 -1
- package/dist/utils.js.map +1 -1
- package/package.json +16 -15
- package/src/custom.d.ts +2 -1
- package/src/device/blindtilt.ts +375 -782
- package/src/device/bot.ts +618 -844
- package/src/device/ceilinglight.ts +224 -607
- package/src/device/colorbulb.ts +266 -656
- package/src/device/contact.ts +231 -553
- package/src/device/curtain.ts +357 -810
- package/src/device/device.ts +699 -0
- package/src/device/fan.ts +552 -0
- package/src/device/hub.ts +271 -624
- package/src/device/humidifier.ts +239 -618
- package/src/device/iosensor.ts +202 -610
- package/src/device/lightstrip.ts +275 -596
- package/src/device/lock.ts +249 -582
- package/src/device/meter.ts +198 -601
- package/src/device/meterplus.ts +186 -602
- package/src/device/motion.ts +158 -541
- package/src/device/plug.ts +94 -480
- package/src/device/robotvacuumcleaner.ts +163 -477
- package/src/device/waterdetector.ts +141 -689
- package/src/homebridge-ui/public/index.html +2 -2
- package/src/index.ts +1 -1
- package/src/irdevice/airconditioner.ts +330 -446
- package/src/irdevice/airpurifier.ts +89 -321
- package/src/irdevice/camera.ts +42 -293
- package/src/irdevice/fan.ts +78 -327
- package/src/irdevice/irdevice.ts +528 -0
- package/src/irdevice/light.ts +32 -287
- package/src/irdevice/other.ts +396 -615
- package/src/irdevice/tv.ts +100 -339
- package/src/irdevice/vacuumcleaner.ts +49 -305
- package/src/irdevice/waterheater.ts +50 -310
- package/src/platform.ts +353 -206
- package/src/settings.ts +57 -566
- package/src/utils.ts +642 -1
package/src/settings.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Copyright(C) 2017-
|
|
1
|
+
/* Copyright(C) 2017-2024, donavanbecker (https://github.com/donavanbecker). All rights reserved.
|
|
2
2
|
*
|
|
3
3
|
* settings.ts: @switchbot/homebridge-switchbot platform class.
|
|
4
4
|
*/
|
|
@@ -36,6 +36,8 @@ export type credentials = {
|
|
|
36
36
|
export type options = {
|
|
37
37
|
refreshRate?: number;
|
|
38
38
|
pushRate?: number;
|
|
39
|
+
maxRetries?: number;
|
|
40
|
+
delayBetweenRetries?: number;
|
|
39
41
|
logging?: string;
|
|
40
42
|
devices?: Array<devicesConfig>;
|
|
41
43
|
irdevices?: Array<irDevicesConfig>;
|
|
@@ -46,11 +48,15 @@ export type options = {
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
export interface devicesConfig extends device {
|
|
51
|
+
bleMac?: string;
|
|
52
|
+
model?: string;
|
|
53
|
+
bleModel?: string;
|
|
49
54
|
configDeviceType: string;
|
|
50
55
|
configDeviceName?: string;
|
|
51
56
|
deviceId: string;
|
|
52
57
|
external?: boolean;
|
|
53
58
|
refreshRate?: number;
|
|
59
|
+
updateRate?: number;
|
|
54
60
|
firmware?: string;
|
|
55
61
|
logging?: string;
|
|
56
62
|
connectionType?: string;
|
|
@@ -59,6 +65,8 @@ export interface devicesConfig extends device {
|
|
|
59
65
|
hide_device?: boolean;
|
|
60
66
|
offline?: boolean;
|
|
61
67
|
maxRetry?: number;
|
|
68
|
+
maxRetries?: number;
|
|
69
|
+
delayBetweenRetries?: number;
|
|
62
70
|
disableCaching?: boolean;
|
|
63
71
|
mqttURL?: string;
|
|
64
72
|
mqttOptions?: IClientOptions;
|
|
@@ -67,6 +75,7 @@ export interface devicesConfig extends device {
|
|
|
67
75
|
webhook?: boolean;
|
|
68
76
|
bot?: bot;
|
|
69
77
|
meter?: meter;
|
|
78
|
+
iosensor?: iosensor;
|
|
70
79
|
humidifier?: humidifier;
|
|
71
80
|
curtain?: curtain;
|
|
72
81
|
blindTilt?: blindTilt;
|
|
@@ -83,6 +92,13 @@ export interface devicesConfig extends device {
|
|
|
83
92
|
|
|
84
93
|
export type meter = {
|
|
85
94
|
hide_temperature?: boolean;
|
|
95
|
+
convertUnitTo?: string;
|
|
96
|
+
hide_humidity?: boolean;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type iosensor = {
|
|
100
|
+
hide_temperature?: boolean;
|
|
101
|
+
convertUnitTo?: string;
|
|
86
102
|
hide_humidity?: boolean;
|
|
87
103
|
};
|
|
88
104
|
|
|
@@ -105,7 +121,6 @@ export type curtain = {
|
|
|
105
121
|
hide_lightsensor?: boolean;
|
|
106
122
|
set_minLux?: number;
|
|
107
123
|
set_maxLux?: number;
|
|
108
|
-
updateRate?: number;
|
|
109
124
|
set_max?: number;
|
|
110
125
|
set_min?: number;
|
|
111
126
|
set_minStep?: number;
|
|
@@ -118,7 +133,6 @@ export type blindTilt = {
|
|
|
118
133
|
hide_lightsensor?: boolean;
|
|
119
134
|
set_minLux?: number;
|
|
120
135
|
set_maxLux?: number;
|
|
121
|
-
updateRate?: number;
|
|
122
136
|
set_max?: number;
|
|
123
137
|
set_min?: number;
|
|
124
138
|
set_minStep?: number;
|
|
@@ -141,8 +155,6 @@ export type motion = {
|
|
|
141
155
|
|
|
142
156
|
export type waterdetector = {
|
|
143
157
|
hide_leak?: boolean;
|
|
144
|
-
hide_temperature?: boolean;
|
|
145
|
-
hide_humidity?: boolean;
|
|
146
158
|
};
|
|
147
159
|
|
|
148
160
|
export type colorbulb = {
|
|
@@ -167,6 +179,7 @@ export type lock = {
|
|
|
167
179
|
|
|
168
180
|
export type hub = {
|
|
169
181
|
hide_temperature?: boolean;
|
|
182
|
+
convertUnitTo?: string;
|
|
170
183
|
hide_humidity?: boolean;
|
|
171
184
|
hide_lightsensor?: boolean;
|
|
172
185
|
};
|
|
@@ -263,11 +276,29 @@ export type device = {
|
|
|
263
276
|
//the current position, 0-100
|
|
264
277
|
slidePosition?: string;
|
|
265
278
|
//the version of the device
|
|
266
|
-
version?:
|
|
267
|
-
//
|
|
268
|
-
|
|
279
|
+
version?: string;
|
|
280
|
+
// Fan Mode: direct mode: direct; natural mode: "natural"; sleep mode: "sleep"; ultra quiet mode: "baby"
|
|
281
|
+
mode: string;
|
|
282
|
+
//the current battery level
|
|
283
|
+
battery: number;
|
|
284
|
+
//ON/OFF state
|
|
285
|
+
power: string;
|
|
286
|
+
//set nightlight status. turn off: off; mode 1: 1; mode 2: 2
|
|
287
|
+
nightStatus: number;
|
|
288
|
+
//set horizontal oscillation. turn on: on; turn off: off
|
|
289
|
+
oscillation: string;
|
|
290
|
+
//set vertical oscillation. turn on: on; turn off: off
|
|
291
|
+
verticalOscillation: string;
|
|
292
|
+
//battery charge status. charging or uncharged
|
|
293
|
+
chargingStatus: string;
|
|
294
|
+
//fan speed. 1~100
|
|
295
|
+
fanSpeed: number;
|
|
269
296
|
};
|
|
270
297
|
|
|
298
|
+
// values defined but not displayed by API
|
|
299
|
+
export interface deviceInfo extends device {
|
|
300
|
+
}
|
|
301
|
+
|
|
271
302
|
//a list of virtual infrared remote devices.
|
|
272
303
|
export type infraredRemoteList = {
|
|
273
304
|
device: Array<irdevice>;
|
|
@@ -278,11 +309,18 @@ export type irdevice = {
|
|
|
278
309
|
deviceName: string; //device name
|
|
279
310
|
remoteType: string; //device type
|
|
280
311
|
hubDeviceId: string; //remote device's parent Hub ID
|
|
312
|
+
model: string; //device model
|
|
281
313
|
};
|
|
282
314
|
|
|
283
315
|
export type deviceStatus = {
|
|
316
|
+
statusCode: number;
|
|
317
|
+
message: string;
|
|
318
|
+
body: deviceStatusBody;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
export type deviceStatusBody = {
|
|
284
322
|
//v1.1 of API
|
|
285
|
-
deviceId: string; //device ID. (Used by the following deviceTypes: Bot, Curtain, Meter, Meter Plus, Lock, Keypad, Keypad Touch, Motion Sensor, Contact Sensor, Ceiling Light, Ceiling Light Pro, Plug Mini (US), Plug Mini (JP), Strip Light, Color Bulb, Robot Vacuum Cleaner S1, Robot Vacuum Cleaner S1 Plus, Humidifier, Blind Tilt)
|
|
323
|
+
deviceId: string; //device ID. (Used by the following deviceTypes: Bot, Curtain, Meter, Meter Plus, Lock, Keypad, Keypad Touch, Motion Sensor, Contact Sensor, Ceiling Light, Ceiling Light Pro, Plug Mini (US), Plug Mini (JP), Strip Light, Color Bulb, Robot Vacuum Cleaner S1, Robot Vacuum Cleaner S1 Plus, Humidifier, Blind Tilt, Battery Circulator Fan)
|
|
286
324
|
deviceType: string; //device type. (Used by the following deviceTypes: Bot, Curtain, Meter, Meter Plus, Lock, Keypad, Keypad Touch, Motion Sensor, Contact Sensor, Ceiling Light, Ceiling Light Pro, Plug Mini (US), Plug Mini (JP), Strip Light, Color Bulb, Robot Vacuum Cleaner S1, Robot Vacuum Cleaner S1 Plus, Humidifier, Blind Tilt)
|
|
287
325
|
hubDeviceId: string; //device's parent Hub ID. 000000000000 when the device itself is a Hub or it is connected through Wi-Fi. (Used by the following deviceTypes: Bot, Curtain, Meter, Meter Plus, Lock, Keypad, Keypad Touch, Motion Sensor, Contact Sensor, Ceiling Light, Ceiling Light Pro, Plug Mini (JP), Strip Light, Color Bulb, Robot Vacuum Cleaner S1, Robot Vacuum Cleaner S1 Plus, Humidifier, Blind Tilt)
|
|
288
326
|
power?: string; //ON/OFF state. (Used by the following deviceTypes: Bot, Ceiling Light, Ceiling Light Pro, PLug, Plug Mini (US), Plug Mini (JP), Strip Light, Color Bulb, Humidifier)
|
|
@@ -312,14 +350,21 @@ export type deviceStatus = {
|
|
|
312
350
|
childLock?: boolean; //determines if a Humidifier's safety lock is on or not. (Used by the following deviceTypes: Humidifier)
|
|
313
351
|
sound?: boolean; //determines if a Humidifier is muted or not. (Used by the following deviceTypes: Humidifier)
|
|
314
352
|
lackWater?: boolean; //determines if the water tank is empty or not. (Used by the following deviceTypes: Humidifier)
|
|
315
|
-
version?: number; //the version of the device.
|
|
353
|
+
version?: number; //the version of the device.
|
|
316
354
|
direction?: string; //the opening direction of a Blind Tilt device. (Used by the following deviceTypes: Blind Tilt)
|
|
317
355
|
runStatus?: string; //'static' when not moving. (Used by the following deviceTypes: Blind Tilt)
|
|
318
|
-
mode?: number; //available for devices. the fan mode. (Used by the following deviceTypes: Smart Fan)
|
|
356
|
+
mode?: number | string; //available for devices. the fan mode. (Used by the following deviceTypes: Smart Fan, Battery Circulator Fan):(direct mode: direct; natural mode: "natural"; sleep mode: "sleep"; ultra quiet mode: "baby")
|
|
319
357
|
speed?: number; //the fan speed. (Used by the following deviceTypes: Smart Fan)
|
|
320
358
|
shaking?: boolean; //determines if the fan is swinging or not. (Used by the following deviceTypes: Smart Fan)
|
|
321
359
|
shakeCenter?: string; //the fan's swing direction. (Used by the following deviceTypes: Smart Fan)
|
|
322
360
|
shakeRange?: string; //the fan's swing range, 0~120°. (Used by the following deviceTypes: Smart Fan)
|
|
361
|
+
status?: number //the leak status. 0 for no leak, 1 for leak. (Used by the following deviceTypes: Water Detector)
|
|
362
|
+
lightLevel?: number; //the light level. (Used by the following deviceTypes: Hub)
|
|
363
|
+
nightStatus: number // set nightlight status. turn off: off; mode 1: 1; mode 2: 2
|
|
364
|
+
oscillation: string // set horizontal oscillation. turn on: on; turn off: off
|
|
365
|
+
verticalOscillation: string // set vertical oscillation. turn on: on; turn off: off
|
|
366
|
+
chargingStatus: string // battery charge status. charging or uncharged
|
|
367
|
+
fanSpeed: number // fan speed. 1~100
|
|
323
368
|
};
|
|
324
369
|
|
|
325
370
|
export type ad = {
|
|
@@ -356,7 +401,7 @@ export type serviceData = {
|
|
|
356
401
|
battery?: number;
|
|
357
402
|
//Humidifier's humidity level percentage
|
|
358
403
|
percentage?: boolean | string;
|
|
359
|
-
//Humidifier's
|
|
404
|
+
//Humidifier's state
|
|
360
405
|
onState?: boolean;
|
|
361
406
|
//Humidifier's AutoMode
|
|
362
407
|
autoMode?: boolean;
|
|
@@ -407,557 +452,3 @@ export type switchbot = {
|
|
|
407
452
|
wait: (arg0: number) => any;
|
|
408
453
|
};
|
|
409
454
|
|
|
410
|
-
export function rgb2hs(r: any, g: any, b: any) {
|
|
411
|
-
/*
|
|
412
|
-
Credit:
|
|
413
|
-
https://github.com/WickyNilliams/pure-color
|
|
414
|
-
*/
|
|
415
|
-
r = parseInt(r);
|
|
416
|
-
g = parseInt(g);
|
|
417
|
-
b = parseInt(b);
|
|
418
|
-
const min = Math.min(r, g, b);
|
|
419
|
-
const max = Math.max(r, g, b);
|
|
420
|
-
const delta = max - min;
|
|
421
|
-
let h;
|
|
422
|
-
let s;
|
|
423
|
-
if (max === 0) {
|
|
424
|
-
s = 0;
|
|
425
|
-
} else {
|
|
426
|
-
s = (delta / max) * 100;
|
|
427
|
-
}
|
|
428
|
-
if (max === min) {
|
|
429
|
-
h = 0;
|
|
430
|
-
} else if (r === max) {
|
|
431
|
-
h = (g - b) / delta;
|
|
432
|
-
} else if (g === max) {
|
|
433
|
-
h = 2 + (b - r) / delta;
|
|
434
|
-
} else if (b === max) {
|
|
435
|
-
h = 4 + (r - g) / delta;
|
|
436
|
-
}
|
|
437
|
-
h = Math.min(h * 60, 360);
|
|
438
|
-
|
|
439
|
-
if (h < 0) {
|
|
440
|
-
h += 360;
|
|
441
|
-
}
|
|
442
|
-
return [Math.round(h), Math.round(s)];
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
export function hs2rgb(h: any, s: any) {
|
|
446
|
-
/*
|
|
447
|
-
Credit:
|
|
448
|
-
https://github.com/WickyNilliams/pure-color
|
|
449
|
-
*/
|
|
450
|
-
h = parseInt(h) / 60;
|
|
451
|
-
s = parseInt(s) / 100;
|
|
452
|
-
const f = h - Math.floor(h);
|
|
453
|
-
const p = 255 * (1 - s);
|
|
454
|
-
const q = 255 * (1 - s * f);
|
|
455
|
-
const t = 255 * (1 - s * (1 - f));
|
|
456
|
-
let rgb;
|
|
457
|
-
switch (Math.floor(h) % 6) {
|
|
458
|
-
case 0:
|
|
459
|
-
rgb = [255, t, p];
|
|
460
|
-
break;
|
|
461
|
-
case 1:
|
|
462
|
-
rgb = [q, 255, p];
|
|
463
|
-
break;
|
|
464
|
-
case 2:
|
|
465
|
-
rgb = [p, 255, t];
|
|
466
|
-
break;
|
|
467
|
-
case 3:
|
|
468
|
-
rgb = [p, q, 255];
|
|
469
|
-
break;
|
|
470
|
-
case 4:
|
|
471
|
-
rgb = [t, p, 255];
|
|
472
|
-
break;
|
|
473
|
-
case 5:
|
|
474
|
-
rgb = [255, p, q];
|
|
475
|
-
break;
|
|
476
|
-
}
|
|
477
|
-
if (rgb[0] === 255) {
|
|
478
|
-
rgb[1] *= 0.8;
|
|
479
|
-
rgb[2] *= 0.8;
|
|
480
|
-
if (rgb[1] <= 25 && rgb[2] <= 25) {
|
|
481
|
-
rgb[1] = 0;
|
|
482
|
-
rgb[2] = 0;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return [Math.round(rgb[0]), Math.round(rgb[1]), Math.round(rgb[2])];
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
export function k2rgb(k: number) {
|
|
489
|
-
// Set kelvin to nearest 100, between 2000 and 7100
|
|
490
|
-
k = Math.round(k / 100) * 100;
|
|
491
|
-
k = Math.max(Math.min(k, 7100), 2000);
|
|
492
|
-
|
|
493
|
-
// k should now appear in our table of kelvin to rgb
|
|
494
|
-
const values = {
|
|
495
|
-
2000: [255, 141, 11],
|
|
496
|
-
2100: [255, 146, 29],
|
|
497
|
-
2200: [255, 147, 44],
|
|
498
|
-
2300: [255, 152, 54],
|
|
499
|
-
2400: [255, 157, 63],
|
|
500
|
-
2500: [255, 166, 69],
|
|
501
|
-
2600: [255, 170, 77],
|
|
502
|
-
2700: [255, 174, 84],
|
|
503
|
-
2800: [255, 173, 94],
|
|
504
|
-
2900: [255, 177, 101],
|
|
505
|
-
3000: [255, 180, 107],
|
|
506
|
-
3100: [255, 189, 111],
|
|
507
|
-
3200: [255, 187, 120],
|
|
508
|
-
3300: [255, 195, 124],
|
|
509
|
-
3400: [255, 198, 130],
|
|
510
|
-
3500: [255, 201, 135],
|
|
511
|
-
3600: [255, 203, 141],
|
|
512
|
-
3700: [255, 206, 146],
|
|
513
|
-
3800: [255, 204, 153],
|
|
514
|
-
3900: [255, 206, 159],
|
|
515
|
-
4000: [255, 213, 161],
|
|
516
|
-
4100: [255, 215, 166],
|
|
517
|
-
4200: [255, 217, 171],
|
|
518
|
-
4300: [255, 219, 175],
|
|
519
|
-
4400: [255, 221, 180],
|
|
520
|
-
4500: [255, 223, 184],
|
|
521
|
-
4600: [255, 225, 188],
|
|
522
|
-
4700: [255, 226, 192],
|
|
523
|
-
4800: [255, 228, 196],
|
|
524
|
-
4900: [255, 229, 200],
|
|
525
|
-
5000: [255, 231, 204],
|
|
526
|
-
5100: [255, 230, 210],
|
|
527
|
-
5200: [255, 234, 211],
|
|
528
|
-
5300: [255, 235, 215],
|
|
529
|
-
5400: [255, 237, 218],
|
|
530
|
-
5500: [255, 236, 224],
|
|
531
|
-
5700: [255, 240, 228],
|
|
532
|
-
5800: [255, 241, 231],
|
|
533
|
-
5900: [255, 243, 234],
|
|
534
|
-
6000: [255, 244, 237],
|
|
535
|
-
6100: [255, 245, 240],
|
|
536
|
-
6200: [255, 246, 243],
|
|
537
|
-
6300: [255, 247, 247],
|
|
538
|
-
6400: [255, 248, 251],
|
|
539
|
-
6500: [255, 249, 253],
|
|
540
|
-
6600: [254, 249, 255],
|
|
541
|
-
6700: [252, 247, 255],
|
|
542
|
-
6800: [249, 246, 255],
|
|
543
|
-
6900: [247, 245, 255],
|
|
544
|
-
7000: [245, 243, 255],
|
|
545
|
-
7100: [243, 242, 255],
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
// Return the value
|
|
549
|
-
return values[k];
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
export function m2hs(m) {
|
|
553
|
-
/*
|
|
554
|
-
Credit:
|
|
555
|
-
https://github.com/homebridge/HAP-NodeJS
|
|
556
|
-
*/
|
|
557
|
-
const table = {
|
|
558
|
-
100: [19, 222.1],
|
|
559
|
-
101: [18.7, 222.2],
|
|
560
|
-
102: [18.4, 222.3],
|
|
561
|
-
103: [18.2, 222.3],
|
|
562
|
-
104: [17.9, 222.4],
|
|
563
|
-
105: [17.6, 222.5],
|
|
564
|
-
106: [17.3, 222.7],
|
|
565
|
-
107: [17, 222.8],
|
|
566
|
-
108: [16.7, 222.9],
|
|
567
|
-
109: [16.4, 223],
|
|
568
|
-
110: [16.1, 223.2],
|
|
569
|
-
111: [15.8, 223.3],
|
|
570
|
-
112: [15.4, 223.4],
|
|
571
|
-
113: [15.2, 223.6],
|
|
572
|
-
114: [14.9, 223.8],
|
|
573
|
-
115: [14.7, 223.9],
|
|
574
|
-
116: [14.3, 224.1],
|
|
575
|
-
117: [14.1, 224.2],
|
|
576
|
-
118: [13.8, 224.4],
|
|
577
|
-
119: [13.5, 224.6],
|
|
578
|
-
120: [13.2, 224.8],
|
|
579
|
-
121: [12.9, 225],
|
|
580
|
-
122: [12.5, 225.3],
|
|
581
|
-
123: [12.2, 225.6],
|
|
582
|
-
124: [11.8, 225.9],
|
|
583
|
-
125: [11.4, 226.3],
|
|
584
|
-
126: [11.1, 226.7],
|
|
585
|
-
127: [10.7, 227.1],
|
|
586
|
-
128: [10.3, 227.6],
|
|
587
|
-
129: [9.9, 228],
|
|
588
|
-
130: [9.6, 228.5],
|
|
589
|
-
131: [9.3, 229.1],
|
|
590
|
-
132: [8.9, 229.6],
|
|
591
|
-
133: [8.5, 230.2],
|
|
592
|
-
134: [8.2, 230.9],
|
|
593
|
-
135: [7.8, 231.6],
|
|
594
|
-
136: [7.5, 232.5],
|
|
595
|
-
137: [7.1, 233.5],
|
|
596
|
-
138: [6.7, 234.6],
|
|
597
|
-
139: [6.3, 235.8],
|
|
598
|
-
140: [6, 237.1],
|
|
599
|
-
141: [5.6, 238.9],
|
|
600
|
-
142: [5.2, 240.9],
|
|
601
|
-
143: [5, 242.9],
|
|
602
|
-
144: [4.8, 244.9],
|
|
603
|
-
145: [4.6, 246.9],
|
|
604
|
-
146: [4.4, 249.3],
|
|
605
|
-
147: [4.3, 251.9],
|
|
606
|
-
148: [4.1, 254.9],
|
|
607
|
-
149: [3.9, 258],
|
|
608
|
-
150: [3.7, 261.8],
|
|
609
|
-
151: [3.4, 265.9],
|
|
610
|
-
152: [3.2, 271],
|
|
611
|
-
153: [3, 276.4],
|
|
612
|
-
154: [2.8, 283.6],
|
|
613
|
-
155: [2.6, 290.4],
|
|
614
|
-
156: [2.3, 295.3],
|
|
615
|
-
157: [2.1, 300],
|
|
616
|
-
158: [1.9, 300],
|
|
617
|
-
159: [1.6, 300],
|
|
618
|
-
160: [1.4, 195.8],
|
|
619
|
-
161: [1.2, 84.3],
|
|
620
|
-
162: [1.3, 58.2],
|
|
621
|
-
163: [1.5, 55.9],
|
|
622
|
-
164: [1.7, 53.2],
|
|
623
|
-
165: [1.9, 50.2],
|
|
624
|
-
166: [2.1, 47.1],
|
|
625
|
-
167: [2.4, 44.5],
|
|
626
|
-
168: [2.6, 42.6],
|
|
627
|
-
169: [2.9, 40.9],
|
|
628
|
-
170: [3.1, 39.5],
|
|
629
|
-
171: [3.4, 38.3],
|
|
630
|
-
172: [3.7, 37.3],
|
|
631
|
-
173: [3.9, 36.5],
|
|
632
|
-
174: [4.2, 35.7],
|
|
633
|
-
175: [4.4, 35.1],
|
|
634
|
-
176: [4.6, 34.5],
|
|
635
|
-
177: [4.9, 34],
|
|
636
|
-
178: [5.1, 33.5],
|
|
637
|
-
179: [5.3, 33],
|
|
638
|
-
180: [5.6, 32.7],
|
|
639
|
-
181: [5.8, 32.3],
|
|
640
|
-
182: [6, 32],
|
|
641
|
-
183: [6.3, 31.7],
|
|
642
|
-
184: [6.5, 31.4],
|
|
643
|
-
185: [6.7, 31.2],
|
|
644
|
-
186: [7, 30.9],
|
|
645
|
-
187: [7.2, 30.7],
|
|
646
|
-
188: [7.4, 30.5],
|
|
647
|
-
189: [7.6, 30.3],
|
|
648
|
-
190: [7.9, 30.1],
|
|
649
|
-
191: [8.1, 29.9],
|
|
650
|
-
192: [8.4, 29.7],
|
|
651
|
-
193: [8.6, 29.6],
|
|
652
|
-
194: [8.9, 29.5],
|
|
653
|
-
195: [9.1, 29.3],
|
|
654
|
-
196: [9.4, 29.2],
|
|
655
|
-
197: [9.6, 29.1],
|
|
656
|
-
198: [9.8, 29],
|
|
657
|
-
199: [10, 28.9],
|
|
658
|
-
200: [10.2, 28.7],
|
|
659
|
-
201: [10.5, 28.7],
|
|
660
|
-
202: [10.7, 28.6],
|
|
661
|
-
203: [11, 28.5],
|
|
662
|
-
204: [11.2, 28.4],
|
|
663
|
-
205: [11.4, 28.3],
|
|
664
|
-
206: [11.6, 28.3],
|
|
665
|
-
207: [11.8, 28.2],
|
|
666
|
-
208: [12.1, 28.1],
|
|
667
|
-
209: [12.3, 28.1],
|
|
668
|
-
210: [12.5, 28],
|
|
669
|
-
211: [12.7, 28],
|
|
670
|
-
212: [12.9, 27.9],
|
|
671
|
-
213: [13.2, 27.8],
|
|
672
|
-
214: [13.4, 27.8],
|
|
673
|
-
215: [13.6, 27.7],
|
|
674
|
-
216: [13.8, 27.7],
|
|
675
|
-
217: [14, 27.7],
|
|
676
|
-
218: [14.3, 27.6],
|
|
677
|
-
219: [14.5, 27.6],
|
|
678
|
-
220: [14.7, 27.5],
|
|
679
|
-
221: [14.9, 27.5],
|
|
680
|
-
222: [15.1, 27.5],
|
|
681
|
-
223: [15.3, 27.4],
|
|
682
|
-
224: [15.5, 27.4],
|
|
683
|
-
225: [15.8, 27.4],
|
|
684
|
-
226: [16, 27.3],
|
|
685
|
-
227: [16.2, 27.3],
|
|
686
|
-
228: [16.4, 27.3],
|
|
687
|
-
229: [16.6, 27.3],
|
|
688
|
-
230: [16.8, 27.2],
|
|
689
|
-
231: [17, 27.2],
|
|
690
|
-
232: [17.2, 27.2],
|
|
691
|
-
233: [17.4, 27.2],
|
|
692
|
-
234: [17.6, 27.2],
|
|
693
|
-
235: [17.8, 27.1],
|
|
694
|
-
236: [18, 27.1],
|
|
695
|
-
237: [18.2, 27.1],
|
|
696
|
-
238: [18.4, 27.1],
|
|
697
|
-
239: [18.7, 27.1],
|
|
698
|
-
240: [18.8, 27],
|
|
699
|
-
241: [19, 27],
|
|
700
|
-
242: [19.2, 27],
|
|
701
|
-
243: [19.4, 27],
|
|
702
|
-
244: [19.6, 27],
|
|
703
|
-
245: [19.8, 27],
|
|
704
|
-
246: [20, 27],
|
|
705
|
-
247: [20.3, 26.9],
|
|
706
|
-
248: [20.5, 26.9],
|
|
707
|
-
249: [20.6, 26.9],
|
|
708
|
-
250: [20.8, 26.9],
|
|
709
|
-
251: [21, 26.9],
|
|
710
|
-
252: [21.3, 26.9],
|
|
711
|
-
253: [21.5, 26.9],
|
|
712
|
-
254: [21.6, 26.9],
|
|
713
|
-
255: [21.8, 26.8],
|
|
714
|
-
256: [22, 26.8],
|
|
715
|
-
257: [22.2, 26.8],
|
|
716
|
-
258: [22.4, 26.8],
|
|
717
|
-
259: [22.6, 26.8],
|
|
718
|
-
260: [22.8, 26.8],
|
|
719
|
-
261: [23, 26.8],
|
|
720
|
-
262: [23.2, 26.8],
|
|
721
|
-
263: [23.4, 26.8],
|
|
722
|
-
264: [23.6, 26.8],
|
|
723
|
-
265: [23.8, 26.8],
|
|
724
|
-
266: [24, 26.8],
|
|
725
|
-
267: [24.1, 26.8],
|
|
726
|
-
268: [24.3, 26.8],
|
|
727
|
-
269: [24.5, 26.8],
|
|
728
|
-
270: [24.7, 26.8],
|
|
729
|
-
271: [24.8, 26.8],
|
|
730
|
-
272: [25.1, 26.7],
|
|
731
|
-
273: [25.3, 26.7],
|
|
732
|
-
274: [25.4, 26.7],
|
|
733
|
-
275: [25.6, 26.7],
|
|
734
|
-
276: [25.8, 26.7],
|
|
735
|
-
277: [26, 26.7],
|
|
736
|
-
278: [26.1, 26.7],
|
|
737
|
-
279: [26.3, 26.7],
|
|
738
|
-
280: [26.5, 26.7],
|
|
739
|
-
281: [26.7, 26.7],
|
|
740
|
-
282: [26.9, 26.7],
|
|
741
|
-
283: [27.1, 26.7],
|
|
742
|
-
284: [27.3, 26.7],
|
|
743
|
-
285: [27.5, 26.7],
|
|
744
|
-
286: [27.7, 26.7],
|
|
745
|
-
287: [27.8, 26.7],
|
|
746
|
-
288: [28, 26.7],
|
|
747
|
-
289: [28.2, 26.7],
|
|
748
|
-
290: [28.4, 26.7],
|
|
749
|
-
291: [28.6, 26.7],
|
|
750
|
-
292: [28.8, 26.7],
|
|
751
|
-
293: [28.9, 26.7],
|
|
752
|
-
294: [29.1, 26.7],
|
|
753
|
-
295: [29.3, 26.7],
|
|
754
|
-
296: [29.5, 26.7],
|
|
755
|
-
297: [29.6, 26.7],
|
|
756
|
-
298: [29.8, 26.7],
|
|
757
|
-
299: [30, 26.7],
|
|
758
|
-
300: [30.2, 26.7],
|
|
759
|
-
301: [30.4, 26.7],
|
|
760
|
-
302: [30.5, 26.7],
|
|
761
|
-
303: [30.7, 26.7],
|
|
762
|
-
304: [30.9, 26.7],
|
|
763
|
-
305: [31.1, 26.7],
|
|
764
|
-
306: [31.2, 26.7],
|
|
765
|
-
307: [31.4, 26.7],
|
|
766
|
-
308: [31.6, 26.7],
|
|
767
|
-
309: [31.8, 26.8],
|
|
768
|
-
310: [31.9, 26.8],
|
|
769
|
-
311: [32.1, 26.8],
|
|
770
|
-
312: [32.3, 26.8],
|
|
771
|
-
313: [32.5, 26.8],
|
|
772
|
-
314: [32.6, 26.8],
|
|
773
|
-
315: [32.8, 26.8],
|
|
774
|
-
316: [33, 26.8],
|
|
775
|
-
317: [33.2, 26.8],
|
|
776
|
-
318: [33.3, 26.8],
|
|
777
|
-
319: [33.5, 26.8],
|
|
778
|
-
320: [33.7, 26.8],
|
|
779
|
-
321: [33.8, 26.8],
|
|
780
|
-
322: [34, 26.8],
|
|
781
|
-
323: [34.2, 26.8],
|
|
782
|
-
324: [34.4, 26.8],
|
|
783
|
-
325: [34.5, 26.8],
|
|
784
|
-
326: [34.7, 26.8],
|
|
785
|
-
327: [34.9, 26.8],
|
|
786
|
-
328: [35.1, 26.8],
|
|
787
|
-
329: [35.2, 26.8],
|
|
788
|
-
330: [35.4, 26.8],
|
|
789
|
-
331: [35.5, 26.8],
|
|
790
|
-
332: [35.7, 26.8],
|
|
791
|
-
333: [35.9, 26.8],
|
|
792
|
-
334: [36.1, 26.8],
|
|
793
|
-
335: [36.3, 26.9],
|
|
794
|
-
336: [36.5, 26.9],
|
|
795
|
-
337: [36.7, 26.9],
|
|
796
|
-
338: [36.9, 26.9],
|
|
797
|
-
339: [37.1, 26.9],
|
|
798
|
-
340: [37.2, 26.9],
|
|
799
|
-
341: [37.4, 26.9],
|
|
800
|
-
342: [37.5, 26.9],
|
|
801
|
-
343: [37.7, 26.9],
|
|
802
|
-
344: [37.9, 26.9],
|
|
803
|
-
345: [38.1, 26.9],
|
|
804
|
-
346: [38.3, 26.9],
|
|
805
|
-
347: [38.5, 26.9],
|
|
806
|
-
348: [38.7, 26.9],
|
|
807
|
-
349: [38.9, 26.9],
|
|
808
|
-
350: [39, 26.9],
|
|
809
|
-
351: [39.2, 26.9],
|
|
810
|
-
352: [39.3, 27],
|
|
811
|
-
353: [39.5, 27],
|
|
812
|
-
354: [39.7, 27],
|
|
813
|
-
355: [39.9, 27],
|
|
814
|
-
356: [40.1, 27],
|
|
815
|
-
357: [40.2, 27],
|
|
816
|
-
358: [40.4, 27],
|
|
817
|
-
359: [40.6, 27],
|
|
818
|
-
360: [40.8, 27],
|
|
819
|
-
361: [40.9, 27],
|
|
820
|
-
362: [41.1, 27],
|
|
821
|
-
363: [41.2, 27],
|
|
822
|
-
364: [41.4, 27],
|
|
823
|
-
365: [41.6, 27],
|
|
824
|
-
366: [41.8, 27],
|
|
825
|
-
367: [42, 27],
|
|
826
|
-
368: [42.1, 27.1],
|
|
827
|
-
369: [42.3, 27.1],
|
|
828
|
-
370: [42.4, 27.1],
|
|
829
|
-
371: [42.6, 27.1],
|
|
830
|
-
372: [42.8, 27.1],
|
|
831
|
-
373: [43, 27.1],
|
|
832
|
-
374: [43.1, 27.1],
|
|
833
|
-
375: [43.2, 27.1],
|
|
834
|
-
376: [43.4, 27.1],
|
|
835
|
-
377: [43.6, 27.1],
|
|
836
|
-
378: [43.8, 27.1],
|
|
837
|
-
379: [43.9, 27.1],
|
|
838
|
-
380: [44.1, 27.1],
|
|
839
|
-
381: [44.3, 27.2],
|
|
840
|
-
382: [44.4, 27.2],
|
|
841
|
-
383: [44.6, 27.2],
|
|
842
|
-
384: [44.7, 27.2],
|
|
843
|
-
385: [44.9, 27.2],
|
|
844
|
-
386: [45.1, 27.2],
|
|
845
|
-
387: [45.3, 27.2],
|
|
846
|
-
388: [45.5, 27.2],
|
|
847
|
-
389: [45.6, 27.2],
|
|
848
|
-
390: [45.8, 27.2],
|
|
849
|
-
391: [46, 27.2],
|
|
850
|
-
392: [46.2, 27.2],
|
|
851
|
-
393: [46.4, 27.3],
|
|
852
|
-
394: [46.5, 27.3],
|
|
853
|
-
395: [46.7, 27.3],
|
|
854
|
-
396: [46.9, 27.3],
|
|
855
|
-
397: [47.1, 27.3],
|
|
856
|
-
398: [47.2, 27.3],
|
|
857
|
-
399: [47.4, 27.3],
|
|
858
|
-
400: [47.6, 27.3],
|
|
859
|
-
401: [47.7, 27.3],
|
|
860
|
-
402: [47.9, 27.3],
|
|
861
|
-
403: [48.1, 27.3],
|
|
862
|
-
404: [48.3, 27.3],
|
|
863
|
-
405: [48.5, 27.4],
|
|
864
|
-
406: [48.7, 27.4],
|
|
865
|
-
407: [48.8, 27.4],
|
|
866
|
-
408: [49, 27.4],
|
|
867
|
-
409: [49.2, 27.4],
|
|
868
|
-
410: [49.4, 27.4],
|
|
869
|
-
411: [49.6, 27.4],
|
|
870
|
-
412: [49.7, 27.4],
|
|
871
|
-
413: [49.9, 27.4],
|
|
872
|
-
414: [50.1, 27.4],
|
|
873
|
-
415: [50.2, 27.4],
|
|
874
|
-
416: [50.4, 27.4],
|
|
875
|
-
417: [50.6, 27.5],
|
|
876
|
-
418: [50.7, 27.5],
|
|
877
|
-
419: [50.9, 27.5],
|
|
878
|
-
420: [51.1, 27.5],
|
|
879
|
-
421: [51.2, 27.5],
|
|
880
|
-
422: [51.4, 27.5],
|
|
881
|
-
423: [51.6, 27.5],
|
|
882
|
-
424: [51.7, 27.5],
|
|
883
|
-
425: [51.9, 27.5],
|
|
884
|
-
426: [52.1, 27.5],
|
|
885
|
-
427: [51.2, 27.6],
|
|
886
|
-
428: [52.4, 27.6],
|
|
887
|
-
429: [52.5, 27.6],
|
|
888
|
-
430: [52.7, 27.6],
|
|
889
|
-
431: [52.9, 27.6],
|
|
890
|
-
432: [53.1, 27.6],
|
|
891
|
-
433: [53.2, 27.6],
|
|
892
|
-
434: [53.4, 27.6],
|
|
893
|
-
435: [53.6, 27.6],
|
|
894
|
-
436: [53.7, 27.6],
|
|
895
|
-
437: [53.9, 27.6],
|
|
896
|
-
438: [54.1, 27.7],
|
|
897
|
-
439: [54.2, 27.7],
|
|
898
|
-
440: [54.3, 27.7],
|
|
899
|
-
441: [54.5, 27.7],
|
|
900
|
-
442: [54.7, 27.7],
|
|
901
|
-
443: [54.8, 27.7],
|
|
902
|
-
444: [55, 27.7],
|
|
903
|
-
445: [55.2, 27.7],
|
|
904
|
-
446: [55.3, 27.7],
|
|
905
|
-
447: [55.5, 27.7],
|
|
906
|
-
448: [55.7, 27.7],
|
|
907
|
-
449: [55.8, 27.8],
|
|
908
|
-
450: [56, 27.8],
|
|
909
|
-
451: [56.2, 27.8],
|
|
910
|
-
452: [56.3, 27.8],
|
|
911
|
-
453: [56.5, 27.8],
|
|
912
|
-
454: [56.7, 27.8],
|
|
913
|
-
455: [56.8, 27.8],
|
|
914
|
-
456: [57, 27.8],
|
|
915
|
-
457: [57.2, 27.8],
|
|
916
|
-
458: [57.3, 27.9],
|
|
917
|
-
459: [57.4, 27.9],
|
|
918
|
-
460: [57.6, 27.9],
|
|
919
|
-
461: [57.8, 27.9],
|
|
920
|
-
462: [57.9, 27.9],
|
|
921
|
-
463: [58.1, 27.9],
|
|
922
|
-
464: [58.3, 27.9],
|
|
923
|
-
465: [58.4, 27.9],
|
|
924
|
-
466: [58.6, 27.9],
|
|
925
|
-
467: [58.8, 27.9],
|
|
926
|
-
468: [59, 28],
|
|
927
|
-
469: [59.1, 28],
|
|
928
|
-
470: [59.2, 28],
|
|
929
|
-
471: [59.4, 28],
|
|
930
|
-
472: [59.6, 28],
|
|
931
|
-
473: [59.7, 28],
|
|
932
|
-
474: [60, 28],
|
|
933
|
-
475: [60.1, 28],
|
|
934
|
-
476: [60.2, 28],
|
|
935
|
-
477: [60.4, 28],
|
|
936
|
-
478: [60.6, 28.1],
|
|
937
|
-
479: [60.7, 28.1],
|
|
938
|
-
480: [60.9, 28.1],
|
|
939
|
-
481: [60.1, 28.1],
|
|
940
|
-
482: [60.3, 28.1],
|
|
941
|
-
483: [61.4, 28.1],
|
|
942
|
-
484: [61.5, 28.1],
|
|
943
|
-
485: [61.7, 28.1],
|
|
944
|
-
486: [61.9, 28.1],
|
|
945
|
-
487: [62, 28.2],
|
|
946
|
-
488: [62.2, 28.2],
|
|
947
|
-
489: [62.3, 28.2],
|
|
948
|
-
490: [62.5, 28.2],
|
|
949
|
-
491: [62.7, 28.2],
|
|
950
|
-
492: [62.8, 28.2],
|
|
951
|
-
493: [63, 28.2],
|
|
952
|
-
494: [63.2, 28.2],
|
|
953
|
-
495: [63.3, 28.2],
|
|
954
|
-
496: [63.4, 28.2],
|
|
955
|
-
497: [63.6, 28.2],
|
|
956
|
-
498: [63.8, 28.3],
|
|
957
|
-
499: [63.9, 28.3],
|
|
958
|
-
500: [64.1, 28.3],
|
|
959
|
-
};
|
|
960
|
-
const input = Math.min(Math.max(Math.round(m), 140), 500);
|
|
961
|
-
const toReturn = table[input];
|
|
962
|
-
return [Math.round(toReturn[1]), Math.round(toReturn[0])];
|
|
963
|
-
}
|