homebridge-enphase-envoy 9.9.4-beta.21 → 9.9.4-beta.4

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/CHANGELOG.md CHANGED
@@ -5,13 +5,6 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [9.9.4] - (xx.03.2025)
9
-
10
- ## Changes
11
-
12
- - config UI improvements [#185](https://github.com/grzegorz914/homebridge-enphase-envoy/issues/185)
13
- - cleanup
14
-
15
8
  ## [9.9.3] - (18.03.2025)
16
9
 
17
10
  ## Changes
@@ -370,7 +370,7 @@
370
370
  }
371
371
  ],
372
372
  "description": "Comparison mode",
373
- "required": true
373
+ "required": false
374
374
  },
375
375
  "powerLevel": {
376
376
  "title": "Power Level",
@@ -529,7 +529,7 @@
529
529
  }
530
530
  ],
531
531
  "description": "Comparison mode",
532
- "required": true
532
+ "required": false
533
533
  },
534
534
  "energyLevel": {
535
535
  "title": "Enargy Level",
@@ -696,7 +696,7 @@
696
696
  }
697
697
  ],
698
698
  "description": "Comparison mode",
699
- "required": true
699
+ "required": false
700
700
  },
701
701
  "powerLevel": {
702
702
  "title": "Power Level",
@@ -863,7 +863,7 @@
863
863
  }
864
864
  ],
865
865
  "description": "Comparison mode",
866
- "required": true
866
+ "required": false
867
867
  },
868
868
  "energyLevel": {
869
869
  "title": "Enargy Level",
@@ -1023,7 +1023,7 @@
1023
1023
  }
1024
1024
  ],
1025
1025
  "description": "Comparison mode",
1026
- "required": true
1026
+ "required": false
1027
1027
  },
1028
1028
  "powerLevel": {
1029
1029
  "title": "Power Level",
@@ -1189,7 +1189,7 @@
1189
1189
  }
1190
1190
  ],
1191
1191
  "description": "Comparison mode",
1192
- "required": true
1192
+ "required": false
1193
1193
  },
1194
1194
  "energyLevel": {
1195
1195
  "title": "Energy Level",
@@ -1391,7 +1391,7 @@
1391
1391
  }
1392
1392
  ],
1393
1393
  "description": "Here select the profile.",
1394
- "required": true
1394
+ "required": false
1395
1395
  },
1396
1396
  "displayType": {
1397
1397
  "title": "Accessory type",
@@ -1604,7 +1604,7 @@
1604
1604
  }
1605
1605
  ],
1606
1606
  "description": "Here select the grid mode.",
1607
- "required": true
1607
+ "required": false
1608
1608
  },
1609
1609
  "displayType": {
1610
1610
  "title": "Accessory type",
@@ -1704,7 +1704,7 @@
1704
1704
  }
1705
1705
  ],
1706
1706
  "description": "Comparison mode",
1707
- "required": true
1707
+ "required": false
1708
1708
  },
1709
1709
  "backupLevel": {
1710
1710
  "title": "Level",
@@ -1930,7 +1930,7 @@
1930
1930
  }
1931
1931
  ],
1932
1932
  "description": "Grid mode",
1933
- "required": true
1933
+ "required": false
1934
1934
  },
1935
1935
  "displayType": {
1936
1936
  "title": "Accessory type",
@@ -2102,7 +2102,7 @@
2102
2102
  }
2103
2103
  ],
2104
2104
  "description": "Grid mode",
2105
- "required": true
2105
+ "required": false
2106
2106
  },
2107
2107
  "displayType": {
2108
2108
  "title": "Accessory type",
@@ -2362,7 +2362,7 @@
2362
2362
  },
2363
2363
  "mode": {
2364
2364
  "title": "Mode",
2365
- "type": "string",
2365
+ "type": "off",
2366
2366
  "default": "off",
2367
2367
  "oneOf": [
2368
2368
  {
@@ -2385,7 +2385,7 @@
2385
2385
  }
2386
2386
  ],
2387
2387
  "description": "Mode",
2388
- "required": true
2388
+ "required": false
2389
2389
  },
