@george.talusan/eufy-robovac-js 0.0.12 → 0.0.13
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 +64 -0
- package/package.json +1 -1
package/lib/RoboVac.js
CHANGED
|
@@ -8,6 +8,7 @@ const COMMAND = {
|
|
|
8
8
|
workMode: '5',
|
|
9
9
|
activity: '15',
|
|
10
10
|
goHome: '101',
|
|
11
|
+
cleanSpeed: '102',
|
|
11
12
|
findMyRobot: '103',
|
|
12
13
|
battery: '104',
|
|
13
14
|
error: '106',
|
|
@@ -16,6 +17,7 @@ const COMMAND = {
|
|
|
16
17
|
volume: '111',
|
|
17
18
|
consumables: '116',
|
|
18
19
|
multimaps: '117',
|
|
20
|
+
boostIQ: '118',
|
|
19
21
|
rooms: '124',
|
|
20
22
|
voice: '125',
|
|
21
23
|
hello: '126',
|
|
@@ -23,6 +25,13 @@ const COMMAND = {
|
|
|
23
25
|
status: '142',
|
|
24
26
|
};
|
|
25
27
|
|
|
28
|
+
const CLEAN_SPEED = {
|
|
29
|
+
quiet: 'Quiet',
|
|
30
|
+
standard: 'Standard',
|
|
31
|
+
turbo: 'Turbo',
|
|
32
|
+
max: 'Max'
|
|
33
|
+
};
|
|
34
|
+
|
|
26
35
|
const ERRORS = {
|
|
27
36
|
0: 'no error',
|
|
28
37
|
1: 'front bumper stuck',
|
|
@@ -117,6 +126,9 @@ class RoboVac extends EventEmitter
|
|
|
117
126
|
else if (command === COMMAND.goHome) {
|
|
118
127
|
this.emit('event', { command: 'goHome', value });
|
|
119
128
|
}
|
|
129
|
+
else if (command === COMMAND.cleanSpeed) {
|
|
130
|
+
this.emit('event', { command: 'cleanSpeed', value });
|
|
131
|
+
}
|
|
120
132
|
else if (command === COMMAND.findMyRobot) {
|
|
121
133
|
this.emit('event', { command: 'locate', value });
|
|
122
134
|
}
|
|
@@ -165,6 +177,9 @@ class RoboVac extends EventEmitter
|
|
|
165
177
|
else if (command === COMMAND.multimaps) {
|
|
166
178
|
this.emit('event', { command: 'multimaps', value: this.multimaps() });
|
|
167
179
|
}
|
|
180
|
+
else if (command === COMMAND.boostIQ) {
|
|
181
|
+
this.emit('event', { command: 'boostIQ', value: this.boostIQ() });
|
|
182
|
+
}
|
|
168
183
|
else if (command === COMMAND.rooms) {
|
|
169
184
|
this.emit('event', { command: 'rooms', value: this.rooms() });
|
|
170
185
|
}
|
|
@@ -427,6 +442,55 @@ class RoboVac extends EventEmitter
|
|
|
427
442
|
return JSON.parse(json);
|
|
428
443
|
}
|
|
429
444
|
|
|
445
|
+
async setCleanSpeedQuiet() {
|
|
446
|
+
if (!Object.hasOwn(this.dps, COMMAND.cleanSpeed)) {
|
|
447
|
+
throw new Error('RoboVac does not support this command');
|
|
448
|
+
}
|
|
449
|
+
return this.set({ [COMMAND.cleanSpeed]: CLEAN_SPEED.quiet });
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
async setCleanSpeedStandard() {
|
|
453
|
+
if (!Object.hasOwn(this.dps, COMMAND.cleanSpeed)) {
|
|
454
|
+
throw new Error('RoboVac does not support this command');
|
|
455
|
+
}
|
|
456
|
+
return this.set({ [COMMAND.cleanSpeed]: CLEAN_SPEED.standard });
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
async setCleanSpeedTurbo() {
|
|
460
|
+
if (!Object.hasOwn(this.dps, COMMAND.cleanSpeed)) {
|
|
461
|
+
throw new Error('RoboVac does not support this command');
|
|
462
|
+
}
|
|
463
|
+
return this.set({ [COMMAND.cleanSpeed]: CLEAN_SPEED.turbo });
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
async setCleanSpeedMax() {
|
|
467
|
+
if (!Object.hasOwn(this.dps, COMMAND.cleanSpeed)) {
|
|
468
|
+
throw new Error('RoboVac does not support this command');
|
|
469
|
+
}
|
|
470
|
+
return this.set({ [COMMAND.cleanSpeed]: CLEAN_SPEED.max});
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
boostIQ() {
|
|
474
|
+
if (!this.dps) {
|
|
475
|
+
throw new Error('no data points available yet');
|
|
476
|
+
}
|
|
477
|
+
if (!Object.hasOwn(this.dps, COMMAND.boostIQ)) {
|
|
478
|
+
throw new Error('RoboVac does not support this command');
|
|
479
|
+
}
|
|
480
|
+
return this.dps[COMMAND.boostIQ];
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
async setBoostIQ(flag) {
|
|
484
|
+
if (!Object.hasOwn(this.dps, COMMAND.boostIQ)) {
|
|
485
|
+
throw new Error('RoboVac does not support this command');
|
|
486
|
+
}
|
|
487
|
+
const b = this.dps[COMMAND.boostIQ];
|
|
488
|
+
if (b === flag) {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
return this.set({ [COMMAND.boostIQ]: flag });
|
|
492
|
+
}
|
|
493
|
+
|
|
430
494
|
rooms() {
|
|
431
495
|
if (!this.dps) {
|
|
432
496
|
throw new Error('no data points available yet');
|