Skip to content

Commit

Permalink
log
Browse files Browse the repository at this point in the history
  • Loading branch information
seydx committed Jun 23, 2021
1 parent d2f7221 commit cf5e753
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 62 deletions.
4 changes: 2 additions & 2 deletions src/accessories/childlock/childlock.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Handler {
state = !states.includes(1);
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory
Expand Down Expand Up @@ -111,7 +111,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.context.busy = false;
Expand Down
18 changes: 9 additions & 9 deletions src/accessories/extras/extras.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class Handler {
state = actives.includes(1) ? true : false;
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand Down Expand Up @@ -152,7 +152,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand Down Expand Up @@ -193,7 +193,7 @@ class Handler {
state = onState === activeValue;
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand Down Expand Up @@ -268,7 +268,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -505,7 +505,7 @@ class Handler {
logger.info('Done!', `${accessory.displayName} (${subtype})`);
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
} finally {
setTimeout(
() =>
Expand Down Expand Up @@ -600,7 +600,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand All @@ -625,7 +625,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -676,7 +676,7 @@ class Handler {
await requestLUA(formData, fritzbox.url.hostname, '/data.lua');
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -728,7 +728,7 @@ class Handler {
await requestLUA(formData, fritzbox.url.hostname, '/data.lua');
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down
2 changes: 1 addition & 1 deletion src/accessories/network/network.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Handler {
}
} catch (err) {
logger.error('An error occured during polling network this.device!', this.device.name);
logger.error(err);
logger.error(err, this.device.name);
} finally {
setTimeout(() => this.poll(), this.device.polling * 1000);
}
Expand Down
62 changes: 31 additions & 31 deletions src/accessories/router/router.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ class Handler {
logger.info('OFF script executed successfully!', `${accessory.displayName} (${subtype})`);
} catch (err) {
logger.error('An error occured during executing OFF script!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}
}
}
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand All @@ -151,13 +151,13 @@ class Handler {
logger.info('OFF script executed successfully!', `${accessory.displayName} (${subtype})`);
} catch (err) {
logger.error('An error occured during executing OFF script!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}
}
}
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand All @@ -172,7 +172,7 @@ class Handler {
state = response.NewEnable === '1';
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand All @@ -192,7 +192,7 @@ class Handler {
state = response.NewEnable === '1';
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand Down Expand Up @@ -227,7 +227,7 @@ class Handler {
state = responses.some((response) => response && response.NewEnable === '1');
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand All @@ -247,7 +247,7 @@ class Handler {
state = response.NewEnable === '1';
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand All @@ -265,7 +265,7 @@ class Handler {
state = response['NewX_AVM-DE_WPSStatus'] === 'on';
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand Down Expand Up @@ -294,7 +294,7 @@ class Handler {
state = body.checked || body.checked === '';
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand All @@ -311,7 +311,7 @@ class Handler {
state = response.NewEnable === '1';
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand All @@ -338,7 +338,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand Down Expand Up @@ -371,7 +371,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand Down Expand Up @@ -400,7 +400,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(state);
Expand Down Expand Up @@ -428,7 +428,7 @@ class Handler {
maxUl = `${(parseInt(response.Newmax_us) / 125000).toFixed(2)} Mbit/s`;
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}

accessory
Expand Down Expand Up @@ -492,7 +492,7 @@ class Handler {
logger.info('ON script executed successfully!', `${accessory.displayName} (${subtype})`);
} catch (err) {
logger.error('An error occured during executing ON script!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}
}

Expand All @@ -506,7 +506,7 @@ class Handler {
accessory.context.restart = true;
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -538,7 +538,7 @@ class Handler {
logger.info('ON script executed successfully!', `${accessory.displayName} (${subtype})`);
} catch (err) {
logger.error('An error occured during executing ON script!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
}
}

Expand All @@ -552,7 +552,7 @@ class Handler {
accessory.context.restart = true;
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -583,7 +583,7 @@ class Handler {
await fritzbox.exec('urn:DeviceConfig-com:serviceId:DeviceConfig1', 'Reboot');
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -613,7 +613,7 @@ class Handler {
});
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -667,7 +667,7 @@ class Handler {
await Promise.all(promises);
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -696,7 +696,7 @@ class Handler {
});
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -724,7 +724,7 @@ class Handler {
});
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand All @@ -750,7 +750,7 @@ class Handler {
await fritzbox.exec(service, 'ForceTermination');
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);
} finally {
setTimeout(
() =>
Expand Down Expand Up @@ -805,7 +805,7 @@ class Handler {
await requestLUA(formData, fritzbox.url.hostname, '/data.lua');
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand All @@ -832,7 +832,7 @@ class Handler {
});
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -870,7 +870,7 @@ class Handler {
});
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand All @@ -892,7 +892,7 @@ class Handler {
}
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -936,7 +936,7 @@ class Handler {
await requestLUA(formData, fritzbox.url.hostname, '/data.lua');
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down Expand Up @@ -966,7 +966,7 @@ class Handler {
await requestLUA(formData, fritzbox.url.hostname, '/data.lua');
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
Expand Down
Loading

0 comments on commit cf5e753

Please sign in to comment.