@7365admin1/core 3.131.1 → 3.132.0

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.mjs CHANGED
@@ -63272,7 +63272,9 @@ var ROBOT_CAPABILITIES = [
63272
63272
  */
63273
63273
  "manualDrive",
63274
63274
  /** A heat camera: alarm and patrol photos carry a thermal picture and temperatures. Reporting only. */
63275
- "thermalCamera"
63275
+ "thermalCamera",
63276
+ /** A scrubber's clean/dirty water levels and whether its tanks and covers are fitted. Reporting only. */
63277
+ "waterTanks"
63276
63278
  ];
63277
63279
  var TIER_REQUIREMENTS = {
63278
63280
  "full-control": [
@@ -64172,6 +64174,8 @@ var OUNITECH_CAPABILITIES = {
64172
64174
  battery: true,
64173
64175
  // The chapter-6 robot list: `floorNo` (the robot's floor).
64174
64176
  floorReporting: true,
64177
+ // robotState readings: clean-water / dirty-water (%), top-cover / tank / dust-box fitted.
64178
+ waterTanks: true,
64175
64179
  // FALSE on purpose - each one is a question for the vendor.
64176
64180
  navigateToPoint: false,
64177
64181
  // app: "Move to Target Point"; API: robot-control actionNo not documented
@@ -64247,6 +64251,39 @@ function ounitechJobWords(st) {
64247
64251
  const v = reading(st, "job");
64248
64252
  return v ? JOB_WORDS[v] ?? null : null;
64249
64253
  }
64254
+ var levelOf = (pct) => pct < 25 ? "low" : pct >= 75 ? "high" : "medium";
64255
+ var LEVEL_WORDS = { \u4F4E: "low", \u4E2D: "medium", \u9AD8: "high" };
64256
+ var PARTS = [
64257
+ ["top-cover", "top cover"],
64258
+ ["clean-water-tank", "clean-water tank"],
64259
+ ["waste-water-tank", "dirty-water tank"],
64260
+ ["dust-box", "dust box"]
64261
+ ];
64262
+ function ounitechCleaning(st, working, taskPercent) {
64263
+ const water = (pctKey, levelKey) => {
64264
+ const pct2 = num(reading(st, pctKey));
64265
+ if (pct2 !== void 0 && pct2 >= 0 && pct2 <= 100)
64266
+ return { level: levelOf(pct2), percent: Math.round(pct2) };
64267
+ const word = LEVEL_WORDS[reading(st, levelKey) ?? ""];
64268
+ return word ? { level: word, percent: null } : null;
64269
+ };
64270
+ const cleanWater = water("clean-water", "clean-water-level");
64271
+ const dirtyWater = water("dirty-water", "dirty-water-level");
64272
+ const parts = PARTS.flatMap(([key, part]) => {
64273
+ const v = reading(st, key)?.toLowerCase();
64274
+ return v === "true" || v === "1" ? [{ part, ok: true }] : v === "false" || v === "0" ? [{ part, ok: false }] : [];
64275
+ });
64276
+ const area = (k) => {
64277
+ const n = num(reading(st, k));
64278
+ return n !== void 0 && n > 0 ? Math.round(n * 10) / 10 : null;
64279
+ };
64280
+ const pct = num(reading(st, "acc-percent")) ?? (finite(taskPercent) ? taskPercent : void 0);
64281
+ const job = working ? { percent: pct !== void 0 && pct >= 0 && pct <= 100 ? Math.round(pct) : null, areaDone: area("acc-area"), areaPlanned: area("count-area") } : null;
64282
+ const hasJob = !!job && (job.percent !== null || job.areaDone !== null);
64283
+ if (!cleanWater && !dirtyWater && !parts.length && !hasJob)
64284
+ return null;
64285
+ return { cleanWater, dirtyWater, parts, job: hasJob ? job : null };
64286
+ }
64250
64287
  function updatedAt(v) {
64251
64288
  const n = num(v);
64252
64289
  if (n !== void 0)
@@ -64282,6 +64319,9 @@ function ounitechRobotFromHomeRow(row, live2, now = Date.now()) {
64282
64319
  floorKnown: Number.isInteger(row.floorNo),
64283
64320
  position: online && x !== void 0 && y !== void 0 ? { x, y, theta: num(st.theta) ?? 0 } : null
64284
64321
  };
64322
+ if (online) {
64323
+ robot.cleaning = ounitechCleaning(st, mode === "WORKING", task && String(task.statusFlag) === "1" ? task.accPercent : null);
64324
+ }
64285
64325
  if (online && (flag === 7 || Array.isArray(st.rtFaultList) && st.rtFaultList.length)) {
64286
64326
  robot.fault = ounitechFault(st.rtFaultList);
64287
64327
  }
@@ -67276,6 +67316,7 @@ function fleetStateItem(id, s, lastSeenAt) {
67276
67316
  fault: s.fault,
67277
67317
  capabilities: s.capabilities,
67278
67318
  profile: s.profile,
67319
+ cleaning: s.cleaning ?? null,
67279
67320
  lastSeenAt: lastSeenAt ? new Date(lastSeenAt) : null
67280
67321
  };
67281
67322
  }
@@ -67404,7 +67445,8 @@ function useRobotFleetService(deps) {
67404
67445
  planPosition: found.planPosition ?? null,
67405
67446
  fault,
67406
67447
  capabilities: manifest.capabilities,
67407
- profile: manifest.profile
67448
+ profile: manifest.profile,
67449
+ cleaning: manifest.capabilities.waterTanks === true && found.online ? found.cleaning ?? null : null
67408
67450
  };
67409
67451
  }
67410
67452
  async function getMaps(robot) {
@@ -107183,6 +107225,7 @@ export {
107183
107225
  orgQualifiesForOwnerRepair,
107184
107226
  orgRoleSets,
107185
107227
  orgSchema,
107228
+ ounitechCleaning,
107186
107229
  ounitechFault,
107187
107230
  ounitechJobWords,
107188
107231
  ounitechRobotFromHomeRow,