@riddix/hamh 2.1.0-alpha.514 → 2.1.0-alpha.515

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.
@@ -179203,6 +179203,23 @@ var BridgeRegistry = class _BridgeRegistry {
179203
179203
  );
179204
179204
  return [];
179205
179205
  }
179206
+ let validSegmentIds;
179207
+ try {
179208
+ const segmentsResponse = await this.client.connection.sendMessagePromise({
179209
+ type: "vacuum/get_segments",
179210
+ entity_id: entityId
179211
+ });
179212
+ if (Array.isArray(segmentsResponse)) {
179213
+ validSegmentIds = new Set(segmentsResponse.map((s) => s.id));
179214
+ _BridgeRegistry.cleanAreaLogger.debug(
179215
+ `${entityId}: Current vacuum segments: ${[...validSegmentIds].join(", ")}`
179216
+ );
179217
+ }
179218
+ } catch {
179219
+ _BridgeRegistry.cleanAreaLogger.debug(
179220
+ `${entityId}: vacuum/get_segments not available, skipping stale entry detection`
179221
+ );
179222
+ }
179206
179223
  const rooms = [];
179207
179224
  for (const haAreaId of Object.keys(areaMapping)) {
179208
179225
  const segments = areaMapping[haAreaId];
@@ -179212,6 +179229,13 @@ var BridgeRegistry = class _BridgeRegistry {
179212
179229
  );
179213
179230
  continue;
179214
179231
  }
179232
+ if (validSegmentIds && !segments.some((sid) => validSegmentIds.has(sid))) {
179233
+ const areaName2 = this.registry.areas.get(haAreaId) ?? haAreaId;
179234
+ _BridgeRegistry.cleanAreaLogger.info(
179235
+ `${entityId}: Skipping stale HA area "${areaName2}" (${haAreaId}) \u2014 segments [${segments.join(", ")}] no longer exist on vacuum`
179236
+ );
179237
+ continue;
179238
+ }
179215
179239
  const areaName = this.registry.areas.get(haAreaId) ?? haAreaId;
179216
179240
  rooms.push({
179217
179241
  areaId: hashAreaId(haAreaId),