homey-lib 2.37.4 → 2.38.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/index.js +4 -3
- package/lib/Util/index.js +36 -0
- package/package.json +1 -1
- package/webpack/index.js +1 -1
package/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
module.exports.App = require('./lib/App');
|
|
4
|
-
module.exports.Device = require('./lib/Device');
|
|
5
4
|
module.exports.Capability = require('./lib/Capability');
|
|
6
|
-
module.exports.
|
|
7
|
-
module.exports.Media = require('./lib/Media');
|
|
5
|
+
module.exports.Device = require('./lib/Device');
|
|
8
6
|
module.exports.Energy = require('./lib/Energy');
|
|
7
|
+
module.exports.Media = require('./lib/Media');
|
|
8
|
+
module.exports.Signal = require('./lib/Signal');
|
|
9
|
+
module.exports.Util = require('./lib/Util');
|
|
9
10
|
|
|
10
11
|
module.exports.getDeviceClasses = module.exports.Device.getClasses.bind(module.exports.Device);
|
|
11
12
|
module.exports.getDeviceClass = module.exports.Device.getClass.bind(module.exports.Device);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class Util {
|
|
4
|
+
|
|
5
|
+
static FEATURE_SPEAKER = 'speaker';
|
|
6
|
+
static FEATURE_LED_RING = 'ledring';
|
|
7
|
+
static FEATURE_NFC = 'nfc';
|
|
8
|
+
static FEATURE_MATTER = 'matter';
|
|
9
|
+
static FEATURE_CAMERA_STREAMING = 'camera-streaming';
|
|
10
|
+
|
|
11
|
+
static _platformLocalFeatures = {
|
|
12
|
+
homey1s: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING, Util.FEATURE_NFC],
|
|
13
|
+
homey1d: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING, Util.FEATURE_NFC],
|
|
14
|
+
homey1q: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING, Util.FEATURE_NFC],
|
|
15
|
+
homey2s: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING, Util.FEATURE_NFC],
|
|
16
|
+
homey2d: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING, Util.FEATURE_NFC],
|
|
17
|
+
homey2q: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING, Util.FEATURE_NFC],
|
|
18
|
+
homey3s: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING],
|
|
19
|
+
homey3d: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING],
|
|
20
|
+
homey4d: [Util.FEATURE_SPEAKER, Util.FEATURE_LED_RING],
|
|
21
|
+
homey5q: [Util.FEATURE_MATTER, Util.FEATURE_CAMERA_STREAMING],
|
|
22
|
+
homey6q: [Util.FEATURE_MATTER, Util.FEATURE_CAMERA_STREAMING],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
static getPlatformLocalFeatures(modelId) {
|
|
26
|
+
return Util._platformLocalFeatures[modelId] || [];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static getMissingPlatformLocalFeatures(modelId, wantedFeatures) {
|
|
30
|
+
const features = Util.getPlatformLocalFeatures(modelId);
|
|
31
|
+
return wantedFeatures.filter(feature => !features.includes(feature));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = Util;
|