homebridge-solaxcloud-api 1.4.5 → 2.0.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
@@ -6,14 +6,45 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SolaxCloudAPIPlatform = void 0;
7
7
  const homebridge_lib_1 = require("homebridge-lib");
8
8
  const fakegato_history_1 = __importDefault(require("fakegato-history"));
9
- const outletAccessory_1 = require("./outletAccessory");
10
9
  const util_1 = __importDefault(require("util"));
11
10
  const solaxcloudapi_1 = require("./solaxcloudapi");
11
+ const outletAccessory_1 = require("./outletAccessory");
12
12
  const motionAccessory_1 = require("./motionAccessory");
13
+ const lightSensorAccessory_1 = require("./lightSensorAccessory");
14
+ /**
15
+ * Valid smoothing methods (Simple Moving Average, Exponential Moving Average).
16
+ */
17
+ const VALID_SMOOTHING_METHODS = ['sma', 'ema'];
18
+ /**
19
+ * Default smoothing method (simple moving average).
20
+ */
21
+ const DEFAULT_SMOOTHING_METHOD = 'sma';
13
22
  /**
14
23
  * Default polling frequency from Solax Cloud (in seconds).
15
24
  */
16
25
  const DEFAULT_POLLING_FREQUENCY = 300;
26
+ /**
27
+ * Max polls / min (obtain frequency need to be lower than 10 times/min).
28
+ */
29
+ const MAX_POLLS_MIN = 10;
30
+ /**
31
+ * Max polls / day (obtain frequency need to be lower than 10,000 times/day).
32
+ */
33
+ const MAX_POLLS_DAY = 10000;
34
+ /**
35
+ * Maximum polling frequency (in seconds).
36
+ */
37
+ 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
+ };
17
48
  /**
18
49
  * SolaxCloudAPIPlatform.
19
50
  * This class is the main constructor for your plugin, this is where you should
@@ -28,6 +59,12 @@ class SolaxCloudAPIPlatform {
28
59
  * @returns
29
60
  */
30
61
  constructor(log, config, api) {
62
+ /**
63
+ * Numeber of periods to use for data smoothing.
64
+ */
65
+ this.smoothingWindow = 1;
66
+ /** Array with all accessories */
67
+ this.solaxAccessories = [];
31
68
  this.sleep = util_1.default.promisify(setTimeout);
32
69
  // store values in properties
33
70
  this.log = log;
@@ -37,48 +74,93 @@ class SolaxCloudAPIPlatform {
37
74
  if (!api || !config) {
38
75
  return;
39
76
  }
40
- // check for mandatory parameters
41
- if (!this.config.tokenId) {
42
- this.log.error('Can\'t find "tokenId" parameter in config file (mandatory)!');
77
+ // check for valid config
78
+ if (!this.checkConfig(this.config)) {
43
79
  return;
44
80
  }
45
- if (!this.config.sn) {
46
- this.log.error('Can\'t find "sn" parameter in config file (mandatory)!');
47
- return;
81
+ // window for smoothing (aim for a 15 minute window)
82
+ this.smoothingWindow = Math.floor(15 * 60 / this.config.pollingFrequency);
83
+ this.log.info(`Window for smoothing series is ${this.smoothingWindow} periods.`);
84
+ 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
+ }
153
+ // start data fetching
154
+ this.fetchDataPeriodically();
155
+ this.log.debug('Finished initializing platform.');
156
+ }
157
+ catch (error) {
158
+ this.log.error(`Unexpected error: ${error}`);
48
159
  }
49
- // setup default polling frequency
50
- this.config.pollingFrequency = this.config.pollingFrequency || DEFAULT_POLLING_FREQUENCY;
51
- this.eve = new homebridge_lib_1.EveHomeKitTypes(this.api);
52
- this.eveService = (0, fakegato_history_1.default)(this.api);
53
- this.log.debug(`Config: ${JSON.stringify(config)}`);
54
- // init new Solax Cloud API object with give tokenID and sn
55
- this.solaxCloudAPI = new solaxcloudapi_1.SolaxCloudAPI(this.config.tokenId, this.config.sn);
56
- // initial data set
57
- this.apiData = this.solaxCloudAPI.getAPIData();
58
- this.log.debug(`apiData = ${JSON.stringify(this.apiData)}`);
59
- const inverterSN = this.apiData.result.inverterSN.toLowerCase();
60
- const inverterModel = solaxcloudapi_1.SolaxCloudAPI.getInverterType(this.apiData.result.inverterType);
61
- // setup outlet accessories
62
- this.outletPV =
63
- new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} PV`, `pv-${inverterSN}`, inverterModel);
64
- this.outletInverterAC =
65
- new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} Inverter AC`, `inv-ac-${inverterSN}`, inverterModel);
66
- this.outletInverterToGrid =
67
- new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} Inverter to Grid`, `inv-grid-${inverterSN}`, inverterModel);
68
- this.outletInverterToHouse =
69
- new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} Inverter to House`, `inv-house-${inverterSN}`, inverterModel);
70
- this.outletGridToHouse =
71
- new outletAccessory_1.SolaxOutletAccessory(this, this.log, `${this.config.name} Grid to House`, `grid-house-${inverterSN}`, inverterModel);
72
- // setup update motion sensor
73
- this.motionUpdate =
74
- new motionAccessory_1.SolaxMotionAccessory(this, this.log, `${this.config.name} Update`, `update-${inverterSN}`, inverterModel);
75
- // start data fetching
76
- this.fetchDataPeriodically();
77
- this.log.debug('Finished initializing platform.'),
78
- // When this event is fired it means Homebridge has created all accessories.
79
- this.api.on("didFinishLaunching" /* DID_FINISH_LAUNCHING */, () => {
80
- this.log.debug('Executed didFinishLaunching callback');
81
- });
160
+ // When this event is fired it means Homebridge has created all accessories.
161
+ this.api.on("didFinishLaunching" /* DID_FINISH_LAUNCHING */, () => {
162
+ this.log.debug('Executed didFinishLaunching callback');
163
+ });
82
164
  }
