homebridge-enphase-envoy 9.14.2-beta.21 → 9.14.2-beta.23
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/package.json +1 -1
- package/src/envoydevice.js +92 -92
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"displayName": "Enphase Envoy",
|
|
4
4
|
"name": "homebridge-enphase-envoy",
|
|
5
|
-
"version": "9.14.2-beta.
|
|
5
|
+
"version": "9.14.2-beta.23",
|
|
6
6
|
"description": "Homebridge plugin for Photovoltaic Energy System manufactured by Enphase.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "grzegorz914",
|
package/src/envoydevice.js
CHANGED
|
@@ -1303,60 +1303,6 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1303
1303
|
};
|
|
1304
1304
|
};
|
|
1305
1305
|
|
|
1306
|
-
async getEnvoyDevId() {
|
|
1307
|
-
const debug = this.enableDebugMode ? this.emit('debug', `Requesting envoy dev Id`) : false;
|
|
1308
|
-
try {
|
|
1309
|
-
//read envoy dev id from file
|
|
1310
|
-
try {
|
|
1311
|
-
const response = await this.readData(this.envoyIdFile);
|
|
1312
|
-
const debug = this.enableDebugMode ? this.emit('debug', `Envoy dev Id from file: ${response.toString().length === 9 ? 'Exist' : 'Missing'}`) : false;
|
|
1313
|
-
const envoyDevId = response.toString() ?? '';
|
|
1314
|
-
if (envoyDevId.length === 9) {
|
|
1315
|
-
this.feature.info.devId = envoyDevId;
|
|
1316
|
-
return true;
|
|
1317
|
-
}
|
|
1318
|
-
} catch (error) {
|
|
1319
|
-
this.emit('warn', `Read envoy dev Id from file error, trying from device: ${error}`)
|
|
1320
|
-
};
|
|
1321
|
-
|
|
1322
|
-
//read envoy dev id from device
|
|
1323
|
-
const response = await this.axiosInstance(ApiUrls.BackboneApplication);
|
|
1324
|
-
const envoyBackboneApp = response.data;
|
|
1325
|
-
const debug = this.enableDebugMode ? this.emit('debug', `Envoy backbone app:`, envoyBackboneApp) : false;
|
|
1326
|
-
|
|
1327
|
-
//backbone data
|
|
1328
|
-
const keyword = 'envoyDevId:';
|
|
1329
|
-
const startIndex = envoyBackboneApp.indexOf(keyword);
|
|
1330
|
-
|
|
1331
|
-
//check envoy dev Id exist
|
|
1332
|
-
if (startIndex === -1) {
|
|
1333
|
-
this.emit('warn', `Envoy dev Id not found, dont worry all working correct, only the power production control will not be possible`);
|
|
1334
|
-
return null;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
const substringStartIndex = startIndex + keyword.length;
|
|
1338
|
-
const envoyDevId = envoyBackboneApp.substr(substringStartIndex, 9);
|
|
1339
|
-
if (envoyDevId.length !== 9) {
|
|
1340
|
-
this.emit('warn', `Envoy dev Id: ${envoyDevId} have wrong format, dont worry all working correct, only the power production control will not be possible`);
|
|
1341
|
-
return null;
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
//save dev id
|
|
1345
|
-
try {
|
|
1346
|
-
await this.saveData(this.envoyIdFile, envoyDevId);
|
|
1347
|
-
} catch (error) {
|
|
1348
|
-
this.emit('error', `Save envoy dev Id error: ${error}`);
|
|
1349
|
-
};
|
|
1350
|
-
|
|
1351
|
-
this.feature.info.devId = envoyDevId;
|
|
1352
|
-
this.feature.backboneApp.supported = true;
|
|
1353
|
-
return true;
|
|
1354
|
-
} catch (error) {
|
|
1355
|
-
this.emit('warn', `Get envoy dev Id from device error: ${error}, dont worry all working correct, only the power production control will not be possible`);
|
|
1356
|
-
return null;
|
|
1357
|
-
};
|
|
1358
|
-
};
|
|
1359
|
-
|
|
1360
1306
|
async updateHome() {
|
|
1361
1307
|
const debug = this.enableDebugMode ? this.emit('debug', `Requesting home`) : false;
|
|
1362
1308
|
try {
|
|
@@ -1369,7 +1315,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1369
1315
|
const envoyCommKeys = Object.keys(envoy.comm);
|
|
1370
1316
|
|
|
1371
1317
|
//get supported devices
|
|
1372
|
-
const
|
|
1318
|
+
const pcusSupported = envoyCommKeys.includes('pcu');
|
|
1373
1319
|
const acBatteriesSupported = envoyCommKeys.includes('acb');
|
|
1374
1320
|
const qRelaysSupported = envoyCommKeys.includes('nsrb');
|
|
1375
1321
|
const ensemblesSupported = envoyCommKeys.includes('esub');
|
|
@@ -4305,6 +4251,60 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4305
4251
|
};
|
|
4306
4252
|
};
|
|
4307
4253
|
|
|
4254
|
+
async getEnvoyDevId() {
|
|
4255
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Requesting envoy dev Id`) : false;
|
|
4256
|
+
try {
|
|
4257
|
+
//read envoy dev id from file
|
|
4258
|
+
try {
|
|
4259
|
+
const response = await this.readData(this.envoyIdFile);
|
|
4260
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Envoy dev Id from file: ${response.toString().length === 9 ? 'Exist' : 'Missing'}`) : false;
|
|
4261
|
+
const envoyDevId = response.toString() ?? '';
|
|
4262
|
+
if (envoyDevId.length === 9) {
|
|
4263
|
+
this.feature.info.devId = envoyDevId;
|
|
4264
|
+
return true;
|
|
4265
|
+
}
|
|
4266
|
+
} catch (error) {
|
|
4267
|
+
this.emit('warn', `Read envoy dev Id from file error, trying from device: ${error}`)
|
|
4268
|
+
};
|
|
4269
|
+
|
|
4270
|
+
//read envoy dev id from device
|
|
4271
|
+
const response = await this.axiosInstance(ApiUrls.BackboneApplication);
|
|
4272
|
+
const envoyBackboneApp = response.data;
|
|
4273
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Envoy backbone app:`, envoyBackboneApp) : false;
|
|
4274
|
+
|
|
4275
|
+
//backbone data
|
|
4276
|
+
const keyword = 'envoyDevId:';
|
|
4277
|
+
const startIndex = envoyBackboneApp.indexOf(keyword);
|
|
4278
|
+
|
|
4279
|
+
//check envoy dev Id exist
|
|
4280
|
+
if (startIndex === -1) {
|
|
4281
|
+
this.emit('warn', `Envoy dev Id not found, dont worry all working correct, only the power production control will not be possible`);
|
|
4282
|
+
return null;
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
const substringStartIndex = startIndex + keyword.length;
|
|
4286
|
+
const envoyDevId = envoyBackboneApp.substr(substringStartIndex, 9);
|
|
4287
|
+
if (envoyDevId.length !== 9) {
|
|
4288
|
+
this.emit('warn', `Envoy dev Id: ${envoyDevId} have wrong format, dont worry all working correct, only the power production control will not be possible`);
|
|
4289
|
+
return null;
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4292
|
+
//save dev id
|
|
4293
|
+
try {
|
|
4294
|
+
await this.saveData(this.envoyIdFile, envoyDevId);
|
|
4295
|
+
} catch (error) {
|
|
4296
|
+
this.emit('error', `Save envoy dev Id error: ${error}`);
|
|
4297
|
+
};
|
|
4298
|
+
|
|
4299
|
+
this.feature.info.devId = envoyDevId;
|
|
4300
|
+
this.feature.backboneApp.supported = true;
|
|
4301
|
+
return true;
|
|
4302
|
+
} catch (error) {
|
|
4303
|
+
this.emit('warn', `Get envoy dev Id from device error: ${error}, dont worry all working correct, only the power production control will not be possible`);
|
|
4304
|
+
return null;
|
|
4305
|
+
};
|
|
4306
|
+
};
|
|
4307
|
+
|
|
4308
4308
|
async updateProductionState() {
|
|
4309
4309
|
const debug = this.enableDebugMode ? this.emit('debug', `Requesting production state`) : false;
|
|
4310
4310
|
try {
|
|
@@ -4372,6 +4372,39 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4372
4372
|
};
|
|
4373
4373
|
};
|
|
4374
4374
|
|
|
4375
|
+
async getDeviceInfo() {
|
|
4376
|
+
const debug = this.enableDebugMode ? this.emit('debug', `Requesting device info`) : false;
|
|
4377
|
+
|
|
4378
|
+
//debug objects
|
|
4379
|
+
const debug1 = this.enableDebugMode ? this.emit('debug', `Pv object:`, this.pv) : false;
|
|
4380
|
+
|
|
4381
|
+
//display info
|
|
4382
|
+
this.emit('devInfo', `-------- ${this.name} --------`);
|
|
4383
|
+
this.emit('devInfo', `Manufacturer: Enphase`);
|
|
4384
|
+
this.emit('devInfo', `Model: ${this.pv.info.modelName}`);
|
|
4385
|
+
this.emit('devInfo', `Firmware: ${this.pv.info.software}`);
|
|
4386
|
+
this.emit('devInfo', `SerialNr: ${this.pv.info.serialNumber}`);
|
|
4387
|
+
this.emit('devInfo', `Time: ${this.pv.info.time}`);
|
|
4388
|
+
this.emit('devInfo', `------------------------------`);
|
|
4389
|
+
const displayLog12 = this.feature.inventory.qRelays.installed ? this.emit('devInfo', `Q-Relays: ${this.feature.inventory.qRelays.count}`) : false;
|
|
4390
|
+
const displayLog15 = this.feature.inventory.pcus.installed ? this.emit('devInfo', `Inverters: ${this.feature.inventory.pcus.count}`) : false;
|
|
4391
|
+
const displayLog13 = this.feature.inventory.acBatteries.installed ? this.emit('devInfo', `${this.acBatterieName}: ${this.feature.inventory.acBatteries.count}`) : false;
|
|
4392
|
+
const displayLog14 = this.feature.inventory.qRelays.installed || this.feature.inventory.acBatteries.installed || this.feature.inventory.pcus.installed ? this.emit('devInfo', `--------------------------------`) : false;
|
|
4393
|
+
const displayLog0 = this.feature.meters.installed ? this.emit('devInfo', `Meters: Yes`) : false;
|
|
4394
|
+
const displayLog1 = this.feature.meters.installed && this.feature.meters.production.supported ? this.emit('devInfo', `Production: ${this.feature.meters.production.enabled ? `Enabled` : `Disabled`}`) : false;
|
|
4395
|
+
const displayLog2 = this.feature.meters.installed && this.feature.meters.consumption.supported ? this.emit('devInfo', `Consumption: ${this.feature.meters.consumption.enabled ? `Enabled` : `Disabled`}`) : false;
|
|
4396
|
+
const displayLog3 = this.feature.meters.installed && this.feature.meters.acBatterie.supported ? this.emit('devInfo', `Storage: ${this.feature.meters.acBatterie.enabled ? `Enabled` : `Disabled`}`) : false;
|
|
4397
|
+
const displayLog4 = this.feature.meters.installed ? this.emit('devInfo', `--------------------------------`) : false;
|
|
4398
|
+
const displayLog5 = this.feature.ensembles.installed ? this.emit('devInfo', `Ensemble: Yes`) : false;
|
|
4399
|
+
const displayLog6 = this.feature.enpowers.installed ? this.emit('devInfo', `Enpowers: ${this.feature.enpowers.count}`) : false;
|
|
4400
|
+
const displayLog7 = this.feature.encharges.installed ? this.emit('devInfo', `${this.enchargeName}: ${this.feature.encharges.count}`) : false;
|
|
4401
|
+
const displayLog8 = this.feature.dryContacts.installed ? this.emit('devInfo', `Dry Contacts: ${this.feature.dryContacts.count}`) : false;
|
|
4402
|
+
const displayLog9 = this.feature.generators.installed ? this.emit('devInfo', `Generator: Yes`) : false;
|
|
4403
|
+
const displayLog10 = this.feature.home.wirelessConnections.installed ? this.emit('devInfo', `Wireless Kit: ${this.feature.home.wirelessConnections.count}`) : false;
|
|
4404
|
+
const displayLog11 = this.feature.ensembles.installed || this.feature.enpowers.installed || this.feature.encharges.installed || this.feature.dryContacts.installed || this.feature.home.wirelessConnections.installed || this.feature.generators.installed ? this.emit('devInfo', `--------------------------------`) : false;
|
|
4405
|
+
return true;
|
|
4406
|
+
};
|
|
4407
|
+
|
|
4375
4408
|
async setProductionState(state) {
|
|
4376
4409
|
const debug = this.enableDebugMode ? this.emit('debug', `Set production power mode`) : false;
|
|
4377
4410
|
try {
|
|
@@ -4599,39 +4632,6 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4599
4632
|
}
|
|
4600
4633
|
};
|
|
4601
4634
|
|
|
4602
|
-
async getDeviceInfo() {
|
|
4603
|
-
const debug = this.enableDebugMode ? this.emit('debug', `Requesting device info`) : false;
|
|
4604
|
-
|
|
4605
|
-
//debug objects
|
|
4606
|
-
const debug1 = this.enableDebugMode ? this.emit('debug', `Pv object:`, this.pv) : false;
|
|
4607
|
-
|
|
4608
|
-
//display info
|
|
4609
|
-
this.emit('devInfo', `-------- ${this.name} --------`);
|
|
4610
|
-
this.emit('devInfo', `Manufacturer: Enphase`);
|
|
4611
|
-
this.emit('devInfo', `Model: ${this.pv.info.modelName}`);
|
|
4612
|
-
this.emit('devInfo', `Firmware: ${this.pv.info.software}`);
|
|
4613
|
-
this.emit('devInfo', `SerialNr: ${this.pv.info.serialNumber}`);
|
|
4614
|
-
this.emit('devInfo', `Time: ${this.pv.info.time}`);
|
|
4615
|
-
this.emit('devInfo', `------------------------------`);
|
|
4616
|
-
const displayLog12 = this.feature.inventory.qRelays.installed ? this.emit('devInfo', `Q-Relays: ${this.feature.inventory.qRelays.count}`) : false;
|
|
4617
|
-
const displayLog15 = this.feature.inventory.pcus.installed ? this.emit('devInfo', `Inverters: ${this.feature.inventory.pcus.count}`) : false;
|
|
4618
|
-
const displayLog13 = this.feature.inventory.acBatteries.installed ? this.emit('devInfo', `${this.acBatterieName}: ${this.feature.inventory.acBatteries.count}`) : false;
|
|
4619
|
-
const displayLog14 = this.feature.inventory.qRelays.installed || this.feature.inventory.acBatteries.installed || this.feature.inventory.pcus.installed ? this.emit('devInfo', `--------------------------------`) : false;
|
|
4620
|
-
const displayLog0 = this.feature.meters.installed ? this.emit('devInfo', `Meters: Yes`) : false;
|
|
4621
|
-
const displayLog1 = this.feature.meters.installed && this.feature.meters.production.supported ? this.emit('devInfo', `Production: ${this.feature.meters.production.enabled ? `Enabled` : `Disabled`}`) : false;
|
|
4622
|
-
const displayLog2 = this.feature.meters.installed && this.feature.meters.consumption.supported ? this.emit('devInfo', `Consumption: ${this.feature.meters.consumption.enabled ? `Enabled` : `Disabled`}`) : false;
|
|
4623
|
-
const displayLog3 = this.feature.meters.installed && this.feature.meters.acBatterie.supported ? this.emit('devInfo', `Storage: ${this.feature.meters.acBatterie.enabled ? `Enabled` : `Disabled`}`) : false;
|
|
4624
|
-
const displayLog4 = this.feature.meters.installed ? this.emit('devInfo', `--------------------------------`) : false;
|
|
4625
|
-
const displayLog5 = this.feature.ensembles.installed ? this.emit('devInfo', `Ensemble: Yes`) : false;
|
|
4626
|
-
const displayLog6 = this.feature.enpowers.installed ? this.emit('devInfo', `Enpowers: ${this.feature.enpowers.count}`) : false;
|
|
4627
|
-
const displayLog7 = this.feature.encharges.installed ? this.emit('devInfo', `${this.enchargeName}: ${this.feature.encharges.count}`) : false;
|
|
4628
|
-
const displayLog8 = this.feature.dryContacts.installed ? this.emit('devInfo', `Dry Contacts: ${this.feature.dryContacts.count}`) : false;
|
|
4629
|
-
const displayLog9 = this.feature.generators.installed ? this.emit('devInfo', `Generator: Yes`) : false;
|
|
4630
|
-
const displayLog10 = this.feature.home.wirelessConnections.installed ? this.emit('devInfo', `Wireless Kit: ${this.feature.home.wirelessConnections.count}`) : false;
|
|
4631
|
-
const displayLog11 = this.feature.ensembles.installed || this.feature.enpowers.installed || this.feature.encharges.installed || this.feature.dryContacts.installed || this.feature.home.wirelessConnections.installed || this.feature.generators.installed ? this.emit('devInfo', `--------------------------------`) : false;
|
|
4632
|
-
return true;
|
|
4633
|
-
};
|
|
4634
|
-
|
|
4635
4635
|
async externalIntegrations() {
|
|
4636
4636
|
try {
|
|
4637
4637
|
//RESTFul server
|
|
@@ -7228,12 +7228,12 @@ class EnvoyDevice extends EventEmitter {
|
|
|
7228
7228
|
|
|
7229
7229
|
//get ensemble data ab FW. >= 7.x.x.
|
|
7230
7230
|
const refreshEnsemble = tokenValid ? await this.updateEnsembleInventory() : false;
|
|
7231
|
-
const updateEnsembleStatus =
|
|
7232
|
-
const refreshEnchargeSettings =
|
|
7231
|
+
const updateEnsembleStatus = this.feature.ensembles.supported ? await this.updateEnsembleStatus() : false;
|
|
7232
|
+
const refreshEnchargeSettings = this.feature.ensembles.supported ? await this.updateEnchargesSettings() : false;
|
|
7233
7233
|
const refreshTariffSettings = refreshEnchargeSettings ? await this.updateTariff() : false;
|
|
7234
|
-
const refreshDryContacts =
|
|
7234
|
+
const refreshDryContacts = this.feature.ensembles.supported ? await this.updateDryContacts() : false;
|
|
7235
7235
|
const updateDryContactsSettings = refreshDryContacts ? await this.updateDryContactsSettings() : false;
|
|
7236
|
-
const refreshGenerator =
|
|
7236
|
+
const refreshGenerator = this.feature.ensembles.supported ? await this.updateGenerator() : false;
|
|
7237
7237
|
const updateGeneratorSettings = refreshGenerator ? await this.updateGeneratorSettings() : false;
|
|
7238
7238
|
|
|
7239
7239
|
//get live data ab FW. >= 7.x.x
|