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/dist/platform.js CHANGED
@@ -4,13 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SolaxCloudAPIPlatform = void 0;
7
- const homebridge_lib_1 = require("homebridge-lib");
8
- const fakegato_history_1 = __importDefault(require("fakegato-history"));
9
- const util_1 = __importDefault(require("util"));
10
- const solaxcloudapi_1 = require("./solaxcloudapi");
11
- const outletAccessory_1 = require("./outletAccessory");
12
- const motionAccessory_1 = require("./motionAccessory");
13
- const lightSensorAccessory_1 = require("./lightSensorAccessory");
7
+ const util_1 = require("./util");
8
+ const platformInverter_1 = require("./platformInverter");
9
+ const util_2 = __importDefault(require("util"));
14
10
  /**
15
11
  * Valid smoothing methods (Simple Moving Average, Exponential Moving Average).
16
12
  */
@@ -35,16 +31,6 @@ const MAX_POLLS_DAY = 10000;
35
31
  * Maximum polling frequency (in seconds).
36
32
  */
37
33
  const MAX_POLLING_FREQUENCY = Math.max(60 / MAX_POLLS_MIN, (24 * 60 * 60) / MAX_POLLS_DAY);
38
- /**
39
- * Accessory names.
40
- */
41
- const ACCESSORY_NAMES = {
42
- pv: 'PV',
43
- inverterAC: 'AC',
44
- inverterToGrid: 'To Grid',
45
- inverterToHouse: 'To House',
46
- gridToHouse: 'From Grid',
47
- };
48
34
  /**
49
35
  * SolaxCloudAPIPlatform.
50
36
  * This class is the main constructor for your plugin, this is where you should
@@ -60,12 +46,14 @@ class SolaxCloudAPIPlatform {
60
46
  */
