homebridge-enphase-envoy 10.3.1-beta.8 → 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 -14
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.8",
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,34 +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.carrier === true || 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
- const networkInterfacesSupported = 'interfaces' in network;
920
- const wirelessConnectionsSupported = 'wireless_connection' in home;
921
- this.pv.home = home;
922
915
 
923
- // Update feature flags
924
916
  this.feature.inventory.pcus.supported = microinvertersSupported;
925
917
  this.feature.inventory.acbs.supported = acBatteriesSupported;
926
918
  this.feature.inventory.nsrbs.supported = qRelaysSupported;
927
919
  this.feature.inventory.esubs.supported = ensemblesSupported;
928
920
  this.feature.inventory.esubs.encharges.supported = enchargesSupported;
929
921
 
930
- this.feature.home.networkInterfaces.supported = networkInterfacesSupported;
931
- this.feature.home.networkInterfaces.installed = network.interfaces.length > 0;
932
- 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
+ }
933
937
 
934
- this.feature.home.wirelessConnections.supported = wirelessConnectionsSupported;
935
- this.feature.home.wirelessConnections.installed = home.wireless_connection.length > 0;
936
- this.feature.home.wirelessConnections.count = home.wireless_connection.length;
938
+ this.pv.home = home;
937
939
  this.feature.home.supported = true;
938
940
 
939
941
  // RESTful + MQTT