Skip to content

Commit

Permalink
fix washer door lock target status
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin committed Jun 21, 2021
1 parent f23ff1e commit 424d41e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## v0.2.8

### Bug fixes

* fix washer door lock target status

## v0.2.7

### Bug fixes
Expand Down
1 change: 1 addition & 0 deletions src/devices/WasherDryer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default class WasherDryer extends baseDevice {

if (this.serviceDoorLock) {
this.serviceDoorLock.updateCharacteristic(Characteristic.LockCurrentState, this.Status.isDoorLocked ? 1 : 0);
this.serviceDoorLock.updateCharacteristic(Characteristic.LockTargetState, this.Status.isDoorLocked ? 1 : 0);
}
}

Expand Down
29 changes: 5 additions & 24 deletions src/lib/ThinQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export class ThinQ {
try {
listDevices = await this.api.getListDevices();
} catch (err) {
// EAI_AGAIN mean dns timeout, should skip it and try later
if (err.code === 'EAI_AGAIN') {
// network issue, no response
if (!err.response) {
return [];
}

Expand All @@ -38,8 +38,8 @@ export class ThinQ {
await this.api.refreshNewToken();
listDevices = await this.api.getListDevices();
} catch (err) {
// write log if error not is DNS timeout
if (err.code !== 'EAI_AGAIN') {
// write log if error not is network issue
if (!err.response) {
this.log.error(err);
}

Expand All @@ -50,25 +50,6 @@ export class ThinQ {
return listDevices.map(device => new Device(device));
}

public async device(id: string) {
await this.api.ready();
let device: Device;
try {
device = await this.api.getDeviceInfo(id);
} catch (err) {
await this.api.refreshNewToken();
try {
device = await this.api.getDeviceInfo(id);
} catch (err) {
this.log.error(err);

throw err;
}
}

return new Device(device);
}

public async startMonitor(device: Device) {
if (device.platform === PlatformType.ThinQ1) {
try {
Expand Down Expand Up @@ -139,7 +120,7 @@ export class ThinQ {
try {
return await this.api.sendCommandToDevice(id, values);
} catch (err) {
this.platform.log.error(err);
this.log.error(err);
throw err;
}
}
Expand Down

0 comments on commit 424d41e

Please sign in to comment.