homebridge-solaxcloud-api 2.5.0 → 2.5.2
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 +177 -164
- package/LICENSE +175 -175
- package/README.md +223 -196
- package/config.sample +15 -15
- package/config.schema.json +113 -113
- package/dist/platformInverter.d.ts +5 -0
- package/dist/platformInverter.d.ts.map +1 -1
- package/dist/platformInverter.js +35 -26
- package/dist/platformInverter.js.map +1 -1
- package/package.json +60 -59
- package/test/batteryAccessory.test.ts +16 -16
- package/test/helpers.ts +80 -80
- package/test/lightSensorAccessory.test.ts +73 -73
- package/test/motionAccessory.test.ts +36 -36
- package/test/outletAccessory.test.ts +75 -75
- package/test/platformAccessory.test.ts +24 -24
- package/test/platformConfig.test.ts +188 -188
- package/test/platformTotalizer.test.ts +165 -123
- package/test/statistics.test.ts +50 -50
package/test/statistics.test.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { Statistics } from '../src/statistics.js';
|
|
2
|
-
|
|
3
|
-
import assert from 'assert';
|
|
4
|
-
|
|
5
|
-
describe('Statistics: Smoothing methods', () => {
|
|
6
|
-
const sampleSeries = [1, 3, 5, 3, 7, 6, 8, 5, 8, 8, 4, 5];
|
|
7
|
-
|
|
8
|
-
it('Simple Moving Average (sanity checks)', () => {
|
|
9
|
-
// window size too big
|
|
10
|
-
assert.deepEqual(Statistics.simpleMovingAverage(sampleSeries, 100), []);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('Simple Moving Average', () => {
|
|
14
|
-
assert.deepEqual(
|
|
15
|
-
Statistics.simpleMovingAverage(sampleSeries, 4),
|
|
16
|
-
[
|
|
17
|
-
3,
|
|
18
|
-
4.5,
|
|
19
|
-
5.25,
|
|
20
|
-
6,
|
|
21
|
-
6.5,
|
|
22
|
-
6.75,
|
|
23
|
-
7.25,
|
|
24
|
-
6.25,
|
|
25
|
-
6.25],
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('Exponential Moving Average (sanity checks)', () => {
|
|
30
|
-
// window size too big
|
|
31
|
-
assert.deepEqual(Statistics.exponentialMovingAverage(sampleSeries, 100), []);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('Exponential Moving Average', () => {
|
|
35
|
-
assert.deepEqual(
|
|
36
|
-
Statistics.exponentialMovingAverage(sampleSeries, 4),
|
|
37
|
-
[
|
|
38
|
-
3,
|
|
39
|
-
4.6,
|
|
40
|
-
5.16,
|
|
41
|
-
6.296,
|
|
42
|
-
5.7776000000000005,
|
|
43
|
-
6.6665600000000005,
|
|
44
|
-
7.199936,
|
|
45
|
-
5.9199616,
|
|
46
|
-
5.55197696,
|
|
47
|
-
],
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
1
|
+
import { Statistics } from '../src/statistics.js';
|
|
2
|
+
|
|
3
|
+
import assert from 'assert';
|
|
4
|
+
|
|
5
|
+
describe('Statistics: Smoothing methods', () => {
|
|
6
|
+
const sampleSeries = [1, 3, 5, 3, 7, 6, 8, 5, 8, 8, 4, 5];
|
|
7
|
+
|
|
8
|
+
it('Simple Moving Average (sanity checks)', () => {
|
|
9
|
+
// window size too big
|
|
10
|
+
assert.deepEqual(Statistics.simpleMovingAverage(sampleSeries, 100), []);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('Simple Moving Average', () => {
|
|
14
|
+
assert.deepEqual(
|
|
15
|
+
Statistics.simpleMovingAverage(sampleSeries, 4),
|
|
16
|
+
[
|
|
17
|
+
3,
|
|
18
|
+
4.5,
|
|
19
|
+
5.25,
|
|
20
|
+
6,
|
|
21
|
+
6.5,
|
|
22
|
+
6.75,
|
|
23
|
+
7.25,
|
|
24
|
+
6.25,
|
|
25
|
+
6.25],
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('Exponential Moving Average (sanity checks)', () => {
|
|
30
|
+
// window size too big
|
|
31
|
+
assert.deepEqual(Statistics.exponentialMovingAverage(sampleSeries, 100), []);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('Exponential Moving Average', () => {
|
|
35
|
+
assert.deepEqual(
|
|
36
|
+
Statistics.exponentialMovingAverage(sampleSeries, 4),
|
|
37
|
+
[
|
|
38
|
+
3,
|
|
39
|
+
4.6,
|
|
40
|
+
5.16,
|
|
41
|
+
6.296,
|
|
42
|
+
5.7776000000000005,
|
|
43
|
+
6.6665600000000005,
|
|
44
|
+
7.199936,
|
|
45
|
+
5.9199616,
|
|
46
|
+
5.55197696,
|
|
47
|
+
],
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
51
|
});
|