@george.talusan/eufy-robovac-js 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/RoboVac.js +10 -11
- package/package.json +1 -2
package/lib/RoboVac.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const ping = require('net-ping').createSession({ retries: 10 });
|
|
2
1
|
const debug = require('debug');
|
|
3
2
|
const api = require('tuyapi');
|
|
4
3
|
const { EventEmitter } = require('events');
|
|
@@ -70,17 +69,7 @@ class RoboVac extends EventEmitter
|
|
|
70
69
|
this.connected = false;
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
ping() {
|
|
74
|
-
ping.pingHost(this.ip, (error, target) => {
|
|
75
|
-
if (error) {
|
|
76
|
-
debug(`${target}: ${error.toString()}`);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
72
|
async initialize() {
|
|
82
|
-
this.ping();
|
|
83
|
-
|
|
84
73
|
this.device = new api({
|
|
85
74
|
id: this.deviceId,
|
|
86
75
|
key: this.localKey,
|
|
@@ -372,6 +361,16 @@ class RoboVac extends EventEmitter
|
|
|
372
361
|
return this.set({ [COMMAND.goHome]: flag });
|
|
373
362
|
}
|
|
374
363
|
|
|
364
|
+
goingHome() {
|
|
365
|
+
if (!this.dps) {
|
|
366
|
+
throw new Error('no data points available yet');
|
|
367
|
+
}
|
|
368
|
+
if (!this.dps.hasOwnProperty(COMMAND.goHome)) {
|
|
369
|
+
throw new Error('RoboVac does not support this command');
|
|
370
|
+
}
|
|
371
|
+
return this.dps[COMMAND.goHome];
|
|
372
|
+
}
|
|
373
|
+
|
|
375
374
|
volume() {
|
|
376
375
|
if (!this.dps) {
|
|
377
376
|
throw new Error('no data points available yet');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@george.talusan/eufy-robovac-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"main": "./lib/RoboVac.js",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"debug": "^4.3.5",
|
|
13
|
-
"net-ping": "^1.2.4",
|
|
14
13
|
"tuyapi": "github:codetheweb/tuyapi"
|
|
15
14
|
},
|
|
16
15
|
"directories": {
|