83
165
  /**
84
166
  * Periodically retrieves inverter data from Solax Cloud API using configured tokenID and SN.
@@ -86,21 +168,13 @@ class SolaxCloudAPIPlatform {
86
168
  async fetchDataPeriodically() {
87
169
  try {
88
170
  this.log.debug('Retrieving data from Solax Cloud API.');
89
- this.apiData = this.solaxCloudAPI.getAPIData();
90
- if (this.apiData.success) {
91
- this.log.debug(`Retrieved inverter status: ${JSON.stringify(this.apiData.result)}`);
92
- // update outlets
93
- this.outletPV.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getPVPower(this.apiData.result));
94
- this.outletInverterAC.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getInverterACPower(this.apiData.result));
95
- this.outletInverterAC.setTotalEnergyConsumption(solaxcloudapi_1.SolaxCloudAPI.getYieldTotal(this.apiData.result));
96
- this.outletInverterToGrid.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getInverterPowerToGrid(this.apiData.result));
97
- this.outletInverterToHouse.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getInverterPowerToHouse(this.apiData.result));
98
- this.outletGridToHouse.setPowerConsumption(solaxcloudapi_1.SolaxCloudAPI.getGridPowerToHouse(this.apiData.result));
99
- // update motion sensor
100
- this.motionUpdate.setState(true);
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);
101
175
  }
102
176
  else {
103
- throw new Error(this.apiData.exception);
177
+ throw new Error(apiData.exception);
104
178
  }
105
179
  }
106
180
  catch (error) {
@@ -112,15 +186,157 @@ class SolaxCloudAPIPlatform {
112
186
  .then(async () => await this.fetchDataPeriodically());
113
187
  }
114
188
  }
189
+ /**
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.
236
+ */
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));
255
+ }
256
+ /**
257
+ * Checks platform config validity and sets defaults whenever needed.
258
+ * @returns {boolean} Whether the config is valid.
259
+ */
260
+ checkConfig(config) {
261
+ let result = true;
262
+ this.log.debug(`Config read: ${JSON.stringify(config)}`);
263
+ // 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!');
266
+ result = false;
267
+ }
268
+ else if (!config.tokenId) {
269
+ this.log.error('Config check: Can\'t find mandatory parameter "tokenId" parameter in config file, aborting!');
270
+ result = false;
271
+ }
272
+ else if (!config.sn) {
273
+ this.log.error('Config check: Can\'t find mandatory parameter "sn" parameter in config file, aborting!');
274
+ result = false;
275
+ }
276
+ // check for polling frequency
277
+ if (config.pollingFrequency === undefined) {
278
+ this.log.info(`Config check: No polling frequency provided, defaulting to ${DEFAULT_POLLING_FREQUENCY} seconds.`);
279
+ config.pollingFrequency = DEFAULT_POLLING_FREQUENCY;
280
+ }
281
+ else {
282
+ if (Number.isInteger(config.pollingFrequency) && config.pollingFrequency > 0) {
283
+ // all good?
284
+ if (config.pollingFrequency < MAX_POLLING_FREQUENCY) {
285
+ this.log.info(`Config check: Polling frequency cannot be higher than ${MAX_POLLS_MIN} times/min and ${MAX_POLLS_DAY} ` +
286
+ `times/day, defaulting to ${DEFAULT_POLLING_FREQUENCY} seconds.`);
287
+ config.pollingFrequency = DEFAULT_POLLING_FREQUENCY;
288
+ }
289
+ }
290
+ else {
291
+ this.log.info('Config check: Invalid polling frequency (must be a positive integer number), defaulting to ' +
292
+ `${DEFAULT_POLLING_FREQUENCY} seconds.`);
293
+ config.pollingFrequency = DEFAULT_POLLING_FREQUENCY;
294
+ }
295
+ }
296
+ // check for smooth meters
297
+ if (this.config.smoothMeters === undefined) {
298
+ this.config.smoothMeters = true;
299
+ this.log.info(`Config check: No config for smooth meters, defaulting to ${this.config.smoothMeters}.`);
300
+ }
301
+ else {
302
+ if (typeof this.config.smoothMeters !== 'boolean') {
303
+ this.config.smoothMeters = true;
304
+ this.log.info(`Config check: Invalid setting for smooth meters, defaulting to ${this.config.smoothMeters}.`);
305
+ }
306
+ }
307
+ // check for smoothing method
308
+ if (this.config.smoothingMethod === undefined) {
309
+ this.log.info(`Config check: No smoothing method provided, defaulting to "${DEFAULT_SMOOTHING_METHOD}".`);
310
+ config.smoothingMethod = DEFAULT_SMOOTHING_METHOD;
311
+ }
312
+ else {
313
+ if (!VALID_SMOOTHING_METHODS.find(this.config.smoothingMethod)) {
314
+ this.log.info(`Config check: Invalid smoothing method, defaulting to "${DEFAULT_SMOOTHING_METHOD}".`);
315
+ config.smoothingMethod = DEFAULT_SMOOTHING_METHOD;
316
+ }
317
+ }
318
+ // check for Home app accessories
319
+ if (this.config.pureHomeApp === undefined) {
320
+ this.config.pureHomeApp = false;
321
+ this.log.info(`Config check: No config for using pure Home app accessories, defaulting to ${this.config.pureHomeApp}.`);
322
+ }
323
+ else {
324
+ if (typeof this.config.pureHomeApp !== 'boolean') {
325
+ this.config.pureHomeApp = false;
326
+ this.log
327
+ .info(`Config check: Invalid setting for using pure Home app accessories, defaulting to ${this.config.pureHomeApp}.`);
328
+ }
329
+ }
330
+ this.log.info(`Config check: final config is ${JSON.stringify(this.config)}`);
331
+ return result;
332
+ }
115
333
  /*
116
334
  * This method is called once at startup.
117
335
  * The Platform should pass all accessories which need to be created to the callback in form of a AccessoryPlugin.
118
336
  * The Platform must respond in a timely manner as otherwise the startup of the bridge would be unnecessarily delayed.
119
337
  */