61
47
  constructor(log, config, api) {
62
48
  /**
63
- * Numeber of periods to use for data smoothing.
49
+ * Number of periods to use for data smoothing.
64
50
  */
65
51
  this.smoothingWindow = 1;
66
- /** Array with all accessories */
67
- this.solaxAccessories = [];
68
- this.sleep = util_1.default.promisify(setTimeout);
52
+ /**
53
+ * Array of inverters.
54
+ */
55
+ this.inverters = [];
56
+ this.sleep = util_2.default.promisify(setTimeout);
69
57
  // store values in properties
70
58
  this.log = log;
71
59
  this.config = config;
@@ -82,74 +70,13 @@ class SolaxCloudAPIPlatform {
82
70
  this.smoothingWindow = Math.floor(15 * 60 / this.config.pollingFrequency);
83
71
  this.log.info(`Window for smoothing series is ${this.smoothingWindow} periods.`);
84
72
  try {
85
- this.eve = new homebridge_lib_1.EveHomeKitTypes(this.api);
86
- this.eveService = (0, fakegato_history_1.default)(this.api);
87
- // init new Solax Cloud API object with give tokenID and sn
88
- this.solaxCloudAPI = new solaxcloudapi_1.SolaxCloudAPI(this.config.tokenId, this.config.sn);
89
- // initial data set
90
- const apiData = this.solaxCloudAPI.getAPIData();
91
- this.log.debug(`apiData = ${JSON.stringify(apiData)}`);
92
- let inverterSN;
93
- let inverterModel;
94
- if (apiData.success) {
95
- inverterSN = apiData.result.inverterSN.toLowerCase();
96
- inverterModel = solaxcloudapi_1.SolaxCloudAPI.getInverterType(apiData.result.inverterType);
97
- }
98
- else {
99
- this.log.info('Could not retrieve initial values from Solax Cloud, accessory Serial Number and Model properties deferred...');
100
- inverterSN = String(this.config.name);
101
- inverterModel = 'Unknown';
102
- }
103
- // setup raw outlet accessories
104
- this.rawOutlets = {
105
- pv: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.pv}`, `pv-${inverterSN}`, inverterModel),
106
- inverterAC: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterAC}`, `inv-ac-${inverterSN}`, inverterModel),
107
- inverterToGrid: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterToGrid}`, `inv-grid-${inverterSN}`, inverterModel),
108
- inverterToHouse: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterToHouse}`, `inv-house-${inverterSN}`, inverterModel),
109
- gridToHouse: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.gridToHouse}`, `grid-house-${inverterSN}`, inverterModel),
110
- };
111
- // setup update motion sensor
112
- this.motionUpdate = new motionAccessory_1.SolaxMotionAccessory(this, this.log, `${this.config.name} Update`, `update-${inverterSN}`, inverterModel);
113
- // create array with all base accessories
114
- this.solaxAccessories =
115
- [this.rawOutlets.pv, this.rawOutlets.inverterAC, this.rawOutlets.inverterToGrid,
116
- this.rawOutlets.inverterToHouse, this.rawOutlets.gridToHouse, this.motionUpdate];
117
- // check if "pure" Home App accessories are needed
118
- if (this.config.pureHomeApp) {
119
- // add raw light sensors
120
- this.rawLightSensors = {
121
- pv: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.pv} sensor`, `pv-light-${inverterSN}`, inverterModel),
122
- inverterAC: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterAC} sensor`, `inv-ac-light-${inverterSN}`, inverterModel),
123
- inverterToGrid: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterToGrid} sensor`, `inv-grid-light-${inverterSN}`, inverterModel),
124
- inverterToHouse: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterToHouse} sensor`, `inv-house-light-${inverterSN}`, inverterModel),
125
- gridToHouse: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.gridToHouse} sensor`, `grid-house-light-${inverterSN}`, inverterModel),
126
- };
127
- this.solaxAccessories.push(this.rawLightSensors.pv, this.rawLightSensors.inverterAC, this.rawLightSensors.inverterToGrid, this.rawLightSensors.inverterToHouse, this.rawLightSensors.gridToHouse);
128
- if (this.config.smoothMeters) {
129
- // add smooth light sensors
130
- this.smoothLightSensors = {
131
- pv: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.pv} sensor (smooth)`, `pv-light-${inverterSN}`, inverterModel),
132
- inverterAC: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterAC} sensor (smooth)`, `inv-ac-light-smooth-${inverterSN}`, inverterModel),
133
- inverterToGrid: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterToGrid} sensor (smooth)`, `inv-grid-light-smooth-${inverterSN}`, inverterModel),
134
- inverterToHouse: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterToHouse} sensor (smooth)`, `inv-house-light-smooth-${inverterSN}`, inverterModel),
135
- gridToHouse: new lightSensorAccessory_1.SolaxLightSensorAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.gridToHouse} sensor (smooth)`, `grid-house-light-smooth-${inverterSN}`, inverterModel),
136
- };
137
- this.solaxAccessories.push(this.smoothLightSensors.pv, this.smoothLightSensors.inverterAC, this.smoothLightSensors.inverterToGrid, this.smoothLightSensors.inverterToHouse, this.smoothLightSensors.gridToHouse);
138
- }
139
- }
140
- else {
141
- if (this.config.smoothMeters) {
142
- // setup smooth outlet accessories
143
- this.smoothOutlets = {
144
- pv: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.pv} (smooth)`, `pv-smooth-${inverterSN}`, inverterModel),
145
- inverterAC: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterAC} (smooth)`, `inv-ac-smooth-${inverterSN}`, inverterModel),
146
- inverterToGrid: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterToGrid} (smooth)`, `inv-grid-smooth-${inverterSN}`, inverterModel),
147
- inverterToHouse: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.inverterToHouse} (smooth)`, `inv-house-smooth-${inverterSN}`, inverterModel),
148
- gridToHouse: new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} ${ACCESSORY_NAMES.gridToHouse} (smooth)`, `grid-house-smooth-${inverterSN}`, inverterModel),
149
- };
150
- this.solaxAccessories.push(this.smoothOutlets.pv, this.smoothOutlets.inverterAC, this.smoothOutlets.inverterToGrid, this.smoothOutlets.inverterToHouse, this.smoothOutlets.gridToHouse);
151
- }
152
- }
73
+ // loop over configured inverters
74
+ this.config.inverters.forEach(inverter => {
75
+ // setup new inverter
76
+ const platformInverter = new platformInverter_1.SolaxCloudAPIPlatformInverter(log, config, api, this.config.tokenId, inverter.sn, inverter.name, this.smoothingWindow);
77
+ // add new inverter to list
78
+ this.inverters.push(platformInverter);
79
+ });
153
80
  // start data fetching
