Skip to content

Commit

Permalink
Fix for wrong return type and adding ability to get/set findRobot sin…
Browse files Browse the repository at this point in the history
…ce it will not stop beeping until you set it back to false or start it vacuuming. I had, wrongly, assumed it beeped a set number of times.
  • Loading branch information
joshstrange committed May 17, 2019
1 parent 1c7b0aa commit 56ed7e6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eufy-robovac",
"version": "1.0.1",
"version": "1.1.0",
"description": "NodeJS library to control Eufy RoboVac",
"main": "dist/index.js",
"types": "dist/index.d.js",
Expand Down Expand Up @@ -28,7 +28,7 @@
"tuyapi": "^4.0.4"
},
"devDependencies": {
"@types/node": "^12.0.0",
"@types/node": "^12.0.2",
"ts-loader": "^6.0.0",
"typescript": "^3.4.5",
"webpack": "^4.31.0",
Expand Down
11 changes: 8 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,22 @@ export class RoboVac {
});
}

async findRobot() {
async setFindRobot(state: boolean) {
await this.doWork(async () => {
await this.set({
[this.FIND_ROBOT]: true
[this.FIND_ROBOT]: state
})
});
}

async getFindRobot(force: boolean = false) {
let statuses = await this.getStatuses(force);
return <boolean>statuses.dps[this.FIND_ROBOT];
}

async getBatteyLevel(force: boolean = false) {
let statuses = await this.getStatuses(force);
return <WorkStatus>statuses.dps[this.BATTERY_LEVEL];
return <number>statuses.dps[this.BATTERY_LEVEL];
}

async getErrorCode(force: boolean = false): Promise<ErrorCode> {
Expand Down

0 comments on commit 56ed7e6

Please sign in to comment.