2390
2390
  "displayType": {
2391
2391
  "title": "Accessory type",
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.9.4-beta.21",
5
+ "version": "9.9.4-beta.4",
6
6
  "description": "Homebridge plugin for Photovoltaic Energy System manufactured by Enphase.",
7
7
  "license": "MIT",
8
8
  "author": "grzegorz914",
@@ -102,70 +102,83 @@ class EnvoyDevice extends EventEmitter {
102
102
  this.mqttConnected = false;
103
103
 
104
104
  //power production control
105
- this.powerProductionStateActiveControls = [];
105
+ const powerProductionStateControlName = this.powerProductionStateControl.name || false;
106
106
  const powerProductionStateControlDisplayType = this.powerProductionStateControl.displayType ?? 0;
107
- if (powerProductionStateControlDisplayType > 0) {
107
+ this.powerProductionStateActiveControls = [];
108
+ if (powerProductionStateControlName && powerProductionStateControlDisplayType > 0) {
108
109
  const tile = {};
109
- tile.name = this.powerProductionStateControl.name || 'Power Production State Control';
110
+ tile.name = powerProductionStateControlName;
110
111
  tile.namePrefix = this.powerProductionStateControl.namePrefix;
111
112
  tile.serviceType = ['', Service.Switch, Service.Outlet, Service.Lightbulb][powerProductionStateControlDisplayType];
112
113
  tile.characteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.On][powerProductionStateControlDisplayType];
113
114
  tile.state = false;
114
115
  this.powerProductionStateActiveControls.push(tile);
116
+ } else {
117
+ const log = powerProductionStateControlDisplayType === 0 ? false : this.emit('warn', `Tile Name Missing`);
115
118
  };
116
119
  this.powerProductionStateActiveControlsCount = this.powerProductionStateActiveControls.length || 0;
117
120
 
118
121
  //plc level control
119
- this.plcLevelActiveControls = [];
122
+ const plcLevelControlName = this.plcLevelControl.name || false;
120
123
  const plcLevelControlDisplayType = this.plcLevelControl.displayType ?? 0;
121
- if (plcLevelControlDisplayType > 0) {
124
+ this.plcLevelActiveControls = [];
125
+ if (plcLevelControlName && plcLevelControlDisplayType > 0) {
122
126
  const tile = {};
123
- tile.name = this.plcLevelControl.name || 'PLC Level Control';
127
+ tile.name = plcLevelControlName;
124
128
  tile.namePrefix = this.plcLevelControl.namePrefix;
125
129
  tile.serviceType = ['', Service.Switch, Service.Outlet, Service.Lightbulb][plcLevelControlDisplayType];
126
130
  tile.characteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.On][plcLevelControlDisplayType];
127
131
  tile.state = false;
128
132
  this.plcLevelActiveControls.push(tile);
133
+ } else {
134
+ const log = plcLevelControlDisplayType === 0 ? false : this.emit('warn', `Tile Name Missing`);
129
135
  };
130
136
  this.plcLevelActiveControlsCount = this.plcLevelActiveControls.length || 0;
131
137
 
132
138
  //data refresh control
133
- this.dataRefreshActiveControls = [];
139
+ const dataRefreshControlName = this.dataRefreshControl.name || false;
134
140
  const dataRefreshControlDisplayType = this.dataRefreshControl.displayType ?? 0;
135
- if (dataRefreshControlDisplayType > 0) {
141
+ this.dataRefreshActiveControls = [];
142
+ if (dataRefreshControlName && dataRefreshControlDisplayType > 0) {
136
143
  const tile = {};
137
- tile.name = this.dataRefreshControl.name || 'Data Refresh Control';
144
+ tile.name = dataRefreshControlName;
138
145
  tile.namePrefix = this.dataRefreshControl.namePrefix;
139
146
  tile.serviceType = ['', Service.Switch, Service.Outlet, Service.Lightbulb][dataRefreshControlDisplayType];
140
147
  tile.characteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.On][dataRefreshControlDisplayType];
141
148
  tile.state = false;
142
149
  this.dataRefreshActiveControls.push(tile);
150
+ } else {
151
+ const log = dataRefreshControlDisplayType === 0 ? false : this.emit('warn', `Tile Name Missing`);
143
152
  };
144
153
  this.dataRefreshActiveControlsCount = this.dataRefreshActiveControls.length || 0;
145
154
 
146
155
  //data refresh sensor
147
- this.dataRefreshActiveSensors = [];
156
+ const dataRefreshSensorName = this.dataRefreshSensor.name || false;
148
157
  const dataRefreshSensorDisplayType = this.dataRefreshSensor.displayType ?? 0;
149
- if (dataRefreshSensorDisplayType > 0) {
158
+ this.dataRefreshActiveSensors = [];
159
+ if (dataRefreshSensorName && dataRefreshSensorDisplayType > 0) {
150
160
  const sensor = {};
151
- sensor.name = this.dataRefreshSensor.name || 'Data Refresh Sensor';
161
+ sensor.name = dataRefreshSensorName;
152
162
  sensor.namePrefix = this.dataRefreshSensor.namePrefix;
153
163
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][dataRefreshSensorDisplayType];
154
164
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][dataRefreshSensorDisplayType];
155
165
  sensor.state = false;
156
166
  this.dataRefreshActiveSensors.push(sensor);
167
+ } else {
168
+ const log = dataRefreshSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
157
169
  };
158
170
  this.dataRefreshActiveSensorsCount = this.dataRefreshActiveSensors.length || 0;
159
171
 
160
172
  //power production level sensors
161
173
  this.powerProductionLevelActiveSensors = [];
162
174
  for (const sensor of this.powerProductionLevelSensors) {
175
+ const name = sensor.name ?? false;
163
176
  const displayType = sensor.displayType ?? 0;
164
- if (displayType === 0) {
177
+ if (!name || displayType === 0) {
178
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
165
179
  continue;
166
- };
180
+ }
167
181
 
168
- sensor.name = sensor.name || 'Power Production Level Sensor';
169
182
  sensor.compareMode = sensor.compareMode ?? 0;
170
183
  sensor.powerLevel = sensor.powerLevel ?? 0;
171
184
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
@@ -176,41 +189,48 @@ class EnvoyDevice extends EventEmitter {
176
189
  this.powerProductionLevelActiveSensorsCount = this.powerProductionLevelActiveSensors.length || 0;
177
190
 
178
191
  //power production state sensor
179
- this.powerProductionStateActiveSensors = [];
192
+ const powerProductionStateSensorName = this.powerProductionStateSensor.name || false;
180
193
  const powerProductionStateSensorDisplayType = this.powerProductionStateSensor.displayType ?? 0;
181
- if (powerProductionStateSensorDisplayType > 0) {
194
+ this.powerProductionStateActiveSensors = [];
195
+ if (powerProductionStateSensorName && powerProductionStateSensorDisplayType > 0) {
182
196
  const sensor = {};
183
- sensor.name = this.powerProductionStateSensor.name || 'Power Production State Sensor';
197
+ sensor.name = powerProductionStateSensorName;
184
198
  sensor.namePrefix = this.powerProductionStateSensor.namePrefix;
185
199
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][powerProductionStateSensorDisplayType];
186
200
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][powerProductionStateSensorDisplayType];
187
201
  sensor.state = false;
188
202
  this.powerProductionStateActiveSensors.push(sensor);
203
+ } else {
204
+ const log = powerProductionStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
189
205
  };
190
206
  this.powerProductionStateActiveSensorsCount = this.powerProductionStateActiveSensors.length || 0;
191
207
 
192
208
  //energy production state sensor
193
209
  this.energyProductionStateActiveSensors = [];
210
+ const energyProductionStateSensorName = this.energyProductionStateSensor.name || false;
194
211
  const energyProductionStateSensorDisplayType = this.energyProductionStateSensor.displayType ?? 0;
195
- if (energyProductionStateSensorDisplayType > 0) {
212
+ if (energyProductionStateSensorName && energyProductionStateSensorDisplayType > 0) {
196
213
  const sensor = {};
197
- sensor.name = this.energyProductionStateSensor.name || 'Energy Production State Sensor';
214
+ sensor.name = energyProductionStateSensorName;
198
215
  sensor.namePrefix = this.energyProductionStateSensor.namePrefix;
199
216
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][energyProductionStateSensorDisplayType];
200
217
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][energyProductionStateSensorDisplayType];
201
218
  sensor.state = false;
202
219
  this.energyProductionStateActiveSensors.push(sensor);
220
+ } else {
221
+ const log = energyProductionStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
203
222
  };
204
- this.energyProductionStateActiveSensorsCount = this.energyProductionStateActiveSensors.length || 0;
223
+ this.energyProductionStateActiveSensorsCount = this.energyProductionStateActiveSensors.length || 0
205
224
 
206
225
  this.energyProductionLevelActiveSensors = [];
207
226
  for (const sensor of this.energyProductionLevelSensors) {
227
+ const name = sensor.name ?? false;
208
228
  const displayType = sensor.displayType ?? 0;
209
- if (displayType === 0) {
229
+ if (!name || displayType === 0) {
230
+ const log = displayType === 0 ? false : this.emit('info', `Sensor Name Missing`);
210
231
  continue;
211
- };
232
+ }
212
233
 
213
- sensor.name = sensor.name || 'Energy Production Levele Sensor';
214
234
  sensor.compareMode = sensor.compareMode ?? 0;
215
235
  sensor.energyLevel = sensor.energyLevel ?? 0;
216
236
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
@@ -221,27 +241,31 @@ class EnvoyDevice extends EventEmitter {
221
241
  this.energyProductionLevelActiveSensorsCount = this.energyProductionLevelActiveSensors.length || 0;
222
242
 
223
243
  //power consumption total state sensor
224
- this.powerConsumptionTotalStateActiveSensors = [];
244
+ const powerConsumptionTotalStateSensorName = this.powerConsumptionTotalStateSensor.name || false;
225
245
  const powerConsumptionTotalStateSensorDisplayType = this.powerConsumptionTotalStateSensor.displayType ?? 0;
226
- if (powerConsumptionTotalStateSensorDisplayType > 0) {
246
+ this.powerConsumptionTotalStateActiveSensors = [];
247
+ if (powerConsumptionTotalStateSensorName && powerConsumptionTotalStateSensorDisplayType > 0) {
227
248
  const sensor = {};
228
- sensor.name = this.powerConsumptionTotalStateSensor.name || 'Power Consumption Total State Sensor';
249
+ sensor.name = powerConsumptionTotalStateSensorName;
229
250
  sensor.namePrefix = this.powerConsumptionTotalStateSensor.namePrefix;
230
251
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][powerConsumptionTotalStateSensorDisplayType];
231
252
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][powerConsumptionTotalStateSensorDisplayType];
232
253
  sensor.state = false;
233
254
  this.powerConsumptionTotalStateActiveSensors.push(sensor);
255
+ } else {
256
+ const log = powerConsumptionTotalStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
234
257
  };
235
258
  this.powerConsumptionTotalStateActiveSensorsCount = this.powerConsumptionTotalStateActiveSensors.length || 0;
236
259
 
237
260
  this.powerConsumptionTotalLevelActiveSensors = [];
238
261
  for (const sensor of this.powerConsumptionTotalLevelSensors) {
262
+ const name = sensor.name ?? false;
239
263
  const displayType = sensor.displayType ?? 0;
240
- if (displayType === 0) {
264
+ if (!name || displayType === 0) {
265
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
241
266
  continue;
242
- };
267
+ }
243
268
 
244
- sensor.name = sensor.name || 'Power Consumption Total Level Sensor';
245
269
  sensor.compareMode = sensor.compareMode ?? 0;
246
270
  sensor.powerLevel = sensor.powerLevel ?? 0;
247
271
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
@@ -253,26 +277,30 @@ class EnvoyDevice extends EventEmitter {
253
277
 
254
278
  //energy consumption total state sensor
255
279
  this.energyConsumptionTotalStateActiveSensors = [];
280
+ const energyConsumptionTotalStateSensorName = this.energyConsumptionTotalStateSensor.name || false;
256
281
  const energyConsumptionTotalStateSensorDisplayType = this.energyConsumptionTotalStateSensor.displayType ?? 0;
257
- if (energyConsumptionTotalStateSensorDisplayType > 0) {
282
+ if (energyConsumptionTotalStateSensorName && energyConsumptionTotalStateSensorDisplayType > 0) {
258
283
  const sensor = {};
259
- sensor.name = this.this.energyConsumptionTotalStateSensor.name || 'Energy Consumption Total State Sensor';
284
+ sensor.name = energyConsumptionTotalStateSensorName;
260
285
  sensor.namePrefix = this.energyConsumptionTotalStateSensor.namePrefix;
261
286
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][energyConsumptionTotalStateSensorDisplayType];
262
287
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][energyConsumptionTotalStateSensorDisplayType];
263
288
  sensor.state = false;
264
289
  this.energyConsumptionTotalStateActiveSensors.push(sensor);
290
+ } else {
291
+ const log = energyConsumptionTotalStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
265
292
  };
266
- this.energyConsumptionTotalStateActiveSensorsCount = this.energyConsumptionTotalStateActiveSensors.length || 0;
293
+ this.energyConsumptionTotalStateActiveSensorsCount = this.energyConsumptionTotalStateActiveSensors.length || 0
267
294
 
268
295
  this.energyConsumptionTotalLevelActiveSensors = [];
269
296
  for (const sensor of this.energyConsumptionTotalLevelSensors) {
297
+ const name = sensor.name ?? false;
270
298
  const displayType = sensor.displayType ?? 0;
271
- if (displayType === 0) {
299
+ if (!name || displayType === 0) {
300
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
272
301
  continue;
273
- };
302
+ }
274
303
 
275
- sensor.name = sensor.name || 'Energy Consumption Total Level Sensor';
276
304
  sensor.compareMode = sensor.compareMode ?? 0;
277
305
  sensor.energyLevel = sensor.energyLevel ?? 0;
278
306
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
@@ -283,27 +311,31 @@ class EnvoyDevice extends EventEmitter {
283
311
  this.energyConsumptionTotalLevelActiveSensorsCount = this.energyConsumptionTotalLevelActiveSensors.length || 0;
284
312
 
285
313
  //power consumption net state sensor
286
- this.powerConsumptionNetStateActiveSensors = [];
314
+ const powerConsumptionNetStateSensorName = this.powerConsumptionNetStateSensor.name || false;
287
315
  const powerConsumptionNetStateSensorDisplayType = this.powerConsumptionNetStateSensor.displayType ?? 0;
288
- if (powerConsumptionNetStateSensorDisplayType > 0) {
316
+ this.powerConsumptionNetStateActiveSensors = [];
317
+ if (powerConsumptionNetStateSensorName && powerConsumptionNetStateSensorDisplayType > 0) {
289
318
  const sensor = {};
290
- sensor.name = this.this.powerConsumptionNetStateSensor.name || 'Power Consumption Net State Sensor';
319
+ sensor.name = powerConsumptionNetStateSensorName;
291
320
  sensor.namePrefix = this.powerConsumptionNetStateSensor.namePrefix;
292
321
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][powerConsumptionNetStateSensorDisplayType];
293
322
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][powerConsumptionNetStateSensorDisplayType];
294
323
  sensor.state = false;
295
324
  this.powerConsumptionNetStateActiveSensors.push(sensor);
325
+ } else {
326
+ const log = powerConsumptionNetStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
296
327
  };
297
328
  this.powerConsumptionNetStateActiveSensorsCount = this.powerConsumptionNetStateActiveSensors.length || 0;
298
329
 
299
330
  this.powerConsumptionNetLevelActiveSensors = [];
300
331
  for (const sensor of this.powerConsumptionNetLevelSensors) {
332
+ const name = sensor.name ?? false;
301
333
  const displayType = sensor.displayType ?? 0;
302
- if (displayType === 0) {
334
+ if (!name || displayType === 0) {
335
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
303
336
  continue;
304
- };
337
+ }
305
338
 
306
- sensor.name = sensor.name || 'Power Consumption Net Level Sensor';
307
339
  sensor.compareMode = sensor.compareMode ?? 0;
308
340
  sensor.powerLevel = sensor.powerLevel ?? 0;
309
341
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
@@ -315,26 +347,30 @@ class EnvoyDevice extends EventEmitter {
315
347
 
316
348
  //energy consumption net state sensor
317
349
  this.energyConsumptionNetStateActiveSensors = [];
350
+ const energyConsumptionNetStateSensorName = this.energyConsumptionNetStateSensor.name || false;
318
351
  const energyConsumptionNetStateSensorDisplayType = this.energyConsumptionNetStateSensor.displayType ?? 0;
319
- if (energyConsumptionNetStateSensorDisplayType > 0) {
352
+ if (energyConsumptionNetStateSensorName && energyConsumptionNetStateSensorDisplayType > 0) {
320
353
  const sensor = {};
321
- sensor.name = this.this.energyConsumptionNetStateSensor.name || 'Energy Consumption Net State Sensor';
354
+ sensor.name = energyConsumptionNetStateSensorName;
322
355
  sensor.namePrefix = this.energyConsumptionNetStateSensor.namePrefix;
323
356
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][energyConsumptionNetStateSensorDisplayType];
324
357
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][energyConsumptionNetStateSensorDisplayType];
325
358
  sensor.state = false;
326
359
  this.energyConsumptionNetStateActiveSensors.push(sensor);
360
+ } else {
361
+ const log = energyConsumptionNetStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
327
362
  };
328
- this.energyConsumptionNetStateActiveSensorsCount = this.energyConsumptionNetStateActiveSensors.length || 0;
363
+ this.energyConsumptionNetStateActiveSensorsCount = this.energyConsumptionNetStateActiveSensors.length || 0
329
364
 
330
365
  this.energyConsumptionNetLevelActiveSensors = [];
331
366
  for (const sensor of this.energyConsumptionNetLevelSensors) {
367
+ const name = sensor.name ?? false;
332
368
  const displayType = sensor.displayType ?? 0;
333
- if (displayType === 0) {
369
+ if (!name || displayType === 0) {
370
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
334
371
  continue;
335
372
  }
336
373
 
337
- sensor.name = sensor.name || 'Energy Consumption Net Level Sensor';
338
374
  sensor.compareMode = sensor.compareMode ?? 0;
339
375
  sensor.energyLevel = sensor.energyLevel ?? 0;
340
376
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
@@ -345,40 +381,47 @@ class EnvoyDevice extends EventEmitter {
345
381
  this.energyConsumptionNetLevelActiveSensorsCount = this.energyConsumptionNetLevelActiveSensors.length || 0;
346
382
 
347
383
  //enpower grid state control
348
- this.enpowerGridStateActiveControls = [];
384
+ const enpowerGridStateControlName = this.enpowerGridStateControl.name || false;
349
385
  const enpowerGridStateControlDisplaqyType = this.enpowerGridStateControl.displayType ?? 0;
350
- if (enpowerGridStateControlDisplaqyType > 0) {
386
+ this.enpowerGridStateActiveControls = [];
387
+ if (enpowerGridStateControlName && enpowerGridStateControlDisplaqyType > 0) {
351
388
  const tile = {};
352
- tile.name = this.enpowerGridStateControl.name || 'Enpower Grid State Control';
389
+ tile.name = enpowerGridStateControlName;
353
390
  tile.namePrefix = this.enpowerGridStateControl.namePrefix;
354
391
  tile.serviceType = ['', Service.Switch, Service.Outlet, Service.Lightbulb][enpowerGridStateControlDisplaqyType];
355
392
  tile.characteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.On][enpowerGridStateControlDisplaqyType];
356
393
  tile.state = false;
357
394
  this.enpowerGridStateActiveControls.push(tile);
395
+ } else {
396
+ const log = enpowerGridStateControlDisplaqyType === 0 ? false : this.emit('warn', `Tile Name Missing`);
358
397
  };
359
398
  this.enpowerGridStateActiveControlsCount = this.enpowerGridStateActiveControls.length || 0;
360
399
 
361
- this.enpowerGridStateActiveSensors = [];
400
+ const enpowerGridStateSensorName = this.enpowerGridStateSensor.name || false;
362
401
  const enpowerGridStateSensorDisplayType = this.enpowerGridStateSensor.displayType ?? 0;
363
- if (enpowerGridStateSensorDisplayType > 0) {
402
+ this.enpowerGridStateActiveSensors = [];
403
+ if (enpowerGridStateSensorName && enpowerGridStateSensorDisplayType > 0) {
364
404
  const sensor = {};
365
- sensor.name = this.enpowerGridStateSensor.name || 'Enpower Grid State Sensor';
405
+ sensor.name = enpowerGridStateSensorName;
366
406
  sensor.namePrefix = this.enpowerGridStateSensor.namePrefix;
367
407
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][enpowerGridStateSensorDisplayType];
368
408
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][enpowerGridStateSensorDisplayType];
369
409
  sensor.state = false;
370
410
  this.enpowerGridStateActiveSensors.push(sensor);
411
+ } else {
412
+ const log = enpowerGridStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
371
413
  };
372
414
  this.enpowerGridStateActiveSensorsCount = this.enpowerGridStateActiveSensors.length || 0;
373
415
 
374
416
  this.enpowerGridModeActiveSensors = [];
375
417
  for (const sensor of this.enpowerGridModeSensors) {
418
+ const name = sensor.name ?? false;
376
419
  const displayType = sensor.displayType ?? 0;
377
- if (displayType === 0) {
420
+ if (!name || displayType === 0) {
421
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
378
422
  continue;
379
- };
423
+ }
380
424
 
381
- sensor.name = sensor.name || 'Enpower Grid Mode Sensor';
382
425
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
383
426
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][displayType];
384
427
  sensor.state = false;
@@ -387,27 +430,31 @@ class EnvoyDevice extends EventEmitter {
387
430
  this.enpowerGridModeActiveSensorsCount = this.enpowerGridModeActiveSensors.length || 0;
388
431
 
389
432
  //encharge
390
- this.enchargeStateActiveSensors = [];
433
+ const enchargeStateSensorName = this.enchargeStateSensor.name || false;
391
434
  const enchargeStateSensorDisplayType = this.enchargeStateSensor.displayType ?? 0;
392
- if (enchargeStateSensorDisplayType > 0) {
435
+ this.enchargeStateActiveSensors = [];
436
+ if (enchargeStateSensorName && enchargeStateSensorDisplayType > 0) {
393
437
  const sensor = {};
394
- sensor.name = this.enchargeStateSensor.name || 'Encharge State Sensor';
438
+ sensor.name = enchargeStateSensorName;
395
439
  sensor.namePrefix = this.enchargeStateSensor.namePrefix;
396
440
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][enchargeStateSensorDisplayType];
397
441
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][enchargeStateSensorDisplayType];
398
442
  sensor.state = false;
399
443
  this.enchargeStateActiveSensors.push(sensor);
444
+ } else {
445
+ const log = enchargeStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
400
446
  };
401
447
  this.enchargeStateActiveSensorsCount = this.enchargeStateActiveSensors.length || 0;
402
448
 
403
449
  this.enchargeProfileActiveControls = [];
404
450
  for (const tile of this.enchargeProfileControl) {
451
+ const name = tile.name ?? false;
405
452
  const displayType = tile.displayType ?? 0;
406
- if (displayType === 0) {
453
+ if (!name || displayType === 0) {
454
+ const log = displayType === 0 ? false : this.emit('warn', `Tile Name Missing`);
407
455
  continue;
408
456
  }
409
457
 
410
- tile.name = tile.name || 'Echarge profile Control';
411
458
  tile.serviceType = ['', Service.Lightbulb][displayType];
412
459
  tile.characteristicType = ['', Characteristic.On][displayType];
413
460
  tile.state = false;
@@ -418,12 +465,13 @@ class EnvoyDevice extends EventEmitter {
418
465
 
419
466
  this.enchargeProfileActiveSensors = [];
420
467
  for (const sensor of this.enchargeProfileSensors) {
468
+ const name = sensor.name ?? false;
421
469
  const displayType = sensor.displayType ?? 0;
422
- if (displayType === 0) {
470
+ if (!name || displayType === 0) {
471
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
423
472
  continue;
424
- };
473
+ }
425
474
 
426
- sensor.name = sensor.name || 'Encharge Profile Sensor';
427
475
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
428
476
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][displayType];
429
477
  sensor.state = false;
@@ -431,27 +479,31 @@ class EnvoyDevice extends EventEmitter {
431
479
  }
432
480
  this.enchargeProfileActiveSensorsCount = this.enchargeProfileActiveSensors.length || 0;
433
481
 
434
- this.enchargeGridStateActiveSensors = [];
482
+ const enchargeGridStateSensorName = this.enchargeGridStateSensor.name || false;
435
483
  const enchargeGridStateSensorDisplayType = this.enchargeGridStateSensor.displayType ?? 0;
436
- if (enchargeGridStateSensorDisplayType > 0) {
484
+ this.enchargeGridStateActiveSensors = [];
485
+ if (enchargeGridStateSensorName && enchargeGridStateSensorDisplayType > 0) {
437
486
  const sensor = {};
438
- sensor.name = this.enchargeGridStateSensor.name || 'Encharge Grid State Sensor';
487
+ sensor.name = enchargeGridStateSensorName;
439
488
  sensor.namePrefix = this.enchargeGridStateSensor.namePrefix;
440
489
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][enchargeGridStateSensorDisplayType];
441
490
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][enchargeGridStateSensorDisplayType];
442
491
  sensor.state = false;
443
492
  this.enchargeGridStateActiveSensors.push(sensor);
493
+ } else {
494
+ const log = enchargeGridStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
444
495
  };
445
496
  this.enchargeGridStateActiveSensorsCount = this.enchargeGridStateActiveSensors.length || 0;
446
497
 
447
498
  this.enchargeGridModeActiveSensors = [];
448
499
  for (const sensor of this.enchargeGridModeSensors) {
500
+ const name = sensor.name ?? false;
449
501
  const displayType = sensor.displayType ?? 0;
450
- if (displayType === 0) {
502
+ if (!name || displayType === 0) {
503
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
451
504
  continue;
452
- };
505
+ }
453
506
 
454
- sensor.name = sensor.name || 'Encharge Grid Mode Sensor';
455
507
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
456
508
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][displayType];
457
509
  sensor.state = false;
@@ -461,14 +513,16 @@ class EnvoyDevice extends EventEmitter {
461
513
 
462
514
  this.enchargeBackupLevelActiveSensors = [];
463
515
  for (const sensor of this.enchargeBackupLevelSensors) {
516
+ const name = sensor.name ?? false;
517
+ const backupLevel = sensor.backupLevel ?? 0;
464
518
  const displayType = sensor.displayType ?? 0;
465
- if (displayType === 0) {
519
+ if (!name || displayType === 0) {
520
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
466
521
  continue;
467
522
  }
468
523
 
469
- sensor.name = sensor.name || 'Encharge Backup Level Sensor';
470
524
  sensor.compareMode = sensor.compareMode ?? 0;
471
- sensor.backupLevel = sensor.backupLevel ?? 0;
525
+ sensor.backupLevel = backupLevel;
472
526
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
473
527
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][displayType];
474
528
  sensor.state = false;
@@ -477,27 +531,31 @@ class EnvoyDevice extends EventEmitter {
477
531
  this.enchargeBackupLevelActiveSensorsCount = this.enchargeBackupLevelActiveSensors.length || 0;
478
532
 
479
533
  //solar
480
- this.solarGridStateActiveSensors = [];
534
+ const solarGridStateSensorName = this.solarGridStateSensor.name || false;
481
535
  const solarGridStateSensorDisplayType = this.solarGridStateSensor.displayType ?? 0;
482
- if (solarGridStateSensorDisplayType > 0) {
536
+ this.solarGridStateActiveSensors = [];
537
+ if (solarGridStateSensorName && solarGridStateSensorDisplayType > 0) {
483
538
  const sensor = {};
484
- sensor.name = this.solarGridStateSensor.name || 'Solar Grid State Sensor';
539
+ sensor.name = solarGridStateSensorName;
485
540
  sensor.namePrefix = this.solarGridStateSensor.namePrefix;
486
541
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][solarGridStateSensorDisplayType];
487
542
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][solarGridStateSensorDisplayType];
488
543
  sensor.state = false;
489
544
  this.solarGridStateActiveSensors.push(sensor);
545
+ } else {
546
+ const log = solarGridStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
490
547
  };
491
548
  this.solarGridStateActiveSensorsCount = this.solarGridStateActiveSensors.length || 0;
492
549
 
493
550
  this.solarGridModeActiveSensors = [];
494
551
  for (const sensor of this.solarGridModeSensors) {
552
+ const name = sensor.name ?? false;
495
553
  const displayType = sensor.displayType ?? 0;
496
- if (displayType === 0) {
554
+ if (!name || displayType === 0) {
555
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
497
556
  continue;
498
- };
557
+ }
499
558
 
500
- sensor.name = sensor.name || 'Solar Grid Mode Sensor';
501
559
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
502
560
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][displayType];
503
561
  sensor.state = false;
@@ -506,40 +564,47 @@ class EnvoyDevice extends EventEmitter {
506
564
  this.solarGridModeActiveSensorsCount = this.solarGridModeActiveSensors.length || 0;
507
565
 
508
566
  //generator
509
- this.generatorStateActiveControls = [];
567
+ const generatorStateControlName = this.generatorStateControl.name || false;
510
568
  const generatorStateControlDisplaqyType = this.generatorStateControl.displayType ?? 0;
511
- if (generatorStateControlDisplaqyType > 0) {
569
+ this.generatorStateActiveControls = [];
570
+ if (generatorStateControlName && generatorStateControlDisplaqyType > 0) {
512
571
  const tile = {};
513
- tile.name = this.generatorStateControl.name || 'Generator State Control';
572
+ tile.name = generatorStateControlName;
514
573
  tile.namePrefix = this.generatorStateControl.namePrefix;
515
574
  tile.serviceType = ['', Service.Switch, Service.Outlet, Service.Lightbulb][generatorStateControlDisplaqyType];
516
575
  tile.characteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.On][generatorStateControlDisplaqyType];
517
576
  tile.state = false;
518
577
  this.generatorStateActiveControls.push(tile);
578
+ } else {
579
+ const log = generatorStateControlDisplaqyType === 0 ? false : this.emit('warn', `Tile Name Missing`);
519
580
  };
520
581
  this.generatorStateActiveControlsCount = this.generatorStateActiveControls.length || 0;
521
582
 
522
- this.generatorStateActiveSensors = [];
583
+ const generatorStateSensorName = this.generatorStateSensor.name || false;
523
584
  const generatorStateSensorDisplayType = this.generatorStateSensor.displayType ?? 0;
524
- if (generatorStateSensorDisplayType > 0) {
585
+ this.generatorStateActiveSensors = [];
586
+ if (generatorStateSensorName && generatorStateSensorDisplayType > 0) {
525
587
  const sensor = {};
526
- sensor.name = this.generatorStateSensor.name || 'Generator State Sensor';
588
+ sensor.name = generatorStateSensorName;
527
589
  sensor.namePrefix = this.generatorStateSensor.namePrefix;
528
590
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][generatorStateSensorDisplayType];
529
591
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][generatorStateSensorDisplayType];
530
592
  sensor.state = false;
531
593
  this.generatorStateActiveSensors.push(sensor);
594
+ } else {
595
+ const log = generatorStateSensorDisplayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
532
596
  };
533
597
  this.generatorStateActiveSensorsCount = this.generatorStateActiveSensors.length || 0;
534
598
 
535
599
  this.generatorModeActiveControls = [];
536
- for (const tile of this.generatorModeContol) {
600
+ for (const tile of this.generatorModeSensors) {
601
+ const name = tile.name ?? false;
537
602
  const displayType = tile.displayType ?? 0;
538
- if (displayType === 0) {
603
+ if (!name || displayType === 0) {
604
+ const log = displayType === 0 ? false : this.emit('warn', `Tile Name Missing`);
539
605
  continue;
540
- };
606
+ }
541
607
 
542
- tile.name = tile.name || 'Generator Mode Control';
543
608
  tile.serviceType = ['', Service.Switch, Service.Outlet, Service.Lightbulb][displayType];
544
609
  tile.characteristicType = ['', Characteristic.On, Characteristic.On, Characteristic.On][displayType];
545
610
  tile.state = false;
@@ -550,12 +615,13 @@ class EnvoyDevice extends EventEmitter {
550
615
 
551
616
  this.generatorModeActiveSensors = [];
552
617
  for (const sensor of this.generatorModeSensors) {
618
+ const name = sensor.name ?? false;
553
619
  const displayType = sensor.displayType ?? 0;
554
- if (displayType === 0) {
620
+ if (!name || displayType === 0) {
621
+ const log = displayType === 0 ? false : this.emit('warn', `Sensor Name Missing`);
555
622
  continue;
556
- };
623
+ }
557
624
 
558
- sensor.name = sensor.name || 'Generator Mode Sensor';
559
625
  sensor.serviceType = ['', Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][displayType];
560
626
  sensor.characteristicType = ['', Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][displayType];
561
627
  sensor.state = false;
@@ -680,12 +746,11 @@ class EnvoyDevice extends EventEmitter {
680
746
  ensembles: {
681
747
  supported: false,
682
748
  installed: false,
749
+ count: 0,
683
750
  inventory: {
684
751
  supported: false,
752
+ installed: false,
685
753
  count: 0,
686
- },
687
- status: {
688
- supported: false
689
754
  }
690
755
  },
691
756
  enpowers: {
@@ -1623,10 +1688,10 @@ class EnvoyDevice extends EventEmitter {
1623
1688
 
1624
1689
  //ensembles
1625
1690
  this.pv.ensembles = [];
1626
- const ensemblesInventoryExist = inventoryKeys.includes('ESUB');
1627
- const ensemblesInventory = ensemblesInventoryExist ? inventory[3].devices : [];
1628
- const ensemblesInventorySupported = ensemblesInventory.length > 0;
1629
- if (ensemblesInventorySupported) {
1691
+ const ensemblesInventorySupported = inventoryKeys.includes('ESUB');
1692
+ const ensemblesInventory = ensemblesInventorySupported ? inventory[3].devices : [];
1693
+ const ensemblesInventoryInstalled = ensemblesInventory.length > 0;
1694
+ if (ensemblesInventoryInstalled) {
1630
1695
  const type = ApiCodes[inventory[3].type] ?? 'Unknown';
1631
1696
  ensemblesInventory.forEach((ensemble, index) => {
1632
1697
  const obj = {
@@ -1663,8 +1728,8 @@ class EnvoyDevice extends EventEmitter {
1663
1728
  }
1664
1729
  });
1665
1730
 
1666
- //ensembles inventory supported
1667
- this.feature.ensembles.inventory.supported = true;
1731
+ //ensembles installed
1732
+ this.feature.ensembles.inventory.installed = true;
1668
1733
  this.feature.ensembles.inventory.count = ensemblesInventory.length;
1669
1734
  }
1670
1735
  //ensembles supported
@@ -2669,21 +2734,19 @@ class EnvoyDevice extends EventEmitter {
2669
2734
  }
2670
2735
  }
2671
2736
  });
2737
+ this.ensemble.encharges = encharges;
2672
2738
 
2673
2739
  //calculate encharges percent full summ 0 - 100%
2674
- encharges.percentFullSum = Math.min(Math.max((enchargesPercentFullSummary.reduce((total, num) => total + num, 0) / enchargesData.length), 0), 100);
2675
- encharges.energyStateSum = encharges.percentFullSum > 0;
2740
+ this.ensemble.encharges.percentFullSum = Math.min(Math.max((enchargesPercentFullSummary.reduce((total, num) => total + num, 0) / enchargesData.length), 0), 100);
2741
+ this.ensemble.encharges.energyStateSum = this.ensemble.encharges.percentFullSum > 0;
2676
2742
 
2677
2743
  //update services
2678
2744
  if (this.enchargesSummaryLevelAndStateService) {
2679
2745
  this.enchargesSummaryLevelAndStateService
2680
- .updateCharacteristic(Characteristic.On, encharges.energyStateSum)
2681
- .updateCharacteristic(Characteristic.Brightness, encharges.percentFullSum)
2746
+ .updateCharacteristic(Characteristic.On, this.ensemble.encharges.energyStateSum)
2747
+ .updateCharacteristic(Characteristic.Brightness, this.ensemble.encharges.percentFullSum)
2682
2748
  }
2683
2749
 
2684
- //add encharges to ensemble object
2685
- this.ensemble.encharges = encharges;
2686
-
2687
2750
  //feature encharges
2688
2751
  this.feature.encharges.installed = true;
2689
2752
  this.feature.encharges.count = enchargesData.length;
@@ -2802,8 +2865,6 @@ class EnvoyDevice extends EventEmitter {
2802
2865
  }
2803
2866
  }
2804
2867
  });
2805
-
2806
- //add enpower to ensemble object
2807
2868
  this.ensemble.enpowers = enpowers;
2808
2869
 
2809
2870
  //feature enpowers
@@ -2817,7 +2878,7 @@ class EnvoyDevice extends EventEmitter {
2817
2878
 
2818
2879
  //ensemble supported
2819
2880
  this.feature.ensembles.supported = ensembleSupported;
2820
- this.feature.ensembles.installed = this.ensemble.enpowers.installed || this.feature.encharges.installed;
2881
+ this.feature.ensembles.installed = this.feature.enpowers.installed;
2821
2882
 
2822
2883
  //restFul
2823
2884
  const restFul = this.restFulConnected ? this.restFul1.update('ensembleinventory', ensembleInventory) : false;
@@ -2839,10 +2900,10 @@ class EnvoyDevice extends EventEmitter {
2839
2900
 
2840
2901
  //ensemble status keys
2841
2902
  const ensembleStatusKeys = Object.keys(ensembleStatus);
2842
- const ensemblesStatusSupported = ensembleStatusKeys.includes('inventory');
2903
+ const ensemblesSupported = ensembleStatusKeys.includes('inventory');
2843
2904
 
2844
2905
  //ensemble status not exist
2845
- if (ensemblesStatusSupported) {
2906
+ if (ensemblesSupported) {
2846
2907
  const inventory = ensembleStatus.inventory;
2847
2908
 
2848
2909
  //encharges installed
@@ -3077,8 +3138,8 @@ class EnvoyDevice extends EventEmitter {
3077
3138
  this.ensemble.relay = relay;
3078
3139
 
3079
3140
  //update chaaracteristics
3080
- if (this.ensembleStatusService) {
3081
- this.ensembleStatusService
3141
+ if (this.ensembleService) {
3142
+ this.ensembleService
3082
3143
  .updateCharacteristic(Characteristic.enphaseEnsembleRestPower, counters.restPowerKw)
3083
3144
  .updateCharacteristic(Characteristic.enphaseEnsembleFreqBiasHz, secctrl.freqBiasHz)
3084
3145
  .updateCharacteristic(Characteristic.enphaseEnsembleVoltageBiasV, secctrl.voltageBiasV)
@@ -3117,6 +3178,7 @@ class EnvoyDevice extends EventEmitter {
3117
3178
  }
3118
3179
  }
3119
3180
 
3181
+
3120
3182
  //encharge grid mode sensors
3121
3183
  if (this.enchargeGridModeActiveSensorsCount > 0) {
3122
3184
  for (let i = 0; i < this.enchargeGridModeActiveSensorsCount; i++) {
@@ -3132,39 +3194,6 @@ class EnvoyDevice extends EventEmitter {
3132
3194
  }
3133
3195
  }
3134
3196
 
3135
- //encharge backup level sensors
3136
- if (this.enchargeBackupLevelActiveSensorsCount > 0) {
3137
- for (let i = 0; i < this.enchargeBackupLevelActiveSensorsCount; i++) {
3138
- const compareMode = this.enchargeBackupLevelActiveSensors[i].compareMode;
3139
- const backupLevel = this.enchargeBackupLevelActiveSensors[i].backupLevel;
3140
- let state = false;
3141
- switch (compareMode) {
3142
- case 0:
3143
- state = this.ensemble.encharges.percentFullSum > backupLevel;
3144
- break;
3145
- case 1:
3146
- state = this.ensemble.encharges.percentFullSum >= backupLevel;
3147
- break;
3148
- case 2:
3149
- state = this.ensemble.encharges.percentFullSum === backupLevel;
3150
- break;
3151
- case 3:
3152
- state = this.ensemble.encharges.percentFullSum < backupLevel;
3153
- break;
3154
- case 4:
3155
- state = this.ensemble.encharges.percentFullSum <= backupLevel;
3156
- break;
3157
- }
3158
- this.enchargeBackupLevelActiveSensors[i].state = state;
3159
-
3160
- if (this.enchargeBackupLevelSensorsServices) {
3161
- const characteristicType = this.enchargeBackupLevelActiveSensors[i].characteristicType;
3162
- this.enchargeBackupLevelSensorsServices[i]
3163
- .updateCharacteristic(characteristicType, state)
3164
- }
3165
- }
3166
- }
3167
-
3168
3197
  //solar grid state sensor
3169
3198
  if (this.solarGridStateActiveSensorsCount > 0) {
3170
3199
  for (let i = 0; i < this.solarGridStateActiveSensorsCount; i++) {
@@ -3204,14 +3233,14 @@ class EnvoyDevice extends EventEmitter {
3204
3233
  }
3205
3234
 
3206
3235
  //ensemble status supported
3207
- this.feature.ensembles.status.supported = ensemblesStatusSupported;
3236
+ this.feature.ensembles.supported = ensemblesSupported;
3208
3237
 
3209
3238
  //restFul
3210
3239
  const restFul = this.restFulConnected ? this.restFul1.update('ensemblestatus', ensembleStatus) : false;
3211
3240
 
3212
3241
  //mqtt
3213
3242
  const mqtt = this.mqttConnected ? this.mqtt1.emit('publish', 'Ensemble Status', ensembleStatus) : false;
3214
- return ensemblesStatusSupported;
3243
+ return ensemblesSupported;
3215
3244
  } catch (error) {
3216
3245
  throw new Error(`Update ensemble status error: ${error}`);
3217
3246
  };
@@ -3967,6 +3996,9 @@ class EnvoyDevice extends EventEmitter {
3967
3996
  //add devices array to live data object
3968
3997
  liveData.devices = [];
3969
3998
 
3999
+ //add live data to pv object
4000
+ this.pv.liveData = liveData;
4001
+
3970
4002
  //add lived data meteres types add to array
3971
4003
  const activeDeviceTypes = [];
3972
4004
  const pushPvTypeToArray = this.feature.meters.installed && this.feature.meters.production.enabled ? activeDeviceTypes.push({ type: 'PV', meter: liveDataMeters.pv }) : false;
@@ -3976,6 +4008,12 @@ class EnvoyDevice extends EventEmitter {
3976
4008
  const pushLoadTypeToArray = this.feature.meters.installed && this.feature.meters.consumption.enabled ? activeDeviceTypes.push({ type: 'Load', meter: liveDataMeters.load }) : false;
3977
4009
  const pushGeneratorTypeToArray = this.feature.meters.installed && this.feature.generators.installed ? activeDeviceTypes.push({ type: 'Generator', meter: liveDataMeters.generator }) : false;
3978
4010
 
4011
+ //live data exist
4012
+ const liveDataMetersExist = activeDeviceTypes.length > 0;
4013
+ if (!liveDataMetersExist) {
4014
+ return null;
4015
+ }
4016
+
3979
4017
  //iterate over active meters
3980
4018
  activeDeviceTypes.forEach((type, index) => {
3981
4019
  if (!type.meter) return;
@@ -3998,7 +4036,7 @@ class EnvoyDevice extends EventEmitter {
3998
4036
  };
3999
4037
 
4000
4038
  //add device to pv object devices
4001
- liveData.devices.push(obj);
4039
+ this.pv.liveData.devices.push(obj);
4002
4040
 
4003
4041
  //update characteristics
4004
4042
  if (this.liveDataServices) {
@@ -4021,8 +4059,39 @@ class EnvoyDevice extends EventEmitter {
4021
4059
  }
4022
4060
  });
4023
4061
 
4024
- //add live data to pv object
4025
- this.pv.liveData = liveData;
4062
+
4063
+ //encharge backup level sensors
4064
+ if (this.enchargeBackupLevelActiveSensorsCount > 0) {
4065
+ for (let i = 0; i < this.enchargeBackupLevelActiveSensorsCount; i++) {
4066
+ const backupLevel = this.enchargeBackupLevelActiveSensors[i].backupLevel;
4067
+ const compareMode = this.enchargeBackupLevelActiveSensors[i].compareMode;
4068
+ let state = false;
4069
+ switch (compareMode) {
4070
+ case 0:
4071
+ state = liveData.meters.backupSoc > backupLevel;
4072
+ break;
4073
+ case 1:
4074
+ state = liveData.meters.backupSoc >= backupLevel;
4075
+ break;
4076
+ case 2:
4077
+ state = liveData.meters.backupSoc === backupLevel;
4078
+ break;
4079
+ case 3:
4080
+ state = liveData.meters.backupSoc < backupLevel;
4081
+ break;
4082
+ case 4:
4083
+ state = liveData.meters.backupSoc <= backupLevel;
4084
+ break;
4085
+ }
4086
+ this.enchargeBackupLevelActiveSensors[i].state = state;
4087
+
4088
+ if (this.enchargeBackupLevelSensorsServices) {
4089
+ const characteristicType = this.enchargeBackupLevelActiveSensors[i].characteristicType;
4090
+ this.enchargeBackupLevelSensorsServices[i]
4091
+ .updateCharacteristic(characteristicType, state)
4092
+ }
4093
+ }
4094
+ }
4026
4095
 
4027
4096
  //live data installed
4028
4097
  this.feature.liveData.supported = liveDataSupported;
@@ -4443,9 +4512,9 @@ class EnvoyDevice extends EventEmitter {
4443
4512
  const productionCtConsumptionSupported = this.feature.production.ct.consumption.supported;
4444
4513
  const productionCtAcBatterieSupported = this.feature.production.ct.acBatterie.supported
4445
4514
  const powerProductionStateSupported = this.feature.powerProductionState.supported;
4446
- const ensemblesInventorySupported = this.feature.ensembles.inventory.supported;
4515
+ const ensemblesInventoryInstalled = this.feature.ensembles.inventory.installed;
4516
+ const ensemblesInstalled = this.feature.ensembles.installed;
4447
4517
  const ensemblesSupported = this.feature.ensembles.supported;
4448
- const ensemblesStatusSupported = this.feature.ensembles.status.supported;
4449
4518
  const enchargesInstalled = this.feature.encharges.installed;
4450
4519
  const enchargeSettingsSupported = this.feature.encharges.settings.supported;
4451
4520
  const tariffSupported = this.feature.encharges.tariff.supported;
@@ -5759,7 +5828,7 @@ class EnvoyDevice extends EventEmitter {
5759
5828
  //ensemble
5760
5829
  if (ensemblesSupported) {
5761
5830
  //ensembles inventory
5762
- if (ensemblesInventorySupported) {
5831
+ if (ensemblesInventoryInstalled) {
5763
5832
  this.ensemblesInventoryServices = [];
5764
5833
  for (const ensemble of this.pv.ensembles) {
5765
5834
  const debug = this.enableDebugMode ? this.emit('debug', `Prepare Ensemble Inventory Service`) : false;
@@ -5807,137 +5876,137 @@ class EnvoyDevice extends EventEmitter {
5807
5876
  };
5808
5877
 
5809
5878
  //ensembles status summary
5810
- if (ensemblesStatusSupported) {
5811
- const debug = this.enableDebugMode ? this.emit('debug', `Prepare Ensemble Status Service`) : false;
5812
- this.ensembleStatusService = accessory.addService(Service.enphaseEnsembleService, `Ensemble`, 'ensembleService');
5813
- this.ensembleStatusService.setCharacteristic(Characteristic.ConfiguredName, `Ensemble`);
5814
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleRestPower)
5879
+ if (ensemblesInstalled) {
5880
+ const debug = this.enableDebugMode ? this.emit('debug', `Prepare Ensemble Service`) : false;
5881
+ this.ensembleService = accessory.addService(Service.enphaseEnsembleService, `Ensemble`, 'ensembleService');
5882
+ this.ensembleService.setCharacteristic(Characteristic.ConfiguredName, `Ensemble`);
5883
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleRestPower)
5815
5884
  .onGet(async () => {
5816
5885
  const value = this.ensemble.counters.restPowerKw;
5817
5886
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, rest power: ${value} kW`);
5818
5887
  return value;
5819
5888
  });
5820
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHz)
5889
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHz)
5821
5890
  .onGet(async () => {
5822
5891
  const value = this.ensemble.secctrl.freqBiasHz;
5823
5892
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L1 bias frequency: ${value} Hz`);
5824
5893
  return value;
5825
5894
  });
5826
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasV)
5895
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasV)
5827
5896
  .onGet(async () => {
5828
5897
  const value = this.ensemble.secctrl.voltageBiasV;
5829
5898
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L1 bias voltage: ${value} V`);
5830
5899
  return value;
5831
5900
  });
5832
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzQ8)
5901
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzQ8)
5833
5902
  .onGet(async () => {
5834
5903
  const value = this.ensemble.secctrl.freqBiasHzQ8;
5835
5904
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L1 bias q8 frequency: ${value} Hz`);
5836
5905
  return value;
5837
5906
  });
5838
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVQ5)
5907
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVQ5)
5839
5908
  .onGet(async () => {
5840
5909
  const value = this.ensemble.secctrl.voltageBiasVQ5;
5841
5910
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L1 bias q5 voltage: ${value} V`);
5842
5911
  return value;
5843
5912
  });
5844
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzPhaseB)
5913
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzPhaseB)
5845
5914
  .onGet(async () => {
5846
5915
  const value = this.ensemble.secctrl.freqBiasHzPhaseB;
5847
5916
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L2 bias frequency: ${value} Hz`);
5848
5917
  return value;
5849
5918
  });
5850
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVPhaseB)
5919
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVPhaseB)
5851
5920
  .onGet(async () => {
5852
5921
  const value = this.ensemble.secctrl.voltageBiasVPhaseB;
5853
5922
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L2 bias voltage: ${value} V`);
5854
5923
  return value;
5855
5924
  });
5856
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzQ8PhaseB)
5925
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzQ8PhaseB)
5857
5926
  .onGet(async () => {
5858
5927
  const value = this.ensemble.secctrl.freqBiasHzQ8PhaseB;
5859
5928
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L2 bias q8 frequency: ${value} Hz`);
5860
5929
  return value;
5861
5930
  });
5862
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVQ5PhaseB)
5931
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVQ5PhaseB)
5863
5932
  .onGet(async () => {
5864
5933
  const value = this.ensemble.secctrl.voltageBiasVQ5PhaseB;
5865
5934
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L2 bias q5 voltage: ${value} V`);
5866
5935
  return value;
5867
5936
  });
5868
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzPhaseC)
5937
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzPhaseC)
5869
5938
  .onGet(async () => {
5870
5939
  const value = this.ensemble.secctrl.freqBiasHzPhaseC;
5871
5940
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L3 bias frequency: ${value} Hz`);
5872
5941
  return value;
5873
5942
  });
5874
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVPhaseC)
5943
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVPhaseC)
5875
5944
  .onGet(async () => {
5876
5945
  const value = this.ensemble.secctrl.voltageBiasVPhaseC;
5877
5946
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L3 bias voltage: ${value} V`);
5878
5947
  return value;
5879
5948
  });
5880
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzQ8PhaseC)
5949
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleFreqBiasHzQ8PhaseC)
5881
5950
  .onGet(async () => {
5882
5951
  const value = this.ensemble.secctrl.freqBiasHzQ8PhaseC;
5883
5952
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L3 bias q8 frequency: ${value} Hz`);
5884
5953
  return value;
5885
5954
  });
5886
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVQ5PhaseC)
5955
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleVoltageBiasVQ5PhaseC)
5887
5956
  .onGet(async () => {
5888
5957
  const value = this.ensemble.secctrl.voltageBiasVQ5PhaseC;
5889
5958
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, L3 bias q5 voltage: ${value} V`);
5890
5959
  return value;
5891
5960
  });
5892
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleConfiguredBackupSoc)
5961
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleConfiguredBackupSoc)
5893
5962
  .onGet(async () => {
5894
5963
  const value = this.ensemble.secctrl.configuredBackupSoc;
5895
5964
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, configured backup SoC: ${value} %`);
5896
5965
  return value;
5897
5966
  });
5898
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleAdjustedBackupSoc)
5967
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleAdjustedBackupSoc)
5899
5968
  .onGet(async () => {
5900
5969
  const value = this.ensemble.secctrl.adjustedBackupSoc;
5901
5970
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, adjusted backup SoC: ${value} %`);
5902
5971
  return value;
5903
5972
  });
5904
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleAggSoc)
5973
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleAggSoc)
5905
5974
  .onGet(async () => {
5906
5975
  const value = this.ensemble.secctrl.aggSoc;
5907
5976
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, agg SoC: ${value} %`);
5908
5977
  return value;
5909
5978
  });
5910
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleAggMaxEnergy)
5979
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleAggMaxEnergy)
5911
5980
  .onGet(async () => {
5912
5981
  const value = this.ensemble.secctrl.aggMaxEnergyKw;
5913
5982
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, agg max energy: ${value} kWh`);
5914
5983
  return value;
5915
5984
  });
5916
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleEncAggSoc)
5985
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleEncAggSoc)
5917
5986
  .onGet(async () => {
5918
5987
  const value = this.ensemble.secctrl.encAggSoc;
5919
5988
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, encharges agg SoC: ${value} %`);
5920
5989
  return value;
5921
5990
  });
5922
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleEncAggRatedPower)
5991
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleEncAggRatedPower)
5923
5992
  .onGet(async () => {
5924
5993
  const value = this.ensemble.encharges.ratedPowerSumKw;
5925
5994
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, encharges agg rated power: ${value} kW`);
5926
5995
  return value;
5927
5996
  });
5928
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleEncAggPercentFull)
5997
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleEncAggPercentFull)
5929
5998
  .onGet(async () => {
5930
5999
  const value = this.ensemble.encharges.percentFullSum;
5931
6000
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, encharges agg percent full: ${value} %`);
5932
6001
  return value;
5933
6002
  });
5934
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleEncAggBackupEnergy)
6003
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleEncAggBackupEnergy)
5935
6004
  .onGet(async () => {
5936
6005
  const value = this.ensemble.secctrl.encAggBackupEnergy;
5937
6006
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, encharges agg backup energy: ${value} kWh`);
5938
6007
  return value;
5939
6008
  });
5940
- this.ensembleStatusService.getCharacteristic(Characteristic.enphaseEnsembleEncAggAvailEnergy)
6009
+ this.ensembleService.getCharacteristic(Characteristic.enphaseEnsembleEncAggAvailEnergy)
5941
6010
  .onGet(async () => {
5942
6011
  const value = this.ensemble.secctrl.encAggAvailEnergy;
5943
6012
  const info = this.disableLogInfo ? false : this.emit('info', `Ensemble, encharges agg available energy: ${value} kWh`);
@@ -6830,10 +6899,11 @@ class EnvoyDevice extends EventEmitter {
6830
6899
  const refreshProduction = await this.updateProductionInverters();
6831
6900
  const updateProductionCt = refreshProduction ? await this.updateProductionCt() : false;
6832
6901
 
6833
- //get production all D8.2.4391
6834
- const cleanedString = this.pv.envoy.info.software.replace(/\D/g, '')
6835
- const envoyFirmware = cleanedString ? parseInt(cleanedString.slice(0, 3)) : 50;
6836
- const refreshProductionAll = tokenValid && envoyFirmware >= 80 ? await this.updateProductionAll() : false;
6902
+ //get production all
6903
+ const match = this.pv.envoy.info.software.match(/\d+/);
6904
+ const envoyFirmware = match ? parseInt(match[0].slice(0, 3)) : 500;
6905
+ this.emit('success', `${envoyFirmware}`)
6906
+ const refreshProductionAll = tokenValid && envoyFirmware >= 8 ? await this.updateProductionAll() : false;
6837
6907
 
6838
6908
  //access with installer password and envoy dev id
6839
6909
  const updatePowerProductionState = envoyDevIdValid && ((this.pv.envoy.jwtToken.installer && tokenValid) || digestAuthorizationInstaller) ? await this.updateProductionPowerState() : false;