120
338
  accessories(callback) {
121
- callback([this.outletPV, this.outletInverterAC,
122
- this.outletInverterToGrid, this.outletInverterToHouse, this.outletGridToHouse,
123
- this.motionUpdate]);
339
+ callback(this.solaxAccessories);
124
340
  }
125
341
  }
126
342
  exports.SolaxCloudAPIPlatform =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,EAAE,CAAC,CAAC;QAE9E,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,QAAuD;QACjE,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAClC,CAAC;CACF;AApaD,sDAoaC"}
@@ -21,6 +21,10 @@ export declare class SolaxPlatformAccessory implements AccessoryPlugin {
21
21
  * Acessory display name.
22
22
  */
23
23
  protected readonly displayName: string;
24
+ /**
25
+ * Real-world accessory serial number.
26
+ */
27
+ protected trueSerialNumber: string;
24
28
  /**
25
29
  * Accessory serial number (string from 64 bit hash)
26
30
  */
@@ -62,6 +66,7 @@ export declare class SolaxPlatformAccessory implements AccessoryPlugin {
62
66
  * @param {string} serial Serial number to set.
63
67
  */
64
68
  setSerial(serial: string): void;
69
+ identify(): void;
65
70
  getServices(): Service[];
66
71
  }
67
72
  //# sourceMappingURL=platformAccessory.d.ts.map
@@ -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,YAAY,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,KAAK,SAAoB;IAEnC;;OAEG;IACH,SA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EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAkC5G;;;OAGG;IACI,QAAQ,IAAI,MAAM;IAMzB;;;OAGG;IACI,QAAQ,CAAC,KAAK,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"}
@@ -33,6 +33,8 @@ class SolaxPlatformAccessory {
33
33
  this.name = name;
34
34
  // display name
35
35
  this.displayName = name;
36
+ // serial
37
+ this.trueSerialNumber = serialNumber;
36
38
  // hash "real-world" serial and hostname to 64 bit hex string
37
39
  this.serialNumber = (0, string_hash_64_1.default)(`${serialNumber}-${os_1.default.hostname()}`).toString(16);
38
40
  // remove non-standard chars from model name
@@ -83,14 +85,19 @@ class SolaxPlatformAccessory {
83
85
  this.serialNumber = serial;
84
86
  this.informationService.setCharacteristic(this.platform.api.hap.Characteristic.SerialNumber, serial);
85
87
  }
88
+ /*
89
+ * This method is optional to implement. It is called when HomeKit ask to identify the accessory.
90
+ * Typical this only ever happens at the pairing process.
91
+ */
92
+ identify() {
93
+ this.log.info(`${this.name}: Identify (true serial=${this.trueSerialNumber}, serial=${this.serialNumber})`);
94
+ }
86
95
  /*
87
96
  * This method is called directly after creation of this instance.
88
97
  * It should return all services which should be added to the accessory.
89
98
  */
90
99
  getServices() {
91
- return [
92
- this.informationService,
93
- ];
100
+ return [this.informationService];
94
101
  }
95
102
  }
96
103
  exports.SolaxPlatformAccessory = SolaxPlatformAccessory;
@@ -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,CAA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CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/F,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,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACvG,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;AA9ID,wDA8IC"}
@@ -0,0 +1,53 @@
1
+ import { SolaxLightSensorAccessory } from './lightSensorAccessory';
2
+ import { SolaxOutletAccessory } from './outletAccessory';
3
+ /**
4
+ * Interface with outlets exposed by the platform.
5
+ */
6
+ export interface PlatformOutletMeters {
7
+ /**
8
+ * Virtual outlet used to detect and measure photovoltaic production.
9
+ */
10
+ pv: SolaxOutletAccessory;
11
+ /**
12
+ * Virtual outlet used to detect and measure inverter AC production.
13
+ */
14
+ inverterAC: SolaxOutletAccessory;
15
+ /**
16
+ * Virtual outlet used to detect and measure inverter excess production injected in the grid.
17
+ */
18
+ inverterToGrid: SolaxOutletAccessory;
19
+ /**
20
+ * Virtual outlet used to detect and measure inverter production directly fed into the house (self-consumption).
21
+ */
22
+ inverterToHouse: SolaxOutletAccessory;
23
+ /**
24
+ * Virtual outlet used to detect and measure grid power fed into the house.
25
+ */
26
+ gridToHouse: SolaxOutletAccessory;
27
+ }
28
+ /**
29
+ * Interface with lights sensors exposed by the platform.
30
+ */
31
+ export interface PlatformLightSensorMeters {
32
+ /**
33
+ * Virtual ambient light meter used to detect and measure photovoltaic production.
34
+ */
35
+ pv: SolaxLightSensorAccessory;
36
+ /**
37
+ * Virtual ambient light meter used to detect and measure inverter AC production.
38
+ */
39
+ inverterAC: SolaxLightSensorAccessory;
40
+ /**
41
+ * Virtual ambient light meter used to detect and measure inverter excess production injected in the grid.
42
+ */
43
+ inverterToGrid: SolaxLightSensorAccessory;
44
+ /**
45
+ * Virtual ambient light meter used to detect and measure inverter production directly fed into the house (self-consumption).
46
+ */
47
+ inverterToHouse: SolaxLightSensorAccessory;
48
+ /**
49
+ * Virtual ambient light meter used to detect and measure grid power fed into the house.
50
+ */
51
+ gridToHouse: SolaxLightSensorAccessory;
52
+ }
53
+ //# sourceMappingURL=platformMeters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformMeters.d.ts","sourceRoot":"","sources":["../src/platformMeters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;MAEE;IACF,EAAE,EAAE,oBAAoB,CAAC;IAEzB;;MAEE;IACF,UAAU,EAAE,oBAAoB,CAAC;IAEjC;;MAEE;IACF,cAAc,EAAE,oBAAoB,CAAC;IAErC;;MAEE;IACF,eAAe,EAAE,oBAAoB,CAAC;IAEtC;;MAEE;IACF,WAAW,EAAE,oBAAoB,CAAC;CACnC;AAEH;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC;;MAEE;IACF,EAAE,EAAE,yBAAyB,CAAC;IAE9B;;MAEE;IACF,UAAU,EAAE,yBAAyB,CAAC;IAEtC;;MAEE;IACF,cAAc,EAAE,yBAAyB,CAAC;IAE1C;;MAEE;IACF,eAAe,EAAE,yBAAyB,CAAC;IAE3C;;MAEE;IACF,WAAW,EAAE,yBAAyB,CAAC;CACxC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=platformMeters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platformMeters.js","sourceRoot":"","sources":["../src/platformMeters.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=solaxcloudfetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solaxcloudfetch.d.ts","sourceRoot":"","sources":["../src/solaxcloudfetch.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /* eslint-disable no-console */
7
+ const solaxcloudapi_1 = require("./solaxcloudapi");
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const config = JSON.parse(fs_1.default.readFileSync('config.json').toString());
10
+ const api = new solaxcloudapi_1.SolaxCloudAPI(config.platforms[0].tokenId, config.platforms[0].sn);
11
+ const result = api.getAPIData();
12
+ console.log(`PV Power: ${solaxcloudapi_1.SolaxCloudAPI.getPVPower(result.result)}W`);
13
+ console.log(`Inverter AC Power: ${solaxcloudapi_1.SolaxCloudAPI.getInverterACPower(result.result)}W`);
14
+ console.log(`Grid Power to House: ${solaxcloudapi_1.SolaxCloudAPI.getGridPowerToHouse(result.result)}W`);
15
+ console.log(`Inverter Power to Grid: ${solaxcloudapi_1.SolaxCloudAPI.getInverterPowerToGrid(result.result)}W`);
16
+ console.log(`Inverter Power to House: ${solaxcloudapi_1.SolaxCloudAPI.getInverterPowerToHouse(result.result)}W`);
17
+ console.log(`Yield Today: ${solaxcloudapi_1.SolaxCloudAPI.getYieldToday(result.result)}KWh`);
18
+ console.log(`Yield Total: ${solaxcloudapi_1.SolaxCloudAPI.getYieldTotal(result.result)}KWh`);
19
+ //# sourceMappingURL=solaxcloudfetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solaxcloudfetch.js","sourceRoot":"","sources":["../src/solaxcloudfetch.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,mDAAgD;AAEhD,4CAAoB;AAEpB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AACrE,MAAM,GAAG,GAAG,IAAI,6BAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAEnF,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;AAEhC,OAAO,CAAC,GAAG,CAAC,aAAa,6BAAa,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrE,OAAO,CAAC,GAAG,CAAC,sBAAsB,6BAAa,CAAC,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACtF,OAAO,CAAC,GAAG,CAAC,wBAAwB,6BAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACzF,OAAO,CAAC,GAAG,CAAC,2BAA2B,6BAAa,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/F,OAAO,CAAC,GAAG,CAAC,4BAA4B,6BAAa,CAAC,uBAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAEjG,OAAO,CAAC,GAAG,CAAC,gBAAgB,6BAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7E,OAAO,CAAC,GAAG,CAAC,gBAAgB,6BAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
@@ -1,2 +1,37 @@
1
- export {};
1
+ /**
2
+ * Statistics.
3
+ * This class is used for statistical calculations for the purpose of smoothing a series of value.
4
+ */
5
+ export declare class Statistics {
6
+ /**
7
+ * Simple moving average calculation from a series of values.
8
+ * Formula is
9
+ * SMA = (V1 + V2 + ... + Vn) / n
10
+ * where
11
+ * Vn = Series value for period n
12
+ * n = number values in period
13
+ * @param {number[]} series Array with series of values.
14
+ * @param {number} windowSize Size of moving average window.
15
+ * @param {number} maxCalculations Maximum calculations to be performed.
16
+ * @returns {number[]} Array with simple moving averages from series.
17
+ */
18
+ static simpleMovingAverage(series: number[], windowSize: number, maxCalculations?: number): number[];
19
+ /**
20
+ * Exponential moving average calculation from a series of values.
21
+ * Formula is
22
+ * EMAn = (Vn - EMAn-1) * weight + EMAn-1
23
+ * where
24
+ * EMAn = Exponential Moving Average for period n
25
+ * EMAn-1 = Exponential Moving Average for period n - 1
26
+ * Vn = Series value for period n
27
+ * weight = multiplier to use lower weights for older value
28
+ * w = window size
29
+ * and
30
+ * weight = 2 / (w + 1)
31
+ * @param {number[]} series Array with series of values.
32
+ * @param {number} windowSize Size of moving average window.
33
+ * @returns {number[]} Array with exponential moving averages from series.
34
+ */
35
+ static exponentialMovingAverage(series: number[], windowSize: number): number[];
36
+ }
2
37
  //# sourceMappingURL=statistics.d.ts.map