From 131667207d9640cb56b9b69550b8c5a6bf485a0f Mon Sep 17 00:00:00 2001 From: George Talusan Date: Mon, 2 Sep 2024 15:09:20 -0400 Subject: [PATCH] make home work a bit better --- package-lock.json | 18 +++++++++--------- package.json | 2 +- src/defaultAccessory.ts | 6 +++++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 189745c..07ed353 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { - "name": "homebridge-plugin-eufy-robovac", - "version": "0.0.1", + "name": "@george.talusan/homebridge-eufy-robovac", + "version": "0.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "homebridge-plugin-eufy-robovac", - "version": "0.0.1", + "name": "@george.talusan/homebridge-eufy-robovac", + "version": "0.0.3", "license": "ISC", "dependencies": { - "@george.talusan/eufy-robovac-js": "^0.0.4" + "@george.talusan/eufy-robovac-js": "^0.0.5" }, "devDependencies": { "@eslint/js": "^9.9.0", @@ -24,7 +24,7 @@ "typescript-eslint": "^8.0.1" }, "engines": { - "homebridge": "^1.8.0 || ^2.0.0-beta.0", + "homebridge": "^1.8.5 || ^2.0.0-beta.0", "node": "^18.20.4 || ^20.16.0 || ^22.6.0" } }, @@ -140,9 +140,9 @@ } }, "node_modules/@george.talusan/eufy-robovac-js": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@george.talusan/eufy-robovac-js/-/eufy-robovac-js-0.0.4.tgz", - "integrity": "sha512-35xkxX6xcifG7ret7e819swDdO7J2+nenIQMBz4TM5i7YxEgpvmk3pOlogUy9uRu4BUX9dgKvebry/o/YghBPQ==", + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/@george.talusan/eufy-robovac-js/-/eufy-robovac-js-0.0.5.tgz", + "integrity": "sha512-Hfv9pETyTuedhTaCkBHfnhVZnJ0QgP3ms5QBl/4+2cywL+p3f0AJg9g+nV49Wr12+gZlabyhHShTqGVeYO3+VQ==", "license": "ISC", "dependencies": { "debug": "^4.3.5", diff --git a/package.json b/package.json index b8b48ed..03d245f 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,6 @@ "typescript-eslint": "^8.0.1" }, "dependencies": { - "@george.talusan/eufy-robovac-js": "^0.0.4" + "@george.talusan/eufy-robovac-js": "^0.0.5" } } diff --git a/src/defaultAccessory.ts b/src/defaultAccessory.ts index fa6bd5e..9132e68 100644 --- a/src/defaultAccessory.ts +++ b/src/defaultAccessory.ts @@ -7,6 +7,8 @@ interface RobovacEvent { value: boolean | number | string | object | null; }; +const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)); + export class DefaultPlatformAccessory { private service: Service; @@ -83,7 +85,9 @@ export class DefaultPlatformAccessory { if (on) { await this.platform.robovac.clean(); } else { - await this.platform.robovac.goHome(); + await this.platform.robovac.pause(); + await sleep(3000); + await this.platform.robovac.goHome(true); } } catch (error: unknown) { this.platform.log.error(error as string);