@george.talusan/eufy-robovac-js 0.0.2 → 0.0.4
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 +24 -1
- package/package.json +2 -1
package/lib/RoboVac.js
CHANGED
|
@@ -4,6 +4,7 @@ const api = require('tuyapi');
|
|
|
4
4
|
const { EventEmitter } = require('events');
|
|
5
5
|
|
|
6
6
|
const COMMAND = {
|
|
7
|
+
workMode: '5',
|
|
7
8
|
activity: '15',
|
|
8
9
|
goHome: '101',
|
|
9
10
|
findMyRobot: '103',
|
|
@@ -112,7 +113,10 @@ class RoboVac extends EventEmitter
|
|
|
112
113
|
|
|
113
114
|
Object.keys(data.dps).forEach(command => {
|
|
114
115
|
const value = data.dps[command];
|
|
115
|
-
if (command === COMMAND.
|
|
116
|
+
if (command === COMMAND.workMode) {
|
|
117
|
+
this.emit('event', { command: 'workMode', value });
|
|
118
|
+
}
|
|
119
|
+
else if (command === COMMAND.activity) {
|
|
116
120
|
this.emit('event', { command: 'activity', value });
|
|
117
121
|
}
|
|
118
122
|
else if (command === COMMAND.goHome) {
|
|
@@ -184,6 +188,25 @@ class RoboVac extends EventEmitter
|
|
|
184
188
|
return this.connect();
|
|
185
189
|
}
|
|
186
190
|
|
|
191
|
+
async clean() {
|
|
192
|
+
if (!this.dps) {
|
|
193
|
+
debug('no data points available yet');
|
|
194
|
+
return 'unknown';
|
|
195
|
+
}
|
|
196
|
+
return this.set({ [COMMAND.workMode]: 'auto' });
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
workMode() {
|
|
200
|
+
if (!this.dps) {
|
|
201
|
+
debug('no data points available yet');
|
|
202
|
+
return 'unknown';
|
|
203
|
+
}
|
|
204
|
+
if (!this.dps.hasOwnProperty(COMMAND.workMode)) {
|
|
205
|
+
throw new Error('RoboVac does not support this command');
|
|
206
|
+
}
|
|
207
|
+
return this.dps[COMMAND.workMode];
|
|
208
|
+
}
|
|
209
|
+
|
|
187
210
|
activity() {
|
|
188
211
|
if (!this.dps) {
|
|
189
212
|
debug('no data points available yet');
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@george.talusan/eufy-robovac-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
7
|
},
|
|
8
8
|
"author": "",
|
|
9
9
|
"license": "ISC",
|
|
10
|
+
"main": "./lib/RoboVac.js",
|
|
10
11
|
"dependencies": {
|
|
11
12
|
"debug": "^4.3.5",
|
|
12
13
|
"net-ping": "^1.2.4",
|