Skip to content

Commit

Permalink
fix/timeout-issue (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
RaresAil authored Feb 6, 2022
1 parent d33732a commit 1976418
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 109 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"displayName": "Levoit Air Purifier",
"main": "dist/index.js",
"license": "Apache-2.0",
"version": "1.1.8",
"version": "1.1.9",
"private": false,
"bugs": {
"url": "https://github.com/RaresAil/homebridge-levoit-air-purifier/issues"
Expand All @@ -27,27 +27,27 @@
"devDependencies": {
"@types/async-lock": "^1.1.3",
"@types/big.js": "^6.1.2",
"@types/node": "^17.0.8",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"eslint": "^8.7.0",
"homebridge": "^1.3.9",
"@types/node": "^17.0.15",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"homebridge": "^1.4.0",
"nodemon": "^2.0.15",
"rimraf": "^3.0.2",
"ts-node": "^10.3.0",
"typescript": "^4.5.4"
"typescript": "^4.5.5"
},
"engines": {
"homebridge": ">=1.3.5",
"node": ">=14.18.1"
},
"dependencies": {
"async-lock": "^1.3.0",
"axios": "^0.24.0",
"async-lock": "^1.3.1",
"axios": "^0.25.0",
"big.js": "^6.1.1"
},
"resolutions": {
"follow-redirects": "^1.14.7"
"minimist": "^1.2.3"
},
"keywords": [
"homebridge-plugin",
Expand Down
6 changes: 3 additions & 3 deletions src/api/VeSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export default class VeSync {
private accountId?: string;
private token?: string;

private readonly VERSION = '1.1.8';
private readonly VERSION = '1.1.9';
private readonly AGENT = `VeSync/VeSync 3.0.51(F5321;HomeBridge-VeSync ${this.VERSION})`;
private readonly TIMEZONE = 'America/New_York';
private readonly OS = 'HomeBridge-VeSync';
private readonly LANG = 'en';

private readonly AXIOS_OPTIONS = {
baseURL: 'https://smartapi.vesync.com',
timeout: 15000
timeout: 30000
};

constructor(
Expand Down Expand Up @@ -315,7 +315,7 @@ export default class VeSync {
)
.map(VeSyncFan.fromResponse(this));

await delay(500);
await delay(1500);

return devices;
} catch (error: any) {
Expand Down
2 changes: 1 addition & 1 deletion src/characteristics/Active.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const characteristic: {
const boolValue = value === 1;

if (boolValue !== this.device.isOn) {
this.device.setPower(boolValue);
await this.device.setPower(boolValue);
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/characteristics/TargetState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ const characteristic: {
switch (value) {
case AUTO:
if (this.device.mode !== Mode.Auto) {
this.device.changeMode(Mode.Auto);
await this.device.changeMode(Mode.Auto);
}
break;
case MANUAL:
if (this.device.mode !== Mode.Manual) {
this.device.changeMode(Mode.Manual);
await this.device.changeMode(Mode.Manual);
}
break;
}
Expand Down
Loading

0 comments on commit 1976418

Please # to comment.