@mega-yfue/eufy-sdk 0.2.0-beta.4 → 0.2.0-beta.5
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/dist/index.js
CHANGED
|
@@ -7737,6 +7737,89 @@ var ModeCtrlMethod = {
|
|
|
7737
7737
|
STOP_SMART_FOLLOW: 18,
|
|
7738
7738
|
START_GLOBAL_CRUISE: 20
|
|
7739
7739
|
};
|
|
7740
|
+
var ModeCtrlParamMethod = {
|
|
7741
|
+
/** `START_SELECT_ROOMS_CLEAN` — clean the named rooms of a named map. */
|
|
7742
|
+
SELECT_ROOMS: { method: 1, param: 4 },
|
|
7743
|
+
/** `START_SELECT_ZONES_CLEAN` — clean the given rectangles of a named map. */
|
|
7744
|
+
SELECT_ZONES: { method: 2, param: 5 },
|
|
7745
|
+
/** `START_GOTO_CLEAN` — drive to a point and clean around it. */
|
|
7746
|
+
GOTO: { method: 4, param: 7 },
|
|
7747
|
+
/** `START_SCENE_CLEAN` — run a saved scene by its id. */
|
|
7748
|
+
SCENE: { method: 24, param: 14 }
|
|
7749
|
+
};
|
|
7750
|
+
var SELECT_ROOMS_FIELD = {
|
|
7751
|
+
/** `rooms` — repeated, one entry per room. */
|
|
7752
|
+
ROOMS: 1,
|
|
7753
|
+
/** `clean_times` — how many passes to make. */
|
|
7754
|
+
CLEAN_TIMES: 2,
|
|
7755
|
+
/** `map_id` — WHICH saved map the room ids belong to. */
|
|
7756
|
+
MAP_ID: 3,
|
|
7757
|
+
/** `id` within a `Room`. */
|
|
7758
|
+
ROOM_ID: 1,
|
|
7759
|
+
/** `order` within a `Room` — the sequence to visit them in. */
|
|
7760
|
+
ROOM_ORDER: 2
|
|
7761
|
+
};
|
|
7762
|
+
var SELECT_ZONES_FIELD = {
|
|
7763
|
+
/** `zones` — repeated, one entry per rectangle. */
|
|
7764
|
+
ZONES: 1,
|
|
7765
|
+
/** `map_id` — which saved map the coordinates belong to. */
|
|
7766
|
+
MAP_ID: 2,
|
|
7767
|
+
/** `quadrangle` within a `Zone` — its four corners. */
|
|
7768
|
+
QUADRANGLE: 1,
|
|
7769
|
+
/** `clean_times` within a `Zone`. */
|
|
7770
|
+
ZONE_CLEAN_TIMES: 2,
|
|
7771
|
+
/** `x` within a `Point`, SIGNED centimetres. */
|
|
7772
|
+
POINT_X: 1,
|
|
7773
|
+
/** `y` within a `Point`, SIGNED centimetres. */
|
|
7774
|
+
POINT_Y: 2
|
|
7775
|
+
};
|
|
7776
|
+
var SCENE_CLEAN_ID = 1;
|
|
7777
|
+
function encodeModeCtrlParam(method2, paramField, build) {
|
|
7778
|
+
return rawDp((w) => {
|
|
7779
|
+
if (method2 !== 0)
|
|
7780
|
+
w.int(MODE_CTRL_FIELD.METHOD, method2);
|
|
7781
|
+
w.int(MODE_CTRL_FIELD.SEQ, nextModeCtrlSeq());
|
|
7782
|
+
w.sub(paramField, build);
|
|
7783
|
+
});
|
|
7784
|
+
}
|
|
7785
|
+
function encodeSelectRoomsClean(mapId, rooms, cleanTimes = 1) {
|
|
7786
|
+
const { method: method2, param } = ModeCtrlParamMethod.SELECT_ROOMS;
|
|
7787
|
+
return encodeModeCtrlParam(method2, param, (p) => {
|
|
7788
|
+
for (const room of rooms) {
|
|
7789
|
+
p.sub(SELECT_ROOMS_FIELD.ROOMS, (r) => {
|
|
7790
|
+
r.int(SELECT_ROOMS_FIELD.ROOM_ID, room.id);
|
|
7791
|
+
if (room.order !== void 0)
|
|
7792
|
+
r.int(SELECT_ROOMS_FIELD.ROOM_ORDER, room.order);
|
|
7793
|
+
});
|
|
7794
|
+
}
|
|
7795
|
+
p.int(SELECT_ROOMS_FIELD.CLEAN_TIMES, cleanTimes);
|
|
7796
|
+
p.int(SELECT_ROOMS_FIELD.MAP_ID, mapId);
|
|
7797
|
+
});
|
|
7798
|
+
}
|
|
7799
|
+
function encodeSelectZonesClean(mapId, zones) {
|
|
7800
|
+
const { method: method2, param } = ModeCtrlParamMethod.SELECT_ZONES;
|
|
7801
|
+
return encodeModeCtrlParam(method2, param, (p) => {
|
|
7802
|
+
for (const zone of zones) {
|
|
7803
|
+
p.sub(SELECT_ZONES_FIELD.ZONES, (z) => {
|
|
7804
|
+
z.sub(SELECT_ZONES_FIELD.QUADRANGLE, (q) => {
|
|
7805
|
+
for (const [i, corner] of zone.corners.entries()) {
|
|
7806
|
+
q.sub(i + 1, (pt) => {
|
|
7807
|
+
pt.sint(SELECT_ZONES_FIELD.POINT_X, corner.x);
|
|
7808
|
+
pt.sint(SELECT_ZONES_FIELD.POINT_Y, corner.y);
|
|
7809
|
+
});
|
|
7810
|
+
}
|
|
7811
|
+
});
|
|
7812
|
+
if (zone.cleanTimes !== void 0)
|
|
7813
|
+
z.int(SELECT_ZONES_FIELD.ZONE_CLEAN_TIMES, zone.cleanTimes);
|
|
7814
|
+
});
|
|
7815
|
+
}
|
|
7816
|
+
p.int(SELECT_ZONES_FIELD.MAP_ID, mapId);
|
|
7817
|
+
});
|
|
7818
|
+
}
|
|
7819
|
+
function encodeSceneClean(sceneId) {
|
|
7820
|
+
const { method: method2, param } = ModeCtrlParamMethod.SCENE;
|
|
7821
|
+
return encodeModeCtrlParam(method2, param, (p) => p.int(SCENE_CLEAN_ID, sceneId));
|
|
7822
|
+
}
|
|
7740
7823
|
var modeCtrlSeq = 111;
|
|
7741
7824
|
function nextModeCtrlSeq() {
|
|
7742
7825
|
return ++modeCtrlSeq;
|
|
@@ -9572,7 +9655,41 @@ var VACUUM_CLEAN_MEMBERS = {
|
|
|
9572
9655
|
/** Return to the dock via ModeCtrlRequest method 6 (DP 152). AIoT only — Tuya write unverified. */
|
|
9573
9656
|
returnToDock: method(({ sink }) => () => sink.dispatch(aiotDp(VACUUM_DP.MODE_CTRL, encodeModeCtrl(ModeCtrlMethod.START_GOHOME, nextModeCtrlSeq()))), "Return to the dock (ModeCtrlRequest method 6 over DP 152).", isAiotVacuum),
|
|
9574
9657
|
/** Pause the current cleaning task via ModeCtrlRequest method 13 (DP 152). AIoT only — Tuya write unverified. */
|
|
9575
|
-
pauseCleaning: method(({ sink }) => () => sink.dispatch(aiotDp(VACUUM_DP.MODE_CTRL, encodeModeCtrl(ModeCtrlMethod.PAUSE_TASK, nextModeCtrlSeq()))), "Pause the current cleaning task (ModeCtrlRequest method 13 over DP 152).", isAiotVacuum)
|
|
9658
|
+
pauseCleaning: method(({ sink }) => () => sink.dispatch(aiotDp(VACUUM_DP.MODE_CTRL, encodeModeCtrl(ModeCtrlMethod.PAUSE_TASK, nextModeCtrlSeq()))), "Pause the current cleaning task (ModeCtrlRequest method 13 over DP 152).", isAiotVacuum),
|
|
9659
|
+
/**
|
|
9660
|
+
* Run a saved cleaning scene by its id (ModeCtrlRequest method 24 over DP 152).
|
|
9661
|
+
*
|
|
9662
|
+
* The id is the device's own, as {@link VACUUM_CLEAN_MEMBERS.scenes} reports it — `VacuumScene.id`
|
|
9663
|
+
* off the `SceneResponse` on DP 180. A scene the device reports invalid stays reportable and running
|
|
9664
|
+
* it is still a well-formed request; `VacuumScene.invalidReason` says why the device will refuse.
|
|
9665
|
+
*
|
|
9666
|
+
* Frame shape is byte-proven against the shared outer `ModeCtrlRequest`, and method 24 has been
|
|
9667
|
+
* WATCHED: run on a T2351, it started the named scene.
|
|
9668
|
+
*/
|
|
9669
|
+
startScene: method(({ sink }) => (sceneId) => sink.dispatch(aiotDp(VACUUM_DP.MODE_CTRL, encodeSceneClean(sceneId))), "Run a saved cleaning scene by its id (ModeCtrlRequest method 24 over DP 152).", isAiotVacuum),
|
|
9670
|
+
/**
|
|
9671
|
+
* Clean the named rooms of a named map (ModeCtrlRequest method 1 over DP 152).
|
|
9672
|
+
*
|
|
9673
|
+
* `mapId` has no default and that is deliberate: room ids are per map, so assuming the map a
|
|
9674
|
+
* single-floor home would have sends a two-floor home's ids against the wrong floor. `SceneInfo.mapid`
|
|
9675
|
+
* on DP 180 and a scheduled rooms-clean's `map_id` are the two real map ids the device reports.
|
|
9676
|
+
*
|
|
9677
|
+
* `cleanTimes` is how many passes to make over the set; rooms with no `order` are visited in the
|
|
9678
|
+
* order given.
|
|
9679
|
+
*
|
|
9680
|
+
* Frame shape is byte-proven against the shared outer `ModeCtrlRequest`, and method 1 has been
|
|
9681
|
+
* WATCHED: run on a T2351, it cleaned the rooms named.
|
|
9682
|
+
*/
|
|
9683
|
+
cleanRooms: method(({ sink }) => (mapId, rooms, cleanTimes = 1) => sink.dispatch(aiotDp(VACUUM_DP.MODE_CTRL, encodeSelectRoomsClean(mapId, rooms, cleanTimes))), "Clean the named rooms of a named map (ModeCtrlRequest method 1 over DP 152).", isAiotVacuum),
|
|
9684
|
+
/**
|
|
9685
|
+
* Clean the given rectangles of a named map (ModeCtrlRequest method 2 over DP 152).
|
|
9686
|
+
*
|
|
9687
|
+
* Corners are SIGNED centimetres in the map's own frame, whose origin sits wherever the robot first
|
|
9688
|
+
* mapped from — negative coordinates are ordinary and are ZigZag-encoded, not written as plain
|
|
9689
|
+
* varints. Same `mapId` reasoning as {@link VACUUM_CLEAN_MEMBERS.cleanRooms}, and the same evidence:
|
|
9690
|
+
* method 2 was run on a T2351 and cleaned the rectangles given.
|
|
9691
|
+
*/
|
|
9692
|
+
cleanZones: method(({ sink }) => (mapId, zones) => sink.dispatch(aiotDp(VACUUM_DP.MODE_CTRL, encodeSelectZonesClean(mapId, zones))), "Clean the given rectangles of a named map (ModeCtrlRequest method 2 over DP 152).", isAiotVacuum)
|
|
9576
9693
|
};
|
|
9577
9694
|
var VACUUM_CLEAN = {
|
|
9578
9695
|
capability: "vacuum_clean",
|