@george.talusan/eufy-robovac-js 0.0.7 → 0.0.8
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 +32 -0
- package/package.json +1 -1
package/lib/RoboVac.js
CHANGED
|
@@ -15,6 +15,7 @@ const COMMAND = {
|
|
|
15
15
|
volume: '111',
|
|
16
16
|
consumables: '116',
|
|
17
17
|
multimaps: '117',
|
|
18
|
+
rooms: '124',
|
|
18
19
|
voice: '125',
|
|
19
20
|
hello: '126',
|
|
20
21
|
autoReturn: '135',
|
|
@@ -163,6 +164,9 @@ class RoboVac extends EventEmitter
|
|
|
163
164
|
else if (command === COMMAND.multimaps) {
|
|
164
165
|
this.emit('event', { command: 'multimaps', value: this.multimaps() });
|
|
165
166
|
}
|
|
167
|
+
else if (command === COMMAND.rooms) {
|
|
168
|
+
this.emit('event', { command: 'rooms', this.rooms() });
|
|
169
|
+
}
|
|
166
170
|
else if (command === COMMAND.voice) {
|
|
167
171
|
this.emit('event', { command: 'voice', value: this.voice() });
|
|
168
172
|
}
|
|
@@ -189,6 +193,23 @@ class RoboVac extends EventEmitter
|
|
|
189
193
|
return this.set({ [COMMAND.workMode]: 'auto' });
|
|
190
194
|
}
|
|
191
195
|
|
|
196
|
+
async cleanRooms(rooms) {
|
|
197
|
+
if (!this.dps) {
|
|
198
|
+
debug('no data points available yet');
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const fn = {
|
|
202
|
+
method: 'selectRoomsClean',
|
|
203
|
+
data: {
|
|
204
|
+
roomIds: rooms || [ 1 ],
|
|
205
|
+
cleanTimes: 1
|
|
206
|
+
},
|
|
207
|
+
timestamp: Date.now()
|
|
208
|
+
};
|
|
209
|
+
const value = Buffer.from(JSON.stringify(fn)).toString('base64');
|
|
210
|
+
return this.set({ [COMMAND.rooms]: value });
|
|
211
|
+
}
|
|
212
|
+
|
|
192
213
|
async resume() {
|
|
193
214
|
if (!this.dps) {
|
|
194
215
|
debug('no data points available yet');
|
|
@@ -402,6 +423,17 @@ class RoboVac extends EventEmitter
|
|
|
402
423
|
return JSON.parse(json);
|
|
403
424
|
}
|
|
404
425
|
|
|
426
|
+
rooms() {
|
|
427
|
+
if (!this.dps) {
|
|
428
|
+
throw new Error('no data points available yet');
|
|
429
|
+
}
|
|
430
|
+
if (!this.dps.hasOwnProperty(COMMAND.rooms)) {
|
|
431
|
+
throw new Error('RoboVac does not support this command');
|
|
432
|
+
}
|
|
433
|
+
const json = Buffer.from(this.dps[COMMAND.rooms], 'base64');
|
|
434
|
+
return JSON.parse(json);
|
|
435
|
+
}
|
|
436
|
+
|
|
405
437
|
voice() {
|
|
406
438
|
if (!this.dps) {
|
|
407
439
|
throw new Error('no data points available yet');
|