homebridge-enphase-envoy 10.2.6-beta.1 → 10.2.6-beta.3
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/customcharacteristics.js +30 -5
- package/src/energymeter.js +0 -2
- package/src/envoydata.js +0 -3
- package/src/envoydevice.js +141 -91
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.2.6-beta.
|
|
5
|
+
"version": "10.2.6-beta.3",
|
|
6
6
|
"description": "Homebridge p7ugin for Photovoltaic Energy System manufactured by Enphase.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "grzegorz914",
|
|
@@ -251,6 +251,18 @@ export default (api) => {
|
|
|
251
251
|
}
|
|
252
252
|
Characteristic.EnpowerGridMode = EnpowerGridMode;
|
|
253
253
|
|
|
254
|
+
class AddressIp extends Characteristic {
|
|
255
|
+
constructor() {
|
|
256
|
+
super('Address Ip', '00000029-000B-1000-8000-0026BB765291');
|
|
257
|
+
this.setProps({
|
|
258
|
+
format: Formats.STRING,
|
|
259
|
+
perms: [Perms.PAIRED_READ, Perms.NOTIFY]
|
|
260
|
+
});
|
|
261
|
+
this.value = this.getDefaultValue();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
Characteristic.AddressIp = AddressIp;
|
|
265
|
+
|
|
254
266
|
class GeneratorState extends Characteristic {
|
|
255
267
|
constructor() {
|
|
256
268
|
super('Generator state', '00000301-000B-1000-8000-0026BB765291');
|
|
@@ -1073,8 +1085,8 @@ export default (api) => {
|
|
|
1073
1085
|
this.setProps({
|
|
1074
1086
|
format: Formats.FLOAT,
|
|
1075
1087
|
unit: 'A',
|
|
1076
|
-
maxValue:
|
|
1077
|
-
minValue: -
|
|
1088
|
+
maxValue: 1000000,
|
|
1089
|
+
minValue: -1000000,
|
|
1078
1090
|
minStep: 0.1,
|
|
1079
1091
|
perms: [Perms.PAIRED_READ, Perms.NOTIFY]
|
|
1080
1092
|
});
|
|
@@ -1880,16 +1892,29 @@ export default (api) => {
|
|
|
1880
1892
|
}
|
|
1881
1893
|
Service.EnvoyService = EnvoyService;
|
|
1882
1894
|
|
|
1895
|
+
//Wireless connection kit service
|
|
1896
|
+
class NetworkInterfaceService extends Service {
|
|
1897
|
+
constructor(displayName, subtype) {
|
|
1898
|
+
super(displayName, '00000010-000A-1000-8000-0026BB765291', subtype);
|
|
1899
|
+
// Mandatory Characteristics
|
|
1900
|
+
this.addCharacteristic(Characteristic.Type);
|
|
1901
|
+
// Optional Characteristics
|
|
1902
|
+
this.addOptionalCharacteristic(Characteristic.SignalStrength);
|
|
1903
|
+
this.addOptionalCharacteristic(Characteristic.AddressIp);
|
|
1904
|
+
this.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
Service.NetworkInterfaceService = NetworkInterfaceService;
|
|
1908
|
+
|
|
1883
1909
|
//Wireless connection kit service
|
|
1884
1910
|
class WirelessConnectionKitService extends Service {
|
|
1885
1911
|
constructor(displayName, subtype) {
|
|
1886
1912
|
super(displayName, '00000010-000A-1000-8000-0026BB765291', subtype);
|
|
1887
1913
|
// Mandatory Characteristics
|
|
1888
|
-
this.addCharacteristic(Characteristic.
|
|
1914
|
+
this.addCharacteristic(Characteristic.Type);
|
|
1889
1915
|
// Optional Characteristics
|
|
1890
|
-
this.addOptionalCharacteristic(Characteristic.Type);
|
|
1891
1916
|
this.addOptionalCharacteristic(Characteristic.SignalStrength);
|
|
1892
|
-
this.addOptionalCharacteristic(Characteristic.
|
|
1917
|
+
this.addOptionalCharacteristic(Characteristic.Connected);
|
|
1893
1918
|
this.addOptionalCharacteristic(Characteristic.ConfiguredName);
|
|
1894
1919
|
}
|
|
1895
1920
|
}
|
package/src/energymeter.js
CHANGED
|
@@ -21,8 +21,6 @@ class EnergyMeter extends EventEmitter {
|
|
|
21
21
|
this.log = log;
|
|
22
22
|
this.url = url;
|
|
23
23
|
this.name = deviceName;
|
|
24
|
-
this.host = device.host;
|
|
25
|
-
|
|
26
24
|
this.envoyFirmware7xxTokenGenerationMode = device.envoyFirmware7xxTokenGenerationMode;
|
|
27
25
|
this.enlightenUser = device.enlightenUser;
|
|
28
26
|
this.enlightenPasswd = device.enlightenPasswd;
|
package/src/envoydata.js
CHANGED
|
@@ -13,7 +13,6 @@ class EnvoyData extends EventEmitter {
|
|
|
13
13
|
|
|
14
14
|
//device configuration
|
|
15
15
|
this.url = url;
|
|
16
|
-
this.host = device.host;
|
|
17
16
|
this.envoyFirmware7xxTokenGenerationMode = device.envoyFirmware7xxTokenGenerationMode;
|
|
18
17
|
this.envoyPasswd = device.envoyPasswd;
|
|
19
18
|
this.enlightenUser = device.enlightenUser;
|
|
@@ -27,8 +26,6 @@ class EnvoyData extends EventEmitter {
|
|
|
27
26
|
this.ensembleDataRefreshTime = (device.ensembleDataRefreshTime || 15) * 1000;
|
|
28
27
|
|
|
29
28
|
//log
|
|
30
|
-
this.logDeviceInfo = device.log?.deviceInfo || true;
|
|
31
|
-
this.logInfo = device.log?.info || false;
|
|
32
29
|
this.logWarn = device.log?.warn || true;
|
|
33
30
|
this.logError = device.log?.error || true;
|
|
34
31
|
this.logDebug = device.log?.debug || false;
|
package/src/envoydevice.js
CHANGED
|
@@ -20,7 +20,6 @@ class EnvoyDevice extends EventEmitter {
|
|
|
20
20
|
this.url = url;
|
|
21
21
|
this.device = device;
|
|
22
22
|
this.name = deviceName;
|
|
23
|
-
this.host = device.host;
|
|
24
23
|
this.displayType = device.displayType;
|
|
25
24
|
|
|
26
25
|
this.lockControl = device.lockControl || false;
|
|
@@ -104,9 +103,9 @@ class EnvoyDevice extends EventEmitter {
|
|
|
104
103
|
|
|
105
104
|
//system accessoty
|
|
106
105
|
this.systemAccessory = {
|
|
107
|
-
serviceType: [
|
|
108
|
-
characteristicType: [
|
|
109
|
-
characteristicType1: [
|
|
106
|
+
serviceType: [null, Service.Lightbulb, Service.Fan, Service.HumiditySensor, Service.CarbonMonoxideSensor][device.displayType],
|
|
107
|
+
characteristicType: [null, Characteristic.On, Characteristic.On, Characteristic.StatusActive, Characteristic.CarbonMonoxideDetected][device.displayType],
|
|
108
|
+
characteristicType1: [null, Characteristic.Brightness, Characteristic.RotationSpeed, Characteristic.CurrentRelativeHumidity, Characteristic.CarbonMonoxideLevel][device.displayType],
|
|
110
109
|
state: false,
|
|
111
110
|
level: 0
|
|
112
111
|
}
|
|
@@ -114,98 +113,98 @@ class EnvoyDevice extends EventEmitter {
|
|
|
114
113
|
//production state sensor
|
|
115
114
|
if (this.productionStateSensor.displayType > 0) {
|
|
116
115
|
const sensor = this.productionStateSensor;
|
|
117
|
-
sensor.serviceType = [
|
|
118
|
-
sensor.characteristicType = [
|
|
116
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
117
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
119
118
|
sensor.state = false;
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
//plc level check control
|
|
123
122
|
if (this.plcLevelCheckControl.displayType > 0) {
|
|
124
123
|
const tile = this.plcLevelCheckControl;
|
|
125
|
-
tile.serviceType = [
|
|
126
|
-
tile.characteristicType = [
|
|
124
|
+
tile.serviceType = [null, Service.Switch, Service.Outlet, Service.Lightbulb][tile.displayType];
|
|
125
|
+
tile.characteristicType = [null, Characteristic.On, Characteristic.On, Characteristic.On][tile.displayType];
|
|
127
126
|
tile.state = false;
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
//data sampling control
|
|
131
130
|
if (this.dataSamplingControl.displayType > 0) {
|
|
132
131
|
const tile = this.dataSamplingControl;
|
|
133
|
-
tile.serviceType = [
|
|
134
|
-
tile.characteristicType = [
|
|
132
|
+
tile.serviceType = [null, Service.Switch, Service.Outlet, Service.Lightbulb][tile.displayType];
|
|
133
|
+
tile.characteristicType = [null, Characteristic.On, Characteristic.On, Characteristic.On][tile.displayType];
|
|
135
134
|
tile.state = false;
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
//data sampling sensor
|
|
139
138
|
if (this.dataSamplingSensor.displayType > 0) {
|
|
140
139
|
const sensor = this.dataSamplingSensor;
|
|
141
|
-
sensor.serviceType = [
|
|
142
|
-
sensor.characteristicType = [
|
|
140
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
141
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
143
142
|
sensor.state = false;
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
//power production sensors
|
|
147
146
|
for (const sensor of this.powerProductionLevelSensors) {
|
|
148
|
-
sensor.serviceType = [
|
|
149
|
-
sensor.characteristicType = [
|
|
147
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
148
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
150
149
|
sensor.state = false;
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
for (const sensor of this.energyProductionLevelSensors) {
|
|
154
|
-
sensor.serviceType = [
|
|
155
|
-
sensor.characteristicType = [
|
|
153
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
154
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
156
155
|
sensor.state = false;
|
|
157
156
|
}
|
|
158
157
|
|
|
159
158
|
//power consumption total sensor
|
|
160
159
|
for (const sensor of this.powerConsumptionTotalLevelSensors) {
|
|
161
|
-
sensor.serviceType = [
|
|
162
|
-
sensor.characteristicType = [
|
|
160
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
161
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
163
162
|
sensor.state = false;
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
for (const sensor of this.energyConsumptionTotalLevelSensors) {
|
|
167
|
-
sensor.serviceType = [
|
|
168
|
-
sensor.characteristicType = [
|
|
166
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
167
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
169
168
|
sensor.state = false;
|
|
170
169
|
}
|
|
171
170
|
|
|
172
171
|
//power consumption net sensor
|
|
173
172
|
for (const sensor of this.powerConsumptionNetLevelSensors) {
|
|
174
|
-
sensor.serviceType = [
|
|
175
|
-
sensor.characteristicType = [
|
|
173
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
174
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
176
175
|
sensor.state = false;
|
|
177
176
|
}
|
|
178
177
|
|
|
179
178
|
for (const sensor of this.energyConsumptionNetLevelSensors) {
|
|
180
|
-
sensor.serviceType = [
|
|
181
|
-
sensor.characteristicType = [
|
|
179
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
180
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
182
181
|
sensor.state = false;
|
|
183
182
|
}
|
|
184
183
|
|
|
185
184
|
//grid quality sensors
|
|
186
185
|
for (const sensor of this.gridProductionQualitySensors) {
|
|
187
|
-
sensor.serviceType = [
|
|
188
|
-
sensor.characteristicType = [
|
|
186
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
187
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
189
188
|
sensor.state = false;
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
for (const sensor of this.gridConsumptionTotalQualitySensors) {
|
|
193
|
-
sensor.serviceType = [
|
|
194
|
-
sensor.characteristicType = [
|
|
192
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
193
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
195
194
|
sensor.state = false;
|
|
196
195
|
}
|
|
197
196
|
|
|
198
197
|
for (const sensor of this.gridConsumptionNetQualitySensors) {
|
|
199
|
-
sensor.serviceType = [
|
|
200
|
-
sensor.characteristicType = [
|
|
198
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
199
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
201
200
|
sensor.state = false;
|
|
202
201
|
}
|
|
203
202
|
|
|
204
203
|
//qRelay
|
|
205
204
|
if (this.qRelayStateSensor.displayType > 0) {
|
|
206
205
|
const sensor = this.qRelayStateSensor;
|
|
207
|
-
sensor.serviceType = [
|
|
208
|
-
sensor.characteristicType = [
|
|
206
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
207
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
209
208
|
sensor.state0 = false;
|
|
210
209
|
sensor.state1 = false;
|
|
211
210
|
sensor.state2 = false;
|
|
@@ -215,19 +214,19 @@ class EnvoyDevice extends EventEmitter {
|
|
|
215
214
|
//ac battery
|
|
216
215
|
if (this.acBatterieBackupLevelSummaryAccessory.displayType > 0) {
|
|
217
216
|
const tile = this.acBatterieBackupLevelSummaryAccessory;
|
|
218
|
-
tile.serviceType = [
|
|
219
|
-
tile.characteristicType = [
|
|
220
|
-
tile.characteristicType1 = [
|
|
217
|
+
tile.serviceType = [null, Service.Lightbulb, Service.Fan, Service.HumiditySensor, Service.CarbonMonoxideSensor, Service.Battery][tile.displayType];
|
|
218
|
+
tile.characteristicType = [null, Characteristic.On, Characteristic.On, Characteristic.StatusActive, Characteristic.CarbonMonoxideDetected, Characteristic.StatusLowBattery][tile.displayType];
|
|
219
|
+
tile.characteristicType1 = [null, Characteristic.Brightness, Characteristic.RotationSpeed, Characteristic.CurrentRelativeHumidity, Characteristic.CarbonMonoxideLevel, Characteristic.BatteryLevel][tile.displayType];
|
|
221
220
|
tile.state = false;
|
|
222
221
|
tile.backupLevel = 0;
|
|
223
222
|
}
|
|
224
223
|
|
|
225
224
|
if (this.acBatterieBackupLevelAccessory.displayType > 0) {
|
|
226
225
|
const tile = this.acBatterieBackupLevelAccessory;
|
|
227
|
-
tile.serviceType = [
|
|
228
|
-
tile.characteristicType = [
|
|
229
|
-
tile.characteristicType1 = [
|
|
230
|
-
tile.characteristicType2 = [
|
|
226
|
+
tile.serviceType = [null, Service.Battery][tile.displayType];
|
|
227
|
+
tile.characteristicType = [null, Characteristic.StatusLowBattery][tile.displayType];
|
|
228
|
+
tile.characteristicType1 = [null, Characteristic.BatteryLevel][tile.displayType];
|
|
229
|
+
tile.characteristicType2 = [null, Characteristic.ChargingState][tile.displayType];
|
|
231
230
|
tile.state = false;
|
|
232
231
|
tile.backupLevel = 0;
|
|
233
232
|
tile.chargeState = 0;
|
|
@@ -236,46 +235,46 @@ class EnvoyDevice extends EventEmitter {
|
|
|
236
235
|
//enpower
|
|
237
236
|
if (this.enpowerGridStateControl.displayType > 0) {
|
|
238
237
|
const tile = this.enpowerGridStateControl;
|
|
239
|
-
tile.serviceType = [
|
|
240
|
-
tile.characteristicType = [
|
|
238
|
+
tile.serviceType = [null, Service.Switch, Service.Outlet, Service.Lightbulb][tile.displaqyType];
|
|
239
|
+
tile.characteristicType = [null, Characteristic.On, Characteristic.On, Characteristic.On][tile.displaqyType];
|
|
241
240
|
tile.state = false;
|
|
242
241
|
}
|
|
243
242
|
|
|
244
243
|
if (this.enpowerGridStateSensor.displayType > 0) {
|
|
245
244
|
const sensor = this.enpowerGridStateSensor;
|
|
246
|
-
sensor.serviceType = [
|
|
247
|
-
sensor.characteristicType = [
|
|
245
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
246
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
248
247
|
sensor.state = false;
|
|
249
248
|
}
|
|
250
249
|
|
|
251
250
|
for (const sensor of this.enpowerGridModeSensors) {
|
|
252
|
-
sensor.serviceType = [
|
|
253
|
-
sensor.characteristicType = [
|
|
251
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
252
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
254
253
|
sensor.state = false;
|
|
255
254
|
}
|
|
256
255
|
|
|
257
256
|
//encharge
|
|
258
257
|
if (this.enchargeBackupLevelSummaryAccessory.displayType > 0) {
|
|
259
258
|
const tile = this.enchargeBackupLevelSummaryAccessory;
|
|
260
|
-
tile.serviceType = [
|
|
261
|
-
tile.characteristicType = [
|
|
262
|
-
tile.characteristicType1 = [
|
|
259
|
+
tile.serviceType = [null, Service.Lightbulb, Service.Fan, Service.HumiditySensor, Service.CarbonMonoxideSensor, Service.Battery][tile.displayType];
|
|
260
|
+
tile.characteristicType = [null, Characteristic.On, Characteristic.On, Characteristic.StatusActive, Characteristic.CarbonMonoxideDetected, Characteristic.StatusLowBattery][tile.displayType];
|
|
261
|
+
tile.characteristicType1 = [null, Characteristic.Brightness, Characteristic.RotationSpeed, Characteristic.CurrentRelativeHumidity, Characteristic.CarbonMonoxideLevel, Characteristic.BatteryLevel][tile.displayType];
|
|
263
262
|
tile.state = false;
|
|
264
263
|
tile.backupLevel = 0;
|
|
265
264
|
}
|
|
266
265
|
|
|
267
266
|
for (const sensor of this.enchargeBackupLevelSummarySensors) {
|
|
268
|
-
sensor.serviceType = [
|
|
269
|
-
sensor.characteristicType = [
|
|
267
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
268
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
270
269
|
sensor.state = false;
|
|
271
270
|
}
|
|
272
271
|
|
|
273
272
|
if (this.enchargeBackupLevelAccessory.displayType > 0) {
|
|
274
273
|
const tile = this.enchargeBackupLevelAccessory;
|
|
275
|
-
tile.serviceType = [
|
|
276
|
-
tile.characteristicType1 = [
|
|
277
|
-
tile.characteristicType = [
|
|
278
|
-
tile.characteristicType2 = [
|
|
274
|
+
tile.serviceType = [null, Service.Battery][tile.displayType];
|
|
275
|
+
tile.characteristicType1 = [null, Characteristic.StatusLowBattery][tile.displayType];
|
|
276
|
+
tile.characteristicType = [null, Characteristic.BatteryLevel][tile.displayType];
|
|
277
|
+
tile.characteristicType2 = [null, Characteristic.ChargingState][tile.displayType];
|
|
279
278
|
tile.state = false;
|
|
280
279
|
tile.backupLevel = 0;
|
|
281
280
|
tile.chargeState = 0;
|
|
@@ -283,77 +282,77 @@ class EnvoyDevice extends EventEmitter {
|
|
|
283
282
|
|
|
284
283
|
if (this.enchargeStateSensor.displayType > 0) {
|
|
285
284
|
const sensor = this.enchargeStateSensor;
|
|
286
|
-
sensor.serviceType = [
|
|
287
|
-
sensor.characteristicType = [
|
|
285
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
286
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
288
287
|
sensor.state = false;
|
|
289
288
|
}
|
|
290
289
|
|
|
291
290
|
for (const tile of this.enchargeProfileControls) {
|
|
292
|
-
tile.serviceType = [
|
|
293
|
-
tile.characteristicType = [
|
|
291
|
+
tile.serviceType = [null, Service.Lightbulb][tile.displayType];
|
|
292
|
+
tile.characteristicType = [null, Characteristic.On][tile.displayType];
|
|
294
293
|
tile.state = false;
|
|
295
294
|
tile.reservedSoc = 0;
|
|
296
295
|
tile.previousState = null;
|
|
297
296
|
}
|
|
298
297
|
|
|
299
298
|
for (const sensor of this.enchargeProfileSensors) {
|
|
300
|
-
sensor.serviceType = [
|
|
301
|
-
sensor.characteristicType = [
|
|
299
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
300
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
302
301
|
sensor.state = false;
|
|
303
302
|
}
|
|
304
303
|
|
|
305
304
|
if (this.enchargeGridStateSensor.displayType > 0) {
|
|
306
305
|
const sensor = this.enchargeGridStateSensor;
|
|
307
|
-
sensor.serviceType = [
|
|
308
|
-
sensor.characteristicType = [
|
|
306
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
307
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
309
308
|
sensor.state = false;
|
|
310
309
|
}
|
|
311
310
|
|
|
312
311
|
for (const sensor of this.enchargeGridModeSensors) {
|
|
313
|
-
sensor.serviceType = [
|
|
314
|
-
sensor.characteristicType = [
|
|
312
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
313
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
315
314
|
sensor.state = false;
|
|
316
315
|
}
|
|
317
316
|
|
|
318
317
|
//solar
|
|
319
318
|
if (this.solarGridStateSensor.displayType > 0) {
|
|
320
319
|
const sensor = this.solarGridStateSensor;
|
|
321
|
-
sensor.serviceType = [
|
|
322
|
-
sensor.characteristicType = [
|
|
320
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
321
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
323
322
|
sensor.state = false;
|
|
324
323
|
}
|
|
325
324
|
|
|
326
325
|
for (const sensor of this.solarGridModeSensors) {
|
|
327
|
-
sensor.serviceType = [
|
|
328
|
-
sensor.characteristicType = [
|
|
326
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
327
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
329
328
|
sensor.state = false;
|
|
330
329
|
}
|
|
331
330
|
|
|
332
331
|
//generator
|
|
333
332
|
if (this.generatorStateControl.displayType > 0) {
|
|
334
333
|
const tile = this.generatorStateControl;
|
|
335
|
-
tile.serviceType = [
|
|
336
|
-
tile.characteristicType = [
|
|
334
|
+
tile.serviceType = [null, Service.Switch, Service.Outlet, Service.Lightbulb][tile.displaqyType];
|
|
335
|
+
tile.characteristicType = [null, Characteristic.On, Characteristic.On, Characteristic.On][tile.displaqyType];
|
|
337
336
|
tile.state = false;
|
|
338
337
|
}
|
|
339
338
|
|
|
340
339
|
if (this.generatorStateSensor.displayType > 0) {
|
|
341
340
|
const sensor = this.generatorStateSensor;
|
|
342
|
-
sensor.serviceType = [
|
|
343
|
-
sensor.characteristicType = [
|
|
341
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
342
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
344
343
|
sensor.state = false;
|
|
345
344
|
}
|
|
346
345
|
|
|
347
346
|
for (const tile of this.generatorModeContols) {
|
|
348
|
-
tile.serviceType = [
|
|
349
|
-
tile.characteristicType = [
|
|
347
|
+
tile.serviceType = [null, Service.Switch, Service.Outlet, Service.Lightbulb][tile.displayType];
|
|
348
|
+
tile.characteristicType = [null, Characteristic.On, Characteristic.On, Characteristic.On][tile.displayType];
|
|
350
349
|
tile.state = false;
|
|
351
350
|
tile.previousState = null;
|
|
352
351
|
}
|
|
353
352
|
|
|
354
353
|
for (const sensor of this.generatorModeSensors) {
|
|
355
|
-
sensor.serviceType = [
|
|
356
|
-
sensor.characteristicType = [
|
|
354
|
+
sensor.serviceType = [null, Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensor.displayType];
|
|
355
|
+
sensor.characteristicType = [null, Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensor.displayType];
|
|
357
356
|
sensor.state = false;
|
|
358
357
|
}
|
|
359
358
|
|
|
@@ -742,6 +741,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
742
741
|
const plcLevelNrsbsSupported = this.feature.plcLevel.nsrbs.supported;
|
|
743
742
|
const plcLevelAcbsSupported = this.feature.plcLevel.acbs.supported;
|
|
744
743
|
const envoySupported = this.feature.home.supported;
|
|
744
|
+
const networkInterfacesInstalled = this.feature.home.networkInterfaces.installed;
|
|
745
745
|
const wirelessConnectionsInstalled = this.feature.home.wirelessConnections.installed;
|
|
746
746
|
const metersInstalled = this.feature.meters.installed;
|
|
747
747
|
const pcuInstalled = this.feature.inventory.pcus.installed;
|
|
@@ -1210,9 +1210,41 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
1212
1212
|
|
|
1213
|
+
// Wireless connection kits
|
|
1214
|
+
if (networkInterfacesInstalled) {
|
|
1215
|
+
this.networkInterfacesServices = [];
|
|
1216
|
+
|
|
1217
|
+
for (const networkInterface of home.networkInterfaces) {
|
|
1218
|
+
const interfaceType = networkInterface.type;
|
|
1219
|
+
if (this.logDebug) this.emit('debug', `Prepare Network Interface ${interfaceType} Service`);
|
|
1220
|
+
|
|
1221
|
+
const networkInterfaceService = accessory.addService(Service.NetworkInterfaceService, `Network Interface ${interfaceType}`, `networkInterfaceService${interfaceType}`);
|
|
1222
|
+
networkInterfaceService.setCharacteristic(Characteristic.ConfiguredName, `Network Interface ${interfaceType}`);
|
|
1223
|
+
|
|
1224
|
+
const Characteristics1 = [
|
|
1225
|
+
{ type: Characteristic.Type, label: 'type', value: networkInterface.type },
|
|
1226
|
+
{ type: Characteristic.AddressIp, label: 'address IP ', value: networkInterface.ip },
|
|
1227
|
+
{ type: Characteristic.SignalStrength, label: 'signal strength', value: networkInterface.signalStrength, unit: '%' }
|
|
1228
|
+
];
|
|
1229
|
+
|
|
1230
|
+
for (const { type, value, label, unit = '', postfix = '' } of Characteristics1) {
|
|
1231
|
+
if (!this.functions.isValidValue(value)) continue;
|
|
1232
|
+
|
|
1233
|
+
networkInterfaceService.getCharacteristic(type)
|
|
1234
|
+
.onGet(async () => {
|
|
1235
|
+
const currentValue = value;
|
|
1236
|
+
if (this.logInfo) this.emit('info', `Network Interface ${interfaceType}, ${label}: ${unit !== '' ? `${currentValue} ${unit}` : postfix !== '' ? `${postfix}` : `${currentValue}`}`);
|
|
1237
|
+
return currentValue;
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
this.networkInterfacesServices.push(networkInterfaceService);
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1213
1245
|
// Wireless connection kits
|
|
1214
1246
|
if (wirelessConnectionsInstalled) {
|
|
1215
|
-
this.
|
|
1247
|
+
this.wirelessConnectionsKitServices = [];
|
|
1216
1248
|
|
|
1217
1249
|
for (const wirelessConnection of home.wirelessKits) {
|
|
1218
1250
|
const connectionType = wirelessConnection.type;
|
|
@@ -1224,8 +1256,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1224
1256
|
const wirelessCharacteristics = [
|
|
1225
1257
|
{ type: Characteristic.Type, label: 'type', value: wirelessConnection.type },
|
|
1226
1258
|
{ type: Characteristic.Connected, label: 'state', value: wirelessConnection.connected, postfix: `${wirelessConnection.connected ? 'Connected' : 'Disconnected'}` },
|
|
1227
|
-
{ type: Characteristic.SignalStrength, label: 'signal strength', value: wirelessConnection.signalStrength, unit: '%' }
|
|
1228
|
-
{ type: Characteristic.SignalStrengthMax, label: 'signal strength max', value: wirelessConnection.signalStrengthMax, unit: '%' },
|
|
1259
|
+
{ type: Characteristic.SignalStrength, label: 'signal strength', value: wirelessConnection.signalStrength, unit: '%' }
|
|
1229
1260
|
];
|
|
1230
1261
|
|
|
1231
1262
|
for (const { type, value, label, unit = '', postfix = '' } of wirelessCharacteristics) {
|
|
@@ -1239,7 +1270,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
1239
1270
|
});
|
|
1240
1271
|
}
|
|
1241
1272
|
|
|
1242
|
-
this.
|
|
1273
|
+
this.wirelessConnectionsKitServices.push(wirelessService);
|
|
1243
1274
|
}
|
|
1244
1275
|
}
|
|
1245
1276
|
|
|
@@ -3077,8 +3108,8 @@ class EnvoyDevice extends EventEmitter {
|
|
|
3077
3108
|
dhcp: iface.dhcp,
|
|
3078
3109
|
ip: iface.ip,
|
|
3079
3110
|
carrier: !!iface.carrier,
|
|
3080
|
-
signalStrength: this.functions.scaleValue(iface.signal_strength, 0,
|
|
3081
|
-
signalStrengthMax:
|
|
3111
|
+
signalStrength: this.functions.scaleValue(iface.signal_strength, 0, iface.signal_strength_max, 0, 100),
|
|
3112
|
+
signalStrengthMax: iface.signal_strength_max,
|
|
3082
3113
|
supported: iface.type === 'wifi' ? iface.supported : null,
|
|
3083
3114
|
present: iface.type === 'wifi' ? iface.present : null,
|
|
3084
3115
|
configured: iface.type === 'wifi' ? iface.configured : null,
|
|
@@ -3095,8 +3126,8 @@ class EnvoyDevice extends EventEmitter {
|
|
|
3095
3126
|
|
|
3096
3127
|
// Process wireless connection kits (synchronous)
|
|
3097
3128
|
const wirelessKits = wirelessConnections.map(kit => ({
|
|
3098
|
-
signalStrength: this.functions.scaleValue(kit.signal_strength, 0,
|
|
3099
|
-
signalStrengthMax:
|
|
3129
|
+
signalStrength: this.functions.scaleValue(kit.signal_strength, 0, kit.signal_strength_max, 0, 100),
|
|
3130
|
+
signalStrengthMax: kit.signal_strength_max,
|
|
3100
3131
|
type: ApiCodes[kit.type] ?? kit.type,
|
|
3101
3132
|
connected: !!kit.connected
|
|
3102
3133
|
}));
|
|
@@ -3170,21 +3201,40 @@ class EnvoyDevice extends EventEmitter {
|
|
|
3170
3201
|
this.envoyService?.updateCharacteristic(type, value);
|
|
3171
3202
|
}
|
|
3172
3203
|
|
|
3204
|
+
// Network interfaces
|
|
3205
|
+
if (this.feature.home.networkInterfaces.installed) {
|
|
3206
|
+
interfaces?.forEach((interface, index) => {
|
|
3207
|
+
if (!interface.carrier) return;
|
|
3208
|
+
|
|
3209
|
+
// Create characteristics
|
|
3210
|
+
const characteristics1 = [
|
|
3211
|
+
{ type: Characteristic.Type, value: interface.type },
|
|
3212
|
+
{ type: Characteristic.AddressIp, value: interface.ip },
|
|
3213
|
+
{ type: Characteristic.SignalStrength, value: interface.signalStrength },
|
|
3214
|
+
];
|
|
3215
|
+
|
|
3216
|
+
// Update envoy services
|
|
3217
|
+
for (const { type, value } of characteristics1) {
|
|
3218
|
+
if (!this.functions.isValidValue(value)) continue;
|
|
3219
|
+
this.networkInterfacesServices?.[index]?.updateCharacteristic(type, value);
|
|
3220
|
+
}
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3173
3224
|
// Wireless connection characteristics
|
|
3174
3225
|
if (this.feature.home.wirelessConnections.installed) {
|
|
3175
|
-
|
|
3226
|
+
wirelessKits?.forEach((kit, index) => {
|
|
3176
3227
|
if (!kit) return;
|
|
3177
3228
|
|
|
3178
3229
|
// Create characteristics
|
|
3179
|
-
const
|
|
3230
|
+
const characteristics2 = [
|
|
3180
3231
|
{ type: Characteristic.SignalStrength, value: kit.signalStrength },
|
|
3181
|
-
{ type: Characteristic.SignalStrengthMax, value: kit.signalStrengthMax },
|
|
3182
3232
|
{ type: Characteristic.Type, value: kit.type },
|
|
3183
3233
|
{ type: Characteristic.Connected, value: kit.connected },
|
|
3184
3234
|
];
|
|
3185
3235
|
|
|
3186
3236
|
// Update envoy services
|
|
3187
|
-
for (const { type, value } of
|
|
3237
|
+
for (const { type, value } of characteristics2) {
|
|
3188
3238
|
if (!this.functions.isValidValue(value)) continue;
|
|
3189
3239
|
this.wirelessConnectionsKitServices?.[index]?.updateCharacteristic(type, value);
|
|
3190
3240
|
}
|
|
@@ -4400,7 +4450,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4400
4450
|
for (const { type, value, valueKey } of characteristics) {
|
|
4401
4451
|
if (!this.functions.isValidValue(value)) continue;
|
|
4402
4452
|
sensor[valueKey] = value;
|
|
4403
|
-
this.
|
|
4453
|
+
this.enchargeGridStateSensorService?.updateCharacteristic(type, value);
|
|
4404
4454
|
}
|
|
4405
4455
|
}
|
|
4406
4456
|
|
|
@@ -4910,7 +4960,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
4910
4960
|
};
|
|
4911
4961
|
}
|
|
4912
4962
|
|
|
4913
|
-
|
|
4963
|
+
enpowerData.dryContacts.push(dryContactData);
|
|
4914
4964
|
});
|
|
4915
4965
|
}
|
|
4916
4966
|
|
|
@@ -5046,7 +5096,7 @@ class EnvoyDevice extends EventEmitter {
|
|
|
5046
5096
|
{ type: Characteristic.MidState, value: updatedCollarsData.midState },
|
|
5047
5097
|
{ type: Characteristic.GridState, value: updatedCollarsData.gridState },
|
|
5048
5098
|
{ type: Characteristic.Communicating, value: updatedCollarsData.communicating },
|
|
5049
|
-
{ type: Characteristic.
|
|
5099
|
+
{ type: Characteristic.Temperature, value: updatedCollarsData.temperature },
|
|
5050
5100
|
{ type: Characteristic.ReadingTime, value: updatedCollarsData.readingTime }
|
|
5051
5101
|
];
|
|
5052
5102
|
|