homebridge-enphase-envoy 10.0.2-beta.21 → 10.0.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 +162 -248
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": "10.0.2-beta.
|
|
5
|
+
"version": "10.0.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
|
@@ -1526,204 +1526,136 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1526
1526
|
}
|
|
1527
1527
|
|
|
1528
1528
|
async updateInventory() {
|
|
1529
|
-
if (this.enableDebugMode) this.emit('debug',
|
|
1529
|
+
if (this.enableDebugMode) this.emit('debug', 'Requesting inventory');
|
|
1530
1530
|
|
|
1531
1531
|
try {
|
|
1532
1532
|
const response = await this.axiosInstance(ApiUrls.Inventory);
|
|
1533
1533
|
const inventory = response.data;
|
|
1534
|
-
if (this.enableDebugMode) this.emit('debug',
|
|
1534
|
+
if (this.enableDebugMode) this.emit('debug', 'Inventory:', inventory);
|
|
1535
|
+
|
|
1536
|
+
const getPartNumber = (partNum) => PartNumbers[partNum] ?? partNum;
|
|
1537
|
+
const parseDeviceCommon = (device) => ({
|
|
1538
|
+
partNumber: getPartNumber(device.part_num),
|
|
1539
|
+
installed: device.installed,
|
|
1540
|
+
serialNumber: device.serial_num,
|
|
1541
|
+
deviceStatus: device.device_status,
|
|
1542
|
+
readingTime: device.last_rpt_date,
|
|
1543
|
+
adminState: device.admin_state,
|
|
1544
|
+
devType: device.dev_type,
|
|
1545
|
+
createdDate: device.created_date,
|
|
1546
|
+
imageLoadDate: device.img_load_date,
|
|
1547
|
+
firmware: device.img_pnum_running,
|
|
1548
|
+
ptpn: device.ptpn,
|
|
1549
|
+
chaneId: device.chaneid,
|
|
1550
|
+
producing: device.producing === true,
|
|
1551
|
+
communicating: device.communicating === true,
|
|
1552
|
+
provisioned: device.provisioned === true,
|
|
1553
|
+
operating: device.operating === true,
|
|
1554
|
+
});
|
|
1535
1555
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1556
|
+
const parseMicroinverters = (devices) => devices.slice(0, 70).map(device => ({
|
|
1557
|
+
type: 'pcu',
|
|
1558
|
+
...parseDeviceCommon(device),
|
|
1559
|
+
deviceControl: device.device_control[0]?.gficlearset ?? false,
|
|
1560
|
+
phase: device.phase
|
|
1561
|
+
}));
|
|
1538
1562
|
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
installed: pcu.installed,
|
|
1551
|
-
serialNumber: pcu.serial_num,
|
|
1552
|
-
deviceStatus: pcu.device_status,
|
|
1553
|
-
readingTime: pcu.last_rpt_date,
|
|
1554
|
-
adminState: pcu.admin_state,
|
|
1555
|
-
devType: pcu.dev_type,
|
|
1556
|
-
createdDate: pcu.created_date,
|
|
1557
|
-
imageLoadDate: pcu.img_load_date,
|
|
1558
|
-
firmware: pcu.img_pnum_running,
|
|
1559
|
-
ptpn: pcu.ptpn,
|
|
1560
|
-
chaneId: pcu.chaneid,
|
|
1561
|
-
deviceControl: pcu.device_control[0].gficlearset, //bool
|
|
1562
|
-
producing: pcu.producing === true,
|
|
1563
|
-
communicating: pcu.communicating === true,
|
|
1564
|
-
provisioned: pcu.provisioned === true,
|
|
1565
|
-
operating: pcu.operating === true,
|
|
1566
|
-
phase: pcu.phase
|
|
1567
|
-
};
|
|
1568
|
-
//add obj to pcu array
|
|
1569
|
-
arr.push(obj);
|
|
1570
|
-
};
|
|
1563
|
+
const parseAcBatteries = (devices) => devices.map(device => ({
|
|
1564
|
+
type: 'acb',
|
|
1565
|
+
...parseDeviceCommon(device),
|
|
1566
|
+
deviceControl: device.device_control,
|
|
1567
|
+
sleepEnabled: device.sleep_enabled,
|
|
1568
|
+
percentFull: device.percentFull,
|
|
1569
|
+
maxCellTemp: device.maxCellTemp,
|
|
1570
|
+
sleepMinSoc: device.sleep_min_soc,
|
|
1571
|
+
sleepMaxSoc: device.sleep_max_soc,
|
|
1572
|
+
chargeState: device.charge_status
|
|
1573
|
+
}));
|
|
1571
1574
|
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1575
|
+
const parseQRelays = (devices) => devices.map(device => {
|
|
1576
|
+
const lines = device['line-count'] ?? 0;
|
|
1577
|
+
return {
|
|
1578
|
+
type: 'nsrb',
|
|
1579
|
+
...parseDeviceCommon(device),
|
|
1580
|
+
deviceControl: device.device_control,
|
|
1581
|
+
relay: ApiCodes[device.relay],
|
|
1582
|
+
relayState: device.relay === 'closed',
|
|
1583
|
+
reasonCode: device.reason_code,
|
|
1584
|
+
reason: device.reason,
|
|
1585
|
+
linesCount: lines,
|
|
1586
|
+
line1Connected: lines >= 1 ? device['line1-connected'] === true : false,
|
|
1587
|
+
line2Connected: lines >= 2 ? device['line2-connected'] === true : false,
|
|
1588
|
+
line3Connected: lines >= 3 ? device['line3-connected'] === true : false
|
|
1589
|
+
};
|
|
1590
|
+
});
|
|
1579
1591
|
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
type: type,
|
|
1590
|
-
partNumber: PartNumbers[acb.part_num] ?? acb.part_num,
|
|
1591
|
-
installed: acb.installed,
|
|
1592
|
-
serialNumber: acb.serial_num,
|
|
1593
|
-
deviceStatus: acb.device_status,
|
|
1594
|
-
readingTime: acb.last_rpt_date,
|
|
1595
|
-
adminState: acb.admin_state,
|
|
1596
|
-
devType: acb.dev_type,
|
|
1597
|
-
createdDate: acb.created_date,
|
|
1598
|
-
imageLoadDate: acb.img_load_date,
|
|
1599
|
-
firmware: acb.img_pnum_running,
|
|
1600
|
-
ptpn: acb.ptpn,
|
|
1601
|
-
chaneId: acb.chaneid,
|
|
1602
|
-
deviceControl: acb.device_control,
|
|
1603
|
-
producing: acb.producing === true,
|
|
1604
|
-
communicating: acb.communicating === true,
|
|
1605
|
-
provisioned: acb.provisioned === true,
|
|
1606
|
-
operating: acb.operating === true,
|
|
1607
|
-
sleepEnabled: acb.sleep_enabled,
|
|
1608
|
-
percentFull: acb.percentFull,
|
|
1609
|
-
maxCellTemp: acb.maxCellTemp,
|
|
1610
|
-
sleepMinSoc: acb.sleep_min_soc,
|
|
1611
|
-
sleepMaxSoc: acb.sleep_max_soc,
|
|
1612
|
-
chargeState: acb.charge_status,
|
|
1613
|
-
};
|
|
1614
|
-
//add ac batteries to acb
|
|
1615
|
-
arr.push(obj);
|
|
1592
|
+
const parseEnsembles = (devices) => devices.map((device, index) => {
|
|
1593
|
+
const obj = {
|
|
1594
|
+
type: 'esub',
|
|
1595
|
+
...parseDeviceCommon(device),
|
|
1596
|
+
installed: new Date(device.installed * 1000).toLocaleString(),
|
|
1597
|
+
readingTime: new Date(device.last_rpt_date * 1000).toLocaleString(),
|
|
1598
|
+
createdDate: new Date(device.created_date * 1000).toLocaleString(),
|
|
1599
|
+
imageLoadDate: new Date(device.img_load_date * 1000).toLocaleString(),
|
|
1600
|
+
deviceControl: device.device_control,
|
|
1616
1601
|
};
|
|
1617
1602
|
|
|
1618
|
-
//
|
|
1619
|
-
this.
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1603
|
+
// update characteristics
|
|
1604
|
+
this.ensemblesInventoryServices?.[index]
|
|
1605
|
+
?.updateCharacteristic(Characteristic.Status, obj.deviceStatus)
|
|
1606
|
+
.updateCharacteristic(Characteristic.ReadingTime, obj.readingTime)
|
|
1607
|
+
.updateCharacteristic(Characteristic.Firmware, obj.firmware)
|
|
1608
|
+
.updateCharacteristic(Characteristic.Producing, obj.producing)
|
|
1609
|
+
.updateCharacteristic(Characteristic.Communicating, obj.communicating)
|
|
1610
|
+
.updateCharacteristic(Characteristic.Operating, obj.operating);
|
|
1625
1611
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1631
|
-
const arr = [];
|
|
1632
|
-
const type = inventory[2].type ?? 'nsrb';
|
|
1633
|
-
for (const nsrb of qRelays) {
|
|
1634
|
-
const obj = {
|
|
1635
|
-
type: type,
|
|
1636
|
-
partNumber: PartNumbers[nsrb.part_num] ?? nsrb.part_num,
|
|
1637
|
-
installed: nsrb.installed,
|
|
1638
|
-
serialNumber: nsrb.serial_num,
|
|
1639
|
-
deviceStatus: nsrb.device_status,
|
|
1640
|
-
readingTime: nsrb.last_rpt_date,
|
|
1641
|
-
adminState: nsrb.admin_state,
|
|
1642
|
-
devType: nsrb.dev_type,
|
|
1643
|
-
createdDate: nsrb.created_date,
|
|
1644
|
-
imageLoadDate: nsrb.img_load_date,
|
|
1645
|
-
firmware: nsrb.img_pnum_running,
|
|
1646
|
-
ptpn: nsrb.ptpn,
|
|
1647
|
-
chaneId: nsrb.chaneid,
|
|
1648
|
-
deviceControl: nsrb.device_control,
|
|
1649
|
-
producing: nsrb.producing === true,
|
|
1650
|
-
communicating: nsrb.communicating === true,
|
|
1651
|
-
provisioned: nsrb.provisioned === true,
|
|
1652
|
-
operating: nsrb.operating === true,
|
|
1653
|
-
relay: ApiCodes[nsrb.relay],
|
|
1654
|
-
relayState: nsrb.relay === 'closed',
|
|
1655
|
-
reasonCode: nsrb.reason_code,
|
|
1656
|
-
reason: nsrb.reason,
|
|
1657
|
-
linesCount: nsrb['line-count'],
|
|
1658
|
-
line1Connected: nsrb['line-count'] >= 1 ? nsrb['line1-connected'] === true : false,
|
|
1659
|
-
line2Connected: nsrb['line-count'] >= 2 ? nsrb['line2-connected'] === true : false,
|
|
1660
|
-
line3Connected: nsrb['line-count'] >= 3 ? nsrb['line3-connected'] === true : false
|
|
1661
|
-
};
|
|
1662
|
-
//add qRelay to nsrb
|
|
1663
|
-
arr.push(obj);
|
|
1664
|
-
};
|
|
1612
|
+
return obj;
|
|
1613
|
+
});
|
|
1614
|
+
|
|
1615
|
+
const inventoryKeys = inventory.map(i => i.type);
|
|
1616
|
+
const getDevicesByType = (type) => inventory.find(i => i.type === type)?.devices ?? [];
|
|
1665
1617
|
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1618
|
+
// Microinverters
|
|
1619
|
+
const microinverters = getDevicesByType('PCU');
|
|
1620
|
+
this.feature.inventory.pcus.supported = inventoryKeys.includes('PCU');
|
|
1621
|
+
this.feature.inventory.pcus.installed = microinverters.length > 0;
|
|
1622
|
+
if (this.feature.inventory.pcus.installed) {
|
|
1623
|
+
this.pv.inventory.pcus = parseMicroinverters(microinverters);
|
|
1624
|
+
this.feature.inventory.pcus.count = microinverters.length;
|
|
1670
1625
|
}
|
|
1671
|
-
//qRelays
|
|
1672
|
-
this.feature.inventory.nsrbs.supported = qRelaysSupported;
|
|
1673
1626
|
|
|
1674
|
-
//
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
if (
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
const obj = {
|
|
1683
|
-
type: type,
|
|
1684
|
-
partNumber: PartNumbers[esub.part_num] ?? esub.part_num,
|
|
1685
|
-
installed: new Date(esub.installed * 1000).toLocaleString(),
|
|
1686
|
-
serialNumber: esub.serial_num,
|
|
1687
|
-
deviceStatus: esub.device_status,
|
|
1688
|
-
readingTime: new Date(esub.last_rpt_date * 1000).toLocaleString(),
|
|
1689
|
-
adminState: esub.admin_state,
|
|
1690
|
-
devType: esub.dev_type,
|
|
1691
|
-
createdDate: new Date(esub.created_date * 1000).toLocaleString(),
|
|
1692
|
-
imageLoadDate: new Date(esub.img_load_date * 1000).toLocaleString(),
|
|
1693
|
-
firmware: esub.img_pnum_running,
|
|
1694
|
-
ptpn: esub.ptpn,
|
|
1695
|
-
chaneId: esub.chaneid,
|
|
1696
|
-
deviceControl: esub.device_control,
|
|
1697
|
-
producing: esub.producing === true,
|
|
1698
|
-
communicating: esub.communicating === true,
|
|
1699
|
-
operating: esub.operating === true
|
|
1700
|
-
};
|
|
1701
|
-
//add obj to ensemble object
|
|
1702
|
-
arr.push(obj);
|
|
1627
|
+
// AC Batteries
|
|
1628
|
+
const acbs = getDevicesByType('ACB');
|
|
1629
|
+
this.feature.inventory.acbs.supported = inventoryKeys.includes('ACB');
|
|
1630
|
+
this.feature.inventory.acbs.installed = acbs.length > 0;
|
|
1631
|
+
if (this.feature.inventory.acbs.installed) {
|
|
1632
|
+
this.pv.inventory.acbs = parseAcBatteries(acbs);
|
|
1633
|
+
this.feature.inventory.acbs.count = acbs.length;
|
|
1634
|
+
}
|
|
1703
1635
|
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
};
|
|
1636
|
+
// Q-Relays
|
|
1637
|
+
const nsrbs = getDevicesByType('NSRB');
|
|
1638
|
+
this.feature.inventory.nsrbs.supported = inventoryKeys.includes('NSRB');
|
|
1639
|
+
this.feature.inventory.nsrbs.installed = nsrbs.length > 0;
|
|
1640
|
+
if (this.feature.inventory.nsrbs.installed) {
|
|
1641
|
+
this.pv.inventory.nsrbs = parseQRelays(nsrbs);
|
|
1642
|
+
this.feature.inventory.nsrbs.count = nsrbs.length;
|
|
1643
|
+
}
|
|
1713
1644
|
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1645
|
+
// Ensembles
|
|
1646
|
+
const esubs = getDevicesByType('ESUB');
|
|
1647
|
+
this.feature.inventory.esubs.supported = inventoryKeys.includes('ESUB');
|
|
1648
|
+
this.feature.inventory.esubs.installed = esubs.length > 0;
|
|
1649
|
+
if (this.feature.inventory.esubs.installed) {
|
|
1650
|
+
this.pv.inventory.esubs = parseEnsembles(esubs);
|
|
1651
|
+
this.feature.inventory.esubs.count = esubs.length;
|
|
1718
1652
|
}
|
|
1719
|
-
//ensembles
|
|
1720
|
-
this.feature.inventory.esubs.supported = ensemblesSupported;
|
|
1721
1653
|
|
|
1722
|
-
//
|
|
1654
|
+
// Inventory globally supported
|
|
1723
1655
|
this.feature.inventory.supported = true;
|
|
1724
1656
|
|
|
1725
|
-
//
|
|
1726
|
-
if (this.restFulConnected) this.restFul1.update('inventory', inventory)
|
|
1657
|
+
// RESTful & MQTT publishing
|
|
1658
|
+
if (this.restFulConnected) this.restFul1.update('inventory', inventory);
|
|
1727
1659
|
if (this.mqttConnected) this.mqtt1.emit('publish', 'Inventory', inventory);
|
|
1728
1660
|
|
|
1729
1661
|
return true;
|
|
@@ -1732,6 +1664,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1732
1664
|
}
|
|
1733
1665
|
}
|
|
1734
1666
|
|
|
1667
|
+
|
|
1735
1668
|
async updatePcuStatus() {
|
|
1736
1669
|
if (this.enableDebugMode) this.emit('debug', `Requesting pcu status`);
|
|
1737
1670
|
|
|
@@ -2743,44 +2676,24 @@ class EnvoyDevice extends EventEmitter {
|
|
|
2743
2676
|
|
|
2744
2677
|
try {
|
|
2745
2678
|
const response = await this.axiosInstance(ApiUrls.SystemReadingStats);
|
|
2746
|
-
const
|
|
2747
|
-
if (this.enableDebugMode) this.emit('debug', `Production ct:`,
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
const productionCtProductionExist = productionCtKeys.includes('production');
|
|
2756
|
-
if (productionCtProductionExist) {
|
|
2757
|
-
// PCU data at index 0
|
|
2758
|
-
const productionPcu = productionCtData.production[0] ?? [];
|
|
2759
|
-
const productionPcuSupported = productionPcu.length > 0;
|
|
2760
|
-
if (productionPcuSupported) {
|
|
2761
|
-
const obj = {
|
|
2762
|
-
type: 'pcu',
|
|
2763
|
-
activeCount: productionPcu.activeCount,
|
|
2764
|
-
measurementType: 'Production',
|
|
2765
|
-
readingTime: productionPcu.readingTime,
|
|
2766
|
-
power: productionPcu.wNow,
|
|
2767
|
-
energyToday: 0,
|
|
2768
|
-
energyLastSevenDays: 0,
|
|
2769
|
-
energyLifetime: productionPcu.whLifetime
|
|
2770
|
-
};
|
|
2771
|
-
//this.pv.powerAndEnergy.production.pcu = obj;
|
|
2679
|
+
const data = response.data;
|
|
2680
|
+
if (this.enableDebugMode) this.emit('debug', `Production ct:`, data);
|
|
2681
|
+
|
|
2682
|
+
const keys = Object.keys(data);
|
|
2683
|
+
|
|
2684
|
+
// --- Production: PCU ---
|
|
2685
|
+
if (keys.includes('production') && Array.isArray(data.production)) {
|
|
2686
|
+
const productionPcu = data.production[0];
|
|
2687
|
+
if (productionPcu) {
|
|
2772
2688
|
this.feature.productionCt.production.pcu.supported = true;
|
|
2773
2689
|
}
|
|
2774
2690
|
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
const productionEimSupported = productionEim.length > 0;
|
|
2778
|
-
if (productionEimSupported) {
|
|
2779
|
-
const measurementType = ApiCodes[productionEim.measurementType];
|
|
2691
|
+
const productionEim = data.production[1];
|
|
2692
|
+
if (productionEim) {
|
|
2780
2693
|
const obj = {
|
|
2781
2694
|
type: 'eim',
|
|
2782
2695
|
activeCount: 1,
|
|
2783
|
-
measurementType: measurementType,
|
|
2696
|
+
measurementType: ApiCodes[productionEim.measurementType],
|
|
2784
2697
|
readingTime: productionEim.readingTime,
|
|
2785
2698
|
power: productionEim.wNow,
|
|
2786
2699
|
energyToday: productionEim.whToday,
|
|
@@ -2797,63 +2710,61 @@ class EnvoyDevice extends EventEmitter {
|
|
|
2797
2710
|
}
|
|
2798
2711
|
}
|
|
2799
2712
|
|
|
2800
|
-
// Consumption
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
const measurementType = ApiCodes[consumption.measurementType];
|
|
2806
|
-
const key = MetersKeyMap[measurementType];
|
|
2807
|
-
|
|
2713
|
+
// --- Consumption: EIM ---
|
|
2714
|
+
if (keys.includes('consumption') && Array.isArray(data.consumption) && this.feature.meters.consumption.net.enabled) {
|
|
2715
|
+
for (const item of data.consumption) {
|
|
2716
|
+
const type = ApiCodes[item.measurementType];
|
|
2717
|
+
const key = MetersKeyMap[type];
|
|
2808
2718
|
const obj = {
|
|
2809
2719
|
type: 'eim',
|
|
2810
|
-
measurementType:
|
|
2720
|
+
measurementType: type,
|
|
2811
2721
|
activeCount: 1,
|
|
2812
|
-
readingTime:
|
|
2813
|
-
power:
|
|
2814
|
-
energyToday:
|
|
2815
|
-
energyLastSevenDays:
|
|
2816
|
-
energyLifetime:
|
|
2817
|
-
reactivePower:
|
|
2818
|
-
apparentPower:
|
|
2819
|
-
current:
|
|
2820
|
-
voltage:
|
|
2821
|
-
pwrFactor:
|
|
2722
|
+
readingTime: item.readingTime,
|
|
2723
|
+
power: item.wNow,
|
|
2724
|
+
energyToday: item.whToday,
|
|
2725
|
+
energyLastSevenDays: item.whLastSevenDays,
|
|
2726
|
+
energyLifetime: item.whLifetime,
|
|
2727
|
+
reactivePower: item.reactPwr,
|
|
2728
|
+
apparentPower: item.apprntPwr,
|
|
2729
|
+
current: item.rmsCurrent,
|
|
2730
|
+
voltage: item.rmsVoltage,
|
|
2731
|
+
pwrFactor: item.pwrFactor
|
|
2822
2732
|
};
|
|
2823
2733
|
this.pv.powerAndEnergy.consumption.eim[key] = obj;
|
|
2824
2734
|
this.feature.productionCt.consumption.eim[key].supported = true;
|
|
2825
2735
|
}
|
|
2826
2736
|
}
|
|
2827
2737
|
|
|
2828
|
-
//
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
for (const acb of productionCtData.storage) {
|
|
2833
|
-
|
|
2738
|
+
// --- Storage: ACB Summary ---
|
|
2739
|
+
if (keys.includes('storage') && Array.isArray(data.storage) && this.feature.inventory.acbs.installed) {
|
|
2740
|
+
const summary = data.storage[0];
|
|
2741
|
+
if (summary) {
|
|
2834
2742
|
const obj = {
|
|
2835
2743
|
type: 'acb',
|
|
2836
2744
|
measurementType: 'Storage',
|
|
2837
|
-
activeCount:
|
|
2838
|
-
readingTime:
|
|
2839
|
-
powerSum:
|
|
2840
|
-
energySum:
|
|
2841
|
-
chargeStateSum:
|
|
2745
|
+
activeCount: summary.activeCount,
|
|
2746
|
+
readingTime: summary.readingTime,
|
|
2747
|
+
powerSum: summary.wNow,
|
|
2748
|
+
energySum: summary.whNow,
|
|
2749
|
+
chargeStateSum: summary.state
|
|
2842
2750
|
};
|
|
2751
|
+
this.feature.productionCt.storage.supported = true;
|
|
2843
2752
|
|
|
2844
|
-
|
|
2845
|
-
|
|
2753
|
+
// Merge into each ACB in inventory
|
|
2754
|
+
for (let i = 0; i < this.pv.inventory.acbs.length; i++) {
|
|
2755
|
+
this.pv.inventory.acbs[i] = {
|
|
2756
|
+
...this.pv.inventory.acbs[i],
|
|
2757
|
+
...obj
|
|
2758
|
+
};
|
|
2846
2759
|
}
|
|
2847
2760
|
}
|
|
2848
|
-
this.feature.productionCt.storage.supported = true;
|
|
2849
2761
|
}
|
|
2850
2762
|
|
|
2851
|
-
//
|
|
2763
|
+
// --- Finalize ---
|
|
2852
2764
|
this.feature.productionCt.supported = true;
|
|
2853
2765
|
|
|
2854
|
-
|
|
2855
|
-
if (this.
|
|
2856
|
-
if (this.mqttConnected) this.mqtt1.emit('publish', 'Production CT', productionCtData);
|
|
2766
|
+
if (this.restFulConnected) this.restFul1.update('productionct', data);
|
|
2767
|
+
if (this.mqttConnected) this.mqtt1.emit('publish', 'Production CT', data);
|
|
2857
2768
|
|
|
2858
2769
|
return true;
|
|
2859
2770
|
} catch (error) {
|
|
@@ -2861,6 +2772,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
2861
2772
|
}
|
|
2862
2773
|
}
|
|
2863
2774
|
|
|
2775
|
+
|
|
2864
2776
|
async updatePowerAndEnergyData() {
|
|
2865
2777
|
if (this.enableDebugMode) this.emit('debug', `Requesting power and energy data`);
|
|
2866
2778
|
|
|
@@ -7945,7 +7857,6 @@ class EnvoyDevice extends EventEmitter {
|
|
|
7945
7857
|
const updateDetailedDevicesData = updateInventory || this.feature.meters.installed ? await this.updateDetailedDevicesData(true) : false;
|
|
7946
7858
|
const pcusData = updateInventory ? await this.updatePcusData() : false;
|
|
7947
7859
|
const nsrbsData = updateInventory ? await this.updateNsrbsData() : false;
|
|
7948
|
-
const acbsData = this.feature.inventory.acbs.installed ? await this.updateAcbsData() : false;
|
|
7949
7860
|
|
|
7950
7861
|
// Production
|
|
7951
7862
|
const refreshProduction = this.feature.info.firmware < 824 ? await this.updateProduction() : false;
|
|
@@ -7954,6 +7865,9 @@ class EnvoyDevice extends EventEmitter {
|
|
|
7954
7865
|
const refreshProductionCt = this.feature.inventory.acbs.installed || this.feature.meters.installed ? await this.updateProductionCt() : false;
|
|
7955
7866
|
const refreshProductionData = await this.updatePowerAndEnergyData();
|
|
7956
7867
|
|
|
7868
|
+
// Battery
|
|
7869
|
+
const acbsData = this.feature.inventory.acbs.installed ? await this.updateAcbsData() : false;
|
|
7870
|
+
|
|
7957
7871
|
// Ensemble (FW >= 7.x.x)
|
|
7958
7872
|
const refreshEnsemble = firmware7xx && this.feature.inventory.esubs.supported ? await this.updateEnsembleInventory() : false;
|
|
7959
7873
|
const updateEnsembleStatus = refreshEnsemble && this.feature.ensemble.installed ? await this.updateEnsembleStatus() : false;
|