homebridge-enphase-envoy 10.3.1-beta.7 → 10.3.1-beta.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/envoydata.js +16 -12
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.3.1-beta.7",
5
+ "version": "10.3.1-beta.9",
6
6
  "description": "Homebridge p7ugin for Photovoltaic Energy System manufactured by Enphase.",
7
7
  "license": "MIT",
8
8
  "author": "grzegorz914",
package/src/envoydata.js CHANGED
@@ -906,32 +906,36 @@ class EnvoyData extends EventEmitter {
906
906
  const home = response.data;
907
907
  if (this.logDebug) this.emit('debug', 'Home:', home);
908
908
 
909
- const network = home.network ?? {};
910
- network.interfaces = (network.interfaces ?? []).filter(iface => iface.ip !== '169.254.120.1');
911
- home.wireless_connection = (home.wireless_connection ?? []).filter(kit => kit.signal_strength_max > 0);
912
-
913
909
  // Communication device support flags
914
910
  const microinvertersSupported = 'pcu' in home.comm;
915
911
  const acBatteriesSupported = 'acb' in home.comm;
916
912
  const qRelaysSupported = 'nsrb' in home.comm;
917
913
  const ensemblesSupported = 'esub' in home.comm;
918
914
  const enchargesSupported = 'encharge' in home.comm;
919
- this.pv.home = home;
920
915
 
921
- // Update feature flags
922
916
  this.feature.inventory.pcus.supported = microinvertersSupported;
923
917
  this.feature.inventory.acbs.supported = acBatteriesSupported;
924
918
  this.feature.inventory.nsrbs.supported = qRelaysSupported;
925
919
  this.feature.inventory.esubs.supported = ensemblesSupported;
926
920
  this.feature.inventory.esubs.encharges.supported = enchargesSupported;
927
921
 
928
- this.feature.home.networkInterfaces.supported = network.interfaces.length > 0;
929
- this.feature.home.networkInterfaces.installed = network.interfaces.some(i => i.carrier);
930
- this.feature.home.networkInterfaces.count = network.interfaces.length;
922
+ const networkInterfacesSupported = 'interfaces' in home.network;
923
+ if (networkInterfacesSupported) {
924
+ home.network.interfaces = (home.network.interfaces ?? []).filter(iface => iface.carrier === true || iface.ip !== '169.254.120.1');
925
+ this.feature.home.networkInterfaces.supported = networkInterfacesSupported;
926
+ this.feature.home.networkInterfaces.installed = home.network.interfaces.length > 0;
927
+ this.feature.home.networkInterfaces.count = home.network.interfaces.length;
928
+ }
929
+
930
+ const wirelessConnectionsSupported = 'wireless_connection' in home;
931
+ if (wirelessConnectionsSupported) {
932
+ home.wireless_connection = (home.wireless_connection ?? []).filter(kit => kit.signal_strength_max > 0);
933
+ this.feature.home.wirelessConnections.supported = wirelessConnectionsSupported;
934
+ this.feature.home.wirelessConnections.installed = home.wireless_connection.length > 0;
935
+ this.feature.home.wirelessConnections.count = home.wireless_connection.length;
936
+ }
931
937
 
932
- this.feature.home.wirelessConnections.supported = home.wireless_connection.length > 0;
933
- this.feature.home.wirelessConnections.installed = home.wireless_connection.some(w => w.connected);
934
- this.feature.home.wirelessConnections.count = home.wireless_connection.length;
938
+ this.pv.home = home;
935
939
  this.feature.home.supported = true;
936
940
 
937
941
  // RESTful + MQTT