@riddix/hamh 2.1.0-alpha.562 → 2.1.0-alpha.563

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.
@@ -175874,6 +175874,11 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
175874
175874
  * dispatching the HA action to prevent re-dispatch, but progress
175875
175875
  * tracking needs the original list for the entire cleaning session. */
175876
175876
  activeAreas = [];
175877
+ /** Diagnostic short-circuit reasons already logged this session.
175878
+ * updateCurrentRoomFromSensor() is called on every HA state event;
175879
+ * without this guard a failing path would flood the log. Cleared
175880
+ * when the vacuum returns to Idle. */
175881
+ loggedShortCircuits = /* @__PURE__ */ new Set();
175877
175882
  async initialize() {
175878
175883
  await super.initialize();
175879
175884
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
@@ -175902,6 +175907,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
175902
175907
  this.trySetCurrentArea(null);
175903
175908
  this.completedAreas.clear();
175904
175909
  this.lastCurrentArea = null;
175910
+ this.loggedShortCircuits.clear();
175905
175911
  } else if (newMode === 1 /* Cleaning */) {
175906
175912
  if (this.activeAreas.length > 0 && this.lastCurrentArea === null) {
175907
175913
  this.trySetCurrentArea(this.activeAreas[0]);
@@ -175912,6 +175918,16 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
175912
175918
  this.updateCurrentRoomFromSensor();
175913
175919
  }
175914
175920
  }
175921
+ /**
175922
+ * Emit a diagnostic INFO log exactly once per cleaning session for a
175923
+ * given short-circuit reason. Prevents log flooding while still
175924
+ * surfacing the silent paths that would otherwise be invisible.
175925
+ */
175926
+ logShortCircuitOnce(reason, message) {
175927
+ if (this.loggedShortCircuits.has(reason)) return;
175928
+ this.loggedShortCircuits.add(reason);
175929
+ logger189.info(message);
175930
+ }
175915
175931
  /**
175916
175932
  * Read the currentRoomEntity sensor and update currentArea + progress
175917
175933
  * to reflect which room the vacuum is actually in right now.
@@ -175920,11 +175936,29 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
175920
175936
  try {
175921
175937
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
175922
175938
  const currentRoomEntityId = homeAssistant.state.mapping?.currentRoomEntity;
175923
- if (!currentRoomEntityId) return;
175939
+ if (!currentRoomEntityId) {
175940
+ this.logShortCircuitOnce(
175941
+ "no-mapping",
175942
+ "currentRoom sensor: no currentRoomEntity in mapping \u2014 auto-detect did not run or sensor not on same HA device"
175943
+ );
175944
+ return;
175945
+ }
175924
175946
  const stateProvider = this.agent.env.get(EntityStateProvider);
175925
175947
  const roomState = stateProvider.getState(currentRoomEntityId);
175926
- if (!roomState || !roomState.state) return;
175927
- if (this.activeAreas.length === 0) return;
175948
+ if (!roomState || !roomState.state) {
175949
+ this.logShortCircuitOnce(
175950
+ "no-state",
175951
+ `currentRoom sensor: no state available for ${currentRoomEntityId}`
175952
+ );
175953
+ return;
175954
+ }
175955
+ if (this.activeAreas.length === 0) {
175956
+ this.logShortCircuitOnce(
175957
+ "no-active-areas",
175958
+ `currentRoom sensor: activeAreas empty while cleaning \u2014 sensor=${currentRoomEntityId} state="${roomState.state}"`
175959
+ );
175960
+ return;
175961
+ }
175928
175962
  const serviceArea = this.agent.get(ServiceAreaBehavior);
175929
175963
  const sensorAttrs = roomState.attributes;
175930
175964
  const segmentId = sensorAttrs.segment_id ?? sensorAttrs.room_id;
@@ -178799,7 +178833,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
178799
178833
  entityId: effectiveMapping?.entityId ?? entityId,
178800
178834
  cleaningModeEntity: vacuumEntities.cleaningModeEntity
178801
178835
  };
178802
- logger200.debug(
178836
+ logger200.info(
178803
178837
  `Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
178804
178838
  );
178805
178839
  }
@@ -178809,7 +178843,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
178809
178843
  entityId: effectiveMapping?.entityId ?? entityId,
178810
178844
  suctionLevelEntity: vacuumEntities.suctionLevelEntity
178811
178845
  };
178812
- logger200.debug(
178846
+ logger200.info(
178813
178847
  `Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
178814
178848
  );
178815
178849
  }
@@ -178819,7 +178853,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
178819
178853
  entityId: effectiveMapping?.entityId ?? entityId,
178820
178854
  mopIntensityEntity: vacuumEntities.mopIntensityEntity
178821
178855
  };
178822
- logger200.debug(
178856
+ logger200.info(
178823
178857
  `Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
178824
178858
  );
178825
178859
  }
@@ -178829,7 +178863,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
178829
178863
  entityId: effectiveMapping?.entityId ?? entityId,
178830
178864
  currentRoomEntity: vacuumEntities.currentRoomEntity
178831
178865
  };
178832
- logger200.debug(
178866
+ logger200.info(
178833
178867
  `Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
178834
178868
  );
178835
178869
  }
@@ -178844,7 +178878,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
178844
178878
  entityId: effectiveMapping?.entityId ?? entityId,
178845
178879
  cleanAreaRooms
178846
178880
  };
178847
- logger200.debug(
178881
+ logger200.info(
178848
178882
  `Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
178849
178883
  );
178850
178884
  }