154
81
  this.fetchDataPeriodically();
155
82
  this.log.debug('Finished initializing platform.');
@@ -163,95 +90,22 @@ class SolaxCloudAPIPlatform {
163
90
  });
164
91
  }
165
92
  /**
166
- * Periodically retrieves inverter data from Solax Cloud API using configured tokenID and SN.
93
+ * Check whether object implements interface InverterConfig.
94
+ * @param obj Any object.
95
+ * @returns Whether object implements interface InverterConfig.
167
96
  */
168
- async fetchDataPeriodically() {
169
- try {
170
- this.log.debug('Retrieving data from Solax Cloud API.');
171
- const apiData = this.solaxCloudAPI.getAPIData();
172
- if (apiData.success) {
173
- this.log.debug(`Retrieved inverter status: ${JSON.stringify(apiData.result)}`);
174
- this.updateAccessories(apiData);
175
- }
176
- else {
177
- throw new Error(apiData.exception);
178
- }
179
- }
180
- catch (error) {
181
- this.log.error(`Failed to read from Solax Cloud API. Error: ${error}`);
182
- }
183
- finally {
184
- this.log.info(`Updated data from Solax Cloud API, sleeping for ${this.config.pollingFrequency} seconds.`);
185
- this.sleep(this.config.pollingFrequency * 1000)
186
- .then(async () => await this.fetchDataPeriodically());
187
- }
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
+ static isInverterConfig(obj) {
99
+ return 'name' in obj && 'sn' in obj;
188
100
  }
189
101
  /**
190
- * Update all platform accessory status based on the values read from the API.
191
- * @param {SolaxCloudAPIResponse} apiData API data from Solax Cloud.
192
- */
193
- updateAccessories(apiData) {
194
- // update raw outlets on/off, power & energy settings
195
- this.updateRawOutlets(apiData);
196
- if (this.config.pureHomeApp) {
197
- // update raw light sensors with power consumption
198
- this.updateRawLightSensors(apiData);
199
- if (this.config.smoothMeters) {
200
- // update smooth light sensors from raw outlets by applying smoothing function to power consumption
201
- this.updateSmoothLightSensors();
202
- }
203
- }
204
- else {
205
- if (this.config.smoothMeters) {
206
- // update smooth outlets data from raw outlets by applying smoothing function to power consumption
207
- this.updateSmoothOutlets();
208
- }
209
- }
210
- // update motion sensor
211
- this.motionUpdate.setState(true);
212
- }
213
- /**
214
- * Updates smooth ambient light sensors data from raw outlet data by applying configured smoothing function.
215
- */
216
- updateSmoothLightSensors() {
217
- this.smoothLightSensors.pv.setAmbientLightLevel(this.rawOutlets.pv.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
218
- this.smoothLightSensors.inverterAC.setAmbientLightLevel(this.rawOutlets.inverterAC.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
219
- this.smoothLightSensors.inverterToGrid.setAmbientLightLevel(this.rawOutlets.inverterToGrid.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
220
- this.smoothLightSensors.inverterToHouse.setAmbientLightLevel(this.rawOutlets.inverterToHouse.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
221
- this.smoothLightSensors.gridToHouse.setAmbientLightLevel(this.rawOutlets.gridToHouse.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
222
- }
223
- /**
224
- * Update raw ambient light sensors with power consumption data from Solax Cloud API.
225
- * @param {SolaxCloudAPIResponse} apiData API data retrieved from Solax Cloud.
226
- */
227
- updateRawLightSensors(apiData) {
228
- this.rawLightSensors.pv.setAmbientLightLevel(solaxcloudapi_1.SolaxCloudAPI.getPVPower(apiData.result));
229
- this.rawLightSensors.inverterAC.setAmbientLightLevel(solaxcloudapi_1.SolaxCloudAPI.getInverterACPower(apiData.result));
230
- this.rawLightSensors.inverterToGrid.setAmbientLightLevel(solaxcloudapi_1.SolaxCloudAPI.getInverterPowerToGrid(apiData.result));
231
- this.rawLightSensors.inverterToHouse.setAmbientLightLevel(solaxcloudapi_1.SolaxCloudAPI.getInverterPowerToHouse(apiData.result));
232
- this.rawLightSensors.gridToHouse.setAmbientLightLevel(solaxcloudapi_1.SolaxCloudAPI.getGridPowerToHouse(apiData.result));
233
- }
234
- /**
235
- * Updates smooth outlet data from raw outlet data by applying configured smoothing function.
102
+ * Periodically retrieves inverter data from Solax Cloud API using configured tokenID and SN.
236
103
  */
237
- updateSmoothOutlets() {
238
- this.smoothOutlets.pv.setPowerConsumption(this.rawOutlets.pv.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
239
- this.smoothOutlets.inverterAC.setPowerConsumption(this.rawOutlets.inverterAC.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
240
- this.smoothOutlets.inverterToGrid.setPowerConsumption(this.rawOutlets.inverterToGrid.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
241
- this.smoothOutlets.inverterToHouse.setPowerConsumption(this.rawOutlets.inverterToHouse.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
242
- this.smoothOutlets.gridToHouse.setPowerConsumption(this.rawOutlets.gridToHouse.getSmoothPowerConsumption(this.config.smoothingMethod, this.smoothingWindow));
243
- }
244
- /**
245
- * Update raw outlet data from API data read from Solax Cloud.
246
- * @param {SolaxCloudAPIResponse} apiData Solax Cloud API data.
247
- * */
248
- updateRawOutlets(apiData) {
249
- this.rawOutlets.pv.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getPVPower(apiData.result));
250
- this.rawOutlets.inverterAC.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getInverterACPower(apiData.result));
251
- this.rawOutlets.inverterAC.setTotalEnergyConsumption(solaxcloudapi_1.SolaxCloudAPI.getYieldTotal(apiData.result));
252
- this.rawOutlets.inverterToGrid.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getInverterPowerToGrid(apiData.result));
253
- this.rawOutlets.inverterToHouse.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getInverterPowerToHouse(apiData.result));
254
- this.rawOutlets.gridToHouse.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getGridPowerToHouse(apiData.result));
104
+ async fetchDataPeriodically() {
105
+ // loop over inverters and update its data
106
+ this.inverters.forEach(inverter => inverter.updateInverterData());
107
+ this.log.info(`Updated data from Solax Cloud API, sleeping for ${this.config.pollingFrequency} seconds.`);
108
+ this.sleep(this.config.pollingFrequency * 1000).then(async () => await this.fetchDataPeriodically());
255
109
  }
256
110
  /**
257
111
  * Checks platform config validity and sets defaults whenever needed.
@@ -260,18 +114,60 @@ class SolaxCloudAPIPlatform {
260
114
  checkConfig(config) {
261
115
  let result = true;
262
116
  this.log.debug(`Config read: ${JSON.stringify(config)}`);
117
+ // check for configuration conversion to new format if needed
118
+ if (!config.inverters) {
119
+ // check for "old" configuration settings
120
+ if (config.name && config.sn) {
121
+ this.log.info('Converting config file to new format (with multiple inverters support)...');
122
+ // setup new configuration settings (supporting multiple inverters) with single entry
123
+ config.inverters = [
124
+ {
125
+ name: config.name,
126
+ sn: config.sn,
127
+ },
128
+ ];
129
+ // delete old configuration settings
130
+ delete config.name;
131
+ delete config.sn;
132
+ }
133
+ }
263
134
  // check for mandatory parameters
264
- if (!config.name) {
265
- this.log.error('Config check: Can\'t find mandatory parameter "name" parameter in config file, aborting!');
135
+ if (!config.tokenId) {
136
+ this.log.error('Config check: Can\'t find mandatory parameter "tokenId" parameter in config file, aborting!');
266
137
  result = false;
138
+ return result;
267
139
  }
268
- else if (!config.tokenId) {
269
- this.log.error('Config check: Can\'t find mandatory parameter "tokenId" parameter in config file, aborting!');
140
+ if (!config.inverters) {
141
+ this.log.error('Config check: Can\'t find mandatory parameter "inverters" parameter in config file, aborting!');
142
+ result = false;
143
+ return result;
144
+ }
145
+ // check for inverters type
146
+ if (Array.isArray(config.inverters)) {
147
+ // loop over inverters and check config type
148
+ config.inverters.forEach(inverter => {
149
+ if (!SolaxCloudAPIPlatform.isInverterConfig(inverter)) {
150
+ this.log.error('Config check: Invalid type for inverter under "inverters" in config file, aborting!');
151
+ result = false;
152
+ return result;
153
+ }
154
+ });
155
+ }
156
+ else {
157
+ this.log.error('Config check: Incorrect type for mandatory parameter "inverters" in config file, aborting!');
158
+ result = false;
159
+ return result;
160
+ }
161
+ // check for duplicates
162
+ if (util_1.Util.arrayHasDuplicates(config.inverters.map(inverter => inverter.name))) {
163
+ this.log.error('Config check: Duplicate inverter names in config file, aborting!');
270
164
  result = false;
165
+ return result;
271
166
  }
272
- else if (!config.sn) {
273
- this.log.error('Config check: Can\'t find mandatory parameter "sn" parameter in config file, aborting!');
167
+ else if (util_1.Util.arrayHasDuplicates(config.inverters.map(inverter => inverter.sn))) {
168
+ this.log.error('Config check: Duplicate inverter SNs in config file, aborting!');
274
169
  result = false;
170
+ return result;
275
171
  }
276
172
  // check for polling frequency
277
173
  if (config.pollingFrequency === undefined) {
@@ -335,7 +231,10 @@ class SolaxCloudAPIPlatform {
335
231
  * The Platform must respond in a timely manner as otherwise the startup of the bridge would be unnecessarily delayed.
336
232
  */
337
233
  accessories(callback) {
338
- callback(this.solaxAccessories);
234
+ const accessories = [];
235
+ // loop over inverters and add accessories
236
+ this.inverters.forEach(inverter => accessories.concat(inverter.getAccessories()));
237
+ callback(accessories);
339
238
  }
340
239
  }
341
240
  exports.SolaxCloudAPIPlatform = SolaxCloudAPIPlatform;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot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C,WAAW,GAAG,CAAC,CAAC;SACpH;aAAM;YACL,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,SAAS,EAAE;gBAC3C,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;gBAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,oFAAoF,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC;aAC1H;SACF;QAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,iCAAiC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAEzE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,QAAuD;QACjE,MAAM,WAAW,GAAsB,EAAE,CAAC;QAE1C,0CAA0C;QAC1C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;QAElF,QAAQ,CAAC,WAAW,CAAC,CAAC;IACxB,CAAC;CACF;AA5OD,sDA4OC"}
@@ -1,18 +1,17 @@
1
- import { Service, AccessoryPlugin, Logging } from 'homebridge';
2
- import { SolaxCloudAPIPlatform } from './platform';
1
+ import { Service, AccessoryPlugin, Logging, API } from 'homebridge';
3
2
  /**
4
3
  * Solax Cloud generic platform accessory.
5
4
  * Handles basic info: accessory name, manufacturer (Solax), inverter model and serial number.
6
5
  */
7
6
  export declare class SolaxPlatformAccessory implements AccessoryPlugin {
8
- /**
9
- * Accessory platform.
10
- */
11
- protected readonly platform: SolaxCloudAPIPlatform;
12
7
  /**
13
8
  * Accessory logging.
14
9
  */
15
10
  protected readonly log: Logging;
11
+ /**
12
+ * Platform API.
13
+ */
14
+ protected readonly api: API;
16
15
  /**
17
16
  * Accessory name.
18
17
  */
@@ -39,13 +38,13 @@ export declare class SolaxPlatformAccessory implements AccessoryPlugin {
39
38
  protected readonly informationService: Service;
40
39
  /**
41
40
  * Virtual accessory main class constructor.
42
- * @param {SolaxCloudApiPlatform} platform The API Platform for Solax Cloud.
43
41
  * @param {Logging} log The platform logging for homebridge.
42
+ * @param {API} api The API for Solax Cloud platform.
44
43
  * @param {string} name The accessory name.
45
44
  * @param {string} serial "Real-world" serial number for this accessory.
46
45
  * @param {string} model Accessory model.
47
46
  */
48
- constructor(platform: SolaxCloudAPIPlatform, log: Logging, name: string, serialNumber: string, model: string);
47
+ constructor(log: Logging, api: API, name: string, serialNumber: string, model: string);
49
48
  /**
50
49
  * Handle requests to get the current value of the "Model" characteristic.
51
50
  * @returns {string} The model.
@@ -1 +1 @@
1
- {"version":3,"file":"platformAccessory.d.ts","sourceRoot":"","sources":["../src/platformAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AASnD;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC5D;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IAEnD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAEvC;;OAEG;IACH,SAAS,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,KAAK,SAAoB;IAEnC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAE/C;;;;;;;OAOG;gBACS,QAAQ,EAAE,qBAAqB,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,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EAAE,MAAM;IAQ7B;;;OAGG;IACI,SAAS,IAAI,MAAM;IAM1B;;;OAGG;IACI,SAAS,CAAC,MAAM,EAAE,MAAM;IAW/B,QAAQ,IAAI,IAAI;IAQhB,WAAW,IAAI,OAAO,EAAE;CAIzB"}
@@ -16,18 +16,18 @@ const plugin = require('../package.json');
16
16
  class SolaxPlatformAccessory {
17
17
  /**
18
18
  * Virtual accessory main class constructor.
19
- * @param {SolaxCloudApiPlatform} platform The API Platform for Solax Cloud.
20
19
  * @param {Logging} log The platform logging for homebridge.
20
+ * @param {API} api The API for Solax Cloud platform.
21
21
  * @param {string} name The accessory name.
22
22
  * @param {string} serial "Real-world" serial number for this accessory.
23
23
  * @param {string} model Accessory model.
24
24
  */
25
- constructor(platform, log, name, serialNumber, model) {
25
+ constructor(log, api, name, serialNumber, model) {
26
26
  /**
27
27
  * Accessory model.
28
28
  */
29
29
  this.model = 'Solax inverter';
30
- this.platform = platform;
30
+ this.api = api;
31
31
  this.log = log;
32
32
  // name
33
33
  this.name = name;
@@ -39,17 +39,16 @@ class SolaxPlatformAccessory {
39
39
  this.serialNumber = (0, string_hash_64_1.default)(`${serialNumber}-${os_1.default.hostname()}`).toString(16);
40
40
  // remove non-standard chars from model name
41
41
  this.model = util_1.Util.normalizeName(model);
42
- const hap = this.platform.api.hap;
43
42
  // information service
44
43
  this.informationService =
45
- new hap.Service.AccessoryInformation()
46
- .setCharacteristic(hap.Characteristic.Name, this.name)
47
- .setCharacteristic(hap.Characteristic.Manufacturer, 'Solax')
48
- .setCharacteristic(hap.Characteristic.FirmwareRevision, plugin.version)
49
- .setCharacteristic(hap.Characteristic.SerialNumber, this.serialNumber)
50
- .setCharacteristic(hap.Characteristic.Model, this.model);
51
- this.informationService.getCharacteristic(hap.Characteristic.SerialNumber).onGet(this.getSerial.bind(this));
52
- this.informationService.getCharacteristic(hap.Characteristic.Model).onGet(this.getModel.bind(this));
44
+ new this.api.hap.Service.AccessoryInformation()
45
+ .setCharacteristic(this.api.hap.Characteristic.Name, this.name)
46
+ .setCharacteristic(this.api.hap.Characteristic.Manufacturer, 'Solax')
47
+ .setCharacteristic(this.api.hap.Characteristic.FirmwareRevision, plugin.version)
48
+ .setCharacteristic(this.api.hap.Characteristic.SerialNumber, this.serialNumber)
49
+ .setCharacteristic(this.api.hap.Characteristic.Model, this.model);
50
+ this.informationService.getCharacteristic(this.api.hap.Characteristic.SerialNumber).onGet(this.getSerial.bind(this));
51
+ this.informationService.getCharacteristic(this.api.hap.Characteristic.Model).onGet(this.getModel.bind(this));
53
52
  }
54
53
  /**
55
54
  * Handle requests to get the current value of the "Model" characteristic.
@@ -66,7 +65,7 @@ class SolaxPlatformAccessory {
66
65
  setModel(model) {
67
66
  this.log.debug(`${this.name}: SET Model (model=${model})`);
68
67
  this.model = model;
69
- this.informationService.setCharacteristic(this.platform.api.hap.Characteristic.Model, model);
68
+ this.informationService.setCharacteristic(this.api.hap.Characteristic.Model, model);
70
69
  }
71
70
  /**
72
71
  * Handle requests to get the current value of the "SerialNumber" characteristic.
@@ -83,7 +82,7 @@ class SolaxPlatformAccessory {
83
82
  setSerial(serial) {
84
83
  this.log.debug(`${this.name}: SET Serial (serial=${serial})`);
85
84
  this.serialNumber = serial;
86
- this.informationService.setCharacteristic(this.platform.api.hap.Characteristic.SerialNumber, serial);
85
+ this.informationService.setCharacteristic(this.api.hap.Characteristic.SerialNumber, serial);
87
86
  }
88
87
  /*
89
88
  * This method is optional to implement. It is called when HomeKit ask to identify the accessory.
@@ -1 +1 @@
1
- {"version":3,"file":"platformAccessory.js","sourceRoot":"","sources":["../src/platformAccessory.ts"],"names":[],"mappings":";;;;;;AAGA,iCAA8B;AAE9B,4CAAoB;AACpB,oEAAkC;AAElC,8DAA8D;AAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAa,sBAAsB;IAyCjC;;;;;;;OAOG;IACH,YAAY,QAA+B,EAAE,GAAY,EAAE,IAAY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AAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,sBAAsB,KAAK,GAAG,CAAC,CAAC;QAG3D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtF,CAAC;IAED;;;OAGG;IACI,SAAS;QACd,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,wBAAwB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QAEzE,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,MAAc;QAC7B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,wBAAwB,MAAM,GAAG,CAAC,CAAC;QAE9D,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC3B,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC9F,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,2BAA2B,IAAI,CAAC,gBAAgB,YAAY,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IAC9G,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,CAAE,IAAI,CAAC,kBAAkB,CAAE,CAAC;IACrC,CAAC;CAEF;AA5ID,wDA4IC"}
@@ -0,0 +1,97 @@
1
+ import { AccessoryPlugin, API, Logging, PlatformConfig } from 'homebridge';
2
+ /**
3
+ * SolaxCloudAPIPlatformInverter.
4
+ * This class is the main constructor for your inverter accessories
5
+ * to be used by Homebridge.
6
+ */
7
+ export declare class SolaxCloudAPIPlatformInverter {
8
+ private readonly log;
9
+ private readonly config;
10
+ private readonly api;
11
+ /**
12
+ * Inverter name.
13
+ */
14
+ private name;
15
+ /**
16
+ * Inverter serial number.
17
+ **/
18
+ private sn;
19
+ /**
20
+ * Size of window for statistical smoothing operations.
21
+ */
22
+ private smoothingWindow;
23
+ /**
24
+ * API for retrieving data from Solax cloud.
25
+ */
26
+ private solaxCloudAPI;
27
+ /**
28
+ * Outlets with raw data gathered from Solax Cloud.
29
+ */
30
+ private rawOutlets;
31
+ /**
32
+ * Smooth data outlets.
33
+ * These outlets present smoothed values based on the raw data figures to
34
+ * prevent events like the temporary passage of a cloud to directly affect values.
35
+ */
36
+ private smoothOutlets;
37
+ /**
38
+ * Virtual motion sensor triggered by data updates from Solax Cloud.
39
+ */
40
+ private motionUpdate;
41
+ /**
42
+ * Ambient light sensors for Power Consumption (pure Home App config).
43
+ */
44
+ private rawLightSensors;
45
+ /**
46
+ * Ambient light sensors for smooth power consumption lights.
47
+ * These lights present smoothed values based on the raw data figures to
48
+ * prevent events like the temporary passage of a cloud to directly affect values.
49
+ */
50
+ private smoothLightSensors;
51
+ /** Array with all accessories */
52
+ private solaxAccessories;
53
+ /**
54
+ * Platform inverter constructor.
55
+ * @param log
56
+ * @param config
57
+ * @param api
58
+ * @param tokenId
59
+ * @param inverterSN
60
+ * @param smoothingWindow
61
+ * @returns
62
+ */
63
+ constructor(log: Logging, config: PlatformConfig, api: API, tokenId: string, sn: string, name: string, smoothingWindow: number);
64
+ /**
65
+ * Updates smooth ambient light sensors data from raw outlet data by applying configured smoothing function.
66
+ */
67
+ private updateSmoothLightSensors;
68
+ /**
69
+ * Update raw ambient light sensors with power consumption data from Solax Cloud API.
70
+ * @param {SolaxCloudAPIResponse} apiData API data retrieved from Solax Cloud.
71
+ */
72
+ private updateRawLightSensors;
73
+ /**
74
+ * Updates smooth outlet data from raw outlet data by applying configured smoothing function.
75
+ */
76
+ private updateSmoothOutlets;
77
+ /**
78
+ * Update raw outlet data from API data read from Solax Cloud.
79
+ * @param {SolaxCloudAPIResponse} apiData Solax Cloud API data.
80
+ */
81
+ private updateRawOutlets;
82
+ /**
83
+ * Update all platform accessory status based on the values read from the API.
84
+ * @param {SolaxCloudAPIResponse} apiData API data from Solax Cloud.
85
+ */
86
+ private updateAccessories;
87
+ /**
88
+ * Update data from this inverter by using the Solax Cloud API
89
+ */
90
+ updateInverterData(): void;
91
+ /**
92
+ * Get array with full list of accessories for this inverter.
93
+ * @returns {AccessoryPlugin[]} Array of accessories for this inverter.
94
+ */
95
+ getAccessories(): AccessoryPlugin[];
96
+ }
97
+ //# sourceMappingURL=platformInverter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformInverter.d.ts","sourceRoot":"","sources":["../src/platformInverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAsB3E;;;;GAIG;AACH,qBAAa,6BAA6B;IACxC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAE1B;;OAEG;IACH,OAAO,CAAC,IAAI,CAAS;IAErB;;QAEI;IACJ,OAAO,CAAC,EAAE,CAAS;IAEnB;;OAEG;IACH,OAAO,CAAC,eAAe,CAAS;IAEhC;;OAEG;IACH,OAAO,CAAC,aAAa,CAAgB;IAErC;;OAEG;IACH,OAAO,CAAC,UAAU,CAAwB;IAE1C;;;;QAII;IACJ,OAAO,CAAC,aAAa,CAAwB;IAE7C;;QAEI;IACJ,OAAO,CAAC,YAAY,CAAwB;IAE5C;;QAEI;IACJ,OAAO,CAAC,eAAe,CAA6B;IAEpD;;;;QAII;IACJ,OAAO,CAAC,kBAAkB,CAA6B;IAEvD,iCAAiC;IACjC,OAAO,CAAC,gBAAgB,CAAyB;IAEjD;;;;;;;;;QASI;gBACS,G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