@riddix/hamh 2.1.0-alpha.557 → 2.1.0-alpha.559

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.
@@ -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(this.state, {
175890
- currentMode: newMode,
175891
- supportedModes: this.state.config.getSupportedModes(
175892
- entity.state,
175893
- this.agent
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(this.state, {
177876
- operationalState: newState,
177877
- operationalError: {
177878
- errorStateId: newState === OperationalState4.Error ? ErrorState.Stuck : ErrorState.NoError
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]}`
@@ -181098,11 +181106,25 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181098
181106
  lastState;
181099
181107
  pendingMappedChange = false;
181100
181108
  flushUpdate;
181109
+ /** Periodic keepalive timer that re-pushes the last known state so
181110
+ * Apple Home (iOS) doesn't show "Updating..." due to stale
181111
+ * subscription data when the vacuum is idle and no HA events fire. */
181112
+ keepaliveTimer;
181101
181113
  constructor(type, entityId, customName, mappedEntityIds) {
181102
181114
  super(type, entityId, customName, mappedEntityIds);
181103
181115
  this.flushUpdate = debounce6(this.flushPendingUpdate.bind(this), 50);
181116
+ this.keepaliveTimer = setInterval(() => {
181117
+ if (this.lastState) {
181118
+ this.pendingMappedChange = true;
181119
+ this.flushUpdate(this.lastState);
181120
+ }
181121
+ }, 55e3);
181104
181122
  }
181105
181123
  async delete() {
181124
+ if (this.keepaliveTimer) {
181125
+ clearInterval(this.keepaliveTimer);
181126
+ this.keepaliveTimer = void 0;
181127
+ }
181106
181128
  this.flushUpdate.clear();
181107
181129
  await super.delete();
181108
181130
  }