@riddix/hamh 2.1.0-alpha.557 → 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,13 +175886,17 @@ 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);
|
|
@@ -177872,12 +177876,16 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
177872
177876
|
this.agent
|
|
177873
177877
|
);
|
|
177874
177878
|
const previousState = this.state.operationalState;
|
|
177875
|
-
applyPatchState(
|
|
177876
|
-
|
|
177877
|
-
|
|
177878
|
-
|
|
177879
|
-
|
|
177880
|
-
|
|
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
|
+
);
|
|
177881
177889
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
177882
177890
|
logger195.info(
|
|
177883
177891
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
@@ -181097,6 +181105,8 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181097
181105
|
}
|
|
181098
181106
|
lastState;
|
|
181099
181107
|
pendingMappedChange = false;
|
|
181108
|
+
/** Timestamp of the last non-empty state push to matter.js */
|
|
181109
|
+
lastNonEmptyPush = Date.now();
|
|
181100
181110
|
flushUpdate;
|
|
181101
181111
|
constructor(type, entityId, customName, mappedEntityIds) {
|
|
181102
181112
|
super(type, entityId, customName, mappedEntityIds);
|
|
@@ -181109,8 +181119,16 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181109
181119
|
async updateStates(states) {
|
|
181110
181120
|
const state = states[this.entityId] ?? {};
|
|
181111
181121
|
const mappedChanged = this.hasMappedEntityChanged(states);
|
|
181112
|
-
|
|
181113
|
-
|
|
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();
|
|
181114
181132
|
}
|
|
181115
181133
|
if (mappedChanged) {
|
|
181116
181134
|
this.pendingMappedChange = true;
|