@riddix/hamh 2.1.0-alpha.556 → 2.1.0-alpha.558
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
|
@@ -175886,19 +175886,22 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175886
175886
|
}
|
|
175887
175887
|
const previousMode = this.state.currentMode;
|
|
175888
175888
|
const newMode = this.state.config.getCurrentMode(entity.state, this.agent);
|
|
175889
|
-
applyPatchState(
|
|
175890
|
-
|
|
175891
|
-
|
|
175892
|
-
|
|
175893
|
-
this.
|
|
175894
|
-
|
|
175895
|
-
|
|
175889
|
+
applyPatchState(
|
|
175890
|
+
this.state,
|
|
175891
|
+
{
|
|
175892
|
+
currentMode: newMode,
|
|
175893
|
+
supportedModes: this.state.config.getSupportedModes(
|
|
175894
|
+
entity.state,
|
|
175895
|
+
this.agent
|
|
175896
|
+
)
|
|
175897
|
+
},
|
|
175898
|
+
{ force: true }
|
|
175899
|
+
);
|
|
175896
175900
|
if (previousMode !== newMode) {
|
|
175897
175901
|
if (newMode === 0 /* Idle */) {
|
|
175898
175902
|
this.trySetCurrentArea(null);
|
|
175899
175903
|
this.completedAreas.clear();
|
|
175900
175904
|
this.lastCurrentArea = null;
|
|
175901
|
-
this.activeAreas = [];
|
|
175902
175905
|
} else if (newMode === 1 /* Cleaning */) {
|
|
175903
175906
|
if (this.activeAreas.length > 0 && this.lastCurrentArea === null) {
|
|
175904
175907
|
this.trySetCurrentArea(this.activeAreas[0]);
|
|
@@ -175923,7 +175926,8 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175923
175926
|
if (!roomState || !roomState.state) return;
|
|
175924
175927
|
if (this.activeAreas.length === 0) return;
|
|
175925
175928
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175926
|
-
const
|
|
175929
|
+
const sensorAttrs = roomState.attributes;
|
|
175930
|
+
const segmentId = sensorAttrs.segment_id ?? sensorAttrs.room_id;
|
|
175927
175931
|
const roomName = roomState.state;
|
|
175928
175932
|
let matchedAreaId = null;
|
|
175929
175933
|
if (segmentId != null) {
|
|
@@ -175939,7 +175943,12 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175939
175943
|
matchedAreaId = area.areaId;
|
|
175940
175944
|
}
|
|
175941
175945
|
}
|
|
175942
|
-
if (matchedAreaId === null)
|
|
175946
|
+
if (matchedAreaId === null) {
|
|
175947
|
+
logger189.debug(
|
|
175948
|
+
`currentRoom sensor: no match for "${roomName}" (segmentId=${segmentId}), activeAreas=[${this.activeAreas.join(", ")}]`
|
|
175949
|
+
);
|
|
175950
|
+
return;
|
|
175951
|
+
}
|
|
175943
175952
|
if (matchedAreaId === this.lastCurrentArea) return;
|
|
175944
175953
|
if (this.lastCurrentArea !== null) {
|
|
175945
175954
|
this.completedAreas.add(this.lastCurrentArea);
|
|
@@ -176063,6 +176072,9 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176063
176072
|
}
|
|
176064
176073
|
case 0 /* Idle */:
|
|
176065
176074
|
this.trySetCurrentArea(null);
|
|
176075
|
+
this.completedAreas.clear();
|
|
176076
|
+
this.lastCurrentArea = null;
|
|
176077
|
+
this.activeAreas = [];
|
|
176066
176078
|
homeAssistant.callAction(
|
|
176067
176079
|
this.state.config.returnToBase(void 0, this.agent)
|
|
176068
176080
|
);
|
|
@@ -176684,7 +176696,8 @@ var vacuumRvcRunModeConfig = {
|
|
|
176684
176696
|
VacuumState.segment_cleaning,
|
|
176685
176697
|
VacuumState.zone_cleaning,
|
|
176686
176698
|
VacuumState.spot_cleaning,
|
|
176687
|
-
VacuumState.mop_cleaning
|
|
176699
|
+
VacuumState.mop_cleaning,
|
|
176700
|
+
VacuumState.paused
|
|
176688
176701
|
];
|
|
176689
176702
|
const isCleaning = cleaningStates.includes(state);
|
|
176690
176703
|
logger192.debug(
|
|
@@ -177863,12 +177876,16 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
177863
177876
|
this.agent
|
|
177864
177877
|
);
|
|
177865
177878
|
const previousState = this.state.operationalState;
|
|
177866
|
-
applyPatchState(
|
|
177867
|
-
|
|
177868
|
-
|
|
177869
|
-
|
|
177870
|
-
|
|
177871
|
-
|
|
177879
|
+
applyPatchState(
|
|
177880
|
+
this.state,
|
|
177881
|
+
{
|
|
177882
|
+
operationalState: newState,
|
|
177883
|
+
operationalError: {
|
|
177884
|
+
errorStateId: newState === OperationalState4.Error ? ErrorState.Stuck : ErrorState.NoError
|
|
177885
|
+
}
|
|
177886
|
+
},
|
|
177887
|
+
{ force: true }
|
|
177888
|
+
);
|
|
177872
177889
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
177873
177890
|
logger195.info(
|
|
177874
177891
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
@@ -177974,7 +177991,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
177974
177991
|
if (isCharging(entity)) {
|
|
177975
177992
|
operationalState = RvcOperationalState3.OperationalState.Charging;
|
|
177976
177993
|
} else {
|
|
177977
|
-
operationalState = RvcOperationalState3.OperationalState.
|
|
177994
|
+
operationalState = RvcOperationalState3.OperationalState.Stopped;
|
|
177978
177995
|
}
|
|
177979
177996
|
} else if (state === VacuumState.error || state === "unavailable") {
|
|
177980
177997
|
operationalState = RvcOperationalState3.OperationalState.Error;
|
|
@@ -177985,8 +178002,8 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
177985
178002
|
);
|
|
177986
178003
|
operationalState = RvcOperationalState3.OperationalState.Running;
|
|
177987
178004
|
} else {
|
|
177988
|
-
logger196.info(`Unknown vacuum state "${state}", treating as
|
|
177989
|
-
operationalState = RvcOperationalState3.OperationalState.
|
|
178005
|
+
logger196.info(`Unknown vacuum state "${state}", treating as Stopped`);
|
|
178006
|
+
operationalState = RvcOperationalState3.OperationalState.Stopped;
|
|
177990
178007
|
}
|
|
177991
178008
|
}
|
|
177992
178009
|
logger196.debug(
|
|
@@ -181088,6 +181105,8 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181088
181105
|
}
|
|
181089
181106
|
lastState;
|
|
181090
181107
|
pendingMappedChange = false;
|
|
181108
|
+
/** Timestamp of the last non-empty state push to matter.js */
|
|
181109
|
+
lastNonEmptyPush = Date.now();
|
|
181091
181110
|
flushUpdate;
|
|
181092
181111
|
constructor(type, entityId, customName, mappedEntityIds) {
|
|
181093
181112
|
super(type, entityId, customName, mappedEntityIds);
|
|
@@ -181100,8 +181119,16 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181100
181119
|
async updateStates(states) {
|
|
181101
181120
|
const state = states[this.entityId] ?? {};
|
|
181102
181121
|
const mappedChanged = this.hasMappedEntityChanged(states);
|
|
181103
|
-
|
|
181104
|
-
|
|
181122
|
+
const stateUnchanged = !mappedChanged && state.state === this.lastState?.state && JSON.stringify(state.attributes) === JSON.stringify(this.lastState?.attributes);
|
|
181123
|
+
if (stateUnchanged) {
|
|
181124
|
+
const now = Date.now();
|
|
181125
|
+
if (now - this.lastNonEmptyPush < 6e4) {
|
|
181126
|
+
return;
|
|
181127
|
+
}
|
|
181128
|
+
this.lastNonEmptyPush = now;
|
|
181129
|
+
this.pendingMappedChange = true;
|
|
181130
|
+
} else {
|
|
181131
|
+
this.lastNonEmptyPush = Date.now();
|
|
181105
181132
|
}
|
|
181106
181133
|
if (mappedChanged) {
|
|
181107
181134
|
this.pendingMappedChange = true;
|