Skip to content

Commit

Permalink
Merge pull request #436 from foxthefox/2.5.0
Browse files Browse the repository at this point in the history
2.5.0.h
  • Loading branch information
foxthefox authored Sep 23, 2023
2 parents 0efbe18 + 1c01ad4 commit 7df08f1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class Fritzdect extends utils.Adapter {
});

if (deviceswithstat && deviceswithstat.val) {
this.log.info('glob state ' + deviceswithstat.val);
let devstat = [].concat([], JSON.parse(String(deviceswithstat.val)));
for (let i = 0; i < devstat.length; i++) {
this.log.debug('updating device ' + devstat[i]);
Expand Down Expand Up @@ -1478,7 +1479,7 @@ class Fritzdect extends utils.Adapter {
}
async updateStats(identifier, fritz) {
this.log.debug('update Stats objects ' + identifier);
let devstat = await this.fritz.getBasicDeviceStats(identifier).catch((e) => this.errorHandlerApi(e));
let devstat = await fritz.getBasicDeviceStats(identifier).catch((e) => this.errorHandlerApi(e));
let statsobj = parser.xml2json(devstat);
await Promise.all(
Object.entries(statsobj.devicetstats).map(async ([ key, obj ]) => {
Expand Down Expand Up @@ -2491,10 +2492,8 @@ class Fritzdect extends utils.Adapter {
let oldarr = await this.getStateAsync('global.statdevices').catch((e) => {
this.log.warn('problem getting statdevices ' + e);
});
this.log.info('oldarr = ' + JSON.stringify(oldarr.val));
if (oldarr && oldarr.val) {
var newarray = [].concat(JSON.parse(String(oldarr.val)), identifier);
this.log.info('newarr = ' + JSON.stringify(newarray));
await this.setStateAsync('global.statdevices', {
val: JSON.stringify(newarray),
ack: true
Expand Down

0 comments on commit 7df08f1

Please sign in to comment.