iobroker.device-watcher 2.9.12 → 2.9.13
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/io-package.json +14 -14
- package/main.js +50 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -189,6 +189,11 @@ It's possible to select:
|
|
|
189
189
|
Placeholder for the next version (at the beginning of the line):
|
|
190
190
|
### **WORK IN PROGRESS**
|
|
191
191
|
-->
|
|
192
|
+
### 2.9.13 (2024-01-03)
|
|
193
|
+
|
|
194
|
+
- (ciddi89) Fixed: Issues from v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)
|
|
195
|
+
- (ciddi89) Fixed: High CPU usage at object and state changes [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)
|
|
196
|
+
|
|
192
197
|
### 2.9.12 (2024-01-02)
|
|
193
198
|
|
|
194
199
|
- (ciddi89) Fixed: Changed handling for state changes and subscriptions [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "device-watcher",
|
|
4
|
-
"version": "2.9.
|
|
4
|
+
"version": "2.9.13",
|
|
5
5
|
"news": {
|
|
6
|
+
"2.9.13": {
|
|
7
|
+
"en": "Fixed: Issues from v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)\nFixed: High CPU usage at object and state changes [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
8
|
+
"de": "Behoben: Fehler von v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)\nBehoben: Hohe CPU-Nutzung bei Objekt- und Zustandsänderungen [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
9
|
+
"ru": "Исправлено: Вопросы от v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)\nИсправлено: Высокое использование процессора на объектах и государственных изменениях [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
10
|
+
"pt": "Corrigido: Questões do v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)\nCorrigido: Uso de alta CPU em alterações de objeto e estado [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
11
|
+
"nl": "Quality over Quantity (QoQ) Releases Vertaling:\nQuality over Quantity (QoQ) Releases Vertaling:",
|
|
12
|
+
"fr": "Correction : Questions renvoyées à l ' adresse v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)\nFixed: High CPU use at object and state changes [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
13
|
+
"it": "Risolto: Problemi da v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)\nRisolto: alto uso della CPU a oggetto e cambiamenti di stato [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
14
|
+
"es": "Arreglado: Cuestiones de v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)\nFijo: Alto uso de la CPU en los cambios de objeto y estado [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
15
|
+
"pl": "Fixed: Issues from v2.9.12 #283(https:/github.com/ciddi89/ioBroker,device-watcher/issues/283) (ang.)\n(Użycie procesora) w obiektach i stanach zmienia liczbę #283 (https:/github.com/ciddi89/ioBroker,device-watcher/issues/283)",
|
|
16
|
+
"uk": "Виправлено: Випуски від v2.9.12 [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)\nВиправлено: Високий рівень використання процесора при об'єктах та змінах стану [#283] (https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
17
|
+
"zh-cn": "Fixed: Issues from v2.9.12[#283] (http://github.com/ciddi89/ioBroker.device-watcher/issues/283)\n九. 固定:在物体和州变化中使用高频单位[第283](http://github.com/ciddi89/ioBroker.device-watcher/issues/283)"
|
|
18
|
+
},
|
|
6
19
|
"2.9.12": {
|
|
7
20
|
"en": "Fixed: Changed handling for state changes and subscriptions [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
8
21
|
"de": "Behoben: Handhabung für Zustandsänderungen und Abonnements geändert [#283](https://github.com/ciddi89/ioBroker.device-watcher/issues/283)",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "Wspieranie Wifilight\nFixed: Multiple messages, jeśli urządzenia Sonoff docierają do miejsca #244 (https:/github.com/ciddi89/ioBroker.device-watcher/issues/244)",
|
|
81
94
|
"uk": "Доданий: Підтримка Wifilight\nВиправлено: Кілька повідомлень, якщо пристрої Sonoff досягаються [#244](https://github.com/ciddi89/ioBroker.device-watcher/issues/244)",
|
|
82
95
|
"zh-cn": "增 编:支持光明\nFixed:Sonoff装置可达到[第244](http://github.com/ciddi89/ioBroker.device-watcher/issues/244)"
|
|
83
|
-
},
|
|
84
|
-
"2.9.6": {
|
|
85
|
-
"en": "Fixed: Admin jsonConfig schema\nChanged: Admin jsonConfig to json5\nAdded: Support for Tuya devices with online state\nOthers: cleaned up files",
|
|
86
|
-
"de": "Behoben: Admin jsonConfig Schema\nGeändert: Admin jsonConfig zu json5\nHinzugefügt: Unterstützung für Tuya-Geräte mit Online-Zustand\nAnderes: Dateien aufgeräumt",
|
|
87
|
-
"ru": "Исправлено: Admin jsonConfig schema\nИзменено: Admin jsonConfig в json5\nДобавлена: Поддержка устройств Tuya с онлайн состоянием\nДругое: очищенные файлы",
|
|
88
|
-
"pt": "Corrigido: Admin jsonConfig schema\nAlterado: Admin jsonConfig to json5\nAdicionado: Suporte para dispositivos Tuya com estado on-line\nOutros: limpe arquivos",
|
|
89
|
-
"nl": "Admin jsonConfig schema\nAdministratie JsonConfig aan Json5\nVersterking voor Tuya apparaten met online staat\nVertaling:",
|
|
90
|
-
"fr": "Correction : Admin jsonConfig schema\nChanged: Admin jsonConfig to json5\nAjouté: Support pour les appareils Tuya avec l'état en ligne\nAutre: nettoyer les fichiers",
|
|
91
|
-
"it": "Fisso: Schema Admin jsonConfig\nModificato: Admin jsonConfig a json5\nAggiunto: Supporto per dispositivi Tuya con stato online\nAltro: file ripuliti",
|
|
92
|
-
"es": "Arreglado: Amin jsonConfig schema\nCambios: Admin jsonConfig a json5\nAñadido: Soporte para dispositivos Tuya con estado en línea\nOtros: limpiar archivos",
|
|
93
|
-
"pl": "Admin jsonConfig schema\nZmiana: Admin jsonConfig to json5\nWstęp: Wsparcie dla urządzeń Tuya z internetowym państwem\nInne: czyste pliki plikowe",
|
|
94
|
-
"uk": "Виправлено: Admin jsonConfig schema\nЗмінено: Admin jsonConfig to json5\nДодано: Підтримка пристроїв Туя з онлайн-державою\nІнше: очищення файлів",
|
|
95
|
-
"zh-cn": "Fix: Admin json Config schema\n修改: Admin json Configg to json5\n增 编:在网上国家支持图亚装置\n其他:清洁档案"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/main.js
CHANGED
|
@@ -79,6 +79,8 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
79
79
|
// Interval timer
|
|
80
80
|
this.refreshDataTimeout = null;
|
|
81
81
|
|
|
82
|
+
this.mainRunning = false;
|
|
83
|
+
|
|
82
84
|
this.on('ready', this.onReady.bind(this));
|
|
83
85
|
this.on('stateChange', this.onStateChange.bind(this));
|
|
84
86
|
this.on('objectChange', this.onObjectChange.bind(this));
|
|
@@ -332,12 +334,19 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
332
334
|
// The object was changed
|
|
333
335
|
//this.log.debug(`object ${id} changed: ${JSON.stringify(obj)}`);
|
|
334
336
|
|
|
335
|
-
if (id.startsWith('system.adapter.')) {
|
|
337
|
+
if (this.config.checkAdapterInstances && id.startsWith('system.adapter.')) {
|
|
336
338
|
//read new instance data and add it to the lists
|
|
337
339
|
await this.getInstanceData(id);
|
|
338
340
|
} else {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
+
if (Array.from(this.listAllDevicesRaw.values()).some((obj) => obj.mainSelector === id)) {
|
|
342
|
+
if (!this.mainRunning) {
|
|
343
|
+
await this.main();
|
|
344
|
+
} else {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
341
350
|
}
|
|
342
351
|
} catch (error) {
|
|
343
352
|
this.log.error(`Issue at object change: ${error}`);
|
|
@@ -498,6 +507,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
498
507
|
*/
|
|
499
508
|
async main() {
|
|
500
509
|
this.log.debug(`Function started: ${this.main.name}`);
|
|
510
|
+
this.mainRunning = true;
|
|
501
511
|
|
|
502
512
|
// cancel run if no adapter is selected
|
|
503
513
|
if (this.adapterSelected.length === 0) return;
|
|
@@ -532,7 +542,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
532
542
|
this.log.error(`[main - create and fill datapoints for each adapter] - ${error}`);
|
|
533
543
|
}
|
|
534
544
|
}
|
|
535
|
-
|
|
545
|
+
this.mainRunning = false;
|
|
536
546
|
this.log.debug(`Function finished: ${this.main.name}`);
|
|
537
547
|
} //<--End of main function
|
|
538
548
|
|
|
@@ -668,6 +678,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
668
678
|
/*---------- Start of loop ----------*/
|
|
669
679
|
for (const [id] of Object.entries(devices)) {
|
|
670
680
|
if (id.endsWith('.')) continue;
|
|
681
|
+
const mainSelector = id;
|
|
671
682
|
|
|
672
683
|
/*=============================================
|
|
673
684
|
= get Instanz =
|
|
@@ -677,8 +688,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
677
688
|
const instanceDeviceConnectionDP = `${instance}.info.connection`;
|
|
678
689
|
const instancedeviceConnected = await this.getInitValue(instanceDeviceConnectionDP);
|
|
679
690
|
// this.subscribeForeignStates(instanceDeviceConnectionDP);
|
|
680
|
-
|
|
681
|
-
this.subscribeForeignObjects('*');
|
|
691
|
+
this.subscribeForeignObjects(`${this.selAdapter[i].Selektor}`);
|
|
692
|
+
// this.subscribeForeignObjects('*');
|
|
693
|
+
this.subscribeForeignStates('*');
|
|
682
694
|
/*=============================================
|
|
683
695
|
= Get device name =
|
|
684
696
|
=============================================*/
|
|
@@ -881,6 +893,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
881
893
|
const setupList = () => {
|
|
882
894
|
this.listAllDevicesRaw.set(currDeviceString, {
|
|
883
895
|
Path: id,
|
|
896
|
+
mainSelector: mainSelector,
|
|
884
897
|
instanceDeviceConnectionDP: instanceDeviceConnectionDP,
|
|
885
898
|
instancedeviceConnected: instancedeviceConnected,
|
|
886
899
|
instance: instance,
|
|
@@ -1964,31 +1977,34 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1964
1977
|
|
|
1965
1978
|
// device unreach
|
|
1966
1979
|
case deviceData.UnreachDP:
|
|
1967
|
-
if (deviceData.
|
|
1968
|
-
|
|
1969
|
-
deviceData.UnreachState
|
|
1970
|
-
|
|
1971
|
-
deviceData.
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
if (
|
|
1980
|
+
if (deviceData.instanceDeviceConnectionDP.val !== undefined) {
|
|
1981
|
+
// check if the generally deviceData connected state is for a while true
|
|
1982
|
+
if (deviceData.UnreachState !== state.val) {
|
|
1983
|
+
oldStatus = deviceData.Status;
|
|
1984
|
+
deviceData.UnreachState = state.val;
|
|
1985
|
+
contactData = await this.getOnlineState(
|
|
1986
|
+
deviceData.timeSelector,
|
|
1987
|
+
deviceData.adapterID,
|
|
1988
|
+
deviceData.UnreachDP,
|
|
1989
|
+
deviceData.SignalStrength,
|
|
1990
|
+
deviceData.UnreachState,
|
|
1991
|
+
deviceData.DeviceStateSelectorDP,
|
|
1992
|
+
deviceData.rssiPeerSelectorDP,
|
|
1993
|
+
);
|
|
1994
|
+
if (contactData !== undefined) {
|
|
1995
|
+
deviceData.LastContact = contactData[0];
|
|
1996
|
+
deviceData.Status = contactData[1];
|
|
1997
|
+
deviceData.SignalStrength = contactData[2];
|
|
1998
|
+
}
|
|
1999
|
+
if (this.config.checkSendOfflineMsg && oldStatus !== deviceData.Status && !this.blacklistNotify.includes(deviceData.Path)) {
|
|
2000
|
+
if (deviceData.instanceDeviceConnectionDP.val !== undefined) {
|
|
2001
|
+
// check if the generally deviceData connected state is for a while true
|
|
2002
|
+
if (await this.getTimestampConnectionDP(deviceData.instanceDeviceConnectionDP, 20000)) {
|
|
2003
|
+
await this.sendStateNotifications('onlineStateDevice', deviceID);
|
|
2004
|
+
}
|
|
2005
|
+
} else {
|
|
1988
2006
|
await this.sendStateNotifications('onlineStateDevice', deviceID);
|
|
1989
2007
|
}
|
|
1990
|
-
} else {
|
|
1991
|
-
await this.sendStateNotifications('onlineStateDevice', deviceID);
|
|
1992
2008
|
}
|
|
1993
2009
|
}
|
|
1994
2010
|
}
|
|
@@ -2083,9 +2099,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2083
2099
|
// this.subscribeForeignStates(id);
|
|
2084
2100
|
// this.subscribeForeignStates(instanceConnectedHostDP);
|
|
2085
2101
|
// this.subscribeForeignStates(instanceConnectedDeviceDP);
|
|
2102
|
+
this.subscribeForeignObjects(`system.adapter.*`);
|
|
2086
2103
|
this.subscribeForeignStates('*');
|
|
2087
|
-
//this.subscribeForeignObjects(
|
|
2088
|
-
this.subscribeForeignObjects('*');
|
|
2104
|
+
// this.subscribeForeignObjects('*');
|
|
2089
2105
|
|
|
2090
2106
|
// create raw list
|
|
2091
2107
|
this.listInstanceRaw.set(instanceID, {
|
|
@@ -2134,9 +2150,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2134
2150
|
let connectedDeviceState = await this.getInitValue(`${instanceID}.info.connection`);
|
|
2135
2151
|
if (connectedDeviceState === undefined) connectedDeviceState = true;
|
|
2136
2152
|
|
|
2137
|
-
let isAlive =
|
|
2153
|
+
let isAlive = aliveState;
|
|
2138
2154
|
let isHealthy = false;
|
|
2139
|
-
let instanceStatusString = 'Instanz deaktiviert';
|
|
2155
|
+
let instanceStatusString = aliveState ? 'Instanz aktiviert' : 'Instanz deaktiviert';
|
|
2140
2156
|
|
|
2141
2157
|
if (!aliveState) {
|
|
2142
2158
|
isAlive = false;
|
|
@@ -2172,7 +2188,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2172
2188
|
|
|
2173
2189
|
let isAlive = false;
|
|
2174
2190
|
let isHealthy = false;
|
|
2175
|
-
let instanceStatusString = 'Instanz deaktiviert';
|
|
2191
|
+
let instanceStatusString = aliveState ? 'Instanz aktiviert' : 'Instanz deaktiviert';
|
|
2176
2192
|
|
|
2177
2193
|
if (aliveState) {
|
|
2178
2194
|
daemonIsAlive = await this.checkDaemonIsHealthy(instanceID);
|