homebridge-solaxcloud-api 2.0.3 → 2.1.1-beta.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 CHANGED
@@ -11,9 +11,11 @@
11
11
  ![npm](https://badgen.net/npm/v/homebridge-solaxcloud-api) ![npm](https://badgen.net/npm/dt/homebridge-solaxcloud-api) [![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
12
12
 
13
13
 
14
- The Solax Cloud Plugin for [Homebridge](https://homebridge.io/) was created as a platform plugin to gather data exposed by Solax inverters to the cloud through the [Solax Cloud API](https://www.eu.solaxcloud.com/phoebus/resource/files/userGuide/Solax_API_for_End-user_V1.0.pdf).
14
+ The Solax Cloud Plugin for [Homebridge](https://homebridge.io/) was created as a platform plugin to gather data exposed by Solax inverters to the cloud through the [Solax Cloud API](https://www.eu.solaxcloud.com/phoebus/resource/files/userGuide/Solax_API_for_End-user_V1.0.pdf).
15
15
 
16
- As HomeKit is still clueless about what a solar panel is, this plugin exposes a set of standard HomeKit accessories though Homebridge that will allow interacting and automating your smart home based on the data made available from the Solax platform:
16
+ Now with **support for multiple inverters**!
17
+
18
+ As HomeKit is still clueless about what a solar panel is, this plugin exposes a set of standard HomeKit accessories though Homebridge for each configured inverter that will allow interacting and automating your smart home based on the data made available from the Solax platform:
17
19
 
18
20
  - **PV** (PV outlet with power consumption)
19
21
  - **AC** (Inverter AC outlet with power and total energy consumptions)
@@ -28,10 +30,10 @@ Please note that additional accessories are created by default with smooth power
28
30
 
29
31
  ## Required information
30
32
 
31
- For this plugin to work, two critical pieces of information are required:
33
+ For this plugin to work, two critical pieces of information are required from Solax Cloud:
32
34
 
33
35
  - **Token ID**: Solax users can get inverter information through the granted tokenID. You need to obtain your tokenID on the API page of Solaxcloud.
34
- - **SN**: Registration No (communication module SN).
36
+ - **SN**: Registration No (communication module SN) for each desired inverter.
35
37
 
36
38
  ## Installation
37
39
 
@@ -51,9 +53,13 @@ Minimal platform configuration is depicted by the example configuration file bel
51
53
  "platforms": [
52
54
  {
53
55
  "platform": "SolaxCloudAPI",
54
- "name": "Solax",
55
56
  "tokenId": "20200722185111234567890",
56
- "sn": "ABCDEFGHIJ"
57
+ "inverters": [
58
+ {
59
+ "name": "Solax",
60
+ "sn": "ABCDEFGHIJ"
61
+ }
62
+ ],
57
63
  }
58
64
  ]
59
65
  }
@@ -63,9 +69,8 @@ Configuration parameters are described on the table below:
63
69
  | **Parameter** | **Type** | **Description** | **Default** | **Mandatory?** |
64
70
  | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------:| :------------: |
65
71
  | `platform` | string | Platform name (must be SolaxCloudAPI) | - | Y |
66
- | `name` | string | Inverter name, used as prefix for accessory naming | - | Y |
67
72
  | `tokenId` | string | Users get information from Solax Cloud through the granted tokenID. Please obtain your tokenID on the API page of Solax Cloud | - | Y |
68
- | `sn` | string | Registration No. (inverter module SN) | - | Y |
73
+ | `inverters` | array | Array of configured inverters as objects with `{ name: string, sn: string }`, where `name` is the inverter name, used as prefix for accessory naming and `sn` is the inverter registration no. (inverter module SN). | - | Y |
69
74
  | `pollingFrequency` | number | Plugin data polling frequency from Solax Cloud (in seconds) | 300 | N |
70
75
  | `smoothingMeters` | boolean | Whether to create additional meters by smoothing raw values from Solax Cloud | true | N |
71
76
  | `smoothingMethod` | string | Statistical method to use for smoothing raw values from Solax Cloud (simple or exponential moving average - "sma" or "ema") | "sma" | N |
@@ -91,11 +96,11 @@ If you want to rely solely on the native Home App, please enable the `pureHomeAp
91
96
 
92
97
  # Automation
93
98
 
94
- Automation can be achieved with the help of the virtual **Update** motion sensor that was specifically tailored for this effect. This motion sensor will be triggered whenever data gets updated from the Solax Cloud API (according to what is defined on the `pollingFrequency` configuration setting).
99
+ Automation can be achieved with the help of the virtual **Update** motion sensor that was specifically tailored for this effect and which is available for each inverter. This motion sensor will be triggered whenever inverter data gets updated from the Solax Cloud API (according to what is defined on the `pollingFrequency` configuration setting).
95
100
 
96
101
  <img src="images/plugin-accessories-eve.png" width="50%" height="50%">
97
102
 
98
- Motion is detected by the **Update** motion sensor whenever there is newly fetched data from Solax Cloud. Using this sensor as a trigger combined with power and energy data from the virtual outlets enumerated above forms the basic building blocks for defining an automation.
103
+ Motion is detected by the **Update** motion sensor whenever there is newly fetched inverter data from Solax Cloud. Using this sensor as a trigger combined with power and energy data from the virtual outlets enumerated above forms the basic building blocks for defining an automation.
99
104
 
100
105
  ## Automation example
101
106
 
@@ -178,4 +183,5 @@ Next planned plugin releases should include:
178
183
  - [X] Consumption history through the [fakegato-history](https://github.com/simont77/fakegato-history) module
179
184
  - [x] Enable support for "pure" Home App accessories (power meters will be exposed as Ambient Light sensors)
180
185
  - [x] Add "smooth" accessories for power meters (compensating for sporadic scenarios like cloud a passing)
181
- - [ ] Accessories for battery state and consumptions (do not have one available)
186
+ - [x] Support for multiple inverters
187
+ - [ ] Accessories for battery state and consumptions (work in progress)
package/config.json CHANGED
@@ -4,7 +4,12 @@
4
4
  "platform": "SolaxCloudAPI",
5
5
  "name": "My Solax",
6
6
  "tokenId": "20211120033637006926905",
7
- "sn": "SWXGXCQJBT",
7
+ "inverters": [
8
+ {
9
+ "name": "My Solax",
10
+ "sn": "SWXGXCQJBT"
11
+ }
12
+ ],
8
13
  "pollingFrequency": 60
9
14
  }
10
15
  ]
package/config.sample CHANGED
@@ -2,9 +2,13 @@
2
2
  "platforms": [
3
3
  {
4
4
  "platform": "SolaxCloudAPI",
5
- "name": "My Solax",
6
5
  "tokenId": "20200722185111234567890",
7
- "sn": "ABCDEFGHIJ",
6
+ inverters: [
7
+ {
8
+ "name": "My Solax",
9
+ "sn": "ABCDEFGHIJ"
10
+ }
11
+ ],
8
12
  "pollingFrequency": 300
9
13
  }
10
14
  ]
@@ -6,15 +6,6 @@
6
6
  "schema": {
7
7
  "type": "object",
8
8
  "properties": {
9
- "name": {
10
- "title": "Inverter name",
11
- "type": "string",
12
- "required": true,
13
- "description": "Inverter name for description purposes.",
14
- "default": "My Solax Inverter",
15
- "minLength": 1,
16
- "maxLength": 30
17
- },
18
9
  "tokenId": {
19
10
  "title": "TokenID from Solax",
20
11
  "type": "string",
@@ -24,14 +15,33 @@
24
15
  "minLength": 23,
25
16
  "maxLength": 23
26
17
  },
27
- "sn": {
28
- "title": "Registration No. (module SN)",
29
- "type": "string",
30
- "required": true,
31
- "description": "Registration No. (inverter module SN)",
32
- "default": "ABCDEFGHIJ",
33
- "minLength": 10,
34
- "maxLength": 10
18
+ "inverters": {
19
+ "title": "Inverters",
20
+ "type": "array",
21
+ "items": {
22
+ "title": "Inverter",
23
+ "type": "object",
24
+ "properties": {
25
+ "name": {
26
+ "title": "Inverter name (unique)",
27
+ "type": "string",
28
+ "required": true,
29
+ "description": "Inverter name for description purposes.",
30
+ "default": "My Solax Inverter",
31
+ "minLength": 1,
32
+ "maxLength": 30
33
+ },
34
+ "sn": {
35
+ "title": "Inverter module SN",
36
+ "type": "string",
37
+ "required": true,
38
+ "description": "Registration No. (inverter module SN)",
39
+ "default": "ABCDEFGHIJ",
40
+ "minLength": 10,
41
+ "maxLength": 10
42
+ }
43
+ }
44
+ }
35
45
  },
36
46
  "pollingFrequency": {
37
47
  "title": "Polling frequency (seconds)",
@@ -1,5 +1,4 @@
1
- import { AccessoryPlugin, CharacteristicGetCallback, Logging, Service } from 'homebridge';
2
- import { SolaxCloudAPIPlatform } from './platform';
1
+ import { AccessoryPlugin, API, CharacteristicGetCallback, Logging, Service } from 'homebridge';
3
2
  import { SolaxPlatformAccessory } from './platformAccessory';
4
3
  /**
5
4
  * Solax Light Sensor Accessory.
@@ -15,13 +14,13 @@ export declare class SolaxLightSensorAccessory extends SolaxPlatformAccessory im
15
14
  private lux;
16
15
  /**
17
16
  * Solax virtual light sensor class constructor.
18
- * @param {SolaxCloudApiPlatform} platform The API Platform for Solax Cloud.
19
17
  * @param {Logging} log The platform logging for homebridge.
18
+ * @param {API} api The platform API.
20
19
  * @param {string} name The accessory name.
21
20
  * @param {string} serial "Real world" serial number for this accessory.
22
21
  * @param {string} model Accessory model.
23
22
  */
24
- constructor(platform: SolaxCloudAPIPlatform, log: Logging, name: string, serial: string, model: string);
23
+ constructor(log: Logging, api: API, name: string, serial: string, model: string);
25
24
  /**
26
25
  * Gets the current ambient light level (power consumpion in Watts).
27
26
  */
@@ -1 +1 @@
1
- {"version":3,"file":"lightSensorAccessory.d.ts","sourceRoot":"","sources":["../src/lightSensorAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEpH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,sBAAuB,YAAW,eAAe;IAC9F,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;OAEG;IACH,OAAO,CAAC,GAAG,CAAK;IAEhB;;;;;;;OAOG;gBACS,QAAQ,EAAE,qBAAqB,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAgBtG;;OAEG;IACI,oBAAoB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAMtE;;;OAGG;IACI,oBAAoB,CAAC,GAAG,EAAE,MAAM;IAavC,WAAW,IAAI,OAAO,EAAE;CAIzB"}
1
+ {"version":3,"file":"lightSensorAccessory.d.ts","sourceRoot":"","sources":["../src/lightSensorAccessory.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,qBAAqB,CAAC;AAE7D;;;;;GAKG;AACH,qBAAa,yBAA0B,SAAQ,sBAAuB,YAAW,eAAe;IAC9F,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IAEvC;;OAEG;IACH,OAAO,CAAC,GAAG,CAAK;IAEhB;;;;;;;OAOG;gBACS,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAc/E;;OAEG;IACI,oBAAoB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAMtE;;;OAGG;IACI,oBAAoB,CAAC,GAAG,EAAE,MAAM;IAavC,WAAW,IAAI,OAAO,EAAE;CAIzB"}
@@ -11,23 +11,22 @@ const platformAccessory_1 = require("./platformAccessory");
11
11
  class SolaxLightSensorAccessory extends platformAccessory_1.SolaxPlatformAccessory {
12
12
  /**
13
13
  * Solax virtual light sensor class constructor.
14
- * @param {SolaxCloudApiPlatform} platform The API Platform for Solax Cloud.
15
14
  * @param {Logging} log The platform logging for homebridge.
15
+ * @param {API} api The platform API.
16
16
  * @param {string} name The accessory name.
17
17
  * @param {string} serial "Real world" serial number for this accessory.
18
18
  * @param {string} model Accessory model.
19
19
  */
20
- constructor(platform, log, name, serial, model) {
21
- super(platform, log, name, serial, model);
20
+ constructor(log, api, name, serial, model) {
21
+ super(log, api, name, serial, model);
22
22
  /**
23
23
  * Ambient light level.
24
24
  */
25
25
  this.lux = 0;
26
- const hap = this.platform.api.hap;
27
26
  this.log.debug(`Creating light "${this.name}"`);
28
- this.lightService = new hap.Service.LightSensor(name);
27
+ this.lightService = new this.api.hap.Service.LightSensor(name);
29
28
  this.lightService
30
- .getCharacteristic(hap.Characteristic.CurrentAmbientLightLevel)
29
+ .getCharacteristic(this.api.hap.Characteristic.CurrentAmbientLightLevel)
31
30
  .on("get" /* GET */, this.getAmbientLightLevel.bind(this));
32
31
  log.info(`Solax light (watts reader) ${name} created!`);
33
32
  }
@@ -46,7 +45,7 @@ class SolaxLightSensorAccessory extends platformAccessory_1.SolaxPlatformAccesso
46
45
  this.log.debug(`${this.name}: SET Ambient Light Level (lux=${lux})`);
47
46
  // Minimum value allowed for light sensor is 0.1
48
47
  this.lux = Math.max(0.1, lux);
49
- this.lightService.updateCharacteristic(this.platform.api.hap.Characteristic.CurrentAmbientLightLevel, this.lux);
48
+ this.lightService.updateCharacteristic(this.api.hap.Characteristic.CurrentAmbientLightLevel, this.lux);
50
49
  }
51
50
  /*
52
51
  * This method is called directly after creation of this instance.
@@ -1 +1 @@
1
- {"version":3,"file":"lightSensorAccessory.js","sourceRoot":"","sources":["../src/lightSensorAccessory.ts"],"names":[],"mappings":";;;AAGA,2DAA6D;AAE7D;;;;;GAKG;AACH,MAAa,yBAA0B,SAAQ,0CAAsB;IAQnE;;;;;;;OAOG;IACH,YAAY,QAA+B,EAAE,GAAY,EAAE,IAAY,EAAE,MAAc,EAAE,KAAa;QACpG,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAd5C;;WAEG;QACK,QAAG,GAAG,CAAC,CAAC;QAad,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;QAElC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAEhD,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAEtD,IAAI,CAAC,YAAY;aACd,iBAAiB,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC;aAC9D,EAAE,kBAA+B,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE1E,GAAG,CAAC,IAAI,CAAC,8BAA8B,IAAI,WAAW,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC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AG,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAE/D,IAAI,CAAC,YAAY;aACd,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,CAAC;aACvE,EAAE,kBAA+B,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE1E,GAAG,CAAC,IAAI,CAAC,8BAA8B,IAAI,WAAW,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,QAAmC;QAC7D,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,kCAAkC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QAE1E,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,GAAW;QACrC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,kCAAkC,GAAG,GAAG,CAAC,CAAC;QAErE,gDAAgD;QAChD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAE9B,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,wBAAwB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACzG,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,CAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,YAAY,CAAE,CAAC;IACxD,CAAC;CAEF;AA5DD,8DA4DC"}
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Service, AccessoryPlugin, Logging, CharacteristicGetCallback } from 'homebridge';
3
- import { SolaxCloudAPIPlatform } from './platform';
2
+ import { Service, AccessoryPlugin, Logging, CharacteristicGetCallback, API } from 'homebridge';
4
3
  import { SolaxPlatformAccessory } from './platformAccessory';
5
4
  /**
6
5
  * Solax Motion Accessory.
@@ -22,13 +21,13 @@ export declare class SolaxMotionAccessory extends SolaxPlatformAccessory impleme
22
21
  private motionTimeout;
23
22
  /**
24
23
  * Solax virtual motion sensor class constructor.
25
- * @param {SolaxCloudApiPlatform} platform The API Platform for Solax Cloud.
26
24
  * @param {Logging} log The platform logging for homebridge.
25
+ * @param {API} api The API for Solax Cloud platform.
27
26
  * @param {string} name The accessory name.
28
27
  * @param {string} serial "Real-world" serial number for this accessory.
29
28
  * @param {string} model Accessory model.
30
29
  */
31
- constructor(platform: SolaxCloudAPIPlatform, log: Logging, name: string, serial: string, model: string);
30
+ constructor(log: Logging, api: API, name: string, serial: string, model: string);
32
31
  sleep: typeof import("timers/promises").setTimeout;
33
32
  /**
34
33
  * Gets the motion sensor state Characteristic.
@@ -1 +1 @@
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,MAAM,YAAY,CAAC;AAI1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAO7D;;;;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,QAAQ,EAAE,qBAAqB,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAetG,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"}
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,qBAAqB,CAAC;AAO7D;;;;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"}
@@ -18,14 +18,14 @@ const MOTION_TIMEOUT = 5;
18
18
  class SolaxMotionAccessory extends platformAccessory_1.SolaxPlatformAccessory {
19
19
  /**
20
20
  * Solax virtual motion sensor class constructor.
21
- * @param {SolaxCloudApiPlatform} platform The API Platform for Solax Cloud.
22
21
  * @param {Logging} log The platform logging for homebridge.
22
+ * @param {API} api The API for Solax Cloud platform.
23
23
  * @param {string} name The accessory name.
24
24
  * @param {string} serial "Real-world" serial number for this accessory.
25
25
  * @param {string} model Accessory model.
26
26
  */
27
- constructor(platform, log, name, serial, model) {
28
- super(platform, log, name, serial, model);
27
+ constructor(log, api, name, serial, model) {
28
+ super(log, api, name, serial, model);
29
29
  /**
30
30
  * Whether motion is detected (Solax Cloud data updated).
31
31
  */
@@ -35,11 +35,10 @@ class SolaxMotionAccessory extends platformAccessory_1.SolaxPlatformAccessory {
35
35
  */
36
36
  this.motionTimeout = MOTION_TIMEOUT;
37
37
  this.sleep = util_1.default.promisify(setTimeout);
38
- const hap = this.platform.api.hap;
39
38
  this.log.debug(`Creating motion sensor "${this.name}"`);
40
- this.motionService = new hap.Service.MotionSensor(this.name);
39
+ this.motionService = new this.api.hap.Service.MotionSensor(this.name);
41
40
  this.motionService
42
- .getCharacteristic(hap.Characteristic.MotionDetected)
41
+ .getCharacteristic(this.api.hap.Characteristic.MotionDetected)
43
42
  .on("get" /* GET */, this.getState.bind(this));
44
43
  log.info(`Motion sensor "${name}" created!`);
45
44
  }
@@ -58,7 +57,7 @@ class SolaxMotionAccessory extends platformAccessory_1.SolaxPlatformAccessory {
58
57
  setState(motion) {
59
58
  this.log.debug(`${this.name}: SET State (motion=${motion})`);
60
59
  this.motionService
61
- .getCharacteristic(this.platform.api.hap.Characteristic.MotionDetected)
60
+ .getCharacteristic(this.api.hap.Characteristic.MotionDetected)
62
61
  .updateValue(motion);
63
62
  this.motion = motion;
64
63
  if (this.motion) {
@@ -1 +1 @@
1
- {"version":3,"file":"motionAccessory.js","sourceRoot":"","sources":["../src/motionAccessory.ts"],"names":[],"mappings":";;;;;;AAEA,gDAAwB;AAGxB,2DAA6D;AAE7D;;GAEG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB;;;;GAIG;AACH,MAAa,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IACH,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,OAAe;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO;YACL,IAAI,CAAC,kBAAkB;YACvB,IAAI,CAAC,aAAa;SACnB,CAAC;IACJ,CAAC;CAEF;AAhGD,oDAgGC"}
@@ -1,5 +1,4 @@
1
- import { Service, AccessoryPlugin, Logging, CharacteristicGetCallback } from 'homebridge';
2
- import { SolaxCloudAPIPlatform } from './platform';
1
+ import { Service, AccessoryPlugin, Logging, CharacteristicGetCallback, API } from 'homebridge';
3
2
  import { SolaxPlatformAccessory } from './platformAccessory';
4
3
  /**
5
4
  * Solax Outlet Accessory.
@@ -7,6 +6,14 @@ import { SolaxPlatformAccessory } from './platformAccessory';
7
6
  * Outlet use is inferred from a positive power comsumption.
8
7
  */
9
8
  export declare class SolaxOutletAccessory extends SolaxPlatformAccessory implements AccessoryPlugin {
9
+ /**
10
+ * Eve Homekit types helper
11
+ * */
12
+ private readonly eve;
13
+ /**
14
+ * Eve Service for fakegato.
15
+ */
16
+ private readonly eveService;
10
17
  /**
11
18
  * Outlet service with power meter.
12
19
  */
@@ -33,13 +40,13 @@ export declare class SolaxOutletAccessory extends SolaxPlatformAccessory impleme
33
40
  private lastEMA;
34
41
  /**
35
42
  * Solax virtual outlet class constructor.
36
- * @param {SolaxCloudApiPlatform} platform The API Platform for Solax Cloud.
37
43
  * @param {Logging} log The platform logging for homebridge.
44
+ * @param {API} api The API for Solax Cloud platform.
38
45
  * @param {string} name The accessory name.
39
46
  * @param {string} serial "Real world" serial number for this accessory.
40
47
  * @param {string} model Accessory model.
41
48
  */
42
- constructor(platform: SolaxCloudAPIPlatform, log: Logging, name: string, serial: string, model: string);
49
+ constructor(log: Logging, api: API, name: string, serial: string, model: string);
43
50
  /**
44
51
  * Adds new power entry to series array of power values.
45
52
  * @param {number} powerConsumption Power value to add (in Watts).
@@ -1 +1 @@
1
- {"version":3,"file":"outletAccessory.d.ts","sourceRoot":"","sources":["../src/outletAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAW7D;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,sBAAuB,YAAW,eAAe;IAEzF;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IAExC;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAAK;IAE7B;;OAEG;IACH,OAAO,CAAC,sBAAsB,CAAO;IAErC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyB;IAExD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgB;IAE5C;;OAEG;IACH,OAAO,CAAC,OAAO,CAAK;IAEpB;;;;;;;OAOG;gBACS,QAAQ,EAAE,qBAAqB,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IA8BtG;;;OAGG;IACH,OAAO,CAAC,aAAa;IAWrB;;;OAGG;IACI,cAAc,IAAI,MAAM,EAAE;IAIjC;;;;;OAKG;IACI,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAwC5E;;OAEG;IACI,mBAAmB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAMrE;;wEAEoE;IAC7D,mBAAmB,CAAC,gBAAgB,EAAE,MAAM;IAcnD;;OAEG;IACI,yBAAyB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAM3E;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E,yBAAyB,GAAG,IAAI;IAMrE;;wEAEoE;IAC7D,mBAAmB,CAAC,gBAAgB,EAAE,MAAM;IAcnD;;OAEG;IACI,yBAAyB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAM3E;;;OAGG;IACI,yBAAyB,CAAC,sBAAsB,EAAE,MAAM;IAQ/D;;;OAGG;IACI,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAU1D,WAAW,IAAI,OAAO,EAAE;CAIzB"}
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.SolaxOutletAccessory = void 0;
4
7
  const platformAccessory_1 = require("./platformAccessory");
5
8
  const statistics_1 = require("./statistics");
9
+ const homebridge_lib_1 = require("homebridge-lib");
10
+ const fakegato_history_1 = __importDefault(require("fakegato-history"));
6
11
  /**
7
12
  * Maximum size for the outlet power series.
8
13
  */
@@ -15,14 +20,14 @@ const MAX_POWER_SERIES_SIZE = 1024;
15
20
  class SolaxOutletAccessory extends platformAccessory_1.SolaxPlatformAccessory {
16
21
  /**
17
22
  * Solax virtual outlet class constructor.
18
- * @param {SolaxCloudApiPlatform} platform The API Platform for Solax Cloud.
19
23
  * @param {Logging} log The platform logging for homebridge.
24
+ * @param {API} api The API for Solax Cloud platform.
20
25
  * @param {string} name The accessory name.
21
26
  * @param {string} serial "Real world" serial number for this accessory.
22
27
  * @param {string} model Accessory model.
23
28
  */
24
- constructor(platform, log, name, serial, model) {
25
- super(platform, log, name, serial, model);
29
+ constructor(log, api, name, serial, model) {
30
+ super(log, api, name, serial, model);
26
31
  /**
27
32
  * Current power reading in Watt.
28
33
  */
@@ -39,22 +44,25 @@ class SolaxOutletAccessory extends platformAccessory_1.SolaxPlatformAccessory {
39
44
  * Last Exponential Moving Average.
40
45
  */
41
46
  this.lastEMA = 0;
42
- const hap = this.platform.api.hap;
43
47
  this.log.debug(`Creating outlet "${this.name}"`);
48
+ // init fakegato objects
49
+ this.eve = new homebridge_lib_1.EveHomeKitTypes(this.api);
50
+ this.eveService = (0, fakegato_history_1.default)(this.api);
44
51
  // create power meter service
45
- this.outletService = new this.platform.eve.Services.Outlet(this.name);
52
+ this.outletService = new this.eve.Services.Outlet(this.name);
46
53
  // outlet on/off state
47
- this.outletService.getCharacteristic(hap.Characteristic.On).on("get" /* GET */, this.getState.bind(this));
54
+ this.outletService.getCharacteristic(this.api.hap.Characteristic.On)
55
+ .on("get" /* GET */, this.getState.bind(this));
48
56
  // in use
49
57
  //this.outletService.getCharacteristic(hap.Characteristic.OutletInUse).on(hap.CharacteristicEventTypes.GET, this.getState.bind(this));
50
58
  // current consumption
51
- this.outletService.getCharacteristic(this.platform.eve.Characteristics.CurrentConsumption)
59
+ this.outletService.getCharacteristic(this.eve.Characteristics.CurrentConsumption)
52
60
  .on("get" /* GET */, this.getPowerConsumption.bind(this));
53
61
  // total consumption
54
- this.outletService.getCharacteristic(this.platform.eve.Characteristics.TotalConsumption)
62
+ this.outletService.getCharacteristic(this.eve.Characteristics.TotalConsumption)
55
63
  .on("get" /* GET */, this.getTotalEnergyConsumption.bind(this));
56
64
  // history logging services
57
- this.loggingService = new this.platform.eveService('energy', this, { storage: 'fs', log: this.log, disableRepeatLastData: true });
65
+ this.loggingService = new this.eveService('energy', this, { storage: 'fs', log: this.log, disableRepeatLastData: true });
58
66
  log.info(`Outlet "${name}" created!`);
59
67
  }
60
68
  /**
@@ -124,7 +132,7 @@ class SolaxOutletAccessory extends platformAccessory_1.SolaxPlatformAccessory {
124
132
  setPowerConsumption(powerConsumption) {
125
133
  this.log.debug(`${this.name}: SET Power (power=${powerConsumption}W)`);
126
134
  this.powerConsumption = powerConsumption >= 0 ? powerConsumption : 0;
127
- this.outletService.getCharacteristic(this.platform.eve.Characteristics.CurrentConsumption).updateValue(this.powerConsumption);
135
+ this.outletService.getCharacteristic(this.eve.Characteristics.CurrentConsumption).updateValue(this.powerConsumption);
128
136
  // add entries to history
129
137
  this.loggingService.addEntry({ time: Math.round(new Date().valueOf() / 1000), power: this.powerConsumption });
130
138
  // add new value to power series
@@ -144,7 +152,7 @@ class SolaxOutletAccessory extends platformAccessory_1.SolaxPlatformAccessory {
144
152
  setTotalEnergyConsumption(totalEnergyConsumption) {
145
153
  this.log.debug(`${this.name}: SET Total Energy (energy=${totalEnergyConsumption}kWh)`);
146
154
  this.totalEnergyConsumption = totalEnergyConsumption;
147
- this.outletService.getCharacteristic(this.platform.eve.Characteristics.TotalConsumption).updateValue(this.totalEnergyConsumption);
155
+ this.outletService.getCharacteristic(this.eve.Characteristics.TotalConsumption).updateValue(this.totalEnergyConsumption);
148
156
  }
149
157
  /**
150
158
  * Gets the outlet state Characteristic based on its consumed power.
@@ -1 +1 @@
1
- {"version":3,"file":"outletAccessory.js","sourceRoot":"","sources":["../src/outletAccessory.ts"],"names":[],"mappings":";;;AAGA,2DAA6D;AAE7D,6CAA0C;AAI1C;;GAEG;AACH,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,0CAAsB;IAgC9D;;;;;;;OAOG;IACH,YAAY,QAA+B,EAAE,GAAY,EAAE,IAAY,EAAE,MAAc,EAAE,KAAa;QACpG,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAlC5C;;WAEG;QACK,qBAAgB,GAAG,CAAC,CAAC;QAE7B;;WAEG;QACK,2BAAsB,GAAG,GAAG,CAAC;QAOrC;;WAEG;QACc,gBAAW,GAAa,EAAE,CAAC;QAE5C;;WAEG;QACK,YAAO,GAAG,CAAC,CAAC;QAalB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;QAElC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,IAA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CAAC,WAAW,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAC3H,CAAC;IAED;;;OAGG;IACI,QAAQ,CAAC,QAAmC;QACjD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,sBAAsB,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAC;QAE5E,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,CAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAE,CAAC;IAC9E,CAAC;CAEF;AAzND,oDAyNC"}
@@ -1,7 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import { AccessoryPlugin, API, StaticPlatformPlugin, Logging, PlatformConfig } from 'homebridge';
3
- import { EveHomeKitTypes } from 'homebridge-lib';
4
- import fakegato from 'fakegato-history';
5
3
  /**
6
4
  * SolaxCloudAPIPlatform.
7
5
  * This class is the main constructor for your plugin, this is where you should
@@ -10,40 +8,15 @@ import fakegato from 'fakegato-history';
10
8
  export declare class SolaxCloudAPIPlatform implements StaticPlatformPlugin {
11
9
  private readonly log;
12
10
  private readonly config;
13
- readonly api: API;
14
- readonly eve: EveHomeKitTypes;
15
- eveService: fakegato;
16
- private readonly solaxCloudAPI;
11
+ private readonly api;
17
12
  /**
18
- * Numeber of periods to use for data smoothing.
13
+ * Number of periods to use for data smoothing.
19
14
  */
20
15
  private smoothingWindow;
21
16
  /**
22
- * Outlets with raw data gather.
17
+ * Array of inverters.
23
18
  */
24
- private rawOutlets;
25
- /**
26
- * Smooth data outlets.
27
- * These outlets present smoothed values based on the raw data figures to
28
- * prevent events like the temporary passage of a cloud to directly affect values.
29
- */
30
- private smoothOutlets;
31
- /**
32
- * Virtual motion sensor triggered by data updates from Solax Cloud.
33
- */
34
- private motionUpdate;
35
- /**
36
- * Ambient light sensors for Power Consumption (pure Home App config)
37
- */
38
- private rawLightSensors;
39
- /**
40
- * Ambient light sensors for smooth power consumption lights.
41
- * These lights present smoothed values based on the raw data figures to
42
- * prevent events like the temporary passage of a cloud to directly affect values.
43
- */
44
- private smoothLightSensors;
45
- /** Array with all accessories */
46
- private solaxAccessories;
19
+ private inverters;
47
20
  /**
48
21
  * Platform constructor.
49
22
  * @param log
@@ -54,32 +27,15 @@ export declare class SolaxCloudAPIPlatform implements StaticPlatformPlugin {
54
27
  constructor(log: Logging, config: PlatformConfig, api: API);
55
28
  sleep: typeof import("timers/promises").setTimeout;
56
29
  /**
57
- * Periodically retrieves inverter data from Solax Cloud API using configured tokenID and SN.
30
+ * Check whether object implements interface InverterConfig.
31
+ * @param obj Any object.
32
+ * @returns Whether object implements interface InverterConfig.
58
33
  */
59
- private fetchDataPeriodically;
34
+ private static isInverterConfig;
60
35
  /**
61
- * Update all platform accessory status based on the values read from the API.
62
- * @param {SolaxCloudAPIResponse} apiData API data from Solax Cloud.
63
- */
64
- private updateAccessories;
65
- /**
66
- * Updates smooth ambient light sensors data from raw outlet data by applying configured smoothing function.
67
- */
68
- private updateSmoothLightSensors;
69
- /**
70
- * Update raw ambient light sensors with power consumption data from Solax Cloud API.
71
- * @param {SolaxCloudAPIResponse} apiData API data retrieved from Solax Cloud.
72
- */
73
- private updateRawLightSensors;
74
- /**
75
- * Updates smooth outlet data from raw outlet data by applying configured smoothing function.
36
+ * Periodically retrieves inverter data from Solax Cloud API using configured tokenID and SN.
76
37
  */
77
- private updateSmoothOutlets;
78
- /**
79
- * Update raw outlet data from API data read from Solax Cloud.
80
- * @param {SolaxCloudAPIResponse} apiData Solax Cloud API data.
81
- * */
82
- private updateRawOutlets;
38
+ private fetchDataPeriodically;
83
39
  /**
84
40
  * Checks platform config validity and sets defaults whenever needed.
85
41
  * @returns {boolean} Whether the config is valid.
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names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