@riddix/hamh 2.1.0-alpha.646 → 2.1.0-alpha.648

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.
@@ -177002,26 +177002,22 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
177002
177002
  );
177003
177003
  return;
177004
177004
  }
177005
- if (s.activeAreas.length === 0) {
177006
- this.logShortCircuitOnce(
177007
- "no-active-areas",
177008
- `currentRoom sensor: activeAreas empty while cleaning, sensor=${currentRoomEntityId} state="${roomState.state}"`
177009
- );
177010
- return;
177011
- }
177012
177005
  const serviceArea = this.agent.get(ServiceAreaBehavior);
177006
+ const externalSession = s.activeAreas.length === 0;
177007
+ const supportedAreaIds = serviceArea.state.supportedAreas.map(
177008
+ (a) => a.areaId
177009
+ );
177010
+ const isAllowedArea = (id) => externalSession ? supportedAreaIds.includes(id) : s.activeAreas.includes(id);
177013
177011
  const sensorAttrs = roomState.attributes;
177014
177012
  const segmentId = sensorAttrs.segment_id ?? sensorAttrs.room_id;
177015
177013
  const roomName = roomState.state;
177016
177014
  let matchedAreaId = null;
177017
- if (segmentId != null) {
177018
- if (s.activeAreas.includes(segmentId)) {
177019
- matchedAreaId = segmentId;
177020
- }
177015
+ if (segmentId != null && isAllowedArea(segmentId)) {
177016
+ matchedAreaId = segmentId;
177021
177017
  }
177022
177018
  if (matchedAreaId === null && segmentId != null) {
177023
177019
  for (const area of serviceArea.state.supportedAreas) {
177024
- if (s.activeAreas.includes(area.areaId) && area.areaId % 1e4 === segmentId) {
177020
+ if (isAllowedArea(area.areaId) && area.areaId % 1e4 === segmentId) {
177025
177021
  matchedAreaId = area.areaId;
177026
177022
  break;
177027
177023
  }
@@ -177031,7 +177027,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
177031
177027
  const area = serviceArea.state.supportedAreas.find(
177032
177028
  (a) => a.areaInfo.locationInfo?.locationName?.toLowerCase() === roomName.toLowerCase()
177033
177029
  );
177034
- if (area && s.activeAreas.includes(area.areaId)) {
177030
+ if (area && isAllowedArea(area.areaId)) {
177035
177031
  matchedAreaId = area.areaId;
177036
177032
  }
177037
177033
  }