Skip to content

Commit

Permalink
Change log & fix switch state if printer is off
Browse files Browse the repository at this point in the history
  • Loading branch information
seydx authored Feb 27, 2021
1 parent eaf929f commit 3be7c89
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/accessories/switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ class SwitchAccessory {
} catch(err) {

if(err instanceof Error){
if(err.code && (err.code === 'ECONNREFUSED' || err.code === 'ETIMEDOUT' || err.code === 'EHOSTUNREACH' || err.code === 'ECONNRESET' || err.code === 'ECONNABORTED')){
Logger.warn('Can not reach printer!', this.accessory.displayName);
if(err.code && (err.code === 'ECONNREFUSED' || err.code === 'ETIMEDOUT' || err.code === 'EHOSTUNREACH' || err.code === 'ECONNRESET' || err.code === 'ECONNABORTED' || err.code === 'ENOTFOUND')){
Logger.debug('Can not reach printer!', this.accessory.displayName);
} else {
Logger.error('An error occured during getting state', this.accessory.displayName);
Logger.error(err);
Expand All @@ -167,7 +167,7 @@ class SwitchAccessory {
this.accessory
.getService(this.api.hap.Service.Switch)
.getCharacteristic(this.api.hap.Characteristic.On)
.updateValue(true);
.updateValue(false);

} finally {

Expand Down

0 comments on commit 3be7c89

Please sign in to comment.