homebridge-solaxcloud-api 2.4.2 → 2.5.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 +164 -156
- package/LICENSE +175 -175
- package/README.md +196 -196
- package/config.sample +15 -15
- package/config.schema.json +113 -113
- package/dist/batteryAccessory.d.ts +1 -1
- package/dist/batteryAccessory.d.ts.map +1 -1
- package/dist/batteryAccessory.js +17 -17
- package/dist/batteryAccessory.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/lightSensorAccessory.d.ts +23 -16
- package/dist/lightSensorAccessory.d.ts.map +1 -1
- package/dist/lightSensorAccessory.js +109 -32
- package/dist/lightSensorAccessory.js.map +1 -1
- package/dist/motionAccessory.d.ts +1 -2
- package/dist/motionAccessory.d.ts.map +1 -1
- package/dist/motionAccessory.js +17 -20
- package/dist/motionAccessory.js.map +1 -1
- package/dist/outletAccessory.d.ts +1 -1
- package/dist/outletAccessory.d.ts.map +1 -1
- package/dist/outletAccessory.js +47 -33
- package/dist/outletAccessory.js.map +1 -1
- package/dist/platform.d.ts +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +30 -27
- package/dist/platform.js.map +1 -1
- package/dist/platformAccessory.d.ts.map +1 -1
- package/dist/platformAccessory.js +40 -18
- package/dist/platformAccessory.js.map +1 -1
- package/dist/platformInverter.d.ts.map +1 -1
- package/dist/platformInverter.js +129 -69
- package/dist/platformInverter.js.map +1 -1
- package/dist/platformMeters.d.ts +2 -2
- package/dist/platformMeters.d.ts.map +1 -1
- package/dist/platformMeters.js +1 -2
- package/dist/settings.js +2 -5
- package/dist/settings.js.map +1 -1
- package/dist/solaxcloudfetch.js +14 -19
- package/dist/solaxcloudfetch.js.map +1 -1
- package/dist/statistics.js +1 -5
- package/dist/statistics.js.map +1 -1
- package/dist/util.js +1 -5
- package/dist/util.js.map +1 -1
- package/package.json +59 -55
- package/test/batteryAccessory.test.ts +16 -16
- package/test/helpers.ts +80 -36
- package/test/lightSensorAccessory.test.ts +73 -28
- 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 +123 -97
- package/test/statistics.test.ts +50 -50
package/config.schema.json
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
{
|
|
2
|
-
"pluginAlias": "SolaxCloudAPI",
|
|
3
|
-
"pluginType": "platform",
|
|
4
|
-
"singular": false,
|
|
5
|
-
"headerDisplay": "This Homebridge plugin uses Solax/QCells API cloud service to obtain real-time info of your inverters.",
|
|
6
|
-
"schema": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"inverters": {
|
|
10
|
-
"title": "Inverters",
|
|
11
|
-
"type": "array",
|
|
12
|
-
"items": {
|
|
13
|
-
"title": "Inverter",
|
|
14
|
-
"type": "object",
|
|
15
|
-
"properties": {
|
|
16
|
-
"brand": {
|
|
17
|
-
"title": "Inverter Brand",
|
|
18
|
-
"type": "string",
|
|
19
|
-
"required": true,
|
|
20
|
-
"default": "solax",
|
|
21
|
-
"oneOf": [
|
|
22
|
-
{ "title": "Solax", "enum": [ "solax" ] },
|
|
23
|
-
{ "title": "QCells", "enum": [ "qcells" ] }
|
|
24
|
-
],
|
|
25
|
-
"description": "Brand for list of inverters below (API data fetch URL is brand dependent)."
|
|
26
|
-
},
|
|
27
|
-
"tokenId": {
|
|
28
|
-
"title": "TokenID",
|
|
29
|
-
"type": "string",
|
|
30
|
-
"required": true,
|
|
31
|
-
"description": "Users get information from the cloud API through the granted tokenID. Please obtain your tokenID on the API page of Solax/QCells cloud.",
|
|
32
|
-
"default": "20200722185111234567890",
|
|
33
|
-
"minLength": 23,
|
|
34
|
-
"maxLength": 24
|
|
35
|
-
},
|
|
36
|
-
"name": {
|
|
37
|
-
"title": "Inverter name (unique)",
|
|
38
|
-
"type": "string",
|
|
39
|
-
"required": true,
|
|
40
|
-
"description": "Inverter name for description purposes.",
|
|
41
|
-
"default": "My Solax Inverter",
|
|
42
|
-
"minLength": 1,
|
|
43
|
-
"maxLength": 30
|
|
44
|
-
},
|
|
45
|
-
"sn": {
|
|
46
|
-
"title": "Inverter module SN",
|
|
47
|
-
"type": "string",
|
|
48
|
-
"required": true,
|
|
49
|
-
"description": "Registration No. (inverter module SN)",
|
|
50
|
-
"default": "ABCDEFGHIJ",
|
|
51
|
-
"minLength": 10,
|
|
52
|
-
"maxLength": 10
|
|
53
|
-
},
|
|
54
|
-
"hasBattery": {
|
|
55
|
-
"title": "Battery installed?",
|
|
56
|
-
"type": "boolean",
|
|
57
|
-
"required": false,
|
|
58
|
-
"description": "Whether this inverter has a battery installed.",
|
|
59
|
-
"default": false
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"pollingFrequency": {
|
|
65
|
-
"title": "Polling frequency (seconds)",
|
|
66
|
-
"type": "integer",
|
|
67
|
-
"required": false,
|
|
68
|
-
"default": 300,
|
|
69
|
-
"oneOf": [
|
|
70
|
-
{ "title": "300 (5 minutes)", "enum": [ 300 ] },
|
|
71
|
-
{ "title": "600 (10 minutes)", "enum": [ 600 ] },
|
|
72
|
-
{ "title": "900 (15 minutes)", "enum": [ 900 ] }
|
|
73
|
-
],
|
|
74
|
-
"description": "Plugin data polling frequency from the cloud (in seconds)."
|
|
75
|
-
},
|
|
76
|
-
"smoothMeters": {
|
|
77
|
-
"title": "Add accessories for smooth meters?",
|
|
78
|
-
"type": "boolean",
|
|
79
|
-
"required": false,
|
|
80
|
-
"default": true,
|
|
81
|
-
"description": "Enable this option to create accessories for smoothing raw values read from the cloud."
|
|
82
|
-
},
|
|
83
|
-
"smoothingMethod": {
|
|
84
|
-
"title": "Smoothing method",
|
|
85
|
-
"type": "string",
|
|
86
|
-
"required": true,
|
|
87
|
-
"default": "sma",
|
|
88
|
-
"oneOf": [
|
|
89
|
-
{ "title": "Simple moving average", "enum": [ "sma" ] },
|
|
90
|
-
{ "title": "Exponential moving average", "enum": [ "ema" ] }
|
|
91
|
-
],
|
|
92
|
-
"condition": {
|
|
93
|
-
"functionBody": "return model.smoothMeters === true;"
|
|
94
|
-
},
|
|
95
|
-
"description": "Statistical method for smoothing power consumption data."
|
|
96
|
-
},
|
|
97
|
-
"pureHomeApp": {
|
|
98
|
-
"title": "Add \"pure\" Home app accessories?",
|
|
99
|
-
"type": "boolean",
|
|
100
|
-
"required": false,
|
|
101
|
-
"default": false,
|
|
102
|
-
"description": "Enable this option to create light ambient sensors for power consumption."
|
|
103
|
-
},
|
|
104
|
-
"enableHistory": {
|
|
105
|
-
"title": "Enable Eve history?",
|
|
106
|
-
"type": "boolean",
|
|
107
|
-
"required": false,
|
|
108
|
-
"default": true,
|
|
109
|
-
"description": "Enable this option to create fakegato history services for outlet power readings."
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"pluginAlias": "SolaxCloudAPI",
|
|
3
|
+
"pluginType": "platform",
|
|
4
|
+
"singular": false,
|
|
5
|
+
"headerDisplay": "This Homebridge plugin uses Solax/QCells API cloud service to obtain real-time info of your inverters.",
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"inverters": {
|
|
10
|
+
"title": "Inverters",
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"title": "Inverter",
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"brand": {
|
|
17
|
+
"title": "Inverter Brand",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"required": true,
|
|
20
|
+
"default": "solax",
|
|
21
|
+
"oneOf": [
|
|
22
|
+
{ "title": "Solax", "enum": [ "solax" ] },
|
|
23
|
+
{ "title": "QCells", "enum": [ "qcells" ] }
|
|
24
|
+
],
|
|
25
|
+
"description": "Brand for list of inverters below (API data fetch URL is brand dependent)."
|
|
26
|
+
},
|
|
27
|
+
"tokenId": {
|
|
28
|
+
"title": "TokenID",
|
|
29
|
+
"type": "string",
|
|
30
|
+
"required": true,
|
|
31
|
+
"description": "Users get information from the cloud API through the granted tokenID. Please obtain your tokenID on the API page of Solax/QCells cloud.",
|
|
32
|
+
"default": "20200722185111234567890",
|
|
33
|
+
"minLength": 23,
|
|
34
|
+
"maxLength": 24
|
|
35
|
+
},
|
|
36
|
+
"name": {
|
|
37
|
+
"title": "Inverter name (unique)",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"required": true,
|
|
40
|
+
"description": "Inverter name for description purposes.",
|
|
41
|
+
"default": "My Solax Inverter",
|
|
42
|
+
"minLength": 1,
|
|
43
|
+
"maxLength": 30
|
|
44
|
+
},
|
|
45
|
+
"sn": {
|
|
46
|
+
"title": "Inverter module SN",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"required": true,
|
|
49
|
+
"description": "Registration No. (inverter module SN)",
|
|
50
|
+
"default": "ABCDEFGHIJ",
|
|
51
|
+
"minLength": 10,
|
|
52
|
+
"maxLength": 10
|
|
53
|
+
},
|
|
54
|
+
"hasBattery": {
|
|
55
|
+
"title": "Battery installed?",
|
|
56
|
+
"type": "boolean",
|
|
57
|
+
"required": false,
|
|
58
|
+
"description": "Whether this inverter has a battery installed.",
|
|
59
|
+
"default": false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"pollingFrequency": {
|
|
65
|
+
"title": "Polling frequency (seconds)",
|
|
66
|
+
"type": "integer",
|
|
67
|
+
"required": false,
|
|
68
|
+
"default": 300,
|
|
69
|
+
"oneOf": [
|
|
70
|
+
{ "title": "300 (5 minutes)", "enum": [ 300 ] },
|
|
71
|
+
{ "title": "600 (10 minutes)", "enum": [ 600 ] },
|
|
72
|
+
{ "title": "900 (15 minutes)", "enum": [ 900 ] }
|
|
73
|
+
],
|
|
74
|
+
"description": "Plugin data polling frequency from the cloud (in seconds)."
|
|
75
|
+
},
|
|
76
|
+
"smoothMeters": {
|
|
77
|
+
"title": "Add accessories for smooth meters?",
|
|
78
|
+
"type": "boolean",
|
|
79
|
+
"required": false,
|
|
80
|
+
"default": true,
|
|
81
|
+
"description": "Enable this option to create accessories for smoothing raw values read from the cloud."
|
|
82
|
+
},
|
|
83
|
+
"smoothingMethod": {
|
|
84
|
+
"title": "Smoothing method",
|
|
85
|
+
"type": "string",
|
|
86
|
+
"required": true,
|
|
87
|
+
"default": "sma",
|
|
88
|
+
"oneOf": [
|
|
89
|
+
{ "title": "Simple moving average", "enum": [ "sma" ] },
|
|
90
|
+
{ "title": "Exponential moving average", "enum": [ "ema" ] }
|
|
91
|
+
],
|
|
92
|
+
"condition": {
|
|
93
|
+
"functionBody": "return model.smoothMeters === true;"
|
|
94
|
+
},
|
|
95
|
+
"description": "Statistical method for smoothing power consumption data."
|
|
96
|
+
},
|
|
97
|
+
"pureHomeApp": {
|
|
98
|
+
"title": "Add \"pure\" Home app accessories?",
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"required": false,
|
|
101
|
+
"default": false,
|
|
102
|
+
"description": "Enable this option to create light ambient sensors for power consumption."
|
|
103
|
+
},
|
|
104
|
+
"enableHistory": {
|
|
105
|
+
"title": "Enable Eve history?",
|
|
106
|
+
"type": "boolean",
|
|
107
|
+
"required": false,
|
|
108
|
+
"default": true,
|
|
109
|
+
"description": "Enable this option to create fakegato history services for outlet power readings."
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccessoryPlugin, API, CharacteristicGetCallback, Logging, Service } from 'homebridge';
|
|
2
|
-
import { SolaxPlatformAccessory } from './platformAccessory';
|
|
2
|
+
import { SolaxPlatformAccessory } from './platformAccessory.js';
|
|
3
3
|
/**
|
|
4
4
|
* Enum with possible battery charging states.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batteryAccessory.d.ts","sourceRoot":"","sources":["../src/batteryAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,GAAG,EAA4B,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzH,OAAO,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"batteryAccessory.d.ts","sourceRoot":"","sources":["../src/batteryAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,GAAG,EAA4B,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAC;AAOF;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,sBAAuB,YAAW,eAAe;IAC1F;;QAEI;IACJ,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IAEzC;;OAEG;IACH,OAAO,CAAC,YAAY,CAAK;IAEzB;;OAEG;IACH,OAAO,CAAC,kBAAkB,CAAuC;IAEjE;;;;;;;OAOG;gBACS,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAwB/E;;OAEG;IACI,mBAAmB,IAAI,MAAM;IAepC;;;OAGG;IACI,aAAa,IAAI,MAAM;IAI9B;;OAEG;IACI,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAM1D;;;OAGG;IACI,QAAQ,CAAC,UAAU,EAAE,MAAM;IAQlC;;OAEG;IACI,cAAc,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAMhE;;;OAGG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM;IAQnC;;;OAGG;IACI,mBAAmB,IAAI,MAAM;IAQpC,WAAW,IAAI,OAAO,EAAE;CAIzB"}
|
package/dist/batteryAccessory.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolaxBatteryAccessory = exports.BATTERY_CHARGING_STATE = void 0;
|
|
4
|
-
const platformAccessory_1 = require("./platformAccessory");
|
|
1
|
+
import { SolaxPlatformAccessory } from './platformAccessory.js';
|
|
5
2
|
/**
|
|
6
3
|
* Enum with possible battery charging states.
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
export const BATTERY_CHARGING_STATE = {
|
|
9
6
|
NOT_CHARGING: 0,
|
|
10
7
|
CHARGING: 1,
|
|
11
8
|
NOT_CHARGEABLE: 2,
|
|
@@ -18,7 +15,19 @@ const LOW_BATTERY_THRESHOLD = 10;
|
|
|
18
15
|
* Solax Battery Accessory.
|
|
19
16
|
* Battery sensor used to monitor inverter battery state of charge (SoC).
|
|
20
17
|
*/
|
|
21
|
-
class SolaxBatteryAccessory extends
|
|
18
|
+
export class SolaxBatteryAccessory extends SolaxPlatformAccessory {
|
|
19
|
+
/**
|
|
20
|
+
* The battery service for Homekit.
|
|
21
|
+
**/
|
|
22
|
+
batteryService;
|
|
23
|
+
/**
|
|
24
|
+
* The battery charge level (in percentage).
|
|
25
|
+
*/
|
|
26
|
+
batteryLevel = 0;
|
|
27
|
+
/**
|
|
28
|
+
* Ambient light level.
|
|
29
|
+
*/
|
|
30
|
+
batteryChargeState = BATTERY_CHARGING_STATE.NOT_CHARGING;
|
|
22
31
|
/**
|
|
23
32
|
* Solax virtual light sensor class constructor.
|
|
24
33
|
* @param {Logging} log The platform logging for homebridge.
|
|
@@ -29,24 +38,16 @@ class SolaxBatteryAccessory extends platformAccessory_1.SolaxPlatformAccessory {
|
|
|
29
38
|
*/
|
|
30
39
|
constructor(log, api, name, serial, model) {
|
|
31
40
|
super(log, api, name, serial, model);
|
|
32
|
-
/**
|
|
33
|
-
* The battery charge level (in percentage).
|
|
34
|
-
*/
|
|
35
|
-
this.batteryLevel = 0;
|
|
36
|
-
/**
|
|
37
|
-
* Ambient light level.
|
|
38
|
-
*/
|
|
39
|
-
this.batteryChargeState = exports.BATTERY_CHARGING_STATE.NOT_CHARGING;
|
|
40
41
|
this.log.debug(`Creating battery "${this.name}"`);
|
|
41
42
|
this.batteryService = new this.api.hap.Service.Battery(name);
|
|
42
43
|
// handler for getting battery level
|
|
43
44
|
this.batteryService
|
|
44
45
|
.getCharacteristic(this.api.hap.Characteristic.BatteryLevel)
|
|
45
|
-
.on("get" /* GET */, this.getLevel.bind(this));
|
|
46
|
+
.on("get" /* CharacteristicEventTypes.GET */, this.getLevel.bind(this));
|
|
46
47
|
// handler for charging state
|
|
47
48
|
this.batteryService
|
|
48
49
|
.getCharacteristic(this.api.hap.Characteristic.ChargingState)
|
|
49
|
-
.on("get" /* GET */, this.getChargeState.bind(this));
|
|
50
|
+
.on("get" /* CharacteristicEventTypes.GET */, this.getChargeState.bind(this));
|
|
50
51
|
// handler for low battery
|
|
51
52
|
this.batteryService.getCharacteristic(this.api.hap.Characteristic.StatusLowBattery)
|
|
52
53
|
.onGet(this.getStatusLowBattery.bind(this));
|
|
@@ -121,5 +122,4 @@ class SolaxBatteryAccessory extends platformAccessory_1.SolaxPlatformAccessory {
|
|
|
121
122
|
return [this.informationService, this.batteryService];
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
|
-
exports.SolaxBatteryAccessory = SolaxBatteryAccessory;
|
|
125
125
|
//# sourceMappingURL=batteryAccessory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batteryAccessory.js","sourceRoot":"","sources":["../src/batteryAccessory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"batteryAccessory.js","sourceRoot":"","sources":["../src/batteryAccessory.ts"],"names":[],"mappings":"AAE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AC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACxG,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,QAAmC;QACvD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,8BAA8B,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAErF,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,KAAa;QACjC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,6BAA6B,KAAK,GAAG,CAAC,CAAC;QAElE,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAEhC,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC7F,CAAC;IAED;;;OAGG;IACI,mBAAmB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,CAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,cAAc,CAAE,CAAC;IAC1D,CAAC;CAEF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { API } from 'homebridge';
|
|
2
|
-
declare const _default: (api: API) => void;
|
|
3
2
|
/**
|
|
4
3
|
* This method registers the platform with Homebridge
|
|
5
4
|
*/
|
|
6
|
-
|
|
5
|
+
declare const _default: (api: API) => void;
|
|
6
|
+
export default _default;
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAKjC;;GAEG;yBACa,KAAK,GAAG;AAAxB,wBAEE"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { PLATFORM_NAME } from './settings.js';
|
|
2
|
+
import { SolaxCloudAPIPlatform } from './platform.js';
|
|
3
|
+
/**
|
|
4
|
+
* This method registers the platform with Homebridge
|
|
5
|
+
*/
|
|
6
|
+
export default (api) => {
|
|
7
|
+
api.registerPlatform(PLATFORM_NAME, SolaxCloudAPIPlatform);
|
|
6
8
|
};
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,eAAe,CAAC,GAAQ,EAAE,EAAE;IAC1B,GAAG,CAAC,gBAAgB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;AAC7D,CAAC,CAAC"}
|
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { AccessoryPlugin, API, CharacteristicGetCallback, Logging, Service } from 'homebridge';
|
|
2
|
-
import { SolaxPlatformAccessory } from './platformAccessory';
|
|
2
|
+
import { SolaxPlatformAccessory } from './platformAccessory.js';
|
|
3
3
|
/**
|
|
4
|
-
* Solax
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Using Lux to display power comsumption.
|
|
4
|
+
* Solax Power Sensor Accessory (Upgraded to Matter).
|
|
5
|
+
* Exposes power consumption directly to Apple Home Energy via Matter,
|
|
6
|
+
* or falls back to a virtual light sensor for older HAP setups.
|
|
8
7
|
*/
|
|
9
8
|
export declare class SolaxLightSensorAccessory extends SolaxPlatformAccessory implements AccessoryPlugin {
|
|
10
|
-
private readonly lightService
|
|
9
|
+
private readonly lightService?;
|
|
10
|
+
private readonly matterApi?;
|
|
11
|
+
private readonly matterUuid?;
|
|
12
|
+
private readonly matterRegistration?;
|
|
13
|
+
private readonly published;
|
|
14
|
+
private currentPowerW;
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
private lux;
|
|
15
|
-
/**
|
|
16
|
-
* Solax virtual light sensor class constructor.
|
|
16
|
+
* Solax virtual light/power sensor class constructor.
|
|
17
17
|
* @param {Logging} log The platform logging for homebridge.
|
|
18
18
|
* @param {API} api The platform API.
|
|
19
19
|
* @param {string} name The accessory name.
|
|
20
20
|
* @param {string} serial "Real world" serial number for this accessory.
|
|
21
21
|
* @param {string} model Accessory model.
|
|
22
22
|
*/
|
|
23
|
-
constructor(log: Logging, api: API, name: string, serial: string, model: string);
|
|
23
|
+
constructor(log: Logging, api: API, name: string, serial: string, model: string, supportsEnergy?: boolean, published?: boolean);
|
|
24
24
|
/**
|
|
25
|
-
* Gets the current
|
|
25
|
+
* Gets the current power consumption in Watts.
|
|
26
26
|
*/
|
|
27
27
|
getAmbientLightLevel(callback: CharacteristicGetCallback): void;
|
|
28
28
|
/**
|
|
29
|
-
* Sets the current
|
|
30
|
-
* @param {number}
|
|
29
|
+
* Sets the current power consumption in Watts.
|
|
30
|
+
* @param {number} power The power consumption value to set (previously lux).
|
|
31
|
+
*/
|
|
32
|
+
setAmbientLightLevel(power: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Sets cumulative generated energy in Watt-hours.
|
|
35
|
+
* @param {number} energyWh The cumulative generated energy in Watt-hours.
|
|
31
36
|
*/
|
|
32
|
-
|
|
37
|
+
setTotalEnergyConsumption(energyWh: number): void;
|
|
38
|
+
isMatterAccessory(): boolean;
|
|
39
|
+
private updateMatterState;
|
|
33
40
|
getServices(): Service[];
|
|
34
41
|
}
|
|
35
42
|
//# sourceMappingURL=lightSensorAccessory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightSensorAccessory.d.ts","sourceRoot":"","sources":["../src/lightSensorAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"lightSensorAccessory.d.ts","sourceRoot":"","sources":["../src/lightSensorAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,GAAG,EAEH,yBAAyB,EACzB,OAAO,EAGP,OAAO,EACR,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,sBAAuB,YAAW,eAAe;IAC9F,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAU;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAmB;IACvD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,aAAa,CAAK;IAE1B;;;;;;;OAOG;gBAED,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,cAAc,UAAQ,EACtB,SAAS,UAAO;IA4DlB;;OAEG;IACI,oBAAoB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAMtE;;;OAGG;IACI,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAczC;;;OAGG;IACI,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAejD,iBAAiB,IAAI,OAAO;IAInC,OAAO,CAAC,iBAAiB;IAsBzB,WAAW,IAAI,OAAO,EAAE;CAMzB"}
|
|
@@ -1,59 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SolaxLightSensorAccessory = void 0;
|
|
4
|
-
const platformAccessory_1 = require("./platformAccessory");
|
|
1
|
+
import { SolaxPlatformAccessory } from './platformAccessory.js';
|
|
2
|
+
import { PLATFORM_NAME, PLUGIN_NAME } from './settings.js';
|
|
5
3
|
/**
|
|
6
|
-
* Solax
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Using Lux to display power comsumption.
|
|
4
|
+
* Solax Power Sensor Accessory (Upgraded to Matter).
|
|
5
|
+
* Exposes power consumption directly to Apple Home Energy via Matter,
|
|
6
|
+
* or falls back to a virtual light sensor for older HAP setups.
|
|
10
7
|
*/
|
|
11
|
-
class SolaxLightSensorAccessory extends
|
|
8
|
+
export class SolaxLightSensorAccessory extends SolaxPlatformAccessory {
|
|
9
|
+
lightService;
|
|
10
|
+
matterApi;
|
|
11
|
+
matterUuid;
|
|
12
|
+
matterRegistration;
|
|
13
|
+
published;
|
|
14
|
+
currentPowerW = 0;
|
|
12
15
|
/**
|
|
13
|
-
* Solax virtual light sensor class constructor.
|
|
16
|
+
* Solax virtual light/power sensor class constructor.
|
|
14
17
|
* @param {Logging} log The platform logging for homebridge.
|
|
15
18
|
* @param {API} api The platform API.
|
|
16
19
|
* @param {string} name The accessory name.
|
|
17
20
|
* @param {string} serial "Real world" serial number for this accessory.
|
|
18
21
|
* @param {string} model Accessory model.
|
|
19
22
|
*/
|
|
20
|
-
constructor(log, api, name, serial, model) {
|
|
23
|
+
constructor(log, api, name, serial, model, supportsEnergy = false, published = true) {
|
|
21
24
|
super(log, api, name, serial, model);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
this.log.debug(`Creating power sensor "${this.name}"`);
|
|
26
|
+
this.published = published;
|
|
27
|
+
if (!published) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.matterApi = this.api.matter;
|
|
31
|
+
if (this.matterApi) {
|
|
32
|
+
this.matterUuid = this.api.hap.uuid.generate(serial + '-matter-power');
|
|
33
|
+
const clusters = {
|
|
34
|
+
electricalPowerMeasurement: {
|
|
35
|
+
activePower: 0,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
if (supportsEnergy) {
|
|
39
|
+
clusters.electricalEnergyMeasurement = {
|
|
40
|
+
cumulativeEnergyExported: { energy: 0 },
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const matterAccessory = {
|
|
44
|
+
displayName: name,
|
|
45
|
+
UUID: this.matterUuid,
|
|
46
|
+
deviceType: this.matterApi.deviceTypes.ElectricalSensor,
|
|
47
|
+
serialNumber: serial,
|
|
48
|
+
manufacturer: 'Solax',
|
|
49
|
+
model,
|
|
50
|
+
context: {},
|
|
51
|
+
clusters,
|
|
52
|
+
};
|
|
53
|
+
this.matterRegistration = this.matterApi
|
|
54
|
+
.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [matterAccessory])
|
|
55
|
+
.then(() => {
|
|
56
|
+
log.info(`Matter Electrical Sensor (Watts) "${name}" created!`);
|
|
57
|
+
return true;
|
|
58
|
+
})
|
|
59
|
+
.catch(error => {
|
|
60
|
+
log.error(`Failed to register Matter accessory "${name}": ${error}`);
|
|
61
|
+
return false;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this.lightService = new this.api.hap.Service.LightSensor(name);
|
|
66
|
+
this.lightService
|
|
67
|
+
.getCharacteristic(this.api.hap.Characteristic.CurrentAmbientLightLevel)
|
|
68
|
+
.on("get" /* CharacteristicEventTypes.GET */, this.getAmbientLightLevel.bind(this));
|
|
69
|
+
log.info(`Light sensor (watts reader) "${name}" created!`);
|
|
70
|
+
}
|
|
32
71
|
}
|
|
33
72
|
/**
|
|
34
|
-
* Gets the current
|
|
73
|
+
* Gets the current power consumption in Watts.
|
|
35
74
|
*/
|
|
36
75
|
getAmbientLightLevel(callback) {
|
|
37
|
-
this.log.debug(`${this.name}: GET
|
|
38
|
-
callback(null, this.
|
|
76
|
+
this.log.debug(`${this.name}: GET Power Level (W=${this.currentPowerW})`);
|
|
77
|
+
callback(null, Math.max(0.1, this.currentPowerW));
|
|
39
78
|
}
|
|
40
79
|
/**
|
|
41
|
-
* Sets the current
|
|
42
|
-
* @param {number}
|
|
80
|
+
* Sets the current power consumption in Watts.
|
|
81
|
+
* @param {number} power The power consumption value to set (previously lux).
|
|
43
82
|
*/
|
|
44
|
-
setAmbientLightLevel(
|
|
45
|
-
this.log.debug(`${this.name}: SET
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
-
|
|
83
|
+
setAmbientLightLevel(power) {
|
|
84
|
+
this.log.debug(`${this.name}: SET Power (W=${power})`);
|
|
85
|
+
this.currentPowerW = power;
|
|
86
|
+
if (this.matterApi && this.matterUuid) {
|
|
87
|
+
this.updateMatterState(this.matterApi.clusterNames.ElectricalPowerMeasurement, { activePower: Math.round(power * 1000) });
|
|
88
|
+
}
|
|
89
|
+
else if (this.lightService) {
|
|
90
|
+
this.lightService.updateCharacteristic(this.api.hap.Characteristic.CurrentAmbientLightLevel, Math.max(0.1, power));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Sets cumulative generated energy in Watt-hours.
|
|
95
|
+
* @param {number} energyWh The cumulative generated energy in Watt-hours.
|
|
96
|
+
*/
|
|
97
|
+
setTotalEnergyConsumption(energyWh) {
|
|
98
|
+
if (!this.matterApi || !this.matterUuid) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.updateMatterState(this.matterApi.clusterNames.ElectricalEnergyMeasurement, {
|
|
102
|
+
cumulativeEnergyExported: {
|
|
103
|
+
energy: Math.round(energyWh * 1000),
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
isMatterAccessory() {
|
|
108
|
+
return Boolean(this.matterApi);
|
|
109
|
+
}
|
|
110
|
+
updateMatterState(cluster, attributes) {
|
|
111
|
+
if (!this.matterApi || !this.matterUuid || !this.matterRegistration) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
void this.matterRegistration
|
|
115
|
+
.then(registered => {
|
|
116
|
+
if (!registered) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
return this.matterApi.updateAccessoryState(this.matterUuid, cluster, attributes);
|
|
120
|
+
})
|
|
121
|
+
.catch(error => {
|
|
122
|
+
this.log.error(`Failed to update Matter accessory "${this.name}": ${error}`);
|
|
123
|
+
});
|
|
49
124
|
}
|
|
50
125
|
/*
|
|
51
126
|
* This method is called directly after creation of this instance.
|
|
52
127
|
* It should return all services which should be added to the accessory.
|
|
53
128
|
*/
|
|
54
129
|
getServices() {
|
|
130
|
+
if (!this.published || this.matterApi) {
|
|
131
|
+
return [this.informationService];
|
|
132
|
+
}
|
|
55
133
|
return [this.informationService, this.lightService];
|
|
56
134
|
}
|
|
57
135
|
}
|
|
58
|
-
exports.SolaxLightSensorAccessory = SolaxLightSensorAccessory;
|
|
59
136
|
//# sourceMappingURL=lightSensorAccessory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightSensorAccessory.js","sourceRoot":"","sources":["../src/lightSensorAccessory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lightSensorAccessory.js","sourceRoot":"","sources":["../src/lightSensorAccessory.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,WAA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AAC;QAED,KAAK,IAAI,CAAC,kBAAkB;aACzB,IAAI,CAAC,UAAU,CAAC,EAAE;YACjB,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO;YACT,CAAC;YAED,OAAO,IAAI,CAAC,SAAU,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACrF,CAAC,CAAC;aACD,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,sCAAsC,IAAI,CAAC,IAAI,MAAM,KAAK,EAAE,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,OAAO,CAAE,IAAI,CAAC,kBAAkB,CAAE,CAAC;QACrC,CAAC;QACD,OAAO,CAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,YAAa,CAAE,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Service, AccessoryPlugin, Logging, CharacteristicGetCallback, API } from 'homebridge';
|
|
3
|
-
import { SolaxPlatformAccessory } from './platformAccessory';
|
|
2
|
+
import { SolaxPlatformAccessory } from './platformAccessory.js';
|
|
4
3
|
/**
|
|
5
4
|
* Solax Motion Accessory.
|
|
6
5
|
* Virtual motion sensor triggered whenever new data is fetched from Solax Cloud.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motionAccessory.d.ts","sourceRoot":"","sources":["../src/motionAccessory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"motionAccessory.d.ts","sourceRoot":"","sources":["../src/motionAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,yBAAyB,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAI/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAOhE;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,sBAAuB,YAAW,eAAe;IAEzF;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IAExC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAS;IAEvB;;OAEG;IACH,OAAO,CAAC,aAAa,CAA0B;IAE/C;;;;;;;OAOG;gBACS,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAa/E,KAAK,8CAA8B;IAEnC;;;OAGG;IACI,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAM1D;;;OAGG;IACI,QAAQ,CAAC,MAAM,EAAE,OAAO;IAe/B;;;OAGG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAIhC;;;OAGG;IACH,gBAAgB,IAAI,MAAM;IAQ1B,WAAW,IAAI,OAAO,EAAE;CAOzB"}
|