diff --git a/LICENSE b/LICENSE index 221a9467..7fd25785 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 - 2023 foxthefox@wysiwis.net +Copyright (c) 2018 - 2024 foxthefox@wysiwis.net Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 6ef1d105..13db7c1a 100644 --- a/README.md +++ b/README.md @@ -217,6 +217,10 @@ otherwise it is more complex and individually to be parametrized. * blind alert state -> decode bit array ## Changelog +### 2.5.10 (npm) +* more loggimg for issue #500 of restart loop +* some error messages downgraded to warnings + ### 2.5.9 (npm) * correction for statistics, * new message box password needs to be reentered in versions >=2.5.4 @@ -541,4 +545,4 @@ otherwise it is more complex and individually to be parametrized. The MIT License (MIT) -Copyright (c) 2018 - 2023 foxthefox +Copyright (c) 2018 - 2024 foxthefox diff --git a/io-package.json b/io-package.json index 019f0286..ce4bc3fb 100644 --- a/io-package.json +++ b/io-package.json @@ -1,8 +1,21 @@ { "common": { "name": "fritzdect", - "version": "2.5.9", + "version": "2.5.10", "news": { + "2.5.10": { + "en": "more loggimg for issue #500 of restart loop", + "de": "Weitere Protokollierung für Problem Nr. 500 der Neustartschleife", + "ru": "больше loggimg для проблемы № 500 цикла перезапуска", + "pt": "mais loggimg para o problema nº 500 do loop de reinicialização", + "nl": "meer loggimg voor probleem #500 van de herstartlus", + "fr": "plus de loggimg pour le numéro 500 de la boucle de redémarrage", + "it": "ulteriori registrazioni per il problema n. 500 del ciclo di riavvio", + "es": "más registros para el problema #500 del ciclo de reinicio", + "pl": "więcej loggimg dla problemu nr 500 pętli restartu", + "uk": "більше loggimg для проблеми №500 циклу перезапуску", + "zh-cn": "有关重新启动循环的问题 #500 的更多 loggimg" + }, "2.5.9": { "en": "new message box, correction for statistics, password needs to be reentered in versions >2.5.4", "de": "Neues Meldungsfeld, Korrektur für Statistiken, Passwort muss in Versionen >2.5.4 erneut eingegeben werden", @@ -215,7 +228,6 @@ ] } ], - "title": "fritzbox DECT", "titleLang": { "en": "fritzbox dect ", "de": "fritzbox dect", diff --git a/main.js b/main.js index 3afdba1b..a42646d4 100644 --- a/main.js +++ b/main.js @@ -591,7 +591,11 @@ class Fritzdect extends utils.Adapter { state.val === 'on' || state.val === 'ON' ) { - const minutes = await this.getStateAsync('DECT_' + id + '.boostactivetime'); + const minutes = await this.getStateAsync( + 'DECT_' + id + '.boostactivetime' + ).catch((error) => { + this.log.warn('DECT_' + +id + '.boostactivetime did not get state -> ' + error); + }); if (minutes && minutes.val !== null) { let activetime = minutes.val; const jetzt = +new Date(); @@ -674,7 +678,13 @@ class Fritzdect extends utils.Adapter { state.val === 'on' || state.val === 'ON' ) { - const minutes = await this.getStateAsync('DECT_' + id + '.windowopenactivetime'); + const minutes = await this.getStateAsync( + 'DECT_' + id + '.windowopenactivetime' + ).catch((error) => { + this.log.warn( + 'DECT_' + +id + '.windowopenactivetime did not get state -> ' + error + ); + }); if (minutes && minutes.val !== null) { let activetime = minutes.val; const jetzt = +new Date(); @@ -727,7 +737,11 @@ class Fritzdect extends utils.Adapter { state.val === 'off' || state.val === 'OFF' ) { - const switchtyp = await this.getStateAsync('DECT_' + id + '.switchtype'); + const switchtyp = await this.getStateAsync( + 'DECT_' + id + '.switchtype' + ).catch((error) => { + this.log.warn('DECT_' + +id + '.switchtype did not get state -> ' + error); + }); if (switchtyp && switchtyp.val !== null) { if (switchtyp.val === 'switch') { this.fritz @@ -763,7 +777,11 @@ class Fritzdect extends utils.Adapter { state.val === 'on' || state.val === 'ON' ) { - const switchtyp = await this.getStateAsync('DECT_' + id + '.switchtype'); + const switchtyp = await this.getStateAsync( + 'DECT_' + id + '.switchtype' + ).catch((error) => { + this.log.warn('DECT_' + +id + '.switchtype did not get state -> ' + error); + }); if (switchtyp && switchtyp.val !== null) { if (switchtyp.val === 'switch') { this.fritz @@ -843,7 +861,9 @@ class Fritzdect extends utils.Adapter { .catch((e) => this.errorHandlerApi(e)); } if (dp == 'hue') { - const saturation = await this.getStateAsync('DECT_' + id + '.saturation'); + const saturation = await this.getStateAsync('DECT_' + id + '.saturation').catch((error) => { + this.log.warn('DECT_' + +id + '.saturation did not get state -> ' + error); + }); if (saturation && saturation.val !== null) { // oder hier die Verwendung von lasttarget const setSaturation = saturation.val; @@ -875,7 +895,9 @@ class Fritzdect extends utils.Adapter { } } if (dp == 'saturation') { - const hue = await this.getStateAsync('DECT_' + id + '.hue'); + const hue = await this.getStateAsync('DECT_' + id + '.hue').catch((error) => { + this.log.warn('DECT_' + +id + '.hue did not get state -> ' + error); + }); if (hue && hue.val !== null) { const setHue = hue.val; if (setHue == '') { @@ -1279,7 +1301,14 @@ class Fritzdect extends utils.Adapter { let active = routine.active == 0 ? false : true; let old = await this.getStateAsync( 'routine_' + routine.identifier.replace(/\s/g, '') + '.active' - ); + ).catch((error) => { + this.log.warn( + 'problem getting routine_' + + routine.identifier.replace(/\s/g, '') + + '.active ' + + error + ); + }); if (old.val !== active || !this.config.fritz_writeonhyst) { this.log.debug('__________________________'); this.log.debug('updating Routine ' + routine.name); @@ -1369,7 +1398,14 @@ class Fritzdect extends utils.Adapter { //hier schon mal operationmode vorbesetzt, wird ggf. später überschrieben wenn es On,Off oder was anderes wird let oldval = await this.getStateAsync( 'DECT_' + devices[i].identifier.replace(/\s/g, '') + '.operationmode' - ); + ).catch((error) => { + this.log.warn( + 'problem getting DECT_' + + devices[i].identifier.replace(/\s/g, '') + + '.operationmode ' + + error + ); + }); if (oldval.val !== currentMode || !this.config.fritz_writeonhyst) { await this.setStateAsync( 'DECT_' + devices[i].identifier.replace(/\s/g, '') + '.operationmode', @@ -1397,7 +1433,14 @@ class Fritzdect extends utils.Adapter { if (devices[i].simpleonoff) { let switchtype = await this.getStateAsync( 'DECT_' + devices[i].identifier.replace(/\s/g, '') + '.switchtype' - ); + ).catch((error) => { + this.log.warn( + 'problem getting DECT_' + + devices[i].identifier.replace(/\s/g, '') + + '.switchtype ' + + error + ); + }); if (switchtype.val !== 'simpleonoff') { await this.setStateAsync( 'DECT_' + devices[i].identifier.replace(/\s/g, '') + '.switchtype', @@ -1543,7 +1586,7 @@ class Fritzdect extends utils.Adapter { old = await this.getStateAsync( 'DECT_' + identifier + '.' + key + '_stats.countm' ).catch((error) => { - this.log.error('DECT_' + identifier + '.' + key + '_stats.countm' + error); + this.log.warn('DECT_' + identifier + '.' + key + '_stats.countm' + error); }); if (old && old.val) { if (old.val !== parseInt(obj['stats'][0]['count'])) { @@ -1562,7 +1605,7 @@ class Fritzdect extends utils.Adapter { old = await this.getStateAsync( 'DECT_' + identifier + '.' + key + '_stats.gridm' ).catch((error) => { - this.log.error('DECT_' + identifier + '.' + key + '_stats.gridm' + error); + this.log.warn('DECT_' + identifier + '.' + key + '_stats.gridm' + error); }); if (old && old.val) { if (old.val !== parseInt(obj['stats'][0]['grid'])) { @@ -1604,7 +1647,7 @@ class Fritzdect extends utils.Adapter { old = await this.getStateAsync( 'DECT_' + identifier + '.' + key + '_stats.countd' ).catch((error) => { - this.log.error('DECT_' + identifier + '.' + key + '_stats.countd' + error); + this.log.warn('DECT_' + identifier + '.' + key + '_stats.countd' + error); }); if (old && old.val) { if (old.val !== parseInt(obj['stats'][1]['count'])) { @@ -1622,7 +1665,7 @@ class Fritzdect extends utils.Adapter { old = await this.getStateAsync( 'DECT_' + identifier + '.' + key + '_stats.gridd' ).catch((error) => { - this.log.error('DECT_' + identifier + '.' + key + '_stats.gridd' + error); + this.log.warn('DECT_' + identifier + '.' + key + '_stats.gridd' + error); }); if (old && old.val) { if (old.val !== parseInt(obj['stats'][1]['grid'])) { @@ -1670,7 +1713,7 @@ class Fritzdect extends utils.Adapter { old = await this.getStateAsync( 'DECT_' + identifier + '.' + key + '_stats.count' ).catch((error) => { - this.log.error('DECT_' + identifier + '.' + key + '_stats.count' + error); + this.log.warn('DECT_' + identifier + '.' + key + '_stats.count ' + error); }); if (old && old.val) { if (old.val !== parseInt(obj['stats']['count'])) { @@ -1689,7 +1732,7 @@ class Fritzdect extends utils.Adapter { old = await this.getStateAsync( 'DECT_' + identifier + '.' + key + '_stats.grid' ).catch((error) => { - this.log.error('DECT_' + identifier + '.' + key + '_stats.grid' + error); + this.log.warn('DECT_' + identifier + '.' + key + '_stats.grid ' + error); }); if (old && old.val) { if (old.val !== parseInt(obj['stats']['grid'])) { @@ -1726,7 +1769,9 @@ class Fritzdect extends utils.Adapter { if (!value || value == '') { this.log.debug(' no value for updating in ' + ain + ' ' + key + ' writing null'); //wirklich mit "null" beschreiben? - old = await this.getStateAsync('DECT_' + ain + '.' + key); + old = await this.getStateAsync('DECT_' + ain + '.' + key).catch((error) => { + this.log.warn('DECT_' + ain + '.' + key + ' did not get state -> ' + error); + }); if (old.val != null || !this.config.fritz_writeonhyst) { this.log.debug('updating data DECT_' + ain + ' : ' + key + ' new: ' + null + ' old: ' + old.val); await this.setStateAsync('DECT_' + ain + '.' + key, { @@ -1736,7 +1781,9 @@ class Fritzdect extends utils.Adapter { } } else { try { - old = await this.getStateAsync('DECT_' + ain + '.' + key); + old = await this.getStateAsync('DECT_' + ain + '.' + key).catch((error) => { + this.log.warn('DECT_' + ain + '.' + key + ' did not get state -> ' + error); + }); if (old !== null || !this.config.fritz_writeonhyst) { if (key == 'nextchange') { //fasthack anstatt neue objekterkennung diff --git a/package.json b/package.json index 4ed59978..b72801cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iobroker.fritzdect", - "version": "2.5.9", + "version": "2.5.10", "description": "ioBroker fritzbox DECT Adapter", "author": { "name": "foxthefox", diff --git a/test/data/unplugged_dect.json b/test/data/unplugged_dect.json new file mode 100644 index 00000000..38e8ae10 --- /dev/null +++ b/test/data/unplugged_dect.json @@ -0,0 +1,80 @@ +[ + { + "087610006102": { + "devicestats": { + "temperature": "", + "voltage": "", + "power": { + "stats": { + "count": "360", + "grid": "10", + "datatime": "1697649617", + "_@attribute": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" + } + }, + "energy": "" + } + } + }, + { + "087610006102": { + "devicestats": { + "temperature": "", + "voltage": "", + "power": { + "stats": { + "count": "360", + "grid": "10", + "datatime": "1697649617", + "_@attribute": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" + } + }, + "energy": "" + } + }, + "116570074380": { + "devicestats": { + "temperature": { + "stats": { + "count": "96", + "grid": "900", + "datatime": "1697707731", + "_@attribute": "100,90,90,90,95,90,90,85,80,80,75,85,85,75,75,70,70,70,70,75,80,80,80,85,85,85,85,80,75,80,80,80,80,85,85,85,85,85,85,85,85,85,85,85,90,85,90,90,90,90,90,95,100,100,95,95,100,110,115,115,120,120,125,120,110,110,110,110,120,120,120,120,120,130,135,140,145,135,145,135,140,135,130,125,120,120,120,115,115,110,105,110,95,85,80,70" + } + }, + "voltage": { + "stats": { + "count": "360", + "grid": "10", + "datatime": "1697707731", + "_@attribute": "236207,236002,236081,236174,236197,236120,236452,236372,236081,236099,236071,236176,236362,236124,236201,235889,236339,236246,236061,235925,236048,235986,235508,236046,236016,235718,235859,235950,235834,235672,235383,235157,235687,235568,235443,235538,235823,235885,235600,235170,235443,235648,235543,235307,235447,235515,235502,235486,235382,235401,235621,235661,235482,235367,235525,235381,235432,235399,235651,235516,235203,235720,235640,235512,235404,235344,235319,235311,235718,235759,235729,235447,235545,235872,235625,235453,235760,236043,235754,235804,235544,235679,235846,235350,235248,235529,235283,235384,235465,235597,235384,235438,235694,235049,235541,235761,235594,235585,235717,235467,235073,235186,235831,236043,236111,236414,236535,236668,236334,235697,236094,236431,236439,236343,236137,236228,235794,235778,235694,235855,235776,235986,235832,235767,235837,235572,235333,235519,235776,235699,235586,235454,235447,235390,235557,235468,235426,235758,235682,235678,235360,236039,235848,235960,235823,235924,235733,235697,235901,235533,235609,235624,235465,235337,235848,235568,235612,235598,235810,235285,235668,235310,235443,235460,235477,235670,235829,235720,235302,235166,235348,235445,235547,235273,235157,235267,235151,235123,235713,235891,235921,236097,235700,235701,235368,235368,235690,235972,235797,235926,236037,236100,235714,235915,235682,235819,235657,235751,235817,236040,236029,236003,236011,236112,235552,235940,236043,235896,235973,236096,235790,236009,235863,235859,236086,236098,236289,236313,236228,236040,235955,236174,236208,236090,236217,236101,235946,235865,235754,235297,236020,235992,236040,236022,236115,236988,236763,237395,237252,237320,237401,237126,237184,237407,237066,237164,237292,237305,237017,237035,236531,237209,233277,233142,233046,233212,233099,233526,233383,233561,233605,233434,233498,233928,233968,233909,233629,233698,233923,234244,234071,233913,234241,234287,234046,234310,234149,234311,234275,234395,234457,234893,235152,234985,235116,234875,235194,234990,235049,235074,235015,235048,234935,234906,234688,234686,234496,234610,234471,234639,234821,234575,234476,234256,233972,234667,234618,234512,234530,234918,234721,234782,234990,234192,234711,235003,234878,234734,234750,234726,234855,234867,234678,234647,234892,234756,234622,234698,234700,234730,234646,234771,234754,234748,234835,234791,234885,234992,234987,234657,235044,234969,235092,235415,235344,235169,235052,234753,234682,235239,235058,235001,235170,235102,235079,234822,235098,235049,235241,235481" + } + }, + "power": { + "stats": { + "count": "360", + "grid": "10", + "datatime": "1697707731", + "_@attribute": "52,51,52,53,51,51,52,53,52,53,51,51,52,52,52,52,51,51,52,51,51,51,52,52,52,53,52,51,52,51,51,51,53,51,52,51,52,53,55,53,52,55,51,52,51,51,52,51,51,51,52,52,52,51,51,51,52,51,52,51,51,51,52,52,52,51,51,53,53,53,51,52,52,52,52,52,51,52,52,50,51,51,52,52,52,50,51,51,51,51,52,57,54,54,52,52,52,51,54,55,52,51,52,51,51,52,52,53,53,55,53,53,52,51,51,52,53,52,51,52,51,52,51,52,51,51,51,51,51,53,51,52,52,53,53,52,50,55,52,58,53,51,52,54,52,52,52,52,52,53,52,52,54,52,54,53,51,52,52,52,51,51,51,52,52,51,51,51,52,52,54,54,53,52,52,53,51,52,52,52,51,52,52,52,51,51,52,51,54,52,55,51,52,52,52,53,55,53,51,51,52,52,60,55,54,52,51,52,52,52,52,50,52,52,52,50,50,50,51,52,55,51,52,54,52,52,52,56,59,54,58,53,52,52,55,55,52,55,54,51,52,53,53,53,52,52,53,52,52,60,52,51,51,50,51,53,51,51,56,54,55,59,55,51,53,54,52,55,52,53,55,54,53,55,55,52,53,53,60,61,56,52,51,51,51,51,51,51,52,51,51,56,52,54,55,55,52,52,51,52,54,61,82,55,57,51,52,51,51,51,59,51,52,51,54,52,51,53,57,56,52,56,52,52,52,53,57,54,54,60,54,53,52,52,51,52,51,52,52,53,51,51,51,52,52,52,51,51,51,52,51,53,51,52,51,52,52,57,51,51" + } + }, + "energy": { + "stats": [ + { + "count": "12", + "grid": "2678400", + "datatime": "1697673604", + "_@attribute": "239,363,347,714,241,8,3,68,551,624,31172,0" + }, + { + "count": "31", + "grid": "86400", + "datatime": "1697673604", + "_@attribute": "6,13,13,13,13,13,13,13,12,13,13,13,13,14,13,13,13,13,12,13,13,13,13,13,13,14,13,13,14,14,13" + } + ] + } + } + } + } +]