@george.talusan/eufy-robovac-js 0.0.9 → 0.0.11
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/README.md +52 -0
- package/lib/RoboVac.js +3 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
## eufy-robovac-js
|
|
2
|
+
|
|
3
|
+
Yet another NodeJS library to control a Eufy RoboVac.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
npm install @george.talusan/eufy-robovac-js
|
|
8
|
+
|
|
9
|
+
## Configuration
|
|
10
|
+
|
|
11
|
+
See https://github.com/gtalusan/eufy-device-id-js for obtaining your Eufy Robovac's device ID and local key.
|
|
12
|
+
|
|
13
|
+
## How to use
|
|
14
|
+
|
|
15
|
+
### Create an instance of RoboVac
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
import { RoboVac } from '@george.talusan/eufy-robovac-js';
|
|
19
|
+
|
|
20
|
+
const vac = new RoboVac({ ip: 'some ip', deviceId: 'your device id', localKey: 'your local key' });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Wire up event listeners
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
vac.on('error', error => console.log(error)); // listen for errors
|
|
27
|
+
vac.on('tuya.connected', fn); // reflected event from TuyAPI
|
|
28
|
+
vac.on('tuya.disconnected', fn); // reflected event from TuyAPI
|
|
29
|
+
vac.on('tuya.data', data => console.log(data)); // reflected event from TuyAPI
|
|
30
|
+
vac.on('tuya.dp-refresh', data => console.log(data)); // reflected event from TuyAPI
|
|
31
|
+
|
|
32
|
+
vac.on('event', ({ command, value }) => console.log(command, value)); // human readable dp-refresh/data events
|
|
33
|
+
vac.on('alert', ({ consumable, duration }) => console.log(consumable, duration)); // alerts when consumables should be replaced
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Commands
|
|
37
|
+
|
|
38
|
+
Refer to the source code for various functionality. Typical setters/commands are async. Use await appropriately.
|
|
39
|
+
|
|
40
|
+
All getters retrieve values from the output of dp-refresh/data events and are hence cached. Thus, `set(X) == Y` does not mean necessarily `get(X) == Y`. In other words, do not assume setters are idempotent.
|
|
41
|
+
|
|
42
|
+
## Other projects using this library
|
|
43
|
+
|
|
44
|
+
* Homebridge: https://github.com/gtalusan/homebridge-eufy-robovac
|
|
45
|
+
* Node-RED: https://github.com/gtalusan/node-red-contrib-eufy-robovac
|
|
46
|
+
|
|
47
|
+
## Credits
|
|
48
|
+
|
|
49
|
+
Inspired by various projects.
|
|
50
|
+
|
|
51
|
+
* https://github.com/apexad/eufy-robovac
|
|
52
|
+
* https://github.com/bmccluskey/robovac
|
package/lib/RoboVac.js
CHANGED
|
@@ -387,6 +387,9 @@ class RoboVac extends EventEmitter
|
|
|
387
387
|
if (!this.dps) {
|
|
388
388
|
throw new Error('no data points available yet');
|
|
389
389
|
}
|
|
390
|
+
if (this.activity() === 'Recharge') {
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
390
393
|
if (!Object.hasOwn(this.dps, COMMAND.goHome)) {
|
|
391
394
|
throw new Error('RoboVac does not support this command');
|
|
392
395
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@george.talusan/eufy-robovac-js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"main": "./lib/RoboVac.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint lib",
|
|
7
|
+
"prepack": "npm run lint",
|
|
7
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
9
|
},
|
|
9
10
|
"author": "",
|
|
10
11
|
"license": "ISC",
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"debug": "^4.3.5",
|
|
13
|
-
"tuyapi": "
|
|
14
|
+
"tuyapi": "^7.7.1"
|
|
14
15
|
},
|
|
15
16
|
"directories": {
|
|
16
17
|
"lib": "lib"
|