iobroker.device-watcher 2.2.0 → 2.2.1
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/README.md +5 -0
- package/admin/jsonConfig.json +19 -0
- package/io-package.json +16 -14
- package/lib/arrApart.js +9 -0
- package/main.js +188 -187
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,6 +90,11 @@ If you don't want a specifice device in the list, you can add it in the blacklis
|
|
|
90
90
|
Placeholder for the next version (at the beginning of the line):
|
|
91
91
|
### **WORK IN PROGRESS**
|
|
92
92
|
-->
|
|
93
|
+
### 2.2.1 (2022-12-28)
|
|
94
|
+
|
|
95
|
+
- (ciddi89) Innogy Smarthome added
|
|
96
|
+
- (ciddi89) Lists for each adapter are working again
|
|
97
|
+
|
|
93
98
|
### 2.2.0 (2022-12-27)
|
|
94
99
|
|
|
95
100
|
- (Scrounger) Yamaha MusicCast adapter added
|
package/admin/jsonConfig.json
CHANGED
|
@@ -116,6 +116,13 @@
|
|
|
116
116
|
"lg": 3,
|
|
117
117
|
"label": "Hue Extended"
|
|
118
118
|
},
|
|
119
|
+
"innogyDevices": {
|
|
120
|
+
"type": "checkbox",
|
|
121
|
+
"sm": 6,
|
|
122
|
+
"md": 6,
|
|
123
|
+
"lg": 3,
|
|
124
|
+
"label": "Innogy Smarthome"
|
|
125
|
+
},
|
|
119
126
|
"jeelinkDevices": {
|
|
120
127
|
"type": "checkbox",
|
|
121
128
|
"sm": 6,
|
|
@@ -1219,6 +1226,18 @@
|
|
|
1219
1226
|
"hidden": "!data.hueExtDevices",
|
|
1220
1227
|
"hideOnlyControl": false
|
|
1221
1228
|
},
|
|
1229
|
+
"innogyMaxMinutes": {
|
|
1230
|
+
"type": "number",
|
|
1231
|
+
"min": 0,
|
|
1232
|
+
"max": 100000,
|
|
1233
|
+
"sm": 6,
|
|
1234
|
+
"md": 6,
|
|
1235
|
+
"lg": 3,
|
|
1236
|
+
"label": "Innogy Smarthome",
|
|
1237
|
+
"help": "in minutes",
|
|
1238
|
+
"hidden": "!data.innogyDevices",
|
|
1239
|
+
"hideOnlyControl": false
|
|
1240
|
+
},
|
|
1222
1241
|
"jeelinkMaxMinutes": {
|
|
1223
1242
|
"type": "number",
|
|
1224
1243
|
"min": 1,
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "device-watcher",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"news": {
|
|
6
|
+
"2.2.1": {
|
|
7
|
+
"en": "Innogy Smarthome added\nLists for each adapter are working again",
|
|
8
|
+
"de": "Innogy Smarthome hinzugefügt\nListen für jeden Adapter arbeiten wieder",
|
|
9
|
+
"ru": "Innogy Smarthome добавлено\nСписки для каждого адаптера работают снова",
|
|
10
|
+
"pt": "Innogy Smarthome adicionado\nListas para cada adaptador estão funcionando novamente",
|
|
11
|
+
"nl": "Innogy Smarthome toegevoegd\nLeugens voor elke adapter werken weer",
|
|
12
|
+
"fr": "Innogy Smarthome ajouté\nLes listes pour chaque adaptateur fonctionnent à nouveau",
|
|
13
|
+
"it": "Innogy Smarthome aggiunto\nLe liste per ogni adattatore funzionano di nuovo",
|
|
14
|
+
"es": "Innogy Smarthome añadido\nListas para cada adaptador están trabajando de nuevo",
|
|
15
|
+
"pl": "Innogia Smarthome dodała\nLista do każdej adaptacji ponownie działa",
|
|
16
|
+
"uk": "Innogy Smarthome додано\nСписки для кожного адаптера працюють знову",
|
|
17
|
+
"zh-cn": "诺特·萨马尔·罗马\n每个适应人员名单正再次工作。"
|
|
18
|
+
},
|
|
6
19
|
"2.2.0": {
|
|
7
20
|
"en": "Yamaha MusicCast adapter added\nsend update message on state change\ndatapoints and scheduled notification for updateable devices added\nreaction for state changes of battery datapoints added\nsend message and write lists directly if one device has low battery\nsend message and write lists directly if on device is going online or offline",
|
|
8
21
|
"de": "Yamaha Musik Cast Adapter hinzugefügt\naktualisierungsnachricht über zustandsänderung senden\ndatenpunkte und geplante benachrichtigung für aktualisierte geräte hinzugefügt\nreaktion auf zustandsänderungen von batteriedatenpunkten hinzugefügt\nsende nachrichten und schreiblisten direkt, wenn ein gerät einen niedrigen akku hat\nnachrichten und schreiblisten direkt senden, wenn auf dem gerät online oder offline geht",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "lupusec, adapter HS100, Zigbee2MQTT i MaxCube\nzmienił nazwę Homematic na HM-RPC\nudało się to zrobić zupełnienie czarnej listy\nczyścił kod i skrócił niektóre z nich",
|
|
81
94
|
"uk": "додано Lupusec, HS100 адаптер, Zigbee2MQTT і MaxCube\nзмінено назву Homematic до HM-RPC\nвиготовлений комплетально макіяж чорного списку\nочистити код і скорочувати деякі",
|
|
82
95
|
"zh-cn": "加上Lupusec,HS100适应者,Zigbee2MQTT和MaxCube\n家庭名称改为HM-RPC\n填写黑名单\na. 守则的清理和缩短某些人"
|
|
83
|
-
},
|
|
84
|
-
"1.1.0": {
|
|
85
|
-
"en": "removed indicatoren for daily sent messages\nchanged selector for shelly devices\nadded Zigbee2MQTT adapter\nadded cron function to use own time for daily overview messages",
|
|
86
|
-
"de": "entfernte anzeige für täglich gesendete nachrichten\ngeänderter selektor für shelly-geräte\nzigbee2MQTT Adapter hinzugefügt\nzusätzliche cron-funktion, um eigene zeit für tägliche übersichtsnachrichten zu verwenden",
|
|
87
|
-
"ru": "удаленный индикатор для ежедневных отправленных сообщений\nизменен селектор для оболочки устройств\nдобавлен адаптер Zigbee2MQTT\nдобавлена функция cron для использования собственного времени для ежедневного обзора сообщений",
|
|
88
|
-
"pt": "indicador removido para mensagens enviadas diárias\nseletor alterado para dispositivos shelly\nadicionado adaptador Zigbee2MQTT\nfunção cron adicionada para usar o próprio tempo para mensagens de visão geral diária",
|
|
89
|
-
"nl": "verwijderde indicatoren voor dagelijks verzonden berichten\nverschoonde selector voor shelly apparaten\nvoegde Zigbee2MQT adapter toe\nvoegde kroonfunctie toe om dagelijks overzicht te gebruiken",
|
|
90
|
-
"fr": "indicateur supprimé pour les messages envoyés quotidiennement\nsélecteur modifié pour les dispositifs shelly\nadaptateur Zigbee2MQTT\nfonction cron ajoutée pour utiliser son propre temps pour les messages d'aperçu quotidien",
|
|
91
|
-
"it": "indicatore rimosso per messaggi inviati giornalieri\nselettore modificato per dispositivi shelly\naggiunto adattatore Zigbee2MQTT\nfunzione di cron aggiunto per utilizzare il proprio tempo per i messaggi di visione quotidiana",
|
|
92
|
-
"es": "indicador eliminado para mensajes enviados diariamente\nselector cambiado para dispositivos de vaina\nadaptador Zigbee2MQTT\nfunción cron agregada para utilizar tiempo propio para mensajes de visión general diaria",
|
|
93
|
-
"pl": "usunąć wskaźniki do codziennego przesyłania wiadomości\nzmieniono wybór dla urządzeń ostrzałowych\nadapter Zigbee2MQTT\ndodała funkcję krona do codziennego użytku",
|
|
94
|
-
"zh-cn": "d. 每天发出的讯息的清除指标\n炮火装置的选择\n增加Zigbee2MQTT适应人员\nb. 利用自己的时间进行日常概览信息",
|
|
95
|
-
"uk": "видалено індикатор щоденних відправлених повідомлень\nзмінено селектор для пристроїв shelly\nдодано адаптер Zigbee2MQTT\nдодано функцію cron для використання власного часу для щоденних оглядових повідомлень"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -205,6 +205,8 @@
|
|
|
205
205
|
"hueMaxMinutes": 0,
|
|
206
206
|
"hueExtDevices": false,
|
|
207
207
|
"hueextMaxMinutes": 0,
|
|
208
|
+
"innogyDevices": false,
|
|
209
|
+
"innogyMaxMinutes": 0,
|
|
208
210
|
"jeelinkDevices": false,
|
|
209
211
|
"jeelinkMaxMinutes": 300,
|
|
210
212
|
"lupusecDevices": false,
|
package/lib/arrApart.js
CHANGED
|
@@ -133,6 +133,15 @@ const arrApart = {
|
|
|
133
133
|
reach: '.reachable',
|
|
134
134
|
isLowBat: 'none',
|
|
135
135
|
},
|
|
136
|
+
innogy: {
|
|
137
|
+
Selektor: 'innogy-smarthome.*.IsReachable',
|
|
138
|
+
adapterID: 'innogy',
|
|
139
|
+
adapter: 'Innogy Smarthome',
|
|
140
|
+
battery: 'none',
|
|
141
|
+
rssiState: 'none',
|
|
142
|
+
reach: '.IsReachable',
|
|
143
|
+
isLowBat: '.LowBattery',
|
|
144
|
+
},
|
|
136
145
|
jeelink: {
|
|
137
146
|
Selektor: 'jeelink.*.lowBatt',
|
|
138
147
|
adapterID: 'jeelink',
|
package/main.js
CHANGED
|
@@ -85,6 +85,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
85
85
|
hs100: this.config.hs100Devices,
|
|
86
86
|
hue: this.config.hueDevices,
|
|
87
87
|
hueExt: this.config.hueExtDevices,
|
|
88
|
+
innogy: this.config.innogyDevices,
|
|
88
89
|
jeelink: this.config.jeelinkDevices,
|
|
89
90
|
lupusec: this.config.lupusecDevices,
|
|
90
91
|
maxcube: this.config.maxcubeDevices,
|
|
@@ -132,6 +133,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
132
133
|
hs100: this.config.hs100MaxMinutes,
|
|
133
134
|
hue: this.config.hueMaxMinutes,
|
|
134
135
|
hueExt: this.config.hueextMaxMinutes,
|
|
136
|
+
innogy: this.config.innogyMaxMinutes,
|
|
135
137
|
jeelink: this.config.jeelinkMaxMinutes,
|
|
136
138
|
lupusec: this.config.lupusecMaxMinutes,
|
|
137
139
|
maxcube: this.config.maxcubeMaxMinutes,
|
|
@@ -249,92 +251,107 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
249
251
|
let oldStatus;
|
|
250
252
|
let oldSignalStrength;
|
|
251
253
|
|
|
252
|
-
for (const
|
|
254
|
+
for (const device of this.listAllDevicesRaw) {
|
|
253
255
|
// On statechange update available datapoint
|
|
254
256
|
switch (id) {
|
|
255
|
-
case
|
|
257
|
+
case device.UpdateDP:
|
|
256
258
|
if (state.val) {
|
|
257
|
-
|
|
259
|
+
device.Upgradable = state.val;
|
|
258
260
|
|
|
259
261
|
await this.createLists();
|
|
260
|
-
|
|
261
262
|
await this.writeDatapoints();
|
|
262
|
-
|
|
263
|
+
if (this.config.createOwnFolder) await this.createDataForEachAdapter(device.adapterID);
|
|
264
|
+
if (!this.blacklistNotify.includes(device.Path)) {
|
|
265
|
+
await this.sendDeviceUpdatesNotification(device.Device, device.Adapter);
|
|
266
|
+
}
|
|
263
267
|
}
|
|
264
268
|
break;
|
|
265
269
|
|
|
266
|
-
case
|
|
267
|
-
oldSignalStrength =
|
|
268
|
-
|
|
269
|
-
if (oldSignalStrength !==
|
|
270
|
+
case device.SignalStrengthDP:
|
|
271
|
+
oldSignalStrength = device.SignalStrength;
|
|
272
|
+
device.SignalStrength = await this.calculateSignalStrength(state, device.adapterID);
|
|
273
|
+
if (oldSignalStrength !== device.SignalStrength) {
|
|
270
274
|
await this.createLists();
|
|
271
|
-
|
|
272
275
|
await this.writeDatapoints();
|
|
276
|
+
if (this.config.createOwnFolder) await this.createDataForEachAdapter(device.adapterID);
|
|
273
277
|
}
|
|
274
278
|
break;
|
|
275
279
|
|
|
276
|
-
case
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
280
|
+
case device.batteryDP:
|
|
281
|
+
if (device.isBatteryDevice) {
|
|
282
|
+
oldLowBatState = device.LowBat;
|
|
283
|
+
batteryData = await this.getBatteryData(state.val, oldLowBatState, device.adapterID);
|
|
284
|
+
|
|
285
|
+
device.Battery = batteryData[0];
|
|
286
|
+
device.BatteryRaw = batteryData[2];
|
|
287
|
+
device.LowBat = await this.setLowbatIndicator(state.val, undefined, device.LowBatDP);
|
|
288
|
+
|
|
289
|
+
if (device.LowBat && oldLowBatState !== device.LowBat) {
|
|
290
|
+
await this.createLists();
|
|
291
|
+
await this.writeDatapoints();
|
|
292
|
+
if (this.config.createOwnFolder) await this.createDataForEachAdapter(device.adapterID);
|
|
293
|
+
if (this.config.checkSendBatteryMsg && !this.blacklistNotify.includes(device.Path)) {
|
|
294
|
+
await this.sendLowBatNoticiation(device.Device, device.Adapter, device.Battery);
|
|
295
|
+
}
|
|
296
|
+
} else if (!device.LowBat && oldLowBatState !== device.LowBat) {
|
|
297
|
+
await this.createLists();
|
|
298
|
+
await this.writeDatapoints();
|
|
299
|
+
if (this.config.createOwnFolder) await this.createDataForEachAdapter(device.adapterID);
|
|
290
300
|
}
|
|
291
|
-
} else if (!i.LowBat && oldLowBatState !== i.LowBat) {
|
|
292
|
-
await this.createLists();
|
|
293
|
-
|
|
294
|
-
await this.writeDatapoints();
|
|
295
301
|
}
|
|
296
302
|
break;
|
|
297
303
|
|
|
298
|
-
case
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
304
|
+
case device.LowBatDP:
|
|
305
|
+
if (device.isBatteryDevice) {
|
|
306
|
+
oldLowBatState = device.LowBat;
|
|
307
|
+
batteryData = await this.getBatteryData(device.BatteryRaw, state.val, device.adapterID);
|
|
308
|
+
device.Battery = batteryData[0];
|
|
309
|
+
device.BatteryRaw = batteryData[2];
|
|
310
|
+
device.LowBat = await this.setLowbatIndicator(device.BatteryRaw, state.val, device.LowBatDP);
|
|
311
|
+
|
|
312
|
+
if (device.LowBat && oldLowBatState !== device.LowBat) {
|
|
313
|
+
await this.createLists();
|
|
314
|
+
await this.writeDatapoints();
|
|
315
|
+
if (this.config.createOwnFolder) await this.createDataForEachAdapter(device.adapterID);
|
|
316
|
+
if (this.config.checkSendBatteryMsg && !this.blacklistNotify.includes(device.Path)) {
|
|
317
|
+
await this.sendLowBatNoticiation(device.Device, device.Adapter, device.Battery);
|
|
318
|
+
}
|
|
319
|
+
} else if (!device.LowBat && oldLowBatState !== device.LowBat) {
|
|
320
|
+
await this.createLists();
|
|
321
|
+
await this.writeDatapoints();
|
|
322
|
+
if (this.config.createOwnFolder) await this.createDataForEachAdapter(device.adapterID);
|
|
311
323
|
}
|
|
312
|
-
} else if (!i.LowBat && oldLowBatState !== i.LowBat) {
|
|
313
|
-
await this.createLists();
|
|
314
|
-
|
|
315
|
-
await this.writeDatapoints();
|
|
316
324
|
}
|
|
325
|
+
|
|
317
326
|
break;
|
|
318
|
-
case
|
|
319
|
-
case
|
|
320
|
-
case
|
|
321
|
-
case
|
|
322
|
-
oldStatus =
|
|
323
|
-
|
|
324
|
-
contactData = await this.getOnlineState(
|
|
327
|
+
case device.UnreachDP:
|
|
328
|
+
case device.DeviceStateSelectorDP:
|
|
329
|
+
case device.rssiPeerSelectorDP:
|
|
330
|
+
case device.Path:
|
|
331
|
+
oldStatus = device.Status;
|
|
332
|
+
device.UnreachState = await this.getInitValue(device.UnreachDP);
|
|
333
|
+
contactData = await this.getOnlineState(
|
|
334
|
+
device.Path,
|
|
335
|
+
device.adapterID,
|
|
336
|
+
device.UnreachDP,
|
|
337
|
+
device.SignalStrength,
|
|
338
|
+
device.UnreachState,
|
|
339
|
+
device.DeviceStateSelectorDP,
|
|
340
|
+
device.rssiPeerSelectorDP,
|
|
341
|
+
);
|
|
325
342
|
if (contactData !== undefined) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
343
|
+
device.LastContact = contactData[0];
|
|
344
|
+
device.Status = contactData[1];
|
|
345
|
+
device.SignalStrength = contactData[2];
|
|
329
346
|
}
|
|
330
|
-
if (
|
|
347
|
+
if (device.Status !== oldStatus) {
|
|
331
348
|
await this.createLists();
|
|
332
|
-
|
|
333
349
|
await this.writeDatapoints();
|
|
350
|
+
if (this.config.createOwnFolder) await this.createDataForEachAdapter(device.adapterID);
|
|
334
351
|
}
|
|
335
352
|
|
|
336
|
-
if (
|
|
337
|
-
await this.sendOfflineNotifications(
|
|
353
|
+
if (device.Status && oldStatus !== device.Status && this.config.checkSendOfflineMsg && !this.blacklistNotify.includes(device.Path)) {
|
|
354
|
+
await this.sendOfflineNotifications(device.Device, device.Adapter, device.Status, device.LastContact);
|
|
338
355
|
}
|
|
339
356
|
break;
|
|
340
357
|
}
|
|
@@ -780,7 +797,13 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
780
797
|
|
|
781
798
|
/**
|
|
782
799
|
* get online state and time
|
|
783
|
-
*
|
|
800
|
+
* @param {object} id - ID
|
|
801
|
+
* @param {string} adapterID - ID of Adapter
|
|
802
|
+
* @param {string} unreachDP - Datapoint of Unreach
|
|
803
|
+
* @param {object} linkQuality - Linkquality Value
|
|
804
|
+
* @param {object} deviceUnreachState - State of deviceUnreach datapoint
|
|
805
|
+
* @param {string} deviceStateSelectorDP - Selector of device state (like .state)
|
|
806
|
+
* @param {string} rssiPeerSelectorDP - HM RSSI Peer Datapoint
|
|
784
807
|
*/
|
|
785
808
|
async getOnlineState(id, adapterID, unreachDP, linkQuality, deviceUnreachState, deviceStateSelectorDP, rssiPeerSelectorDP) {
|
|
786
809
|
let lastContactString;
|
|
@@ -925,17 +948,25 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
925
948
|
* when was last contact of device
|
|
926
949
|
*/
|
|
927
950
|
async checkLastContact() {
|
|
928
|
-
for (const
|
|
929
|
-
const oldContactState =
|
|
930
|
-
|
|
931
|
-
const contactData = await this.getOnlineState(
|
|
951
|
+
for (const device of this.listAllDevicesRaw) {
|
|
952
|
+
const oldContactState = device.Status;
|
|
953
|
+
device.UnreachState = await this.getInitValue(device.UnreachDP);
|
|
954
|
+
const contactData = await this.getOnlineState(
|
|
955
|
+
device.Path,
|
|
956
|
+
device.adapterID,
|
|
957
|
+
device.UnreachDP,
|
|
958
|
+
device.SignalStrength,
|
|
959
|
+
device.UnreachState,
|
|
960
|
+
device.DeviceStateSelectorDP,
|
|
961
|
+
device.rssiPeerSelectorDP,
|
|
962
|
+
);
|
|
932
963
|
if (contactData !== undefined) {
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
964
|
+
device.LastContact = contactData[0];
|
|
965
|
+
device.Status = contactData[1];
|
|
966
|
+
device.linkQuality = contactData[2];
|
|
936
967
|
}
|
|
937
|
-
if (oldContactState !==
|
|
938
|
-
await this.sendOfflineNotifications(
|
|
968
|
+
if (this.config.checkSendOfflineMsg && oldContactState !== device.Status && !this.blacklistNotify.includes(device.Path)) {
|
|
969
|
+
await this.sendOfflineNotifications(device.Device, device.Adapter, device.Status, device.LastContact);
|
|
939
970
|
}
|
|
940
971
|
}
|
|
941
972
|
await this.createLists();
|
|
@@ -1152,13 +1183,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1152
1183
|
return;
|
|
1153
1184
|
}
|
|
1154
1185
|
} // <-- end of loop
|
|
1155
|
-
await this.createLists();
|
|
1156
1186
|
} // <-- end of createData
|
|
1157
1187
|
|
|
1158
1188
|
/**
|
|
1159
1189
|
* Create Lists
|
|
1160
1190
|
*/
|
|
1161
|
-
async createLists() {
|
|
1191
|
+
async createLists(adptName) {
|
|
1162
1192
|
this.linkQualityDevices = [];
|
|
1163
1193
|
this.batteryPowered = [];
|
|
1164
1194
|
this.batteryLowPowered = [];
|
|
@@ -1168,78 +1198,84 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1168
1198
|
this.offlineDevicesRaw = [];
|
|
1169
1199
|
this.upgradableList = [];
|
|
1170
1200
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
if (device.LowBat && device.Status !== 'Offline') {
|
|
1175
|
-
this.batteryLowPoweredRaw.push({
|
|
1176
|
-
Path: device.Path,
|
|
1177
|
-
Device: device.Device,
|
|
1178
|
-
Adapter: device.Adapter,
|
|
1179
|
-
Battery: device.Battery,
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
// offline raw list
|
|
1183
|
-
if (device.Status === 'Offline') {
|
|
1184
|
-
this.offlineDevicesRaw.push({
|
|
1185
|
-
Path: device.Path,
|
|
1186
|
-
Device: device.Device,
|
|
1187
|
-
Adapter: device.Adapter,
|
|
1188
|
-
'Last contact': device.LastContact,
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1201
|
+
if (adptName === undefined) {
|
|
1202
|
+
adptName = '';
|
|
1203
|
+
}
|
|
1191
1204
|
|
|
1192
|
-
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
Adapter: device.Adapter,
|
|
1197
|
-
Battery: device.Battery,
|
|
1198
|
-
'Signal strength': device.SignalStrength,
|
|
1199
|
-
'Last contact': device.LastContact,
|
|
1200
|
-
Status: device.Status,
|
|
1201
|
-
});
|
|
1202
|
-
// LinkQuality lists
|
|
1203
|
-
if (device.SignalStrength != ' - ') {
|
|
1204
|
-
this.linkQualityDevices.push({
|
|
1205
|
-
Device: device.Device,
|
|
1206
|
-
Adapter: device.Adapter,
|
|
1207
|
-
'Signal strength': device.SignalStrength,
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
// Battery lists
|
|
1211
|
-
if (device['isBatteryDevice']) {
|
|
1212
|
-
this.batteryPowered.push({
|
|
1213
|
-
Device: device.Device,
|
|
1214
|
-
Adapter: device.Adapter,
|
|
1215
|
-
Battery: device.Battery,
|
|
1216
|
-
Status: device.Status,
|
|
1217
|
-
});
|
|
1218
|
-
}
|
|
1219
|
-
// Low Bat lists
|
|
1205
|
+
for (const device of this.listAllDevicesRaw) {
|
|
1206
|
+
if (device.adapterID.includes(adptName)) {
|
|
1207
|
+
/*---------- fill raw lists ----------*/
|
|
1208
|
+
// low bat list
|
|
1220
1209
|
if (device.LowBat && device.Status !== 'Offline') {
|
|
1221
|
-
this.
|
|
1210
|
+
this.batteryLowPoweredRaw.push({
|
|
1211
|
+
Path: device.Path,
|
|
1222
1212
|
Device: device.Device,
|
|
1223
1213
|
Adapter: device.Adapter,
|
|
1224
1214
|
Battery: device.Battery,
|
|
1225
1215
|
});
|
|
1226
1216
|
}
|
|
1227
|
-
|
|
1228
|
-
// Offline List
|
|
1217
|
+
// offline raw list
|
|
1229
1218
|
if (device.Status === 'Offline') {
|
|
1230
|
-
this.
|
|
1219
|
+
this.offlineDevicesRaw.push({
|
|
1220
|
+
Path: device.Path,
|
|
1231
1221
|
Device: device.Device,
|
|
1232
1222
|
Adapter: device.Adapter,
|
|
1233
1223
|
'Last contact': device.LastContact,
|
|
1234
1224
|
});
|
|
1235
1225
|
}
|
|
1236
1226
|
|
|
1237
|
-
|
|
1238
|
-
if (device.
|
|
1239
|
-
this.
|
|
1227
|
+
/*---------- fill user lists ----------*/
|
|
1228
|
+
if (!this.blacklistLists.includes(device.Path)) {
|
|
1229
|
+
this.listAllDevices.push({
|
|
1240
1230
|
Device: device.Device,
|
|
1241
1231
|
Adapter: device.Adapter,
|
|
1232
|
+
Battery: device.Battery,
|
|
1233
|
+
'Signal strength': device.SignalStrength,
|
|
1234
|
+
'Last contact': device.LastContact,
|
|
1235
|
+
Status: device.Status,
|
|
1242
1236
|
});
|
|
1237
|
+
// LinkQuality lists
|
|
1238
|
+
if (device.SignalStrength != ' - ') {
|
|
1239
|
+
this.linkQualityDevices.push({
|
|
1240
|
+
Device: device.Device,
|
|
1241
|
+
Adapter: device.Adapter,
|
|
1242
|
+
'Signal strength': device.SignalStrength,
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
// Battery lists
|
|
1246
|
+
if (device['isBatteryDevice']) {
|
|
1247
|
+
this.batteryPowered.push({
|
|
1248
|
+
Device: device.Device,
|
|
1249
|
+
Adapter: device.Adapter,
|
|
1250
|
+
Battery: device.Battery,
|
|
1251
|
+
Status: device.Status,
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
// Low Bat lists
|
|
1255
|
+
if (device.LowBat && device.Status !== 'Offline') {
|
|
1256
|
+
this.batteryLowPowered.push({
|
|
1257
|
+
Device: device.Device,
|
|
1258
|
+
Adapter: device.Adapter,
|
|
1259
|
+
Battery: device.Battery,
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
// Offline List
|
|
1264
|
+
if (device.Status === 'Offline') {
|
|
1265
|
+
this.offlineDevices.push({
|
|
1266
|
+
Device: device.Device,
|
|
1267
|
+
Adapter: device.Adapter,
|
|
1268
|
+
'Last contact': device.LastContact,
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
// Device update List
|
|
1273
|
+
if (device.Upgradable) {
|
|
1274
|
+
this.upgradableList.push({
|
|
1275
|
+
Device: device.Device,
|
|
1276
|
+
Adapter: device.Adapter,
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1243
1279
|
}
|
|
1244
1280
|
}
|
|
1245
1281
|
}
|
|
@@ -1281,14 +1317,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1281
1317
|
// create Data for each Adapter in own lists
|
|
1282
1318
|
this.log.debug(`Function started: ${this.createDataForEachAdapter.name}`);
|
|
1283
1319
|
|
|
1284
|
-
await this.resetVars(); // reset the arrays and counts
|
|
1285
|
-
|
|
1286
1320
|
try {
|
|
1287
|
-
for (const
|
|
1288
|
-
if (
|
|
1321
|
+
for (const device of this.listAllDevicesRaw) {
|
|
1322
|
+
if (device.adapterID.includes(adptName)) {
|
|
1289
1323
|
// list device only if selected adapter matched with device
|
|
1290
|
-
await this.createLists();
|
|
1291
|
-
await this.writeDatapoints();
|
|
1324
|
+
await this.createLists(adptName);
|
|
1325
|
+
await this.writeDatapoints(adptName);
|
|
1292
1326
|
}
|
|
1293
1327
|
}
|
|
1294
1328
|
|
|
@@ -1307,10 +1341,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1307
1341
|
this.log.debug(`Function started: ${this.createDataOfAllAdapter.name}`);
|
|
1308
1342
|
|
|
1309
1343
|
try {
|
|
1310
|
-
await this.resetVars(); // reset the arrays and counts
|
|
1311
|
-
|
|
1312
1344
|
for (let i = 0; i < this.arrDev.length; i++) {
|
|
1313
1345
|
await this.createData(i);
|
|
1346
|
+
await this.createLists();
|
|
1314
1347
|
}
|
|
1315
1348
|
await this.writeDatapoints(); // fill the datapoints
|
|
1316
1349
|
} catch (error) {
|
|
@@ -1525,21 +1558,18 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1525
1558
|
* @param {string} deviceName
|
|
1526
1559
|
* @param {string} adapter
|
|
1527
1560
|
* @param {string} battery
|
|
1528
|
-
* @param {string} devicePath
|
|
1529
1561
|
**/
|
|
1530
|
-
async sendLowBatNoticiation(deviceName, adapter, battery
|
|
1562
|
+
async sendLowBatNoticiation(deviceName, adapter, battery) {
|
|
1531
1563
|
this.log.debug(`Start the function: ${this.sendLowBatNoticiation.name}`);
|
|
1532
1564
|
|
|
1533
1565
|
try {
|
|
1534
1566
|
let msg = '';
|
|
1535
1567
|
let deviceList = '';
|
|
1536
1568
|
|
|
1537
|
-
if (!this.
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
}
|
|
1541
|
-
deviceList = `${deviceList}\n${adapter}: ${deviceName} (${battery})`;
|
|
1542
|
-
}
|
|
1569
|
+
if (!this.config.showAdapterNameinMsg) {
|
|
1570
|
+
deviceList = `${deviceList}\n${deviceName} (${battery})`;
|
|
1571
|
+
} else {
|
|
1572
|
+
deviceList = `${deviceList}\n${adapter}: ${deviceName} (${battery})`;
|
|
1543
1573
|
}
|
|
1544
1574
|
msg = `Gerät mit geringer Batterie erkannt: \n`;
|
|
1545
1575
|
|
|
@@ -1554,21 +1584,24 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1554
1584
|
|
|
1555
1585
|
/**
|
|
1556
1586
|
* send message if an device is offline
|
|
1587
|
+
* @param {string} deviceName
|
|
1588
|
+
* @param {string} adapter
|
|
1589
|
+
* @param {string} status
|
|
1590
|
+
* @param {string} lastContact
|
|
1557
1591
|
*/
|
|
1558
|
-
async sendOfflineNotifications(deviceName, adapter, status, lastContact
|
|
1592
|
+
async sendOfflineNotifications(deviceName, adapter, status, lastContact) {
|
|
1559
1593
|
this.log.debug(`Start the function: ${this.sendOfflineNotifications.name}`);
|
|
1560
1594
|
|
|
1561
1595
|
try {
|
|
1562
1596
|
let msg = '';
|
|
1563
1597
|
let deviceList = '';
|
|
1564
1598
|
|
|
1565
|
-
if (!this.
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1569
|
-
deviceList = `${deviceList}\n${adapter}: ${deviceName} (${lastContact})`;
|
|
1570
|
-
}
|
|
1599
|
+
if (!this.config.showAdapterNameinMsg) {
|
|
1600
|
+
deviceList = `${deviceList}\n${deviceName} (${lastContact})`;
|
|
1601
|
+
} else {
|
|
1602
|
+
deviceList = `${deviceList}\n${adapter}: ${deviceName} (${lastContact})`;
|
|
1571
1603
|
}
|
|
1604
|
+
|
|
1572
1605
|
if (status === 'Online') {
|
|
1573
1606
|
// make singular if it is only one device
|
|
1574
1607
|
msg = 'Folgendes Gerät ist wieder erreichbar: \n';
|
|
@@ -1644,22 +1677,20 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1644
1677
|
* check if device updates are available and send notification
|
|
1645
1678
|
* @param {string} deviceName
|
|
1646
1679
|
* @param {string} adapter
|
|
1647
|
-
* @param {string} devicePath
|
|
1648
1680
|
**/
|
|
1649
|
-
async sendDeviceUpdatesNotification(deviceName, adapter
|
|
1681
|
+
async sendDeviceUpdatesNotification(deviceName, adapter) {
|
|
1650
1682
|
this.log.debug(`Start the function: ${this.sendDeviceUpdatesNotification.name}`);
|
|
1651
1683
|
|
|
1652
1684
|
try {
|
|
1653
1685
|
let msg = '';
|
|
1654
1686
|
let deviceList = '';
|
|
1655
1687
|
|
|
1656
|
-
if (!this.
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
deviceList = `${deviceList}\n${adapter}: ${deviceName}`;
|
|
1661
|
-
}
|
|
1688
|
+
if (!this.config.showAdapterNameinMsg) {
|
|
1689
|
+
deviceList = `${deviceList}\n${deviceName}`;
|
|
1690
|
+
} else {
|
|
1691
|
+
deviceList = `${deviceList}\n${adapter}: ${deviceName}`;
|
|
1662
1692
|
}
|
|
1693
|
+
|
|
1663
1694
|
msg = `Neue Geräte Updates vorhanden: \n`;
|
|
1664
1695
|
|
|
1665
1696
|
this.log.info(msg + deviceList);
|
|
@@ -1725,36 +1756,6 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1725
1756
|
}
|
|
1726
1757
|
} //<--End of daily offline notification
|
|
1727
1758
|
|
|
1728
|
-
/**
|
|
1729
|
-
* reset arrays and counts
|
|
1730
|
-
*/
|
|
1731
|
-
async resetVars() {
|
|
1732
|
-
//Reset all arrays and counts
|
|
1733
|
-
this.log.debug(`Function started: ${this.resetVars.name}`);
|
|
1734
|
-
|
|
1735
|
-
// arrays
|
|
1736
|
-
this.offlineDevices = [];
|
|
1737
|
-
this.linkQualityDevices = [];
|
|
1738
|
-
this.batteryPowered = [];
|
|
1739
|
-
this.batteryLowPowered = [];
|
|
1740
|
-
this.listAllDevices = [];
|
|
1741
|
-
//this.listAllDevicesRaw = [];
|
|
1742
|
-
|
|
1743
|
-
// raws
|
|
1744
|
-
this.batteryLowPoweredRaw = [];
|
|
1745
|
-
this.offlineDevicesRaw = [];
|
|
1746
|
-
|
|
1747
|
-
// counts
|
|
1748
|
-
this.offlineDevicesCount = 0;
|
|
1749
|
-
this.deviceCounter = 0;
|
|
1750
|
-
this.linkQualityCount = 0;
|
|
1751
|
-
this.batteryPoweredCount = 0;
|
|
1752
|
-
this.lowBatteryPoweredCount = 0;
|
|
1753
|
-
this.upgradableDevicesCount = 0;
|
|
1754
|
-
|
|
1755
|
-
this.log.debug(`Function finished: ${this.resetVars.name}`);
|
|
1756
|
-
} // <-- end of resetVars
|
|
1757
|
-
|
|
1758
1759
|
/**
|
|
1759
1760
|
* @param {string} [adptName] - Adaptername
|
|
1760
1761
|
*/
|