@riddix/hamh 2.1.0-alpha.587 → 2.1.0-alpha.589
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/backend/cli.js
CHANGED
|
@@ -176057,7 +176057,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176057
176057
|
await super.initialize();
|
|
176058
176058
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
176059
176059
|
this.update(homeAssistant.entity);
|
|
176060
|
-
this.reactTo(homeAssistant.onChange, this.update);
|
|
176060
|
+
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
176061
176061
|
}
|
|
176062
176062
|
update(entity) {
|
|
176063
176063
|
if (!entity.state || !entity.state.attributes) {
|
|
@@ -176079,13 +176079,25 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176079
176079
|
);
|
|
176080
176080
|
if (previousMode !== newMode) {
|
|
176081
176081
|
if (newMode === 0 /* Idle */) {
|
|
176082
|
-
|
|
176083
|
-
|
|
176084
|
-
|
|
176082
|
+
if (s.lastCurrentArea !== null) {
|
|
176083
|
+
s.completedAreas.add(s.lastCurrentArea);
|
|
176084
|
+
s.lastCurrentArea = null;
|
|
176085
|
+
try {
|
|
176086
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
176087
|
+
serviceArea.state.currentArea = null;
|
|
176088
|
+
this.updateProgressFromTracking(serviceArea);
|
|
176089
|
+
} catch {
|
|
176090
|
+
}
|
|
176091
|
+
}
|
|
176085
176092
|
s.loggedShortCircuits.clear();
|
|
176086
176093
|
} else if (newMode === 1 /* Cleaning */) {
|
|
176087
176094
|
if (s.activeAreas.length > 0 && s.lastCurrentArea === null) {
|
|
176088
|
-
|
|
176095
|
+
const firstPending = s.activeAreas.find(
|
|
176096
|
+
(id) => !s.completedAreas.has(id)
|
|
176097
|
+
);
|
|
176098
|
+
if (firstPending !== void 0) {
|
|
176099
|
+
this.trySetCurrentArea(firstPending);
|
|
176100
|
+
}
|
|
176089
176101
|
}
|
|
176090
176102
|
}
|
|
176091
176103
|
}
|
|
@@ -176226,6 +176238,22 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176226
176238
|
}));
|
|
176227
176239
|
}
|
|
176228
176240
|
}
|
|
176241
|
+
/**
|
|
176242
|
+
* Update progress entries from tracking state without any area
|
|
176243
|
+
* operating. Used on mid-session transitions (e.g. vacuum-then-mop
|
|
176244
|
+
* tool swap) where the vacuum is temporarily idle but the session
|
|
176245
|
+
* is not finished: completed areas stay Completed, remaining areas
|
|
176246
|
+
* stay Pending.
|
|
176247
|
+
*/
|
|
176248
|
+
updateProgressFromTracking(serviceArea) {
|
|
176249
|
+
const s = getSession(this.endpoint);
|
|
176250
|
+
if (s.activeAreas.length === 0) return;
|
|
176251
|
+
const state = serviceArea.state;
|
|
176252
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
176253
|
+
areaId: id,
|
|
176254
|
+
status: s.completedAreas.has(id) ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Pending
|
|
176255
|
+
}));
|
|
176256
|
+
}
|
|
176229
176257
|
/**
|
|
176230
176258
|
* Find the ServiceArea area ID that corresponds to a run mode value
|
|
176231
176259
|
* by matching the mode label to the area location name.
|
|
@@ -176258,6 +176286,9 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176258
176286
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
176259
176287
|
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
176260
176288
|
s.activeAreas = [...serviceArea.state.selectedAreas];
|
|
176289
|
+
s.completedAreas.clear();
|
|
176290
|
+
s.lastCurrentArea = null;
|
|
176291
|
+
s.loggedShortCircuits.clear();
|
|
176261
176292
|
this.trySetCurrentArea(s.activeAreas[0]);
|
|
176262
176293
|
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
176263
176294
|
this.state.currentMode = newMode;
|
|
@@ -176271,6 +176302,9 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176271
176302
|
if (this.state.config.cleanRoom) {
|
|
176272
176303
|
const areaId = this.findAreaIdForMode(newMode);
|
|
176273
176304
|
s.activeAreas = areaId !== null ? [areaId] : [];
|
|
176305
|
+
s.completedAreas.clear();
|
|
176306
|
+
s.lastCurrentArea = null;
|
|
176307
|
+
s.loggedShortCircuits.clear();
|
|
176274
176308
|
this.trySetCurrentArea(areaId);
|
|
176275
176309
|
homeAssistant.callAction(
|
|
176276
176310
|
this.state.config.cleanRoom(newMode, this.agent)
|
|
@@ -176288,6 +176322,9 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176288
176322
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
176289
176323
|
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
176290
176324
|
s.activeAreas = [...serviceArea.state.selectedAreas];
|
|
176325
|
+
s.completedAreas.clear();
|
|
176326
|
+
s.lastCurrentArea = null;
|
|
176327
|
+
s.loggedShortCircuits.clear();
|
|
176291
176328
|
this.trySetCurrentArea(s.activeAreas[0]);
|
|
176292
176329
|
}
|
|
176293
176330
|
} catch {
|
|
@@ -176300,6 +176337,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176300
176337
|
s.completedAreas.clear();
|
|
176301
176338
|
s.lastCurrentArea = null;
|
|
176302
176339
|
s.activeAreas = [];
|
|
176340
|
+
s.loggedShortCircuits.clear();
|
|
176303
176341
|
homeAssistant.callAction(
|
|
176304
176342
|
this.state.config.returnToBase(void 0, this.agent)
|
|
176305
176343
|
);
|
|
@@ -178090,7 +178128,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
178090
178128
|
await super.initialize();
|
|
178091
178129
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
178092
178130
|
this.update(homeAssistant.entity);
|
|
178093
|
-
this.reactTo(homeAssistant.onChange, this.update);
|
|
178131
|
+
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
178094
178132
|
}
|
|
178095
178133
|
update(entity) {
|
|
178096
178134
|
if (!entity.state || !entity.state.attributes) {
|