@riddix/hamh 2.1.0-alpha.614 → 2.1.0-alpha.615

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.
@@ -1743,8 +1743,8 @@ var init_Cancelable = __esm({
1743
1743
  };
1744
1744
  return result;
1745
1745
  }
1746
- static set logger(logger205) {
1747
- this.#logger = logger205;
1746
+ static set logger(logger206) {
1747
+ this.#logger = logger206;
1748
1748
  }
1749
1749
  static get logger() {
1750
1750
  return this.#logger;
@@ -3422,13 +3422,13 @@ var init_Logger = __esm({
3422
3422
  *
3423
3423
  * @deprecated use {@link destinations}
3424
3424
  */
3425
- static addLogger(identifier, logger205, options) {
3425
+ static addLogger(identifier, logger206, options) {
3426
3426
  if (identifier in this.destinations) {
3427
3427
  throw new ImplementationError(`Logger "${identifier}" already exists`);
3428
3428
  }
3429
3429
  const dest = LogDestination({ name: identifier });
3430
3430
  const legacy = adaptDestinationToLegacy(dest);
3431
- legacy.log = logger205;
3431
+ legacy.log = logger206;
3432
3432
  if (options?.defaultLogLevel !== void 0) {
3433
3433
  legacy.defaultLogLevel = options.defaultLogLevel;
3434
3434
  }
@@ -5538,8 +5538,8 @@ function Construction(subject, initializer) {
5538
5538
  }
5539
5539
  }
5540
5540
  function unhandledError(...args) {
5541
- const logger205 = Logger.get(subject.constructor.name);
5542
- logger205.error(...args);
5541
+ const logger206 = Logger.get(subject.constructor.name);
5542
+ logger206.error(...args);
5543
5543
  }
5544
5544
  function createErrorHandler(name) {
5545
5545
  return (e) => {
@@ -135998,11 +135998,11 @@ var init_Api = __esm({
135998
135998
  }
135999
135999
  Api2.resourceFor = resourceFor;
136000
136000
  function log(level, facility, id, ...message) {
136001
- let logger205 = loggers.get(facility);
136002
- if (!logger205) {
136003
- loggers.set(facility, logger205 = Logger.get(facility));
136001
+ let logger206 = loggers.get(facility);
136002
+ if (!logger206) {
136003
+ loggers.set(facility, logger206 = Logger.get(facility));
136004
136004
  }
136005
- logger205[level](Diagnostic.via(id || "(anon)"), message);
136005
+ logger206[level](Diagnostic.via(id || "(anon)"), message);
136006
136006
  }
136007
136007
  Api2.log = log;
136008
136008
  function logRequest(facility, id, method, target) {
@@ -147327,10 +147327,10 @@ var init_home_assistant_actions = __esm({
147327
147327
  circuitBreakerResetMs: 3e4
147328
147328
  };
147329
147329
  HomeAssistantActions = class extends Service {
147330
- constructor(logger205, client, config10) {
147330
+ constructor(logger206, client, config10) {
147331
147331
  super("HomeAssistantActions");
147332
147332
  this.client = client;
147333
- this.log = logger205.get(this);
147333
+ this.log = logger206.get(this);
147334
147334
  this.config = { ...defaultConfig, ...config10 };
147335
147335
  this.circuitBreaker = new CircuitBreaker(
147336
147336
  this.config.circuitBreakerThreshold,
@@ -147670,10 +147670,10 @@ var DiagnosticService = class {
147670
147670
  };
147671
147671
 
147672
147672
  // src/api/access-log.ts
147673
- function accessLogger(logger205) {
147673
+ function accessLogger(logger206) {
147674
147674
  return (req, res, next) => {
147675
147675
  res.on("finish", () => {
147676
- logger205.debug(
147676
+ logger206.debug(
147677
147677
  `${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
147678
147678
  );
147679
147679
  });
@@ -148153,7 +148153,9 @@ async function restoreBridgeIcon(zipDirectory, bridgeId, storageLocation) {
148153
148153
 
148154
148154
  // src/api/bridge-export-api.ts
148155
148155
  init_dist();
148156
+ init_esm();
148156
148157
  import express2 from "express";
148158
+ var logger142 = Logger.get("BridgeExportApi");
148157
148159
  function migrateFilter(legacyFilter) {
148158
148160
  if (!legacyFilter) {
148159
148161
  return { include: [], exclude: [] };
@@ -148302,8 +148304,10 @@ function bridgeExportApi(bridgeStorage) {
148302
148304
  }
148303
148305
  const result = { imported, skipped, errors };
148304
148306
  res.json(result);
148305
- } catch {
148306
- res.status(400).json({ error: "Failed to import bridges" });
148307
+ } catch (e) {
148308
+ const message = e instanceof Error ? e.message : String(e);
148309
+ logger142.warn(`Failed to import bridges: ${message}`, e);
148310
+ res.status(400).json({ error: `Failed to import bridges: ${message}` });
148307
148311
  }
148308
148312
  });
148309
148313
  return router;
@@ -150303,7 +150307,7 @@ init_esm();
150303
150307
  import { execFile } from "node:child_process";
150304
150308
  import * as fs4 from "node:fs";
150305
150309
  import * as path4 from "node:path";
150306
- var logger142 = Logger.get("PluginInstaller");
150310
+ var logger143 = Logger.get("PluginInstaller");
150307
150311
  var VALID_PACKAGE_RE = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*(@[^@\s]+)?$/;
150308
150312
  var PluginInstaller = class {
150309
150313
  pluginDir;
@@ -150343,7 +150347,7 @@ var PluginInstaller = class {
150343
150347
  error: `Invalid package name: "${packageName}"`
150344
150348
  };
150345
150349
  }
150346
- logger142.info(`Installing plugin: ${packageName}`);
150350
+ logger143.info(`Installing plugin: ${packageName}`);
150347
150351
  return new Promise((resolve6) => {
150348
150352
  execFile(
150349
150353
  "npm",
@@ -150355,7 +150359,7 @@ var PluginInstaller = class {
150355
150359
  },
150356
150360
  (error, _stdout, stderr) => {
150357
150361
  if (error) {
150358
- logger142.error(
150362
+ logger143.error(
150359
150363
  `Failed to install ${packageName}:`,
150360
150364
  stderr || error.message
150361
150365
  );
@@ -150367,7 +150371,7 @@ var PluginInstaller = class {
150367
150371
  return;
150368
150372
  }
150369
150373
  const version = this.getInstalledVersion(packageName);
150370
- logger142.info(
150374
+ logger143.info(
150371
150375
  `Successfully installed ${packageName}@${version || "unknown"}`
150372
150376
  );
150373
150377
  resolve6({
@@ -150387,7 +150391,7 @@ var PluginInstaller = class {
150387
150391
  error: `Invalid package name: "${packageName}"`
150388
150392
  };
150389
150393
  }
150390
- logger142.info(`Uninstalling plugin: ${packageName}`);
150394
+ logger143.info(`Uninstalling plugin: ${packageName}`);
150391
150395
  return new Promise((resolve6) => {
150392
150396
  execFile(
150393
150397
  "npm",
@@ -150398,7 +150402,7 @@ var PluginInstaller = class {
150398
150402
  },
150399
150403
  (error, _stdout, stderr) => {
150400
150404
  if (error) {
150401
- logger142.error(
150405
+ logger143.error(
150402
150406
  `Failed to uninstall ${packageName}:`,
150403
150407
  stderr || error.message
150404
150408
  );
@@ -150409,7 +150413,7 @@ var PluginInstaller = class {
150409
150413
  });
150410
150414
  return;
150411
150415
  }
150412
- logger142.info(`Successfully uninstalled ${packageName}`);
150416
+ logger143.info(`Successfully uninstalled ${packageName}`);
150413
150417
  resolve6({ success: true, packageName });
150414
150418
  }
150415
150419
  );
@@ -150459,7 +150463,7 @@ var PluginInstaller = class {
150459
150463
  return result;
150460
150464
  } catch (e) {
150461
150465
  const msg = e instanceof Error ? e.message : String(e);
150462
- logger142.error("Failed to install from tgz:", msg);
150466
+ logger143.error("Failed to install from tgz:", msg);
150463
150467
  return { success: false, packageName: "unknown", error: msg };
150464
150468
  } finally {
150465
150469
  try {
@@ -150546,7 +150550,7 @@ var PluginInstaller = class {
150546
150550
  }
150547
150551
  fs4.mkdirSync(path4.dirname(targetLink), { recursive: true });
150548
150552
  fs4.symlinkSync(resolvedPath, targetLink, "dir");
150549
- logger142.info(
150553
+ logger143.info(
150550
150554
  `Linked local plugin: ${packageName}@${pkg.version || "unknown"} \u2192 ${resolvedPath}`
150551
150555
  );
150552
150556
  return {
@@ -150577,7 +150581,7 @@ var PluginInstaller = class {
150577
150581
  init_esm();
150578
150582
  import * as fs5 from "node:fs";
150579
150583
  import * as path5 from "node:path";
150580
- var logger143 = Logger.get("PluginRegistry");
150584
+ var logger144 = Logger.get("PluginRegistry");
150581
150585
  var PluginRegistry = class {
150582
150586
  plugins = [];
150583
150587
  filePath;
@@ -150592,7 +150596,7 @@ var PluginRegistry = class {
150592
150596
  this.plugins = JSON.parse(raw);
150593
150597
  }
150594
150598
  } catch (e) {
150595
- logger143.warn("Failed to load plugin registry:", e);
150599
+ logger144.warn("Failed to load plugin registry:", e);
150596
150600
  this.plugins = [];
150597
150601
  }
150598
150602
  }
@@ -150608,7 +150612,7 @@ var PluginRegistry = class {
150608
150612
  "utf-8"
150609
150613
  );
150610
150614
  } catch (e) {
150611
- logger143.error("Failed to save plugin registry:", e);
150615
+ logger144.error("Failed to save plugin registry:", e);
150612
150616
  }
150613
150617
  }
150614
150618
  getAll() {
@@ -151022,7 +151026,7 @@ import { promisify } from "node:util";
151022
151026
  import v8 from "node:v8";
151023
151027
  import express15 from "express";
151024
151028
  var execAsync = promisify(exec);
151025
- var logger144 = Logger.get("SystemApi");
151029
+ var logger145 = Logger.get("SystemApi");
151026
151030
  function detectEnvironment2() {
151027
151031
  if (process.env.SUPERVISOR_TOKEN || process.env.HASSIO_TOKEN) {
151028
151032
  return "Home Assistant Add-on";
@@ -151067,7 +151071,7 @@ function systemApi(version) {
151067
151071
  environment: detectEnvironment2()
151068
151072
  });
151069
151073
  } catch (error) {
151070
- logger144.error("Failed to check for updates:", error);
151074
+ logger145.error("Failed to check for updates:", error);
151071
151075
  res.status(500).json({ error: "Failed to check for updates" });
151072
151076
  }
151073
151077
  });
@@ -151116,7 +151120,7 @@ function systemApi(version) {
151116
151120
  };
151117
151121
  res.json(systemInfo);
151118
151122
  } catch (error) {
151119
- logger144.error("Failed to get system info:", error);
151123
+ logger145.error("Failed to get system info:", error);
151120
151124
  res.status(500).json({ error: "Failed to get system info" });
151121
151125
  }
151122
151126
  });
@@ -151159,7 +151163,7 @@ async function getStorageInfo() {
151159
151163
  return await getUnixStorageInfo(pathToCheck);
151160
151164
  }
151161
151165
  } catch (error) {
151162
- logger144.error("Failed to get storage info:", error);
151166
+ logger145.error("Failed to get storage info:", error);
151163
151167
  return { total: 0, used: 0, free: 0 };
151164
151168
  }
151165
151169
  }
@@ -151389,7 +151393,7 @@ var WebSocketApi = class {
151389
151393
 
151390
151394
  // src/api/web-api.ts
151391
151395
  var WebApi = class extends Service {
151392
- constructor(logger205, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
151396
+ constructor(logger206, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
151393
151397
  super("WebApi");
151394
151398
  this.bridgeService = bridgeService;
151395
151399
  this.haClient = haClient;
@@ -151400,8 +151404,8 @@ var WebApi = class extends Service {
151400
151404
  this.settingsStorage = settingsStorage;
151401
151405
  this.backupService = backupService;
151402
151406
  this.props = props;
151403
- this.logger = logger205;
151404
- this.log = logger205.get(this);
151407
+ this.logger = logger206;
151408
+ this.log = logger206.get(this);
151405
151409
  this.accessLogger = accessLogger(this.log.createChild("Access Log"));
151406
151410
  this.startTime = Date.now();
151407
151411
  this.wsApi = new WebSocketApi(
@@ -151887,12 +151891,12 @@ var CustomStorage = class extends StorageBackendDisk {
151887
151891
 
151888
151892
  // src/core/app/storage.ts
151889
151893
  function storage(environment, options) {
151890
- const logger205 = environment.get(LoggerService).get("CustomStorage");
151894
+ const logger206 = environment.get(LoggerService).get("CustomStorage");
151891
151895
  const location2 = resolveStorageLocation(options.location);
151892
151896
  fs8.mkdirSync(location2, { recursive: true });
151893
151897
  const storageService = environment.get(StorageService);
151894
151898
  storageService.location = location2;
151895
- storageService.factory = (ns) => new CustomStorage(logger205, path8.resolve(location2, ns));
151899
+ storageService.factory = (ns) => new CustomStorage(logger206, path8.resolve(location2, ns));
151896
151900
  }
151897
151901
  function resolveStorageLocation(storageLocation) {
151898
151902
  const homedir = os5.homedir();
@@ -152466,11 +152470,28 @@ import {
152466
152470
  ERR_INVALID_AUTH,
152467
152471
  getConfig
152468
152472
  } from "home-assistant-js-websocket";
152473
+ var TRANSIENT_CONNECT_ERROR_CODES = /* @__PURE__ */ new Set([
152474
+ "ECONNREFUSED",
152475
+ "ECONNRESET",
152476
+ "ETIMEDOUT",
152477
+ "ENOTFOUND",
152478
+ "EAI_AGAIN",
152479
+ "EHOSTUNREACH",
152480
+ "ENETUNREACH",
152481
+ "EPIPE"
152482
+ ]);
152483
+ function isTransientConnectError(reason) {
152484
+ if (reason === ERR_CANNOT_CONNECT) return true;
152485
+ const code = reason?.code;
152486
+ if (code && TRANSIENT_CONNECT_ERROR_CODES.has(code)) return true;
152487
+ const msg = reason instanceof Error ? reason.message : String(reason);
152488
+ return msg.includes("socket hang up") || msg.includes("tls") || msg.includes("TLS");
152489
+ }
152469
152490
  var HomeAssistantClient = class extends Service {
152470
- constructor(logger205, options) {
152491
+ constructor(logger206, options) {
152471
152492
  super("HomeAssistantClient");
152472
152493
  this.options = options;
152473
- this.log = logger205.get(this);
152494
+ this.log = logger206.get(this);
152474
152495
  }
152475
152496
  options;
152476
152497
  static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
@@ -152498,16 +152519,6 @@ var HomeAssistantClient = class extends Service {
152498
152519
  await this.waitForHomeAssistantToBeUpAndRunning(connection);
152499
152520
  return connection;
152500
152521
  } catch (reason) {
152501
- if (reason === ERR_CANNOT_CONNECT) {
152502
- this.log.warnCtx("Unable to connect to Home Assistant, retrying...", {
152503
- url: props.url,
152504
- attempt,
152505
- maxAttempts: maxConnectAttempts,
152506
- retryDelayMs: 5e3
152507
- });
152508
- await new Promise((resolve6) => setTimeout(resolve6, 5e3));
152509
- continue;
152510
- }
152511
152522
  if (reason === ERR_INVALID_AUTH) {
152512
152523
  this.log.errorCtx(
152513
152524
  "Authentication failed",
@@ -152518,6 +152529,17 @@ var HomeAssistantClient = class extends Service {
152518
152529
  "Authentication failed while connecting to home assistant"
152519
152530
  );
152520
152531
  }
152532
+ if (isTransientConnectError(reason)) {
152533
+ this.log.warnCtx("Unable to connect to Home Assistant, retrying...", {
152534
+ url: props.url,
152535
+ attempt,
152536
+ maxAttempts: maxConnectAttempts,
152537
+ retryDelayMs: 5e3,
152538
+ reason: reason instanceof Error ? reason.message : String(reason)
152539
+ });
152540
+ await new Promise((resolve6) => setTimeout(resolve6, 5e3));
152541
+ continue;
152542
+ }
152521
152543
  throw new Error(`Unable to connect to home assistant: ${reason}`);
152522
152544
  }
152523
152545
  }
@@ -152648,7 +152670,7 @@ async function getAreaRegistry(connection) {
152648
152670
  }
152649
152671
 
152650
152672
  // src/services/home-assistant/home-assistant-registry.ts
152651
- var logger145 = Logger.get("HomeAssistantRegistry");
152673
+ var logger146 = Logger.get("HomeAssistantRegistry");
152652
152674
  var HomeAssistantRegistry = class extends Service {
152653
152675
  constructor(client, options) {
152654
152676
  super("HomeAssistantRegistry");
@@ -152687,14 +152709,22 @@ var HomeAssistantRegistry = class extends Service {
152687
152709
  }
152688
152710
  enableAutoRefresh(onRefresh) {
152689
152711
  this.disableAutoRefresh();
152712
+ let refreshing = false;
152690
152713
  this.autoRefresh = setInterval(async () => {
152714
+ if (refreshing) {
152715
+ logger146.debug("Skipping registry refresh \u2014 previous tick still running");
152716
+ return;
152717
+ }
152718
+ refreshing = true;
152691
152719
  try {
152692
152720
  const changed = await this.reload();
152693
152721
  if (changed) {
152694
152722
  await onRefresh();
152695
152723
  }
152696
152724
  } catch (e) {
152697
- logger145.warn("Failed to refresh registry, will retry next interval:", e);
152725
+ logger146.warn("Failed to refresh registry, will retry next interval:", e);
152726
+ } finally {
152727
+ refreshing = false;
152698
152728
  }
152699
152729
  }, this.options.refreshInterval * 1e3);
152700
152730
  }
@@ -152710,7 +152740,7 @@ var HomeAssistantRegistry = class extends Service {
152710
152740
  baseDelayMs: 2e3,
152711
152741
  maxDelayMs: 3e4,
152712
152742
  onRetry: (attempt, error, delayMs) => {
152713
- logger145.warn(
152743
+ logger146.warn(
152714
152744
  `Registry fetch failed (attempt ${attempt}), retrying in ${delayMs}ms:`,
152715
152745
  error
152716
152746
  );
@@ -152720,7 +152750,7 @@ var HomeAssistantRegistry = class extends Service {
152720
152750
  async fetchRegistries() {
152721
152751
  const connection = this.client.connection;
152722
152752
  if (!connection.connected) {
152723
- logger145.debug("Connection not ready, waiting for reconnect...");
152753
+ logger146.debug("Connection not ready, waiting for reconnect...");
152724
152754
  await new Promise((resolve6) => {
152725
152755
  const timeout = setTimeout(() => {
152726
152756
  connection.removeEventListener("ready", onReady);
@@ -152776,7 +152806,7 @@ var HomeAssistantRegistry = class extends Service {
152776
152806
  const fingerprint = hash2.digest("hex");
152777
152807
  this._states = keyBy(statesList, "entity_id");
152778
152808
  if (fingerprint === this.lastRegistryFingerprint) {
152779
- logger145.debug("Registry unchanged, skipping full refresh");
152809
+ logger146.debug("Registry unchanged, skipping full refresh");
152780
152810
  return false;
152781
152811
  }
152782
152812
  this.lastRegistryFingerprint = fingerprint;
@@ -152797,10 +152827,10 @@ var HomeAssistantRegistry = class extends Service {
152797
152827
  const missingDevices = fromPairs(missingDeviceIds.map((d) => [d, { id: d }]));
152798
152828
  this._devices = { ...missingDevices, ...realDevices };
152799
152829
  this._entities = allEntities;
152800
- logger145.debug(
152830
+ logger146.debug(
152801
152831
  `Loaded HA registry: ${keys(allEntities).length} entities, ${keys(realDevices).length} devices, ${keys(this._states).length} states`
152802
152832
  );
152803
- logMemoryUsage(logger145, "after HA registry load");
152833
+ logMemoryUsage(logger146, "after HA registry load");
152804
152834
  this._labels = labels;
152805
152835
  this._areas = new Map(areas.map((a) => [a.area_id, a.name]));
152806
152836
  return true;
@@ -153518,7 +153548,7 @@ var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError40('Cannot
153518
153548
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
153519
153549
  var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
153520
153550
  var __privateMethod2 = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
153521
- var logger146 = Logger.get("ScenesManagementServer");
153551
+ var logger147 = Logger.get("ScenesManagementServer");
153522
153552
  var UNDEFINED_SCENE_ID = 255;
153523
153553
  var GLOBAL_SCENE_ID = 0;
153524
153554
  var UNDEFINED_GROUP = GroupId(0);
@@ -153677,11 +153707,11 @@ var ScenesManagementServer = class extends ScenesManagementBase {
153677
153707
  return { status: Status2.ResourceExhausted, groupId: groupId22, sceneId };
153678
153708
  }
153679
153709
  this.state.sceneTable.push(sceneData);
153680
- logger146.debug(`Added scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
153710
+ logger147.debug(`Added scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
153681
153711
  this.#updateFabricSceneInfoCountsForFabric(fabricIndex);
153682
153712
  } else {
153683
153713
  this.state.sceneTable[existingSceneIndex] = sceneData;
153684
- logger146.debug(`Updated scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
153714
+ logger147.debug(`Updated scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
153685
153715
  }
153686
153716
  return { status: Status2.Success, groupId: groupId22, sceneId };
153687
153717
  }
@@ -153984,20 +154014,20 @@ var ScenesManagementServer = class extends ScenesManagementBase {
153984
154014
  }
153985
154015
  }
153986
154016
  if (fieldCount !== 2) {
153987
- logger146.warn(
154017
+ logger147.warn(
153988
154018
  `AttributeValuePair has invalid number (${fieldCount}) of fields (${serialize(attributeValuePair)})`
153989
154019
  );
153990
154020
  return void 0;
153991
154021
  }
153992
154022
  const value = attributeValuePair[mappedType];
153993
154023
  if (value === void 0) {
153994
- logger146.warn(
154024
+ logger147.warn(
153995
154025
  `AttributeValuePair missing value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
153996
154026
  );
153997
154027
  return void 0;
153998
154028
  }
153999
154029
  if (typeof value !== "number" && typeof value !== "bigint") {
154000
- logger146.warn(
154030
+ logger147.warn(
154001
154031
  `AttributeValuePair has invalid non-numeric value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
154002
154032
  // Should never happen
154003
154033
  );
@@ -154095,7 +154125,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154095
154125
  } else if (schema6.schema.baseTypeMin < 0 && schema6.schema.min > schema6.schema.baseTypeMin) {
154096
154126
  return { attributeId, [mappedType]: schema6.schema.baseTypeMin };
154097
154127
  } else {
154098
- logger146.warn(
154128
+ logger147.warn(
154099
154129
  `Cannot determine out-of-bounds value for attribute schema, returning min value of datatype schema`
154100
154130
  );
154101
154131
  }
@@ -154116,7 +154146,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154116
154146
  }
154117
154147
  }
154118
154148
  });
154119
- logger146.debug(`Collected scene attribute values on Endpoint ${this.endpoint.id}: ${serialize(sceneValues)}`);
154149
+ logger147.debug(`Collected scene attribute values on Endpoint ${this.endpoint.id}: ${serialize(sceneValues)}`);
154120
154150
  return sceneValues;
154121
154151
  }
154122
154152
  /**
@@ -154155,7 +154185,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154155
154185
  }
154156
154186
  const attrType = attribute2.primitiveBase?.name;
154157
154187
  if (attrType === void 0 || DataTypeToSceneAttributeDataMap[attrType] === void 0) {
154158
- logger146.warn(
154188
+ logger147.warn(
154159
154189
  `Scene Attribute ${attribute2.name} on Cluster ${clusterName} has unsupported datatype ${attrType} for scene management on Endpoint ${this.endpoint.id}`
154160
154190
  );
154161
154191
  continue;
@@ -154170,7 +154200,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154170
154200
  });
154171
154201
  }
154172
154202
  if (sceneClusterDetails) {
154173
- logger146.info(
154203
+ logger147.info(
154174
154204
  `Registered ${sceneClusterDetails.attributes.size} scene attributes for Cluster ${clusterName} on Endpoint ${this.endpoint.id}`
154175
154205
  );
154176
154206
  this.internal.endpointSceneableBehaviors.add(sceneClusterDetails);
@@ -154178,7 +154208,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154178
154208
  }
154179
154209
  /** Apply scene attribute values in the various clusters on the endpoint. */
154180
154210
  #applySceneAttributeValues(sceneValues, transitionTime = null) {
154181
- logger146.debug(`Recalling scene on Endpoint ${this.endpoint.id} with values: ${serialize(sceneValues)}`);
154211
+ logger147.debug(`Recalling scene on Endpoint ${this.endpoint.id} with values: ${serialize(sceneValues)}`);
154182
154212
  const agent = this.endpoint.agentFor(this.context);
154183
154213
  const promises = [];
154184
154214
  for (const [clusterName, clusterAttributes] of Object.entries(sceneValues)) {
@@ -154189,7 +154219,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154189
154219
  promises.push(result);
154190
154220
  }
154191
154221
  } else {
154192
- logger146.warn(
154222
+ logger147.warn(
154193
154223
  `No scenes implementation found for cluster ${clusterName} on Endpoint ${this.endpoint.id} during scene recall. Values are ignored`
154194
154224
  );
154195
154225
  }
@@ -154197,7 +154227,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154197
154227
  if (promises.length) {
154198
154228
  return Promise.all(promises).then(
154199
154229
  () => void 0,
154200
- (error) => logger146.warn(`Error applying scene attribute values on Endpoint ${this.endpoint.id}:`, error)
154230
+ (error) => logger147.warn(`Error applying scene attribute values on Endpoint ${this.endpoint.id}:`, error)
154201
154231
  );
154202
154232
  }
154203
154233
  }
@@ -154388,7 +154418,7 @@ var GroupsBehaviorConstructor = ClusterBehavior.withInterface().for(Groups3.Clus
154388
154418
  var GroupsBehavior = GroupsBehaviorConstructor;
154389
154419
 
154390
154420
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/groups/GroupsServer.js
154391
- var logger147 = Logger.get("GroupsServer");
154421
+ var logger148 = Logger.get("GroupsServer");
154392
154422
  Groups3.Cluster.commands = {
154393
154423
  ...Groups3.Cluster.commands,
154394
154424
  addGroup: Command(
@@ -154452,7 +154482,7 @@ var GroupsServer = class extends GroupsBase {
154452
154482
  (fabric2, gkm) => gkm.addEndpointForGroup(fabric2, groupId3, endpointNumber, groupName)
154453
154483
  );
154454
154484
  } catch (error) {
154455
- logger147.error(error);
154485
+ logger148.error(error);
154456
154486
  StatusResponseError.accept(error);
154457
154487
  return { status: error.code, groupId: groupId3 };
154458
154488
  }
@@ -157492,7 +157522,7 @@ function miredsToXy(mireds) {
157492
157522
  }
157493
157523
 
157494
157524
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/color-control/ColorControlServer.js
157495
- var logger148 = Logger.get("ColorControlServer");
157525
+ var logger149 = Logger.get("ColorControlServer");
157496
157526
  var ColorControlBase = ColorControlBehavior.with(
157497
157527
  ColorControl3.Feature.HueSaturation,
157498
157528
  ColorControl3.Feature.EnhancedHue,
@@ -158673,7 +158703,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158673
158703
  switch (oldMode) {
158674
158704
  case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
158675
158705
  if (this.state.currentHue === void 0 || this.state.currentSaturation === void 0) {
158676
- logger148.warn("Could not convert from hue/saturation because one of them is undefined");
158706
+ logger149.warn("Could not convert from hue/saturation because one of them is undefined");
158677
158707
  break;
158678
158708
  }
158679
158709
  switch (newMode) {
@@ -158685,7 +158715,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158685
158715
  case ColorControl3.ColorMode.ColorTemperatureMireds:
158686
158716
  const mireds = hsvToMireds(this.hue, this.saturation);
158687
158717
  if (mireds === void 0) {
158688
- logger148.warn(
158718
+ logger149.warn(
158689
158719
  `Could not convert hue/saturation (${this.hue}/${this.saturation}) to color temperature`
158690
158720
  );
158691
158721
  } else {
@@ -158696,7 +158726,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158696
158726
  break;
158697
158727
  case ColorControl3.ColorMode.CurrentXAndCurrentY:
158698
158728
  if (this.state.currentX === void 0 || this.state.currentY === void 0) {
158699
- logger148.warn("Could not convert from xy because one of them is undefined");
158729
+ logger149.warn("Could not convert from xy because one of them is undefined");
158700
158730
  break;
158701
158731
  }
158702
158732
  switch (newMode) {
@@ -158708,7 +158738,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158708
158738
  case ColorControl3.ColorMode.ColorTemperatureMireds:
158709
158739
  const mireds = xyToMireds(this.x, this.y);
158710
158740
  if (mireds === void 0) {
158711
- logger148.warn(`Could not convert xy ${this.x / this.y} to color temperature`);
158741
+ logger149.warn(`Could not convert xy ${this.x / this.y} to color temperature`);
158712
158742
  } else {
158713
158743
  this.mireds = mireds;
158714
158744
  }
@@ -158717,14 +158747,14 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158717
158747
  break;
158718
158748
  case ColorControl3.ColorMode.ColorTemperatureMireds:
158719
158749
  if (this.state.colorTemperatureMireds === void 0) {
158720
- logger148.warn("Could not convert from color temperature because it is undefined");
158750
+ logger149.warn("Could not convert from color temperature because it is undefined");
158721
158751
  break;
158722
158752
  }
158723
158753
  switch (newMode) {
158724
158754
  case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
158725
158755
  const hsvResult = miredsToHsv(this.mireds);
158726
158756
  if (hsvResult === void 0) {
158727
- logger148.warn(`Could not convert color temperature ${this.mireds} to hue/saturation`);
158757
+ logger149.warn(`Could not convert color temperature ${this.mireds} to hue/saturation`);
158728
158758
  } else {
158729
158759
  const [hue, saturation] = hsvResult;
158730
158760
  this.hue = hue;
@@ -158734,7 +158764,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158734
158764
  case ColorControl3.ColorMode.CurrentXAndCurrentY:
158735
158765
  const xyResult = miredsToXy(this.mireds);
158736
158766
  if (xyResult === void 0) {
158737
- logger148.warn("Could not convert color temperature to xy");
158767
+ logger149.warn("Could not convert color temperature to xy");
158738
158768
  } else {
158739
158769
  const [x, y] = xyResult;
158740
158770
  this.x = x;
@@ -158783,7 +158813,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158783
158813
  );
158784
158814
  newColorTemp = tempPhysMax - tempDelta;
158785
158815
  }
158786
- logger148.debug(`Synced color temperature with level: ${level}, new color temperature: ${newColorTemp}`);
158816
+ logger149.debug(`Synced color temperature with level: ${level}, new color temperature: ${newColorTemp}`);
158787
158817
  return this.moveToColorTemperatureLogic(newColorTemp, 0);
158788
158818
  }
158789
158819
  #assertRate(mode, rate) {
@@ -158987,7 +159017,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158987
159017
  targetEnhancedColorMode = values4.enhancedColorMode;
158988
159018
  }
158989
159019
  if (!this.#supportsColorMode(targetEnhancedColorMode)) {
158990
- logger148.info(
159020
+ logger149.info(
158991
159021
  `Can not apply scene with unsupported color mode: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
158992
159022
  );
158993
159023
  }
@@ -159029,7 +159059,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
159029
159059
  }
159030
159060
  break;
159031
159061
  default:
159032
- logger148.info(
159062
+ logger149.info(
159033
159063
  `No supported color mode found to apply scene: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
159034
159064
  );
159035
159065
  break;
@@ -159122,7 +159152,7 @@ init_esm();
159122
159152
  init_ServerNode();
159123
159153
  init_esm4();
159124
159154
  init_esm3();
159125
- var logger149 = Logger.get("LevelControlServer");
159155
+ var logger150 = Logger.get("LevelControlServer");
159126
159156
  var LevelControlBase = LevelControlBehavior.with(LevelControl3.Feature.OnOff, LevelControl3.Feature.Lighting);
159127
159157
  var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlBase {
159128
159158
  /** Returns the minimum level, including feature specific fallback value handling. */
@@ -159209,17 +159239,17 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
159209
159239
  */
159210
159240
  initializeLighting() {
159211
159241
  if (this.state.currentLevel === 0) {
159212
- logger149.warn(
159242
+ logger150.warn(
159213
159243
  `The currentLevel value of ${this.state.currentLevel} is invalid according to Matter specification. The value must not be 0.`
159214
159244
  );
159215
159245
  }
159216
159246
  if (this.minLevel !== 1) {
159217
- logger149.warn(
159247
+ logger150.warn(
159218
159248
  `The minLevel value of ${this.minLevel} is invalid according to Matter specification. The value should be 1.`
159219
159249
  );
159220
159250
  }
159221
159251
  if (this.maxLevel !== 254) {
159222
- logger149.warn(
159252
+ logger150.warn(
159223
159253
  `The maxLevel value of ${this.maxLevel} is invalid according to Matter specification. The value should be 254.`
159224
159254
  );
159225
159255
  }
@@ -159530,7 +159560,7 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
159530
159560
  if (!onOff || this.state.onLevel === null) {
159531
159561
  return;
159532
159562
  }
159533
- logger149.debug(`OnOff changed to ON, setting level to onLevel value of ${this.state.onLevel}`);
159563
+ logger150.debug(`OnOff changed to ON, setting level to onLevel value of ${this.state.onLevel}`);
159534
159564
  this.state.currentLevel = this.state.onLevel;
159535
159565
  }
159536
159566
  #calculateEffectiveOptions(optionsMask, optionsOverride) {
@@ -160567,7 +160597,7 @@ var SwitchBehavior = SwitchBehaviorConstructor;
160567
160597
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/switch/SwitchServer.js
160568
160598
  var DEFAULT_MULTIPRESS_DELAY = Millis(300);
160569
160599
  var DEFAULT_LONG_PRESS_DELAY = Seconds(2);
160570
- var logger150 = Logger.get("SwitchServer");
160600
+ var logger151 = Logger.get("SwitchServer");
160571
160601
  var SwitchServerBase = SwitchBehavior.for(Switch3.Complete).with(
160572
160602
  Switch3.Feature.LatchingSwitch,
160573
160603
  Switch3.Feature.MomentarySwitch,
@@ -160621,7 +160651,7 @@ var SwitchBaseServer = class extends SwitchServerBase {
160621
160651
  this.internal.currentIsLongPress = false;
160622
160652
  this.internal.multiPressTimer?.stop();
160623
160653
  this.internal.longPressTimer?.stop();
160624
- logger150.info("State of Switch got reset");
160654
+ logger151.info("State of Switch got reset");
160625
160655
  }
160626
160656
  // TODO remove when Validator logic can assess that with 1.3 introduction
160627
160657
  #assertPositionInRange(position) {
@@ -161148,7 +161178,7 @@ var ModeSelectBehaviorConstructor = ClusterBehavior.withInterface().for(ModeSele
161148
161178
  var ModeSelectBehavior = ModeSelectBehaviorConstructor;
161149
161179
 
161150
161180
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/mode-select/ModeSelectServer.js
161151
- var logger151 = Logger.get("ModeSelectServer");
161181
+ var logger152 = Logger.get("ModeSelectServer");
161152
161182
  var ModeSelectBase = ModeSelectBehavior.with(ModeSelect3.Feature.OnOff);
161153
161183
  var ModeSelectBaseServer = class extends ModeSelectBase {
161154
161184
  initialize() {
@@ -161165,7 +161195,7 @@ var ModeSelectBaseServer = class extends ModeSelectBase {
161165
161195
  }
161166
161196
  this.reactTo(onOffServer.events.onOff$Changed, this.#handleOnOffDependency);
161167
161197
  } else {
161168
- logger151.warn("OnOffServer not found on endpoint, but OnMode is set.");
161198
+ logger152.warn("OnOffServer not found on endpoint, but OnMode is set.");
161169
161199
  }
161170
161200
  }
161171
161201
  if (!currentModeOverridden && this.state.startUpMode !== void 0 && this.state.startUpMode !== null && this.#getBootReason() !== GeneralDiagnostics3.BootReason.SoftwareUpdateCompleted) {
@@ -161386,7 +161416,7 @@ init_IdentifyServer();
161386
161416
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/occupancy-sensing/OccupancySensingServer.js
161387
161417
  init_occupancy_sensing();
161388
161418
  init_esm();
161389
- var logger152 = Logger.get("OccupancySensingServer");
161419
+ var logger153 = Logger.get("OccupancySensingServer");
161390
161420
  var holdTimeDependencies = [
161391
161421
  "holdTimeLimits",
161392
161422
  "pirOccupiedToUnoccupiedDelay",
@@ -161402,7 +161432,7 @@ var holdTimeDependencies = [
161402
161432
  var OccupancySensingServer = class extends OccupancySensingBehavior {
161403
161433
  initialize() {
161404
161434
  if (!Object.values(this.features).some((feature) => feature)) {
161405
- logger152.error(
161435
+ logger153.error(
161406
161436
  `OccupancySensingServer: Since revision 5 of the cluster features need to be set based on the detector type. Currently no features are enabled.`
161407
161437
  );
161408
161438
  } else if (!Object.values(this.state.occupancySensorTypeBitmap).some((feature) => feature) || this.state.occupancySensorType === void 0) {
@@ -161429,7 +161459,7 @@ var OccupancySensingServer = class extends OccupancySensingBehavior {
161429
161459
  } else if (this.state.occupancySensorTypeBitmap.physicalContact) {
161430
161460
  this.state.occupancySensorType = OccupancySensing3.OccupancySensorType.PhysicalContact;
161431
161461
  }
161432
- logger152.debug(
161462
+ logger153.debug(
161433
161463
  "Sync occupancySensorType to",
161434
161464
  OccupancySensing3.OccupancySensorType[this.state.occupancySensorType],
161435
161465
  "and occupancySensorTypeBitmap to",
@@ -162394,7 +162424,7 @@ init_esm3();
162394
162424
 
162395
162425
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteState.js
162396
162426
  init_esm();
162397
- var logger153 = Logger.get("AtomicWriteState");
162427
+ var logger154 = Logger.get("AtomicWriteState");
162398
162428
  var MAXIMUM_ALLOWED_TIMEOUT = Seconds(9);
162399
162429
  var AtomicWriteState = class {
162400
162430
  peerAddress;
@@ -162429,19 +162459,19 @@ var AtomicWriteState = class {
162429
162459
  });
162430
162460
  }
162431
162461
  start() {
162432
- logger153.debug(
162462
+ logger154.debug(
162433
162463
  `Starting atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
162434
162464
  );
162435
162465
  this.#timer.start();
162436
162466
  }
162437
162467
  #timeoutTriggered() {
162438
- logger153.debug(
162468
+ logger154.debug(
162439
162469
  `Atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id} timed out`
162440
162470
  );
162441
162471
  this.close();
162442
162472
  }
162443
162473
  close() {
162444
- logger153.debug(
162474
+ logger154.debug(
162445
162475
  `Closing atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
162446
162476
  );
162447
162477
  if (this.#timer.isRunning) {
@@ -162452,7 +162482,7 @@ var AtomicWriteState = class {
162452
162482
  };
162453
162483
 
162454
162484
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteHandler.js
162455
- var logger154 = Logger.get("AtomicWriteHandler");
162485
+ var logger155 = Logger.get("AtomicWriteHandler");
162456
162486
  var AtomicWriteHandler = class _AtomicWriteHandler {
162457
162487
  #observers = new ObserverGroup();
162458
162488
  #pendingWrites = new BasicSet();
@@ -162522,7 +162552,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162522
162552
  );
162523
162553
  this.#pendingWrites.add(state);
162524
162554
  state.closed.on(() => void this.#pendingWrites.delete(state));
162525
- logger154.debug("Added atomic write state:", state);
162555
+ logger155.debug("Added atomic write state:", state);
162526
162556
  return state;
162527
162557
  }
162528
162558
  if (existingState === void 0) {
@@ -162589,10 +162619,10 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162589
162619
  writeAttribute(context, endpoint, cluster2, attribute2, value) {
162590
162620
  const state = this.#assertPendingWriteForAttributeAndPeer(context, endpoint, cluster2, attribute2);
162591
162621
  const attributeName = state.attributeNames.get(attribute2);
162592
- logger154.debug(`Writing pending value for attribute ${attributeName}, ${attribute2} in atomic write`, value);
162622
+ logger155.debug(`Writing pending value for attribute ${attributeName}, ${attribute2} in atomic write`, value);
162593
162623
  endpoint.eventsOf(cluster2.id)[`${attributeName}$AtomicChanging`]?.emit(value, state.pendingAttributeValues[attribute2] !== void 0 ? state.pendingAttributeValues[attribute2] : state.initialValues[attribute2], context);
162594
162624
  state.pendingAttributeValues[attribute2] = value;
162595
- logger154.debug("Atomic write state after current write:", state);
162625
+ logger155.debug("Atomic write state after current write:", state);
162596
162626
  }
162597
162627
  /**
162598
162628
  * Implements the commit logic for an atomic write.
@@ -162611,7 +162641,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162611
162641
  await context.transaction?.commit();
162612
162642
  } catch (error) {
162613
162643
  await context.transaction?.rollback();
162614
- logger154.info(`Failed to write attribute ${attr} during atomic write commit: ${error}`);
162644
+ logger155.info(`Failed to write attribute ${attr} during atomic write commit: ${error}`);
162615
162645
  statusCode = error instanceof StatusResponseError ? error.code : Status2.Failure;
162616
162646
  commandStatusCode = commandStatusCode === Status2.Failure ? Status2.Failure : commandStatusCode === Status2.ConstraintError ? Status2.ConstraintError : Status2.Failure;
162617
162647
  }
@@ -162647,7 +162677,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162647
162677
  const fabricIndex = fabric.fabricIndex;
162648
162678
  for (const writeState of Array.from(this.#pendingWrites)) {
162649
162679
  if (writeState.peerAddress.fabricIndex === fabricIndex) {
162650
- logger154.debug(
162680
+ logger155.debug(
162651
162681
  `Closing atomic write state for peer ${writeState.peerAddress.toString()} on endpoint ${writeState.endpoint.id} due to fabric removal`
162652
162682
  );
162653
162683
  writeState.close();
@@ -162688,7 +162718,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162688
162718
  if (!PeerAddress.is(attrWriteState.peerAddress, peerAddress)) {
162689
162719
  return void 0;
162690
162720
  }
162691
- logger154.debug(
162721
+ logger155.debug(
162692
162722
  `Found pending value for attribute ${attribute2} for peer ${peerAddress.nodeId}`,
162693
162723
  serialize(attrWriteState.pendingAttributeValues[attribute2])
162694
162724
  );
@@ -162724,7 +162754,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162724
162754
  };
162725
162755
 
162726
162756
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/thermostat/ThermostatServer.js
162727
- var logger155 = Logger.get("ThermostatServer");
162757
+ var logger156 = Logger.get("ThermostatServer");
162728
162758
  var ThermostatBehaviorLogicBase = ThermostatBehavior.with(
162729
162759
  Thermostat3.Feature.Heating,
162730
162760
  Thermostat3.Feature.Cooling,
@@ -162753,7 +162783,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
162753
162783
  throw new ImplementationError("Setback feature is deprecated and not allowed to be enabled");
162754
162784
  }
162755
162785
  if (this.features.matterScheduleConfiguration) {
162756
- logger155.warn("MatterScheduleConfiguration feature is not yet implemented. Please do not activate it");
162786
+ logger156.warn("MatterScheduleConfiguration feature is not yet implemented. Please do not activate it");
162757
162787
  }
162758
162788
  const options = this.endpoint.behaviors.optionsFor(_ThermostatBaseServer);
162759
162789
  if (this.features.presets && this.state.persistedPresets === void 0) {
@@ -162871,7 +162901,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
162871
162901
  throw new StatusResponse.InvalidCommandError("Requested PresetHandle not found");
162872
162902
  }
162873
162903
  }
162874
- logger155.info(`Setting active preset handle to`, presetHandle);
162904
+ logger156.info(`Setting active preset handle to`, presetHandle);
162875
162905
  this.state.activePresetHandle = presetHandle;
162876
162906
  return preset;
162877
162907
  }
@@ -162941,7 +162971,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
162941
162971
  }
162942
162972
  if (this.state.setpointHoldExpiryTimestamp === void 0) {
162943
162973
  } else {
162944
- logger155.warn(
162974
+ logger156.warn(
162945
162975
  "Handling for setpointHoldExpiryTimestamp is not yet implemented. To use this attribute you need to install the needed logic yourself"
162946
162976
  );
162947
162977
  }
@@ -163014,7 +163044,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163014
163044
  "RemoteSensing cannot be set to LocalTemperature when LocalTemperatureNotExposed feature is enabled"
163015
163045
  );
163016
163046
  }
163017
- logger155.debug("LocalTemperatureNotExposed feature is enabled, ignoring local temperature measurement");
163047
+ logger156.debug("LocalTemperatureNotExposed feature is enabled, ignoring local temperature measurement");
163018
163048
  this.state.localTemperature = null;
163019
163049
  }
163020
163050
  let localTemperature = null;
@@ -163023,11 +163053,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163023
163053
  const endpoints = this.env.get(ServerNode).endpoints;
163024
163054
  const endpoint = endpoints.has(localTempEndpoint) ? endpoints.for(localTempEndpoint) : void 0;
163025
163055
  if (endpoint !== void 0 && endpoint.behaviors.has(TemperatureMeasurementServer)) {
163026
- logger155.debug(
163056
+ logger156.debug(
163027
163057
  `Using existing TemperatureMeasurement cluster on endpoint #${localTempEndpoint} for local temperature measurement`
163028
163058
  );
163029
163059
  if (this.state.externalMeasuredIndoorTemperature !== void 0) {
163030
- logger155.warn(
163060
+ logger156.warn(
163031
163061
  "Both local TemperatureMeasurement cluster and externalMeasuredIndoorTemperature state are set, using local cluster"
163032
163062
  );
163033
163063
  }
@@ -163037,19 +163067,19 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163037
163067
  );
163038
163068
  localTemperature = endpoint.stateOf(TemperatureMeasurementServer).measuredValue;
163039
163069
  } else {
163040
- logger155.warn(
163070
+ logger156.warn(
163041
163071
  `No TemperatureMeasurement cluster found on endpoint #${localTempEndpoint}, falling back to externalMeasuredIndoorTemperature state if set`
163042
163072
  );
163043
163073
  }
163044
163074
  } else {
163045
163075
  if (this.state.externalMeasuredIndoorTemperature === void 0) {
163046
163076
  if (this.state.localTemperatureCalibration !== void 0) {
163047
- logger155.warn(
163077
+ logger156.warn(
163048
163078
  "No local TemperatureMeasurement cluster available, externalMeasuredIndoorTemperature state not set but localTemperatureCalibration is used: Ensure to correctly consider the calibration when updating the localTemperature value"
163049
163079
  );
163050
163080
  }
163051
163081
  } else {
163052
- logger155.info("Using measured temperature via externalMeasuredIndoorTemperature state");
163082
+ logger156.info("Using measured temperature via externalMeasuredIndoorTemperature state");
163053
163083
  localTemperature = this.state.externalMeasuredIndoorTemperature ?? null;
163054
163084
  }
163055
163085
  this.reactTo(this.events.externalMeasuredIndoorTemperature$Changed, this.#handleMeasuredTemperatureChange);
@@ -163089,28 +163119,28 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163089
163119
  const endpoints = this.env.get(ServerNode).endpoints;
163090
163120
  const endpoint = endpoints.has(localOccupancyEndpoint) ? endpoints.for(localOccupancyEndpoint) : void 0;
163091
163121
  if (endpoint !== void 0 && endpoint.behaviors.has(OccupancySensingServer)) {
163092
- logger155.debug(
163122
+ logger156.debug(
163093
163123
  `Using existing OccupancySensing cluster on endpoint ${localOccupancyEndpoint} for local occupancy sensing`
163094
163124
  );
163095
163125
  if (this.state.externallyMeasuredOccupancy !== void 0) {
163096
- logger155.warn(
163126
+ logger156.warn(
163097
163127
  "Both local OccupancySensing cluster and externallyMeasuredOccupancy state are set, using local cluster"
163098
163128
  );
163099
163129
  }
163100
163130
  this.reactTo(endpoint.eventsOf(OccupancySensingServer).occupancy$Changed, this.#handleOccupancyChange);
163101
163131
  currentOccupancy = !!endpoint.stateOf(OccupancySensingServer).occupancy.occupied;
163102
163132
  } else {
163103
- logger155.warn(
163133
+ logger156.warn(
163104
163134
  `No OccupancySensing cluster found on endpoint ${localOccupancyEndpoint}, falling back to externallyMeasuredOccupancy state if set`
163105
163135
  );
163106
163136
  }
163107
163137
  } else {
163108
163138
  if (this.state.externallyMeasuredOccupancy === void 0) {
163109
- logger155.warn(
163139
+ logger156.warn(
163110
163140
  "No local OccupancySensing cluster available and externallyMeasuredOccupancy state not set"
163111
163141
  );
163112
163142
  } else {
163113
- logger155.info("Using occupancy via externallyMeasuredOccupancy state");
163143
+ logger156.info("Using occupancy via externallyMeasuredOccupancy state");
163114
163144
  currentOccupancy = this.state.externallyMeasuredOccupancy;
163115
163145
  }
163116
163146
  this.reactTo(this.events.externallyMeasuredOccupancy$Changed, this.#handleExternalOccupancyChange);
@@ -163377,7 +163407,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163377
163407
  max = this.state[`max${scope}`] ?? defaults.absMax,
163378
163408
  absMax = this.state[`absMax${scope}`] ?? defaults.absMax
163379
163409
  } = details;
163380
- logger155.debug(
163410
+ logger156.debug(
163381
163411
  `Validating user setpoint limits for ${scope}: absMin=${absMin}, min=${min}, max=${max}, absMax=${absMax}`
163382
163412
  );
163383
163413
  if (absMin > min) {
@@ -163424,7 +163454,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163424
163454
  const limitMax = scope === "Heat" ? this.heatSetpointMaximum : this.coolSetpointMaximum;
163425
163455
  const result = cropValueRange(setpoint, limitMin, limitMax);
163426
163456
  if (result !== setpoint) {
163427
- logger155.debug(
163457
+ logger156.debug(
163428
163458
  `${scope} setpoint (${setpoint}) is out of limits [${limitMin}, ${limitMax}], clamping to ${result}`
163429
163459
  );
163430
163460
  }
@@ -163461,7 +163491,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163461
163491
  const otherLimit = otherType === "Heating" ? this.heatSetpointMinimum : this.coolSetpointMaximum;
163462
163492
  if (otherType === "Cooling") {
163463
163493
  const minValidSetpoint = value + deadband;
163464
- logger155.debug(
163494
+ logger156.debug(
163465
163495
  `Ensuring deadband for ${type}${otherType}Setpoint, min valid setpoint is ${minValidSetpoint}`
163466
163496
  );
163467
163497
  if (otherSetpoint >= minValidSetpoint) {
@@ -163472,11 +163502,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163472
163502
  `Cannot adjust cooling setpoint to maintain deadband, would exceed max cooling setpoint (${otherLimit})`
163473
163503
  );
163474
163504
  }
163475
- logger155.debug(`Adjusting ${type}${otherType}Setpoint to ${minValidSetpoint} to maintain deadband`);
163505
+ logger156.debug(`Adjusting ${type}${otherType}Setpoint to ${minValidSetpoint} to maintain deadband`);
163476
163506
  this.state[`${type}${otherType}Setpoint`] = minValidSetpoint;
163477
163507
  } else {
163478
163508
  const maxValidSetpoint = value - deadband;
163479
- logger155.debug(
163509
+ logger156.debug(
163480
163510
  `Ensuring deadband for ${type}${otherType}Setpoint, max valid setpoint is ${maxValidSetpoint}`
163481
163511
  );
163482
163512
  if (otherSetpoint <= maxValidSetpoint) {
@@ -163487,7 +163517,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163487
163517
  `Cannot adjust heating setpoint to maintain deadband, would exceed min heating setpoint (${otherLimit})`
163488
163518
  );
163489
163519
  }
163490
- logger155.debug(`Adjusting ${type}${otherType}Setpoint to ${maxValidSetpoint} to maintain deadband`);
163520
+ logger156.debug(`Adjusting ${type}${otherType}Setpoint to ${maxValidSetpoint} to maintain deadband`);
163491
163521
  this.state[`${type}${otherType}Setpoint`] = maxValidSetpoint;
163492
163522
  }
163493
163523
  }
@@ -163755,7 +163785,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163755
163785
  */
163756
163786
  #handlePersistedPresetsChanged(newPresets, oldPresets) {
163757
163787
  if (oldPresets === void 0) {
163758
- logger155.debug(
163788
+ logger156.debug(
163759
163789
  "Old presets is undefined, skipping some checks. This should only happen on setup of the behavior."
163760
163790
  );
163761
163791
  }
@@ -163764,7 +163794,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163764
163794
  const newPresetHandles = /* @__PURE__ */ new Set();
163765
163795
  for (const preset of newPresets) {
163766
163796
  if (preset.presetHandle === null) {
163767
- logger155.error("Preset is missing presetHandle, generating a new one");
163797
+ logger156.error("Preset is missing presetHandle, generating a new one");
163768
163798
  preset.presetHandle = entropy.randomBytes(16);
163769
163799
  changed = true;
163770
163800
  }
@@ -163813,7 +163843,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163813
163843
  throw new StatusResponse.InvalidInStateError(`ActivePresetHandle references non-existing presetHandle`);
163814
163844
  }
163815
163845
  if (changed) {
163816
- logger155.error("PresetHandles or BuiltIn flags were updated, updating persistedPresets");
163846
+ logger156.error("PresetHandles or BuiltIn flags were updated, updating persistedPresets");
163817
163847
  this.state.persistedPresets = deepCopy(newPresets);
163818
163848
  }
163819
163849
  }
@@ -164716,7 +164746,7 @@ init_IdentifyServer();
164716
164746
  init_window_covering();
164717
164747
  init_esm();
164718
164748
  init_esm3();
164719
- var logger156 = Logger.get("WindowCoveringServer");
164749
+ var logger157 = Logger.get("WindowCoveringServer");
164720
164750
  var WindowCoveringBase = WindowCoveringBehavior.with(
164721
164751
  WindowCovering3.Feature.Lift,
164722
164752
  WindowCovering3.Feature.Tilt,
@@ -164801,7 +164831,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164801
164831
  this.state.configStatus = configStatus;
164802
164832
  });
164803
164833
  }
164804
- logger156.debug(
164834
+ logger157.debug(
164805
164835
  `Mode changed to ${Diagnostic.json(mode)} and config status to ${Diagnostic.json(configStatus)} and internal calibration mode to ${this.internal.calibrationMode}`
164806
164836
  );
164807
164837
  }
@@ -164809,7 +164839,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164809
164839
  #handleOperationalStatusChanging(operationalStatus) {
164810
164840
  const globalStatus = operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped ? operationalStatus.lift : operationalStatus.tilt;
164811
164841
  operationalStatus.global = globalStatus;
164812
- logger156.debug(
164842
+ logger157.debug(
164813
164843
  `Operational status changed to ${Diagnostic.json(operationalStatus)} with new global status ${globalStatus}`
164814
164844
  );
164815
164845
  this.state.operationalStatus = operationalStatus;
@@ -164838,10 +164868,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164838
164868
  this.state.currentPositionLiftPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
164839
164869
  if (this.state.operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionLiftPercent100ths) {
164840
164870
  this.state.operationalStatus.lift = WindowCovering3.MovementStatus.Stopped;
164841
- logger156.debug("Lift movement stopped, target value reached");
164871
+ logger157.debug("Lift movement stopped, target value reached");
164842
164872
  }
164843
164873
  }
164844
- logger156.debug(
164874
+ logger157.debug(
164845
164875
  `Syncing lift position ${this.state.currentPositionLiftPercent100ths === null ? null : (this.state.currentPositionLiftPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionLiftPercentage}%`
164846
164876
  );
164847
164877
  }
@@ -164851,10 +164881,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164851
164881
  this.state.currentPositionTiltPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
164852
164882
  if (this.state.operationalStatus.tilt !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionTiltPercent100ths) {
164853
164883
  this.state.operationalStatus.tilt = WindowCovering3.MovementStatus.Stopped;
164854
- logger156.debug("Tilt movement stopped, target value reached");
164884
+ logger157.debug("Tilt movement stopped, target value reached");
164855
164885
  }
164856
164886
  }
164857
- logger156.debug(
164887
+ logger157.debug(
164858
164888
  `Syncing tilt position ${this.state.currentPositionTiltPercent100ths === null ? null : (this.state.currentPositionTiltPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionTiltPercentage}%`
164859
164889
  );
164860
164890
  }
@@ -164942,7 +164972,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164942
164972
  }
164943
164973
  const directionInfo = direction === 2 ? ` in direction by position` : ` in direction ${direction === 1 ? "Close" : "Open"}`;
164944
164974
  const targetInfo = targetPercent100ths === void 0 ? "" : ` to target position ${(targetPercent100ths / 100).toFixed(2)}`;
164945
- logger156.debug(
164975
+ logger157.debug(
164946
164976
  `Moving the device ${type === 0 ? "Lift" : "Tilt"}${directionInfo} (reversed=${reversed})${targetInfo}`
164947
164977
  );
164948
164978
  }
@@ -164964,7 +164994,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164964
164994
  );
164965
164995
  }
164966
164996
  if (type === 0 && this.state.configStatus.liftMovementReversed) {
164967
- logger156.debug("Lift movement is reversed");
164997
+ logger157.debug("Lift movement is reversed");
164968
164998
  }
164969
164999
  switch (type) {
164970
165000
  case 0:
@@ -165194,7 +165224,7 @@ init_esm3();
165194
165224
 
165195
165225
  // src/utils/apply-patch-state.ts
165196
165226
  init_esm();
165197
- var logger157 = Logger.get("ApplyPatchState");
165227
+ var logger158 = Logger.get("ApplyPatchState");
165198
165228
  function applyPatchState(state, patch, options) {
165199
165229
  return applyPatch(state, patch, options?.force);
165200
165230
  }
@@ -165221,23 +165251,23 @@ function applyPatch(state, patch, force = false) {
165221
165251
  if (errorMessage.includes(
165222
165252
  "Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
165223
165253
  )) {
165224
- logger157.debug(
165254
+ logger158.debug(
165225
165255
  `Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
165226
165256
  );
165227
165257
  return actualPatch;
165228
165258
  }
165229
165259
  if (errorMessage.includes("synchronous-transaction-conflict")) {
165230
- logger157.warn(
165260
+ logger158.warn(
165231
165261
  `Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
165232
165262
  );
165233
165263
  return actualPatch;
165234
165264
  }
165235
165265
  failedKeys.push(key);
165236
- logger157.warn(`Failed to set property '${key}': ${errorMessage}`);
165266
+ logger158.warn(`Failed to set property '${key}': ${errorMessage}`);
165237
165267
  }
165238
165268
  }
165239
165269
  if (failedKeys.length > 0) {
165240
- logger157.warn(
165270
+ logger158.warn(
165241
165271
  `${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
165242
165272
  );
165243
165273
  }
@@ -165446,7 +165476,7 @@ init_basic_information2();
165446
165476
  init_descriptor2();
165447
165477
  init_aggregator();
165448
165478
  init_esm();
165449
- var logger158 = Logger.get("BridgedDeviceBasicInformationServer");
165479
+ var logger159 = Logger.get("BridgedDeviceBasicInformationServer");
165450
165480
  var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInformationBehavior {
165451
165481
  async initialize() {
165452
165482
  if (this.endpoint.lifecycle.isInstalled) {
@@ -165461,7 +165491,7 @@ var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInform
165461
165491
  this.state.uniqueId = BasicInformationServer.createUniqueId();
165462
165492
  }
165463
165493
  if (serialNumber !== void 0 && uniqueId === this.state.serialNumber) {
165464
- logger158.warn("uniqueId and serialNumber shall not be the same.");
165494
+ logger159.warn("uniqueId and serialNumber shall not be the same.");
165465
165495
  }
165466
165496
  }
165467
165497
  static schema = BasicInformationServer.enableUniqueIdPersistence(
@@ -166333,7 +166363,7 @@ var IdentifyServer2 = class extends IdentifyServer {
166333
166363
  // src/matter/endpoints/validate-endpoint-type.ts
166334
166364
  init_esm();
166335
166365
  init_esm7();
166336
- var logger159 = Logger.get("EndpointValidation");
166366
+ var logger160 = Logger.get("EndpointValidation");
166337
166367
  function toCamelCase(name) {
166338
166368
  return name.charAt(0).toLowerCase() + name.slice(1);
166339
166369
  }
@@ -166363,12 +166393,12 @@ function validateEndpointType(endpointType, entityId) {
166363
166393
  }
166364
166394
  const prefix = entityId ? `[${entityId}] ` : "";
166365
166395
  if (missingMandatory.length > 0) {
166366
- logger159.warn(
166396
+ logger160.warn(
166367
166397
  `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): missing mandatory clusters: ${missingMandatory.join(", ")}`
166368
166398
  );
166369
166399
  }
166370
166400
  if (availableOptional.length > 0) {
166371
- logger159.debug(
166401
+ logger160.debug(
166372
166402
  `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): optional clusters not used: ${availableOptional.join(", ")}`
166373
166403
  );
166374
166404
  }
@@ -166522,7 +166552,7 @@ function truncate(maxLength, value) {
166522
166552
  }
166523
166553
 
166524
166554
  // src/plugins/plugin-device-factory.ts
166525
- var logger160 = Logger.get("PluginDeviceFactory");
166555
+ var logger161 = Logger.get("PluginDeviceFactory");
166526
166556
  var deviceTypeMap = {
166527
166557
  on_off_light: () => OnOffLightDevice.with(
166528
166558
  IdentifyServer2,
@@ -166628,7 +166658,7 @@ var deviceTypeMap = {
166628
166658
  function createPluginEndpointType(deviceType) {
166629
166659
  const factory = deviceTypeMap[deviceType];
166630
166660
  if (!factory) {
166631
- logger160.warn(`Unsupported plugin device type: "${deviceType}"`);
166661
+ logger161.warn(`Unsupported plugin device type: "${deviceType}"`);
166632
166662
  return void 0;
166633
166663
  }
166634
166664
  const endpoint = factory();
@@ -166643,7 +166673,7 @@ function getSupportedPluginDeviceTypes() {
166643
166673
  init_esm();
166644
166674
  import * as fs10 from "node:fs";
166645
166675
  import * as path11 from "node:path";
166646
- var logger161 = Logger.get("PluginStorage");
166676
+ var logger162 = Logger.get("PluginStorage");
166647
166677
  var SAVE_DEBOUNCE_MS = 500;
166648
166678
  var FilePluginStorage = class {
166649
166679
  data = {};
@@ -166679,7 +166709,7 @@ var FilePluginStorage = class {
166679
166709
  this.data = JSON.parse(raw);
166680
166710
  }
166681
166711
  } catch (e) {
166682
- logger161.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
166712
+ logger162.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
166683
166713
  this.data = {};
166684
166714
  }
166685
166715
  }
@@ -166701,7 +166731,7 @@ var FilePluginStorage = class {
166701
166731
  fs10.writeFileSync(this.filePath, JSON.stringify(this.data, null, 2));
166702
166732
  this.dirty = false;
166703
166733
  } catch (e) {
166704
- logger161.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
166734
+ logger162.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
166705
166735
  }
166706
166736
  }
166707
166737
  flush() {
@@ -166711,7 +166741,7 @@ var FilePluginStorage = class {
166711
166741
 
166712
166742
  // src/plugins/safe-plugin-runner.ts
166713
166743
  init_esm();
166714
- var logger162 = Logger.get("SafePluginRunner");
166744
+ var logger163 = Logger.get("SafePluginRunner");
166715
166745
  var DEFAULT_TIMEOUT_MS = 1e4;
166716
166746
  var CIRCUIT_BREAKER_THRESHOLD = 3;
166717
166747
  var SafePluginRunner = class {
@@ -166744,7 +166774,7 @@ var SafePluginRunner = class {
166744
166774
  async run(pluginName, operation, fn, timeoutMs = DEFAULT_TIMEOUT_MS) {
166745
166775
  const state = this.getState(pluginName);
166746
166776
  if (state.disabled) {
166747
- logger162.debug(
166777
+ logger163.debug(
166748
166778
  `Plugin "${pluginName}" is disabled (circuit breaker open), skipping ${operation}`
166749
166779
  );
166750
166780
  return void 0;
@@ -166762,13 +166792,13 @@ var SafePluginRunner = class {
166762
166792
  timeout.clear();
166763
166793
  state.failures++;
166764
166794
  state.lastError = error instanceof Error ? error.message : String(error);
166765
- logger162.error(
166795
+ logger163.error(
166766
166796
  `Plugin "${pluginName}" failed during ${operation} (failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
166767
166797
  );
166768
166798
  if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
166769
166799
  state.disabled = true;
166770
166800
  state.disabledAt = Date.now();
166771
- logger162.error(
166801
+ logger163.error(
166772
166802
  `Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures. Last error: ${state.lastError}`
166773
166803
  );
166774
166804
  }
@@ -166790,13 +166820,13 @@ var SafePluginRunner = class {
166790
166820
  } catch (error) {
166791
166821
  state.failures++;
166792
166822
  state.lastError = error instanceof Error ? error.message : String(error);
166793
- logger162.error(
166823
+ logger163.error(
166794
166824
  `Plugin "${pluginName}" failed during ${operation} (sync, failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
166795
166825
  );
166796
166826
  if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
166797
166827
  state.disabled = true;
166798
166828
  state.disabledAt = Date.now();
166799
- logger162.error(
166829
+ logger163.error(
166800
166830
  `Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures.`
166801
166831
  );
166802
166832
  }
@@ -166822,7 +166852,7 @@ var SafePluginRunner = class {
166822
166852
  };
166823
166853
 
166824
166854
  // src/plugins/plugin-manager.ts
166825
- var logger163 = Logger.get("PluginManager");
166855
+ var logger164 = Logger.get("PluginManager");
166826
166856
  var PLUGIN_API_VERSION = 1;
166827
166857
  var MAX_PLUGIN_DEVICE_ID_LENGTH = 100;
166828
166858
  function validatePluginDevice(device) {
@@ -166905,7 +166935,7 @@ var PluginManager = class {
166905
166935
  throw new Error(`Plugin at ${packagePath} package.json missing "main"`);
166906
166936
  }
166907
166937
  if (manifest.hamhPluginApiVersion != null && manifest.hamhPluginApiVersion !== PLUGIN_API_VERSION) {
166908
- logger163.warn(
166938
+ logger164.warn(
166909
166939
  `Plugin "${manifest.name}" declares API version ${manifest.hamhPluginApiVersion}, current is ${PLUGIN_API_VERSION}. It may not work correctly.`
166910
166940
  );
166911
166941
  }
@@ -166936,7 +166966,7 @@ var PluginManager = class {
166936
166966
  };
166937
166967
  await this.register(plugin, metadata);
166938
166968
  } catch (e) {
166939
- logger163.error(`Failed to load external plugin from ${packagePath}:`, e);
166969
+ logger164.error(`Failed to load external plugin from ${packagePath}:`, e);
166940
166970
  throw e;
166941
166971
  }
166942
166972
  }
@@ -167013,7 +167043,7 @@ var PluginManager = class {
167013
167043
  devices,
167014
167044
  started: false
167015
167045
  });
167016
- logger163.info(
167046
+ logger164.info(
167017
167047
  `Registered plugin: ${plugin.name} v${plugin.version} (${metadata.source})`
167018
167048
  );
167019
167049
  }
@@ -167024,13 +167054,13 @@ var PluginManager = class {
167024
167054
  for (const [name, instance] of this.instances) {
167025
167055
  if (!instance.metadata.enabled) continue;
167026
167056
  if (this.runner.isDisabled(name)) {
167027
- logger163.warn(
167057
+ logger164.warn(
167028
167058
  `Plugin "${name}" is disabled (circuit breaker), skipping start`
167029
167059
  );
167030
167060
  instance.metadata.enabled = false;
167031
167061
  continue;
167032
167062
  }
167033
- logger163.info(`Starting plugin: ${name}`);
167063
+ logger164.info(`Starting plugin: ${name}`);
167034
167064
  await this.runner.run(
167035
167065
  name,
167036
167066
  "onStart",
@@ -167078,7 +167108,7 @@ var PluginManager = class {
167078
167108
  storage2.flush();
167079
167109
  }
167080
167110
  instance.started = false;
167081
- logger163.info(`Plugin "${name}" shut down`);
167111
+ logger164.info(`Plugin "${name}" shut down`);
167082
167112
  }
167083
167113
  this.instances.clear();
167084
167114
  }
@@ -167489,10 +167519,10 @@ init_diagnostic_event_bus();
167489
167519
  var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
167490
167520
  var DEAD_SESSION_TIMEOUT_MS = 6e4;
167491
167521
  var Bridge = class {
167492
- constructor(env, logger205, dataProvider, endpointManager) {
167522
+ constructor(env, logger206, dataProvider, endpointManager) {
167493
167523
  this.dataProvider = dataProvider;
167494
167524
  this.endpointManager = endpointManager;
167495
- this.log = logger205.get(`Bridge / ${dataProvider.id}`);
167525
+ this.log = logger206.get(`Bridge / ${dataProvider.id}`);
167496
167526
  this.server = new BridgeServerNode(
167497
167527
  env,
167498
167528
  this.dataProvider,
@@ -167524,6 +167554,10 @@ var Bridge = class {
167524
167554
  autoForceSyncTimer = null;
167525
167555
  deadSessionTimer = null;
167526
167556
  staleSessionTimers = /* @__PURE__ */ new Map();
167557
+ // Serialize concurrent lifecycle calls so auto-recovery and a manual
167558
+ // restartBridge can't race past each other's Starting/Stopping states.
167559
+ startInFlight;
167560
+ stopInFlight;
167527
167561
  // Tracks the last synced state JSON per entity to avoid pushing unchanged states.
167528
167562
  // Key: entity_id, Value: JSON.stringify of entity.state
167529
167563
  lastSyncedStates = /* @__PURE__ */ new Map();
@@ -167640,6 +167674,15 @@ var Bridge = class {
167640
167674
  if (this.status.code === BridgeStatus.Running) {
167641
167675
  return;
167642
167676
  }
167677
+ if (this.startInFlight) {
167678
+ return this.startInFlight;
167679
+ }
167680
+ this.startInFlight = this.runStart().finally(() => {
167681
+ this.startInFlight = void 0;
167682
+ });
167683
+ return this.startInFlight;
167684
+ }
167685
+ async runStart() {
167643
167686
  this.lastSyncedStates.clear();
167644
167687
  try {
167645
167688
  this.setStatus({
@@ -167677,6 +167720,15 @@ ${e?.toString()}`);
167677
167720
  }
167678
167721
  }
167679
167722
  async stop(code = BridgeStatus.Stopped, reason = "Manually stopped") {
167723
+ if (this.stopInFlight) {
167724
+ return this.stopInFlight;
167725
+ }
167726
+ this.stopInFlight = this.runStop(code, reason).finally(() => {
167727
+ this.stopInFlight = void 0;
167728
+ });
167729
+ return this.stopInFlight;
167730
+ }
167731
+ async runStop(code, reason) {
167680
167732
  this.unwireSessionDiagnostics();
167681
167733
  this.stopAutoForceSync();
167682
167734
  await this.endpointManager.stopPlugins();
@@ -168290,7 +168342,7 @@ init_clusters();
168290
168342
 
168291
168343
  // src/matter/behaviors/electrical-energy-measurement-server.ts
168292
168344
  init_home_assistant_entity_behavior();
168293
- var logger164 = Logger.get("ElectricalEnergyMeasurementServer");
168345
+ var logger165 = Logger.get("ElectricalEnergyMeasurementServer");
168294
168346
  var FeaturedBase = ElectricalEnergyMeasurementServer.with("CumulativeEnergy", "ImportedEnergy");
168295
168347
  var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
168296
168348
  async initialize() {
@@ -168299,7 +168351,7 @@ var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
168299
168351
  const entityId = homeAssistant.entityId;
168300
168352
  const energyEntity = homeAssistant.state.mapping?.energyEntity;
168301
168353
  if (energyEntity) {
168302
- logger164.debug(
168354
+ logger165.debug(
168303
168355
  `[${entityId}] ElectricalEnergyMeasurement using mapped energy entity: ${energyEntity}`
168304
168356
  );
168305
168357
  }
@@ -168351,7 +168403,7 @@ var HaElectricalEnergyMeasurementServer = ElectricalEnergyMeasurementServerBase.
168351
168403
  // src/matter/behaviors/electrical-power-measurement-server.ts
168352
168404
  init_esm();
168353
168405
  init_home_assistant_entity_behavior();
168354
- var logger165 = Logger.get("ElectricalPowerMeasurementServer");
168406
+ var logger166 = Logger.get("ElectricalPowerMeasurementServer");
168355
168407
  var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurementServer {
168356
168408
  async initialize() {
168357
168409
  await super.initialize();
@@ -168359,7 +168411,7 @@ var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurem
168359
168411
  const entityId = homeAssistant.entityId;
168360
168412
  const powerEntity = homeAssistant.state.mapping?.powerEntity;
168361
168413
  if (powerEntity) {
168362
- logger165.debug(
168414
+ logger166.debug(
168363
168415
  `[${entityId}] ElectricalPowerMeasurement using mapped power entity: ${powerEntity}`
168364
168416
  );
168365
168417
  }
@@ -168411,7 +168463,7 @@ init_home_assistant_entity_behavior();
168411
168463
  // src/matter/behaviors/humidity-measurement-server.ts
168412
168464
  init_esm();
168413
168465
  init_home_assistant_entity_behavior();
168414
- var logger166 = Logger.get("HumidityMeasurementServer");
168466
+ var logger167 = Logger.get("HumidityMeasurementServer");
168415
168467
  var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementServer {
168416
168468
  async initialize() {
168417
168469
  await super.initialize();
@@ -168424,7 +168476,7 @@ var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementSer
168424
168476
  return;
168425
168477
  }
168426
168478
  const humidity = this.getHumidity(this.state.config, entity.state);
168427
- logger166.debug(
168479
+ logger167.debug(
168428
168480
  `Humidity ${entity.state.entity_id} raw=${entity.state.state} measuredValue=${humidity}`
168429
168481
  );
168430
168482
  applyPatchState(this.state, {
@@ -168454,7 +168506,7 @@ function HumidityMeasurementServer(config10) {
168454
168506
  // src/matter/behaviors/power-source-server.ts
168455
168507
  init_esm();
168456
168508
  init_home_assistant_entity_behavior();
168457
- var logger167 = Logger.get("PowerSourceServer");
168509
+ var logger168 = Logger.get("PowerSourceServer");
168458
168510
  var FeaturedBase2 = PowerSourceServer.with("Battery", "Rechargeable");
168459
168511
  var PowerSourceServerBase = class extends FeaturedBase2 {
168460
168512
  async initialize() {
@@ -168466,17 +168518,17 @@ var PowerSourceServerBase = class extends FeaturedBase2 {
168466
168518
  applyPatchState(this.state, {
168467
168519
  endpointList: [endpointNumber]
168468
168520
  });
168469
- logger167.debug(
168521
+ logger168.debug(
168470
168522
  `[${entityId}] PowerSource initialized with endpointList=[${endpointNumber}]`
168471
168523
  );
168472
168524
  } else {
168473
- logger167.warn(
168525
+ logger168.warn(
168474
168526
  `[${entityId}] PowerSource endpoint number is null during initialize - endpointList will be empty!`
168475
168527
  );
168476
168528
  }
168477
168529
  const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
168478
168530
  if (batteryEntity) {
168479
- logger167.debug(
168531
+ logger168.debug(
168480
168532
  `[${entityId}] PowerSource using mapped battery entity: ${batteryEntity}`
168481
168533
  );
168482
168534
  }
@@ -168801,13 +168853,30 @@ init_home_assistant_entity_behavior();
168801
168853
  init_esm();
168802
168854
  init_home_assistant_entity_behavior();
168803
168855
  var lastTurnOnTimestamps = /* @__PURE__ */ new Map();
168856
+ var LAST_TURN_ON_TTL_MS = 6e4;
168804
168857
  var optimisticLevelState = /* @__PURE__ */ new Map();
168805
168858
  var OPTIMISTIC_TIMEOUT_MS = 3e3;
168806
168859
  var OPTIMISTIC_TOLERANCE = 5;
168860
+ function sweepOptimisticLevel(now) {
168861
+ for (const [key, value] of optimisticLevelState) {
168862
+ if (now - value.timestamp > OPTIMISTIC_TIMEOUT_MS) {
168863
+ optimisticLevelState.delete(key);
168864
+ }
168865
+ }
168866
+ }
168867
+ function sweepLastTurnOn(now) {
168868
+ for (const [key, ts] of lastTurnOnTimestamps) {
168869
+ if (now - ts > LAST_TURN_ON_TTL_MS) {
168870
+ lastTurnOnTimestamps.delete(key);
168871
+ }
168872
+ }
168873
+ }
168807
168874
  function notifyLightTurnedOn(entityId) {
168808
- lastTurnOnTimestamps.set(entityId, Date.now());
168875
+ const now = Date.now();
168876
+ sweepLastTurnOn(now);
168877
+ lastTurnOnTimestamps.set(entityId, now);
168809
168878
  }
168810
- var logger168 = Logger.get("LevelControlServer");
168879
+ var logger169 = Logger.get("LevelControlServer");
168811
168880
  var FeaturedBase4 = LevelControlServer.with("OnOff", "Lighting");
168812
168881
  var LevelControlServerBase = class extends FeaturedBase4 {
168813
168882
  pendingTransitionTime;
@@ -168822,12 +168891,12 @@ var LevelControlServerBase = class extends FeaturedBase4 {
168822
168891
  this.state.maxLevel = 254;
168823
168892
  }
168824
168893
  this.state.onLevel = null;
168825
- logger168.debug(`initialize: calling super.initialize()`);
168894
+ logger169.debug(`initialize: calling super.initialize()`);
168826
168895
  try {
168827
168896
  await super.initialize();
168828
- logger168.debug(`initialize: super.initialize() completed successfully`);
168897
+ logger169.debug(`initialize: super.initialize() completed successfully`);
168829
168898
  } catch (error) {
168830
- logger168.error(`initialize: super.initialize() FAILED:`, error);
168899
+ logger169.error(`initialize: super.initialize() FAILED:`, error);
168831
168900
  throw error;
168832
168901
  }
168833
168902
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
@@ -168904,7 +168973,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
168904
168973
  const lastTurnOn = lastTurnOnTimestamps.get(entityId);
168905
168974
  const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
168906
168975
  if (level >= this.maxLevel && timeSinceTurnOn < 200) {
168907
- logger168.debug(
168976
+ logger169.debug(
168908
168977
  `[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
168909
168978
  );
168910
168979
  return;
@@ -168927,9 +168996,11 @@ var LevelControlServerBase = class extends FeaturedBase4 {
168927
168996
  };
168928
168997
  }
168929
168998
  this.state.currentLevel = level;
168999
+ const now = Date.now();
169000
+ sweepOptimisticLevel(now);
168930
169001
  optimisticLevelState.set(entityId, {
168931
169002
  expectedLevel: level,
168932
- timestamp: Date.now()
169003
+ timestamp: now
168933
169004
  });
168934
169005
  homeAssistant.callAction(action);
168935
169006
  }
@@ -168948,9 +169019,16 @@ function LevelControlServer2(config10) {
168948
169019
  }
168949
169020
 
168950
169021
  // src/matter/behaviors/on-off-server.ts
168951
- var logger169 = Logger.get("OnOffServer");
169022
+ var logger170 = Logger.get("OnOffServer");
168952
169023
  var optimisticOnOffState = /* @__PURE__ */ new Map();
168953
169024
  var OPTIMISTIC_TIMEOUT_MS2 = 3e3;
169025
+ function sweepOptimisticOnOff(now) {
169026
+ for (const [key, value] of optimisticOnOffState) {
169027
+ if (now - value.timestamp > OPTIMISTIC_TIMEOUT_MS2) {
169028
+ optimisticOnOffState.delete(key);
169029
+ }
169030
+ }
169031
+ }
168954
169032
  var OnOffServerBase = class extends OnOffServer {
168955
169033
  async initialize() {
168956
169034
  await super.initialize();
@@ -168992,11 +169070,13 @@ var OnOffServerBase = class extends OnOffServer {
168992
169070
  if (!action) {
168993
169071
  return;
168994
169072
  }
168995
- logger169.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
169073
+ logger170.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
168996
169074
  notifyLightTurnedOn(homeAssistant.entityId);
169075
+ const now = Date.now();
169076
+ sweepOptimisticOnOff(now);
168997
169077
  optimisticOnOffState.set(homeAssistant.entityId, {
168998
169078
  expectedOnOff: true,
168999
- timestamp: Date.now()
169079
+ timestamp: now
169000
169080
  });
169001
169081
  homeAssistant.callAction(action);
169002
169082
  if (turnOff === null) {
@@ -169015,10 +169095,12 @@ var OnOffServerBase = class extends OnOffServer {
169015
169095
  if (!action) {
169016
169096
  return;
169017
169097
  }
169018
- logger169.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
169098
+ logger170.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
169099
+ const now = Date.now();
169100
+ sweepOptimisticOnOff(now);
169019
169101
  optimisticOnOffState.set(homeAssistant.entityId, {
169020
169102
  expectedOnOff: false,
169021
- timestamp: Date.now()
169103
+ timestamp: now
169022
169104
  });
169023
169105
  homeAssistant.callAction(action);
169024
169106
  }
@@ -169038,14 +169120,16 @@ function OnOffServer2(config10 = {}) {
169038
169120
  return OnOffServerBase.set({ config: config10 });
169039
169121
  }
169040
169122
  function setOptimisticOnOff(entityId, expectedOnOff) {
169123
+ const now = Date.now();
169124
+ sweepOptimisticOnOff(now);
169041
169125
  optimisticOnOffState.set(entityId, {
169042
169126
  expectedOnOff,
169043
- timestamp: Date.now()
169127
+ timestamp: now
169044
169128
  });
169045
169129
  }
169046
169130
 
169047
169131
  // src/matter/behaviors/fan-control-server.ts
169048
- var logger170 = Logger.get("FanControlServer");
169132
+ var logger171 = Logger.get("FanControlServer");
169049
169133
  var defaultStepSize = 33.33;
169050
169134
  var minSpeedMax = 3;
169051
169135
  var maxSpeedMax = 100;
@@ -169421,7 +169505,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
169421
169505
  const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
169422
169506
  setOptimisticOnOff(entityId, on);
169423
169507
  } catch (e) {
169424
- logger170.debug(
169508
+ logger171.debug(
169425
169509
  `syncOnOff(${on}) failed: ${e instanceof Error ? e.message : String(e)}`
169426
169510
  );
169427
169511
  }
@@ -169509,7 +169593,7 @@ var FanOnOffServer = OnOffServer2({
169509
169593
  });
169510
169594
 
169511
169595
  // src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
169512
- var logger171 = Logger.get("ComposedAirPurifierEndpoint");
169596
+ var logger172 = Logger.get("ComposedAirPurifierEndpoint");
169513
169597
  var temperatureConfig = {
169514
169598
  getValue(entity, agent) {
169515
169599
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
@@ -169722,7 +169806,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
169722
169806
  config10.powerEntityId ? "+Pwr" : "",
169723
169807
  config10.energyEntityId ? "+Nrg" : ""
169724
169808
  ].filter(Boolean).join("");
169725
- logger171.info(
169809
+ logger172.info(
169726
169810
  `Created composed air purifier ${primaryEntityId}: ${clusterLabels}`
169727
169811
  );
169728
169812
  return endpoint;
@@ -169822,7 +169906,7 @@ init_home_assistant_entity_behavior();
169822
169906
  // src/matter/behaviors/pressure-measurement-server.ts
169823
169907
  init_esm();
169824
169908
  init_home_assistant_entity_behavior();
169825
- var logger172 = Logger.get("PressureMeasurementServer");
169909
+ var logger173 = Logger.get("PressureMeasurementServer");
169826
169910
  var MIN_PRESSURE = 300;
169827
169911
  var MAX_PRESSURE = 1100;
169828
169912
  var PressureMeasurementServerBase = class extends PressureMeasurementServer {
@@ -169850,7 +169934,7 @@ var PressureMeasurementServerBase = class extends PressureMeasurementServer {
169850
169934
  }
169851
169935
  const rounded = Math.round(value);
169852
169936
  if (rounded < MIN_PRESSURE || rounded > MAX_PRESSURE) {
169853
- logger172.warn(
169937
+ logger173.warn(
169854
169938
  `Pressure value ${rounded} (raw: ${value}) for ${entity.entity_id} is outside valid range [${MIN_PRESSURE}-${MAX_PRESSURE}], ignoring`
169855
169939
  );
169856
169940
  return null;
@@ -169869,7 +169953,7 @@ function PressureMeasurementServer2(config10) {
169869
169953
  }
169870
169954
 
169871
169955
  // src/matter/endpoints/composed/composed-sensor-endpoint.ts
169872
- var logger173 = Logger.get("ComposedSensorEndpoint");
169956
+ var logger174 = Logger.get("ComposedSensorEndpoint");
169873
169957
  var temperatureConfig2 = {
169874
169958
  getValue(entity, agent) {
169875
169959
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
@@ -170043,7 +170127,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
170043
170127
  if (config10.pressureEntityId && pressSub) {
170044
170128
  endpoint.subEndpoints.set(config10.pressureEntityId, pressSub);
170045
170129
  }
170046
- logger173.info(
170130
+ logger174.info(
170047
170131
  `Created composed sensor ${primaryEntityId} with ${parts.length} sub-endpoint(s): T${humSub ? "+H" : ""}${pressSub ? "+P" : ""}${config10.batteryEntityId ? "+Bat" : ""}${config10.powerEntityId ? "+Pwr" : ""}${config10.energyEntityId ? "+Nrg" : ""}`
170048
170132
  );
170049
170133
  return endpoint;
@@ -170179,7 +170263,7 @@ init_home_assistant_entity_behavior();
170179
170263
  // src/matter/behaviors/mode-select-server.ts
170180
170264
  init_esm();
170181
170265
  init_home_assistant_entity_behavior();
170182
- var logger174 = Logger.get("ModeSelectServer");
170266
+ var logger175 = Logger.get("ModeSelectServer");
170183
170267
  var ModeSelectServerBase = class extends ModeSelectServer {
170184
170268
  async initialize() {
170185
170269
  await super.initialize();
@@ -170208,13 +170292,13 @@ var ModeSelectServerBase = class extends ModeSelectServer {
170208
170292
  const options = config10.getOptions(homeAssistant.entity);
170209
170293
  const { newMode } = request;
170210
170294
  if (newMode < 0 || newMode >= options.length) {
170211
- logger174.warn(
170295
+ logger175.warn(
170212
170296
  `[${homeAssistant.entityId}] Invalid mode ${newMode}, options: [${options.join(", ")}]`
170213
170297
  );
170214
170298
  return;
170215
170299
  }
170216
170300
  const option = options[newMode];
170217
- logger174.info(
170301
+ logger175.info(
170218
170302
  `[${homeAssistant.entityId}] changeToMode(${newMode}) -> "${option}"`
170219
170303
  );
170220
170304
  applyPatchState(this.state, { currentMode: newMode });
@@ -170736,7 +170820,7 @@ var WaterLeakDetectorType = WaterLeakDetectorDevice.with(
170736
170820
  );
170737
170821
 
170738
170822
  // src/matter/endpoints/legacy/binary-sensor/index.ts
170739
- var logger175 = Logger.get("BinarySensorDevice");
170823
+ var logger176 = Logger.get("BinarySensorDevice");
170740
170824
  var deviceClasses = {
170741
170825
  [BinarySensorDeviceClass.CarbonMonoxide]: CoAlarmType,
170742
170826
  [BinarySensorDeviceClass.Gas]: CoAlarmType,
@@ -170788,11 +170872,11 @@ function BinarySensorDevice(homeAssistantEntity) {
170788
170872
  const originalTypeName = type.name;
170789
170873
  if (hasBattery && batteryTypes.has(type)) {
170790
170874
  type = batteryTypes.get(type);
170791
- logger175.info(
170875
+ logger176.info(
170792
170876
  `[${entityId}] Using battery variant: ${originalTypeName} -> ${type.name}, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
170793
170877
  );
170794
170878
  } else if (hasBattery) {
170795
- logger175.warn(
170879
+ logger176.warn(
170796
170880
  `[${entityId}] Has battery but no variant available for ${originalTypeName}`
170797
170881
  );
170798
170882
  }
@@ -170946,7 +171030,7 @@ init_home_assistant_entity_behavior();
170946
171030
  // src/matter/behaviors/thermostat-server.ts
170947
171031
  init_esm();
170948
171032
  init_home_assistant_entity_behavior();
170949
- var logger176 = Logger.get("ThermostatServer");
171033
+ var logger177 = Logger.get("ThermostatServer");
170950
171034
  var SystemMode = Thermostat3.SystemMode;
170951
171035
  var RunningMode = Thermostat3.ThermostatRunningMode;
170952
171036
  var nudgingSetpoints = /* @__PURE__ */ new Set();
@@ -171004,7 +171088,7 @@ var HeatingAndCoolingFeaturedBase = ThermostatServer.with("Heating", "Cooling").
171004
171088
  );
171005
171089
  function thermostatPreInitialize(self) {
171006
171090
  const currentLocal = self.state.localTemperature;
171007
- logger176.debug(
171091
+ logger177.debug(
171008
171092
  `initialize: features - heating=${self.features.heating}, cooling=${self.features.cooling}`
171009
171093
  );
171010
171094
  const localValue = typeof currentLocal === "number" && !Number.isNaN(currentLocal) ? currentLocal : currentLocal === null ? null : 2100;
@@ -171027,7 +171111,7 @@ function thermostatPreInitialize(self) {
171027
171111
  const coolingValue = typeof currentCooling === "number" && !Number.isNaN(currentCooling) ? currentCooling : 2400;
171028
171112
  self.state.occupiedCoolingSetpoint = coolingValue;
171029
171113
  }
171030
- logger176.debug(
171114
+ logger177.debug(
171031
171115
  `initialize: after force-set - local=${self.state.localTemperature}`
171032
171116
  );
171033
171117
  self.state.thermostatRunningState = runningStateAllOff;
@@ -171109,7 +171193,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171109
171193
  maxCoolLimit,
171110
171194
  "cool"
171111
171195
  );
171112
- logger176.debug(
171196
+ logger177.debug(
171113
171197
  `update: limits heat=[${minHeatLimit}, ${maxHeatLimit}], cool=[${minCoolLimit}, ${maxCoolLimit}], systemMode=${systemMode}, runningMode=${runningMode}`
171114
171198
  );
171115
171199
  let controlSequence = config10.getControlSequence(entity.state, this.agent);
@@ -171182,18 +171266,18 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171182
171266
  */
171183
171267
  // biome-ignore lint/correctness/noUnusedPrivateClassMembers: Called via thermostatPostInitialize + prototype copy
171184
171268
  heatingSetpointChanging(value, _oldValue, context) {
171185
- logger176.debug(
171269
+ logger177.debug(
171186
171270
  `heatingSetpointChanging: value=${value}, oldValue=${_oldValue}, isOffline=${transactionIsOffline(context)}`
171187
171271
  );
171188
171272
  if (transactionIsOffline(context)) {
171189
- logger176.debug(
171273
+ logger177.debug(
171190
171274
  "heatingSetpointChanging: skipping - transaction is offline"
171191
171275
  );
171192
171276
  return;
171193
171277
  }
171194
171278
  const next = Temperature.celsius(value / 100);
171195
171279
  if (!next) {
171196
- logger176.debug("heatingSetpointChanging: skipping - invalid temperature");
171280
+ logger177.debug("heatingSetpointChanging: skipping - invalid temperature");
171197
171281
  return;
171198
171282
  }
171199
171283
  this.agent.asLocalActor(() => {
@@ -171204,7 +171288,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171204
171288
  this.agent
171205
171289
  );
171206
171290
  const currentMode = this.state.systemMode;
171207
- logger176.debug(
171291
+ logger177.debug(
171208
171292
  `heatingSetpointChanging: supportsRange=${supportsRange}, systemMode=${currentMode}, features.heating=${this.features.heating}, features.cooling=${this.features.cooling}`
171209
171293
  );
171210
171294
  if (!supportsRange) {
@@ -171214,12 +171298,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171214
171298
  const isOff = currentMode === Thermostat3.SystemMode.Off;
171215
171299
  if (isOff && this.features.heating) {
171216
171300
  if (nudgingSetpoints.has(homeAssistant.entityId)) {
171217
- logger176.debug(
171301
+ logger177.debug(
171218
171302
  `heatingSetpointChanging: skipping auto-resume - nudge write in progress`
171219
171303
  );
171220
171304
  return;
171221
171305
  }
171222
- logger176.info(
171306
+ logger177.info(
171223
171307
  `heatingSetpointChanging: auto-resume - switching to Heat (was Off)`
171224
171308
  );
171225
171309
  const modeAction = config10.setSystemMode(
@@ -171228,17 +171312,17 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171228
171312
  );
171229
171313
  homeAssistant.callAction(modeAction);
171230
171314
  } else if (!isAutoMode && !isHeatingMode) {
171231
- logger176.debug(
171315
+ logger177.debug(
171232
171316
  `heatingSetpointChanging: skipping - not in heating/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
171233
171317
  );
171234
171318
  return;
171235
171319
  }
171236
- logger176.debug(
171320
+ logger177.debug(
171237
171321
  `heatingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isHeatingMode=${isHeatingMode}, isOff=${isOff}, haMode=${haHvacMode}`
171238
171322
  );
171239
171323
  }
171240
171324
  const coolingSetpoint = this.features.cooling ? this.state.occupiedCoolingSetpoint : value;
171241
- logger176.debug(
171325
+ logger177.debug(
171242
171326
  `heatingSetpointChanging: calling setTemperature with heat=${next.celsius(true)}, cool=${coolingSetpoint}`
171243
171327
  );
171244
171328
  this.setTemperature(
@@ -171277,12 +171361,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171277
171361
  const isOff = currentMode === Thermostat3.SystemMode.Off;
171278
171362
  if (isOff && !this.features.heating && this.features.cooling) {
171279
171363
  if (nudgingSetpoints.has(homeAssistant.entityId)) {
171280
- logger176.debug(
171364
+ logger177.debug(
171281
171365
  `coolingSetpointChanging: skipping auto-resume - nudge write in progress`
171282
171366
  );
171283
171367
  return;
171284
171368
  }
171285
- logger176.info(
171369
+ logger177.info(
171286
171370
  `coolingSetpointChanging: auto-resume - switching to Cool (was Off)`
171287
171371
  );
171288
171372
  const modeAction = config10.setSystemMode(
@@ -171291,12 +171375,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171291
171375
  );
171292
171376
  homeAssistant.callAction(modeAction);
171293
171377
  } else if (!isAutoMode && !isCoolingMode) {
171294
- logger176.debug(
171378
+ logger177.debug(
171295
171379
  `coolingSetpointChanging: skipping - not in cooling/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
171296
171380
  );
171297
171381
  return;
171298
171382
  }
171299
- logger176.debug(
171383
+ logger177.debug(
171300
171384
  `coolingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isCoolingMode=${isCoolingMode}, isOff=${isOff}, haMode=${haHvacMode}`
171301
171385
  );
171302
171386
  }
@@ -171393,7 +171477,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171393
171477
  const effectiveMax = max ?? 5e3;
171394
171478
  if (value == null || Number.isNaN(value)) {
171395
171479
  const defaultValue = type === "heat" ? 2e3 : 2400;
171396
- logger176.debug(
171480
+ logger177.debug(
171397
171481
  `${type} setpoint is undefined, using default: ${defaultValue}`
171398
171482
  );
171399
171483
  return Math.max(effectiveMin, Math.min(effectiveMax, defaultValue));
@@ -171838,7 +171922,7 @@ init_home_assistant_entity_behavior();
171838
171922
  init_esm();
171839
171923
  init_home_assistant_actions();
171840
171924
  init_home_assistant_entity_behavior();
171841
- var logger177 = Logger.get("WindowCoveringServer");
171925
+ var logger178 = Logger.get("WindowCoveringServer");
171842
171926
  var MovementStatus = WindowCovering3.MovementStatus;
171843
171927
  var FeaturedBase6 = WindowCoveringServer.with(
171844
171928
  "Lift",
@@ -171954,7 +172038,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
171954
172038
  }
171955
172039
  return existing100ths ?? current100ths;
171956
172040
  };
171957
- logger177.debug(
172041
+ logger178.debug(
171958
172042
  `Cover update for ${entity.entity_id}: state=${state.state}, lift=${currentLift}%, tilt=${currentTilt}%, movement=${MovementStatus[movementStatus]}`
171959
172043
  );
171960
172044
  const appliedPatch = applyPatchState(
@@ -171997,9 +172081,9 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
171997
172081
  );
171998
172082
  if (Object.keys(appliedPatch).length > 0) {
171999
172083
  const hasOperationalChange = "operationalStatus" in appliedPatch;
172000
- const log = hasOperationalChange ? logger177.info : logger177.debug;
172084
+ const log = hasOperationalChange ? logger178.info : logger178.debug;
172001
172085
  log.call(
172002
- logger177,
172086
+ logger178,
172003
172087
  `Cover ${entity.entity_id} state changed: ${JSON.stringify(appliedPatch)}`
172004
172088
  );
172005
172089
  }
@@ -172007,7 +172091,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
172007
172091
  async handleMovement(type, _, direction, targetPercent100ths) {
172008
172092
  const currentLift = this.state.currentPositionLiftPercent100ths ?? 0;
172009
172093
  const currentTilt = this.state.currentPositionTiltPercent100ths ?? 0;
172010
- logger177.info(
172094
+ logger178.info(
172011
172095
  `handleMovement: type=${MovementType[type]}, direction=${MovementDirection[direction]}, target=${targetPercent100ths}, currentLift=${currentLift}, currentTilt=${currentTilt}, absolutePosition=${this.features.absolutePosition}`
172012
172096
  );
172013
172097
  if (type === MovementType.Lift) {
@@ -172026,7 +172110,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
172026
172110
  }
172027
172111
  } else if (type === MovementType.Tilt) {
172028
172112
  if (targetPercent100ths == null && this.lastLiftMovementDirection === direction && Date.now() - this.lastLiftMovementMs < 50) {
172029
- logger177.info(
172113
+ logger178.info(
172030
172114
  `Skipping tilt ${MovementDirection[direction]} \u2014 lift already moving in same direction`
172031
172115
  );
172032
172116
  return;
@@ -172051,13 +172135,13 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
172051
172135
  handleLiftOpen() {
172052
172136
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
172053
172137
  const action = this.state.config.openCoverLift(void 0, this.agent);
172054
- logger177.info(`handleLiftOpen: calling action=${action.action}`);
172138
+ logger178.info(`handleLiftOpen: calling action=${action.action}`);
172055
172139
  homeAssistant.callAction(action);
172056
172140
  }
172057
172141
  handleLiftClose() {
172058
172142
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
172059
172143
  const action = this.state.config.closeCoverLift(void 0, this.agent);
172060
- logger177.info(`handleLiftClose: calling action=${action.action}`);
172144
+ logger178.info(`handleLiftClose: calling action=${action.action}`);
172061
172145
  homeAssistant.callAction(action);
172062
172146
  }
172063
172147
  handleGoToLiftPosition(targetPercent100ths) {
@@ -172078,7 +172162,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
172078
172162
  this.lastLiftCommandTime = now;
172079
172163
  const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
172080
172164
  const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
172081
- logger177.debug(
172165
+ logger178.debug(
172082
172166
  `Lift command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
172083
172167
  );
172084
172168
  if (this.liftDebounceTimer) {
@@ -172127,7 +172211,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
172127
172211
  this.lastTiltCommandTime = now;
172128
172212
  const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
172129
172213
  const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
172130
- logger177.debug(
172214
+ logger178.debug(
172131
172215
  `Tilt command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
172132
172216
  );
172133
172217
  if (this.tiltDebounceTimer) {
@@ -172186,7 +172270,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
172186
172270
  }
172187
172271
 
172188
172272
  // src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
172189
- var logger178 = Logger.get("CoverWindowCoveringServer");
172273
+ var logger179 = Logger.get("CoverWindowCoveringServer");
172190
172274
  var attributes5 = (entity) => entity.attributes;
172191
172275
  var MATTER_SEMANTIC_PLATFORMS = [
172192
172276
  // Currently empty - no known platforms use Matter semantics by default
@@ -172204,7 +172288,7 @@ var adjustPositionForReading2 = (position, agent) => {
172204
172288
  const { featureFlags } = agent.env.get(BridgeDataProvider);
172205
172289
  const matterSem = usesMatterSemantics(agent);
172206
172290
  const result = adjustPositionForReading(position, featureFlags, matterSem);
172207
- logger178.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
172291
+ logger179.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
172208
172292
  return result;
172209
172293
  };
172210
172294
  var adjustPositionForWriting2 = (position, agent) => {
@@ -172311,7 +172395,7 @@ var config5 = {
172311
172395
  var CoverWindowCoveringServer = WindowCoveringServer2(config5);
172312
172396
 
172313
172397
  // src/matter/endpoints/legacy/cover/index.ts
172314
- var logger179 = Logger.get("CoverDevice");
172398
+ var logger180 = Logger.get("CoverDevice");
172315
172399
  var DISCRETE_COVER_CLASSES = /* @__PURE__ */ new Set(["garage", "gate"]);
172316
172400
  var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
172317
172401
  const features2 = /* @__PURE__ */ new Set();
@@ -172322,7 +172406,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
172322
172406
  features2.add("AbsolutePosition");
172323
172407
  }
172324
172408
  } else {
172325
- logger179.warn(
172409
+ logger180.warn(
172326
172410
  `[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
172327
172411
  );
172328
172412
  features2.add("Lift");
@@ -172341,7 +172425,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
172341
172425
  features2.add("AbsolutePosition");
172342
172426
  }
172343
172427
  }
172344
- logger179.info(
172428
+ logger180.info(
172345
172429
  `[${entityId}] Creating WindowCovering with features: [${[...features2].join(", ")}], supported_features=${supportedFeatures}`
172346
172430
  );
172347
172431
  const baseBehaviors = [
@@ -172365,18 +172449,18 @@ function CoverDevice(homeAssistantEntity) {
172365
172449
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
172366
172450
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
172367
172451
  if (hasBattery) {
172368
- logger179.info(
172452
+ logger180.info(
172369
172453
  `[${entityId}] Creating cover with PowerSource cluster, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
172370
172454
  );
172371
172455
  } else {
172372
- logger179.debug(
172456
+ logger180.debug(
172373
172457
  `[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
172374
172458
  );
172375
172459
  }
172376
172460
  const deviceClass = attributes7.device_class;
172377
172461
  const isDiscrete = typeof deviceClass === "string" && DISCRETE_COVER_CLASSES.has(deviceClass.toLowerCase());
172378
172462
  if (isDiscrete) {
172379
- logger179.info(
172463
+ logger180.info(
172380
172464
  `[${entityId}] Garage/gate cover (device_class=${deviceClass}): using discrete Open/Close mode`
172381
172465
  );
172382
172466
  }
@@ -172493,7 +172577,7 @@ function DishwasherEndpoint(homeAssistantEntity) {
172493
172577
  // src/matter/behaviors/generic-switch-server.ts
172494
172578
  init_esm();
172495
172579
  init_home_assistant_entity_behavior();
172496
- var logger180 = Logger.get("GenericSwitchServer");
172580
+ var logger181 = Logger.get("GenericSwitchServer");
172497
172581
  var SimpleBase = SwitchServer.with(
172498
172582
  "MomentarySwitch",
172499
172583
  "MomentarySwitchRelease",
@@ -172535,7 +172619,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
172535
172619
  await super.initialize();
172536
172620
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
172537
172621
  const entityId = homeAssistant.entityId;
172538
- logger180.debug(`[${entityId}] GenericSwitch initialized (simple)`);
172622
+ logger181.debug(`[${entityId}] GenericSwitch initialized (simple)`);
172539
172623
  this.reactTo(homeAssistant.onChange, this.handleEventChange);
172540
172624
  }
172541
172625
  handleEventChange() {
@@ -172546,7 +172630,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
172546
172630
  const eventType = attrs.event_type;
172547
172631
  if (!eventType) return;
172548
172632
  const entityId = homeAssistant.entityId;
172549
- logger180.debug(`[${entityId}] Event fired: ${eventType}`);
172633
+ logger181.debug(`[${entityId}] Event fired: ${eventType}`);
172550
172634
  this.triggerPress(eventType);
172551
172635
  }
172552
172636
  triggerPress(eventType) {
@@ -172592,7 +172676,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
172592
172676
  await super.initialize();
172593
172677
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
172594
172678
  const entityId = homeAssistant.entityId;
172595
- logger180.debug(`[${entityId}] GenericSwitch initialized (multi)`);
172679
+ logger181.debug(`[${entityId}] GenericSwitch initialized (multi)`);
172596
172680
  this.reactTo(homeAssistant.onChange, this.handleEventChange);
172597
172681
  }
172598
172682
  handleEventChange() {
@@ -172603,7 +172687,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
172603
172687
  const eventType = attrs.event_type;
172604
172688
  if (!eventType) return;
172605
172689
  const entityId = homeAssistant.entityId;
172606
- logger180.debug(`[${entityId}] Event fired: ${eventType}`);
172690
+ logger181.debug(`[${entityId}] Event fired: ${eventType}`);
172607
172691
  this.triggerPress(eventType);
172608
172692
  }
172609
172693
  triggerPress(eventType) {
@@ -172933,7 +173017,7 @@ init_nodejs();
172933
173017
 
172934
173018
  // src/matter/behaviors/color-control-server.ts
172935
173019
  init_home_assistant_entity_behavior();
172936
- var logger181 = Logger.get("ColorControlServer");
173020
+ var logger182 = Logger.get("ColorControlServer");
172937
173021
  var optimisticColorState = /* @__PURE__ */ new Map();
172938
173022
  var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
172939
173023
  var OPTIMISTIC_TOLERANCE2 = 5;
@@ -172972,7 +173056,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
172972
173056
  if (this.state.startUpColorTemperatureMireds == null) {
172973
173057
  this.state.startUpColorTemperatureMireds = defaultMireds;
172974
173058
  }
172975
- logger181.debug(
173059
+ logger182.debug(
172976
173060
  `initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
172977
173061
  );
172978
173062
  }
@@ -173405,7 +173489,7 @@ init_home_assistant_entity_behavior();
173405
173489
  // src/matter/behaviors/lock-server.ts
173406
173490
  init_esm();
173407
173491
  init_home_assistant_entity_behavior();
173408
- var logger182 = Logger.get("LockServer");
173492
+ var logger183 = Logger.get("LockServer");
173409
173493
  function hasStoredCredentialHelper(env, entityId) {
173410
173494
  try {
173411
173495
  const storage2 = env.get(LockCredentialStorage);
@@ -173563,7 +173647,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
173563
173647
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
173564
173648
  const action = this.state.config.lock(void 0, this.agent);
173565
173649
  const hasPinProvided = !!request.pinCode;
173566
- logger182.debug(
173650
+ logger183.debug(
173567
173651
  `lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
173568
173652
  );
173569
173653
  if (request.pinCode) {
@@ -173576,12 +173660,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
173576
173660
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
173577
173661
  const action = this.state.config.unlock(void 0, this.agent);
173578
173662
  const hasPinProvided = !!request.pinCode;
173579
- logger182.debug(
173663
+ logger183.debug(
173580
173664
  `unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
173581
173665
  );
173582
173666
  if (this.state.requirePinForRemoteOperation) {
173583
173667
  if (!request.pinCode) {
173584
- logger182.info(
173668
+ logger183.info(
173585
173669
  `unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
173586
173670
  );
173587
173671
  throw new StatusResponseError(
@@ -173591,12 +173675,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
173591
173675
  }
173592
173676
  const providedPin = new TextDecoder().decode(request.pinCode);
173593
173677
  if (!this.verifyStoredPin(homeAssistant.entityId, providedPin)) {
173594
- logger182.info(
173678
+ logger183.info(
173595
173679
  `unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
173596
173680
  );
173597
173681
  throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
173598
173682
  }
173599
- logger182.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
173683
+ logger183.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
173600
173684
  action.data = { ...action.data, code: providedPin };
173601
173685
  }
173602
173686
  homeAssistant.callAction(action);
@@ -173757,7 +173841,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173757
173841
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
173758
173842
  const action = this.state.config.lock(void 0, this.agent);
173759
173843
  const hasPinProvided = !!request.pinCode;
173760
- logger182.debug(
173844
+ logger183.debug(
173761
173845
  `lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
173762
173846
  );
173763
173847
  if (request.pinCode) {
@@ -173771,12 +173855,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173771
173855
  const unlatchConfig = this.state.config.unlatch;
173772
173856
  const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
173773
173857
  const hasPinProvided = !!request.pinCode;
173774
- logger182.debug(
173858
+ logger183.debug(
173775
173859
  `unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
173776
173860
  );
173777
173861
  if (this.state.requirePinForRemoteOperation) {
173778
173862
  if (!request.pinCode) {
173779
- logger182.info(
173863
+ logger183.info(
173780
173864
  `unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
173781
173865
  );
173782
173866
  throw new StatusResponseError(
@@ -173786,12 +173870,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173786
173870
  }
173787
173871
  const providedPin = new TextDecoder().decode(request.pinCode);
173788
173872
  if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
173789
- logger182.info(
173873
+ logger183.info(
173790
173874
  `unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
173791
173875
  );
173792
173876
  throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
173793
173877
  }
173794
- logger182.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
173878
+ logger183.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
173795
173879
  action.data = { ...action.data, code: providedPin };
173796
173880
  }
173797
173881
  homeAssistant.callAction(action);
@@ -173806,12 +173890,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173806
173890
  }
173807
173891
  const action = unlatchConfig(void 0, this.agent);
173808
173892
  const hasPinProvided = !!request.pinCode;
173809
- logger182.debug(
173893
+ logger183.debug(
173810
173894
  `unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
173811
173895
  );
173812
173896
  if (this.state.requirePinForRemoteOperation) {
173813
173897
  if (!request.pinCode) {
173814
- logger182.info(
173898
+ logger183.info(
173815
173899
  `unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
173816
173900
  );
173817
173901
  throw new StatusResponseError(
@@ -173821,12 +173905,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173821
173905
  }
173822
173906
  const providedPin = new TextDecoder().decode(request.pinCode);
173823
173907
  if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
173824
- logger182.info(
173908
+ logger183.info(
173825
173909
  `unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
173826
173910
  );
173827
173911
  throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
173828
173912
  }
173829
- logger182.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
173913
+ logger183.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
173830
173914
  action.data = { ...action.data, code: providedPin };
173831
173915
  }
173832
173916
  homeAssistant.callAction(action);
@@ -173977,7 +174061,7 @@ init_home_assistant_entity_behavior();
173977
174061
  init_dist();
173978
174062
  init_esm();
173979
174063
  init_home_assistant_entity_behavior();
173980
- var logger183 = Logger.get("MediaPlayerKeypadInputServer");
174064
+ var logger184 = Logger.get("MediaPlayerKeypadInputServer");
173981
174065
  var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
173982
174066
  sendKey(request) {
173983
174067
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
@@ -173988,12 +174072,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
173988
174072
  const features2 = attributes7.supported_features ?? 0;
173989
174073
  const action = this.mapKeyToAction(request.keyCode, features2);
173990
174074
  if (!action) {
173991
- logger183.debug(
174075
+ logger184.debug(
173992
174076
  `Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
173993
174077
  );
173994
174078
  return { status: KeypadInput3.Status.UnsupportedKey };
173995
174079
  }
173996
- logger183.debug(
174080
+ logger184.debug(
173997
174081
  `sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
173998
174082
  );
173999
174083
  homeAssistant.callAction({ action });
@@ -174272,10 +174356,17 @@ init_home_assistant_entity_behavior();
174272
174356
  // src/matter/behaviors/speaker-level-control-server.ts
174273
174357
  init_esm();
174274
174358
  init_home_assistant_entity_behavior();
174275
- var logger184 = Logger.get("SpeakerLevelControlServer");
174359
+ var logger185 = Logger.get("SpeakerLevelControlServer");
174276
174360
  var optimisticLevelState2 = /* @__PURE__ */ new Map();
174277
174361
  var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
174278
174362
  var OPTIMISTIC_TOLERANCE3 = 5;
174363
+ function sweepOptimisticLevel2(now) {
174364
+ for (const [key, value] of optimisticLevelState2) {
174365
+ if (now - value.timestamp > OPTIMISTIC_TIMEOUT_MS4) {
174366
+ optimisticLevelState2.delete(key);
174367
+ }
174368
+ }
174369
+ }
174279
174370
  var FeaturedBase8 = LevelControlServer.with("OnOff");
174280
174371
  var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
174281
174372
  async initialize() {
@@ -174308,7 +174399,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
174308
174399
  currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
174309
174400
  }
174310
174401
  const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
174311
- logger184.debug(
174402
+ logger185.debug(
174312
174403
  `[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
174313
174404
  );
174314
174405
  const optimistic = optimisticLevelState2.get(entity.entity_id);
@@ -174356,7 +174447,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
174356
174447
  const config10 = this.state.config;
174357
174448
  const entityId = homeAssistant.entity.entity_id;
174358
174449
  const levelPercent = level / 254;
174359
- logger184.debug(
174450
+ logger185.debug(
174360
174451
  `[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
174361
174452
  );
174362
174453
  const current = config10.getValuePercent(
@@ -174367,9 +174458,11 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
174367
174458
  return;
174368
174459
  }
174369
174460
  this.state.currentLevel = level;
174461
+ const now = Date.now();
174462
+ sweepOptimisticLevel2(now);
174370
174463
  optimisticLevelState2.set(entityId, {
174371
174464
  expectedLevel: level,
174372
- timestamp: Date.now()
174465
+ timestamp: now
174373
174466
  });
174374
174467
  homeAssistant.callAction(
174375
174468
  config10.moveToLevelPercent(levelPercent, this.agent)
@@ -175718,7 +175811,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
175718
175811
  };
175719
175812
 
175720
175813
  // src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
175721
- var logger185 = Logger.get("TvocSensor");
175814
+ var logger186 = Logger.get("TvocSensor");
175722
175815
  function airQualityFromUgm3(value) {
175723
175816
  if (value <= 300) return AirQuality3.AirQualityEnum.Good;
175724
175817
  if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
@@ -175759,17 +175852,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
175759
175852
  const attributes7 = entity.state.attributes;
175760
175853
  const deviceClass = attributes7.device_class;
175761
175854
  let airQuality = AirQuality3.AirQualityEnum.Unknown;
175762
- logger185.debug(
175855
+ logger186.debug(
175763
175856
  `[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
175764
175857
  );
175765
175858
  if (state != null && !Number.isNaN(+state)) {
175766
175859
  const value = +state;
175767
175860
  airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
175768
- logger185.debug(
175861
+ logger186.debug(
175769
175862
  `[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
175770
175863
  );
175771
175864
  } else {
175772
- logger185.warn(
175865
+ logger186.warn(
175773
175866
  `[${entity.entity_id}] TVOC state not a valid number: "${state}"`
175774
175867
  );
175775
175868
  }
@@ -175983,7 +176076,7 @@ init_home_assistant_entity_behavior();
175983
176076
  // src/matter/behaviors/pm25-concentration-measurement-server.ts
175984
176077
  init_esm();
175985
176078
  init_home_assistant_entity_behavior();
175986
- var logger186 = Logger.get("Pm25ConcentrationMeasurementServer");
176079
+ var logger187 = Logger.get("Pm25ConcentrationMeasurementServer");
175987
176080
  var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
175988
176081
  ConcentrationMeasurement3.Feature.NumericMeasurement
175989
176082
  );
@@ -176007,11 +176100,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
176007
176100
  if (this.state.measurementMedium === void 0) {
176008
176101
  this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
176009
176102
  }
176010
- logger186.debug(
176103
+ logger187.debug(
176011
176104
  "Pm25ConcentrationMeasurementServer: before super.initialize()"
176012
176105
  );
176013
176106
  await super.initialize();
176014
- logger186.debug(
176107
+ logger187.debug(
176015
176108
  "Pm25ConcentrationMeasurementServer: after super.initialize()"
176016
176109
  );
176017
176110
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
@@ -176034,7 +176127,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
176034
176127
  };
176035
176128
 
176036
176129
  // src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
176037
- var logger187 = Logger.get("Pm25AirQualityServer");
176130
+ var logger188 = Logger.get("Pm25AirQualityServer");
176038
176131
  var Pm25AirQualityServerBase = AirQualityServer.with(
176039
176132
  AirQuality3.Feature.Fair,
176040
176133
  AirQuality3.Feature.Moderate,
@@ -176046,9 +176139,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
176046
176139
  if (this.state.airQuality === void 0) {
176047
176140
  this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
176048
176141
  }
176049
- logger187.debug("Pm25AirQualityServer: before super.initialize()");
176142
+ logger188.debug("Pm25AirQualityServer: before super.initialize()");
176050
176143
  await super.initialize();
176051
- logger187.debug("Pm25AirQualityServer: after super.initialize()");
176144
+ logger188.debug("Pm25AirQualityServer: after super.initialize()");
176052
176145
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
176053
176146
  this.update(homeAssistant.entity);
176054
176147
  this.reactTo(homeAssistant.onChange, this.update);
@@ -176428,7 +176521,7 @@ init_home_assistant_entity_behavior();
176428
176521
  init_dist();
176429
176522
  init_esm();
176430
176523
  init_home_assistant_entity_behavior();
176431
- var logger188 = Logger.get("VacuumIdentifyServer");
176524
+ var logger189 = Logger.get("VacuumIdentifyServer");
176432
176525
  var VacuumIdentifyServer = class extends IdentifyServer2 {
176433
176526
  triggerEffect(effect) {
176434
176527
  this.#locate("triggerEffect");
@@ -176445,11 +176538,11 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
176445
176538
  const features2 = homeAssistant.entity.state.attributes.supported_features ?? 0;
176446
176539
  const hasLocate = testBit(features2, VacuumDeviceFeature.LOCATE);
176447
176540
  if (!hasLocate) {
176448
- logger188.warn(
176541
+ logger189.warn(
176449
176542
  `${source} for ${homeAssistant.entityId} \u2014 LOCATE not in supported_features (${features2}), calling vacuum.locate anyway`
176450
176543
  );
176451
176544
  } else {
176452
- logger188.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
176545
+ logger189.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
176453
176546
  }
176454
176547
  homeAssistant.callAction({ action: "vacuum.locate" });
176455
176548
  }
@@ -176468,7 +176561,7 @@ init_rvc_run_mode();
176468
176561
 
176469
176562
  // src/matter/behaviors/rvc-run-mode-server.ts
176470
176563
  init_home_assistant_entity_behavior();
176471
- var logger189 = Logger.get("RvcRunModeServer");
176564
+ var logger190 = Logger.get("RvcRunModeServer");
176472
176565
  var ROOM_MODE_BASE = 100;
176473
176566
  function isRoomMode(mode) {
176474
176567
  return mode >= ROOM_MODE_BASE;
@@ -176549,7 +176642,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
176549
176642
  const s = getSession(this.endpoint);
176550
176643
  if (s.loggedShortCircuits.has(reason)) return;
176551
176644
  s.loggedShortCircuits.add(reason);
176552
- logger189.info(message);
176645
+ logger190.info(message);
176553
176646
  }
176554
176647
  /**
176555
176648
  * Read the currentRoomEntity sensor and update currentArea + progress
@@ -176610,7 +176703,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
176610
176703
  }
176611
176704
  }
176612
176705
  if (matchedAreaId === null) {
176613
- logger189.info(
176706
+ logger190.info(
176614
176707
  `currentRoom sensor: no match for "${roomName}" (segmentId=${segmentId}), activeAreas=[${s.activeAreas.join(", ")}], supportedAreas=[${serviceArea.state.supportedAreas.map((a) => `${a.areaId}:${a.areaInfo.locationInfo?.locationName}`).join(", ")}]`
176615
176708
  );
176616
176709
  return;
@@ -176620,14 +176713,14 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
176620
176713
  s.completedAreas.add(s.lastCurrentArea);
176621
176714
  }
176622
176715
  s.lastCurrentArea = matchedAreaId;
176623
- logger189.info(
176716
+ logger190.info(
176624
176717
  `currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
176625
176718
  );
176626
176719
  this.trySetCurrentArea(matchedAreaId);
176627
176720
  } catch (e) {
176628
176721
  const msg = e instanceof Error ? e.message : String(e);
176629
176722
  if (!msg.includes("No provider for") && !msg.includes("not supported")) {
176630
- logger189.warn(`currentRoom sensor update failed: ${msg}`);
176723
+ logger190.warn(`currentRoom sensor update failed: ${msg}`);
176631
176724
  }
176632
176725
  }
176633
176726
  }
@@ -176642,7 +176735,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
176642
176735
  const serviceArea = this.agent.get(ServiceAreaBehavior);
176643
176736
  if (serviceArea.state.currentArea !== areaId) {
176644
176737
  serviceArea.state.currentArea = areaId;
176645
- logger189.debug(`currentArea set to ${areaId}`);
176738
+ logger190.debug(`currentArea set to ${areaId}`);
176646
176739
  }
176647
176740
  this.updateProgress(serviceArea, areaId);
176648
176741
  } catch {
@@ -176990,14 +177083,14 @@ init_esm();
176990
177083
 
176991
177084
  // src/matter/behaviors/service-area-server.ts
176992
177085
  init_esm();
176993
- var logger190 = Logger.get("ServiceAreaServer");
177086
+ var logger191 = Logger.get("ServiceAreaServer");
176994
177087
  var ServiceAreaWithProgress = ServiceAreaBehavior.with(
176995
177088
  ServiceArea3.Feature.ProgressReporting
176996
177089
  );
176997
177090
  var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
176998
177091
  selectAreas(request) {
176999
177092
  const { newAreas } = request;
177000
- logger190.info(
177093
+ logger191.info(
177001
177094
  `ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
177002
177095
  );
177003
177096
  const uniqueAreas = [...new Set(newAreas)];
@@ -177006,7 +177099,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
177006
177099
  (id) => !supportedAreaIds.includes(id)
177007
177100
  );
177008
177101
  if (invalidAreas.length > 0) {
177009
- logger190.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
177102
+ logger191.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
177010
177103
  return {
177011
177104
  status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
177012
177105
  statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
@@ -177017,7 +177110,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
177017
177110
  areaId,
177018
177111
  status: ServiceArea3.OperationalStatus.Pending
177019
177112
  }));
177020
- logger190.info(
177113
+ logger191.info(
177021
177114
  `ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
177022
177115
  );
177023
177116
  return {
@@ -177038,7 +177131,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
177038
177131
  ServiceAreaServerBase2.State = State;
177039
177132
  })(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
177040
177133
  function ServiceAreaServer2(initialState) {
177041
- logger190.info(
177134
+ logger191.info(
177042
177135
  `Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
177043
177136
  );
177044
177137
  return ServiceAreaServerBase.set({
@@ -177055,7 +177148,7 @@ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
177055
177148
  var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
177056
177149
  selectAreas(request) {
177057
177150
  const { newAreas } = request;
177058
- logger190.info(
177151
+ logger191.info(
177059
177152
  `ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
177060
177153
  );
177061
177154
  const uniqueAreas = [...new Set(newAreas)];
@@ -177064,7 +177157,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
177064
177157
  (id) => !supportedAreaIds.includes(id)
177065
177158
  );
177066
177159
  if (invalidAreas.length > 0) {
177067
- logger190.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
177160
+ logger191.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
177068
177161
  return {
177069
177162
  status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
177070
177163
  statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
@@ -177075,7 +177168,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
177075
177168
  areaId,
177076
177169
  status: ServiceArea3.OperationalStatus.Pending
177077
177170
  }));
177078
- logger190.info(
177171
+ logger191.info(
177079
177172
  `ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
177080
177173
  );
177081
177174
  return {
@@ -177096,14 +177189,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
177096
177189
  ServiceAreaServerWithMapsBase2.State = State;
177097
177190
  })(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
177098
177191
  function ServiceAreaServerWithMaps(initialState) {
177099
- logger190.info(
177192
+ logger191.info(
177100
177193
  `Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
177101
177194
  );
177102
177195
  for (const map of initialState.supportedMaps) {
177103
177196
  const areaCount = initialState.supportedAreas.filter(
177104
177197
  (a) => a.mapId === map.mapId
177105
177198
  ).length;
177106
- logger190.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
177199
+ logger191.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
177107
177200
  }
177108
177201
  return ServiceAreaServerWithMapsBase.set({
177109
177202
  supportedAreas: initialState.supportedAreas,
@@ -177115,7 +177208,7 @@ function ServiceAreaServerWithMaps(initialState) {
177115
177208
  }
177116
177209
 
177117
177210
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
177118
- var logger191 = Logger.get("VacuumServiceAreaServer");
177211
+ var logger192 = Logger.get("VacuumServiceAreaServer");
177119
177212
  function toAreaId(roomId) {
177120
177213
  if (typeof roomId === "number") {
177121
177214
  return roomId;
@@ -177194,13 +177287,13 @@ function createVacuumServiceAreaServer(attributes7, roomEntities, includeUnnamed
177194
177287
  let rooms;
177195
177288
  if (roomEntities && roomEntities.length > 0) {
177196
177289
  rooms = buttonEntitiesToRooms(roomEntities, attributes7);
177197
- logger191.info(
177290
+ logger192.info(
177198
177291
  `Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
177199
177292
  );
177200
177293
  } else {
177201
177294
  rooms = parseVacuumRooms(attributes7, includeUnnamedRooms);
177202
177295
  if (rooms.length > 0) {
177203
- logger191.info(
177296
+ logger192.info(
177204
177297
  `Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
177205
177298
  );
177206
177299
  }
@@ -177254,7 +177347,7 @@ function createCustomServiceAreaServer(customAreas) {
177254
177347
  landmarkInfo: null
177255
177348
  }
177256
177349
  }));
177257
- logger191.info(
177350
+ logger192.info(
177258
177351
  `Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
177259
177352
  );
177260
177353
  return ServiceAreaServer2({
@@ -177276,7 +177369,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
177276
177369
  landmarkInfo: null
177277
177370
  }
177278
177371
  }));
177279
- logger191.info(
177372
+ logger192.info(
177280
177373
  `Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
177281
177374
  );
177282
177375
  return ServiceAreaServer2({
@@ -177287,11 +177380,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
177287
177380
  }
177288
177381
 
177289
177382
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
177290
- var logger192 = Logger.get("VacuumRvcRunModeServer");
177383
+ var logger193 = Logger.get("VacuumRvcRunModeServer");
177291
177384
  function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
177292
177385
  const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
177293
177386
  const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
177294
- logger192.info(
177387
+ logger193.info(
177295
177388
  `Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
177296
177389
  );
177297
177390
  return {
@@ -177353,12 +177446,12 @@ function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, ser
177353
177446
  const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
177354
177447
  serviceArea.state.selectedAreas = [];
177355
177448
  if (matched.length === 0) {
177356
- logger192.warn(
177449
+ logger193.warn(
177357
177450
  `Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
177358
177451
  );
177359
177452
  return { action: "vacuum.start" };
177360
177453
  }
177361
- logger192.info(
177454
+ logger193.info(
177362
177455
  `Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
177363
177456
  );
177364
177457
  for (let i = 1; i < matched.length; i++) {
@@ -177398,7 +177491,7 @@ var vacuumRvcRunModeConfig = {
177398
177491
  VacuumState.paused
177399
177492
  ];
177400
177493
  const isCleaning = cleaningStates.includes(state);
177401
- logger192.debug(
177494
+ logger193.debug(
177402
177495
  `Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
177403
177496
  );
177404
177497
  return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
@@ -177430,7 +177523,7 @@ var vacuumRvcRunModeConfig = {
177430
177523
  const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
177431
177524
  serviceArea.state.selectedAreas = [];
177432
177525
  if (haAreaIds.length > 0) {
177433
- logger192.info(
177526
+ logger193.info(
177434
177527
  `CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
177435
177528
  );
177436
177529
  return {
@@ -177451,7 +177544,7 @@ var vacuumRvcRunModeConfig = {
177451
177544
  }
177452
177545
  }
177453
177546
  if (buttonEntityIds.length > 0) {
177454
- logger192.info(
177547
+ logger193.info(
177455
177548
  `Roborock: Pressing button entities for selected rooms: ${buttonEntityIds.join(", ")}`
177456
177549
  );
177457
177550
  serviceArea.state.selectedAreas = [];
@@ -177489,7 +177582,7 @@ var vacuumRvcRunModeConfig = {
177489
177582
  }
177490
177583
  }
177491
177584
  if (roomIds.length > 0) {
177492
- logger192.info(
177585
+ logger193.info(
177493
177586
  `Starting cleaning with selected areas: ${roomIds.join(", ")}`
177494
177587
  );
177495
177588
  serviceArea.state.selectedAreas = [];
@@ -177497,7 +177590,7 @@ var vacuumRvcRunModeConfig = {
177497
177590
  if (targetMapName) {
177498
177591
  const vacName = vacuumEntityId.replace("vacuum.", "");
177499
177592
  const selectedMapEntity = `select.${vacName}_selected_map`;
177500
- logger192.info(
177593
+ logger193.info(
177501
177594
  `Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
177502
177595
  );
177503
177596
  homeAssistant.callAction({
@@ -177524,7 +177617,7 @@ var vacuumRvcRunModeConfig = {
177524
177617
  }
177525
177618
  if (isEcovacsVacuum(attributes7)) {
177526
177619
  const roomIdStr = roomIds.join(",");
177527
- logger192.info(
177620
+ logger193.info(
177528
177621
  `Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
177529
177622
  );
177530
177623
  return {
@@ -177539,14 +177632,14 @@ var vacuumRvcRunModeConfig = {
177539
177632
  }
177540
177633
  };
177541
177634
  }
177542
- logger192.warn(
177635
+ logger193.warn(
177543
177636
  `Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
177544
177637
  );
177545
177638
  }
177546
177639
  }
177547
177640
  } catch {
177548
177641
  }
177549
- logger192.info("Starting regular cleaning (no areas selected)");
177642
+ logger193.info("Starting regular cleaning (no areas selected)");
177550
177643
  return { action: "vacuum.start" };
177551
177644
  },
177552
177645
  returnToBase: () => ({ action: "vacuum.return_to_base" }),
@@ -177561,7 +177654,7 @@ var vacuumRvcRunModeConfig = {
177561
177654
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
177562
177655
  const entity = homeAssistant.entity;
177563
177656
  const attributes7 = entity.state.attributes;
177564
- logger192.info(`cleanRoom called: roomMode=${roomMode}`);
177657
+ logger193.info(`cleanRoom called: roomMode=${roomMode}`);
177565
177658
  const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
177566
177659
  if (cleanAreaRooms && cleanAreaRooms.length > 0) {
177567
177660
  const sorted = [...cleanAreaRooms].sort(
@@ -177570,7 +177663,7 @@ var vacuumRvcRunModeConfig = {
177570
177663
  const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
177571
177664
  if (areaIndex >= 0 && areaIndex < sorted.length) {
177572
177665
  const area = sorted[areaIndex];
177573
- logger192.info(
177666
+ logger193.info(
177574
177667
  `cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
177575
177668
  );
177576
177669
  return {
@@ -177587,7 +177680,7 @@ var vacuumRvcRunModeConfig = {
177587
177680
  const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
177588
177681
  if (areaIndex >= 0 && areaIndex < sorted.length) {
177589
177682
  const area = sorted[areaIndex];
177590
- logger192.info(
177683
+ logger193.info(
177591
177684
  `cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
177592
177685
  );
177593
177686
  return {
@@ -177608,7 +177701,7 @@ var vacuumRvcRunModeConfig = {
177608
177701
  }
177609
177702
  const rooms = parseVacuumRooms(attributes7);
177610
177703
  const numericIdFromMode = getRoomIdFromMode(roomMode);
177611
- logger192.info(
177704
+ logger193.info(
177612
177705
  `cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
177613
177706
  );
177614
177707
  const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
@@ -177618,7 +177711,7 @@ var vacuumRvcRunModeConfig = {
177618
177711
  if (room.mapName) {
177619
177712
  const vacuumName = vacuumEntityId.replace("vacuum.", "");
177620
177713
  const selectedMapEntity = `select.${vacuumName}_selected_map`;
177621
- logger192.info(
177714
+ logger193.info(
177622
177715
  `Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
177623
177716
  );
177624
177717
  homeAssistant.callAction({
@@ -177627,7 +177720,7 @@ var vacuumRvcRunModeConfig = {
177627
177720
  data: { option: room.mapName }
177628
177721
  });
177629
177722
  }
177630
- logger192.debug(
177723
+ logger193.debug(
177631
177724
  `Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
177632
177725
  );
177633
177726
  return {
@@ -177638,7 +177731,7 @@ var vacuumRvcRunModeConfig = {
177638
177731
  };
177639
177732
  }
177640
177733
  if (isRoborockVacuum(attributes7) || isXiaomiMiotVacuum(attributes7)) {
177641
- logger192.debug(
177734
+ logger193.debug(
177642
177735
  `Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
177643
177736
  );
177644
177737
  return {
@@ -177651,7 +177744,7 @@ var vacuumRvcRunModeConfig = {
177651
177744
  }
177652
177745
  if (isEcovacsVacuum(attributes7)) {
177653
177746
  const roomIdStr = String(commandId3);
177654
- logger192.info(
177747
+ logger193.info(
177655
177748
  `Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
177656
177749
  );
177657
177750
  return {
@@ -177666,7 +177759,7 @@ var vacuumRvcRunModeConfig = {
177666
177759
  }
177667
177760
  };
177668
177761
  }
177669
- logger192.warn(
177762
+ logger193.warn(
177670
177763
  `Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
177671
177764
  );
177672
177765
  }
@@ -177682,20 +177775,20 @@ function createVacuumRvcRunModeServer(attributes7, includeUnnamedRooms = false,
177682
177775
  includeUnnamedRooms,
177683
177776
  customAreas
177684
177777
  );
177685
- logger192.info(
177778
+ logger193.info(
177686
177779
  `Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
177687
177780
  );
177688
177781
  if (rooms.length > 0) {
177689
- logger192.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
177782
+ logger193.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
177690
177783
  }
177691
177784
  if (filteredCount > 0) {
177692
177785
  const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
177693
- logger192.info(
177786
+ logger193.info(
177694
177787
  `Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
177695
177788
  );
177696
177789
  }
177697
177790
  if (allRooms.length === 0) {
177698
- logger192.debug(
177791
+ logger193.debug(
177699
177792
  `No rooms found. Attributes: rooms=${JSON.stringify(attributes7.rooms)}, segments=${JSON.stringify(attributes7.segments)}, room_list=${attributes7.room_list}`
177700
177793
  );
177701
177794
  }
@@ -177729,7 +177822,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
177729
177822
  modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
177730
177823
  });
177731
177824
  }
177732
- logger192.info(
177825
+ logger193.info(
177733
177826
  `Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
177734
177827
  );
177735
177828
  return RvcRunModeServer2(vacuumRvcRunModeConfig, {
@@ -177790,7 +177883,7 @@ init_rvc_clean_mode();
177790
177883
 
177791
177884
  // src/matter/behaviors/rvc-clean-mode-server.ts
177792
177885
  init_home_assistant_entity_behavior();
177793
- var logger193 = Logger.get("RvcCleanModeServerBase");
177886
+ var logger194 = Logger.get("RvcCleanModeServerBase");
177794
177887
  var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
177795
177888
  // Pending mode from a recent changeToMode command.
177796
177889
  // Prevents stale HA state (from a different entity like select.xxx)
@@ -177833,14 +177926,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
177833
177926
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
177834
177927
  const { newMode } = request;
177835
177928
  if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
177836
- logger193.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
177929
+ logger194.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
177837
177930
  return {
177838
177931
  status: ModeBase3.ModeChangeStatus.UnsupportedMode,
177839
177932
  statusText: `Unsupported mode: ${newMode}`
177840
177933
  };
177841
177934
  }
177842
177935
  const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
177843
- logger193.info(
177936
+ logger194.info(
177844
177937
  `changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
177845
177938
  );
177846
177939
  this.pendingMode = newMode;
@@ -177848,7 +177941,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
177848
177941
  this.state.currentMode = newMode;
177849
177942
  const action = this.state.config.setCleanMode(newMode, this.agent);
177850
177943
  if (action) {
177851
- logger193.info(
177944
+ logger194.info(
177852
177945
  `changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
177853
177946
  );
177854
177947
  homeAssistant.callAction(action);
@@ -177881,7 +177974,7 @@ function RvcCleanModeServer2(config10, initialState) {
177881
177974
  }
177882
177975
 
177883
177976
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
177884
- var logger194 = Logger.get("VacuumRvcCleanModeServer");
177977
+ var logger195 = Logger.get("VacuumRvcCleanModeServer");
177885
177978
  var MODE_VACUUM = 0;
177886
177979
  var MODE_VACUUM_AND_MOP = 1;
177887
177980
  var MODE_MOP = 2;
@@ -178180,7 +178273,7 @@ function findMatchingCleanOption(ct, availableOptions) {
178180
178273
  if (match) return match;
178181
178274
  }
178182
178275
  }
178183
- logger194.warn(
178276
+ logger195.warn(
178184
178277
  `No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
178185
178278
  );
178186
178279
  return aliases[0];
@@ -178189,7 +178282,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
178189
178282
  const selectEntityId = getCleaningModeSelectEntity(agent);
178190
178283
  const { options } = readSelectEntity(selectEntityId, agent);
178191
178284
  const optionToUse = findMatchingCleanOption(targetCleanType, options);
178192
- logger194.info(
178285
+ logger195.info(
178193
178286
  `Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
178194
178287
  );
178195
178288
  return {
@@ -178278,7 +178371,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178278
178371
  }
178279
178372
  }
178280
178373
  if (speedMode !== void 0) {
178281
- logger194.debug(
178374
+ logger195.debug(
178282
178375
  `Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
178283
178376
  );
178284
178377
  return speedMode;
@@ -178299,7 +178392,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178299
178392
  }
178300
178393
  }
178301
178394
  if (mopMode !== void 0) {
178302
- logger194.debug(
178395
+ logger195.debug(
178303
178396
  `Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
178304
178397
  );
178305
178398
  return mopMode;
@@ -178317,14 +178410,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178317
178410
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
178318
178411
  const vacuumEntityId = homeAssistant.entityId;
178319
178412
  const mapping = homeAssistant.state.mapping;
178320
- logger194.info(
178413
+ logger195.info(
178321
178414
  `setCleanMode(${mode}) for ${vacuumEntityId} \u2014 suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})}`
178322
178415
  );
178323
178416
  if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
178324
178417
  const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
178325
178418
  const mopName = mopIntensityList[mopIndex];
178326
178419
  if (!mopName) {
178327
- logger194.warn(`Invalid mop intensity mode index: ${mopIndex}`);
178420
+ logger195.warn(`Invalid mop intensity mode index: ${mopIndex}`);
178328
178421
  return void 0;
178329
178422
  }
178330
178423
  if (hasCleanTypes) {
@@ -178337,18 +178430,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178337
178430
  mapping.mopIntensityEntity,
178338
178431
  agent
178339
178432
  );
178340
- logger194.info(
178433
+ logger195.info(
178341
178434
  `Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
178342
178435
  );
178343
178436
  let option = matchMopIntensityOption(mopName, options);
178344
178437
  if (!option && options && mopIndex < options.length) {
178345
178438
  option = options[mopIndex];
178346
- logger194.info(
178439
+ logger195.info(
178347
178440
  `Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
178348
178441
  );
178349
178442
  }
178350
178443
  if (option) {
178351
- logger194.info(
178444
+ logger195.info(
178352
178445
  `Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
178353
178446
  );
178354
178447
  return {
@@ -178357,11 +178450,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178357
178450
  target: mapping.mopIntensityEntity
178358
178451
  };
178359
178452
  }
178360
- logger194.warn(
178453
+ logger195.warn(
178361
178454
  `No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
178362
178455
  );
178363
178456
  } else {
178364
- logger194.warn(
178457
+ logger195.warn(
178365
178458
  `Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
178366
178459
  );
178367
178460
  }
@@ -178371,7 +178464,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178371
178464
  const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
178372
178465
  const fanSpeedName = fanSpeedList[fanSpeedIndex];
178373
178466
  if (!fanSpeedName) {
178374
- logger194.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
178467
+ logger195.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
178375
178468
  return void 0;
178376
178469
  }
178377
178470
  if (mapping?.suctionLevelEntity) {
@@ -178384,7 +178477,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178384
178477
  mapping.suctionLevelEntity,
178385
178478
  agent
178386
178479
  );
178387
- logger194.info(
178480
+ logger195.info(
178388
178481
  `Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
178389
178482
  );
178390
178483
  let option = matchFanSpeedOption(
@@ -178394,12 +178487,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178394
178487
  );
178395
178488
  if (!option && options && fanSpeedIndex < options.length) {
178396
178489
  option = options[fanSpeedIndex];
178397
- logger194.info(
178490
+ logger195.info(
178398
178491
  `Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
178399
178492
  );
178400
178493
  }
178401
178494
  if (option) {
178402
- logger194.info(
178495
+ logger195.info(
178403
178496
  `Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
178404
178497
  );
178405
178498
  return {
@@ -178408,7 +178501,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178408
178501
  target: mapping.suctionLevelEntity
178409
178502
  };
178410
178503
  }
178411
- logger194.warn(
178504
+ logger195.warn(
178412
178505
  `No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
178413
178506
  );
178414
178507
  return void 0;
@@ -178418,7 +178511,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178418
178511
  buildCleaningModeAction(0 /* Sweeping */, agent)
178419
178512
  );
178420
178513
  }
178421
- logger194.info(
178514
+ logger195.info(
178422
178515
  `Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
178423
178516
  );
178424
178517
  return {
@@ -178428,7 +178521,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178428
178521
  };
178429
178522
  }
178430
178523
  if (!hasCleanTypes) {
178431
- logger194.debug(
178524
+ logger195.debug(
178432
178525
  `Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
178433
178526
  );
178434
178527
  return void 0;
@@ -178440,7 +178533,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178440
178533
  agent
178441
178534
  );
178442
178535
  const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
178443
- logger194.info(
178536
+ logger195.info(
178444
178537
  `Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
178445
178538
  );
178446
178539
  return {
@@ -178458,10 +178551,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
178458
178551
  cleaningModeOptions,
178459
178552
  customFanSpeedTags
178460
178553
  );
178461
- logger194.info(
178554
+ logger195.info(
178462
178555
  `Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
178463
178556
  );
178464
- logger194.info(
178557
+ logger195.info(
178465
178558
  `Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
178466
178559
  );
178467
178560
  const initialState = {
@@ -178539,7 +178632,7 @@ init_rvc_operational_state();
178539
178632
  init_home_assistant_entity_behavior();
178540
178633
  var OperationalState4 = RvcOperationalState3.OperationalState;
178541
178634
  var ErrorState = RvcOperationalState3.ErrorState;
178542
- var logger195 = Logger.get("RvcOperationalStateServer");
178635
+ var logger196 = Logger.get("RvcOperationalStateServer");
178543
178636
  var activeStates = /* @__PURE__ */ new Set([
178544
178637
  OperationalState4.Running,
178545
178638
  OperationalState4.SeekingCharger
@@ -178588,7 +178681,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
178588
178681
  { force: true }
178589
178682
  );
178590
178683
  if (activeStates.has(previousState) && !activeStates.has(newState)) {
178591
- logger195.info(
178684
+ logger196.info(
178592
178685
  `Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
178593
178686
  );
178594
178687
  try {
@@ -178601,7 +178694,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
178601
178694
  this.context
178602
178695
  );
178603
178696
  } catch (e) {
178604
- logger195.debug("Failed to emit operationCompletion event:", e);
178697
+ logger196.debug("Failed to emit operationCompletion event:", e);
178605
178698
  }
178606
178699
  }
178607
178700
  }
@@ -178636,7 +178729,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
178636
178729
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
178637
178730
  homeAssistant.callAction(goHomeAction(void 0, this.agent));
178638
178731
  } else {
178639
- logger195.warn("GoHome command received but no goHome action configured");
178732
+ logger196.warn("GoHome command received but no goHome action configured");
178640
178733
  }
178641
178734
  return {
178642
178735
  commandResponseState: {
@@ -178656,7 +178749,7 @@ function RvcOperationalStateServer2(config10) {
178656
178749
  }
178657
178750
 
178658
178751
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
178659
- var logger196 = Logger.get("VacuumRvcOperationalStateServer");
178752
+ var logger197 = Logger.get("VacuumRvcOperationalStateServer");
178660
178753
  function isCharging(entity) {
178661
178754
  const attrs = entity.attributes;
178662
178755
  if (attrs.battery_icon?.includes("charging")) return true;
@@ -178698,16 +178791,16 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
178698
178791
  operationalState = RvcOperationalState3.OperationalState.Error;
178699
178792
  } else {
178700
178793
  if (state.toLowerCase().includes("clean")) {
178701
- logger196.info(
178794
+ logger197.info(
178702
178795
  `Unknown vacuum state "${state}" contains 'clean', treating as Running`
178703
178796
  );
178704
178797
  operationalState = RvcOperationalState3.OperationalState.Running;
178705
178798
  } else {
178706
- logger196.info(`Unknown vacuum state "${state}", treating as Stopped`);
178799
+ logger197.info(`Unknown vacuum state "${state}", treating as Stopped`);
178707
178800
  operationalState = RvcOperationalState3.OperationalState.Stopped;
178708
178801
  }
178709
178802
  }
178710
- logger196.debug(
178803
+ logger197.debug(
178711
178804
  `Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
178712
178805
  );
178713
178806
  return operationalState;
@@ -178728,7 +178821,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
178728
178821
  });
178729
178822
 
178730
178823
  // src/matter/endpoints/legacy/vacuum/index.ts
178731
- var logger197 = Logger.get("VacuumDevice");
178824
+ var logger198 = Logger.get("VacuumDevice");
178732
178825
  var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
178733
178826
  BasicInformationServer2,
178734
178827
  VacuumIdentifyServer,
@@ -178742,7 +178835,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
178742
178835
  const entityId = homeAssistantEntity.entity.entity_id;
178743
178836
  const attributes7 = homeAssistantEntity.entity.state.attributes;
178744
178837
  const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
178745
- logger197.info(
178838
+ logger198.info(
178746
178839
  `Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
178747
178840
  );
178748
178841
  const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
@@ -178754,32 +178847,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
178754
178847
  )
178755
178848
  ).set({ homeAssistantEntity });
178756
178849
  if (includeOnOff) {
178757
- logger197.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
178850
+ logger198.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
178758
178851
  device = device.with(VacuumOnOffServer);
178759
178852
  }
178760
178853
  device = device.with(VacuumPowerSourceServer);
178761
178854
  const roomEntities = homeAssistantEntity.mapping?.roomEntities;
178762
178855
  const rooms = parseVacuumRooms(attributes7);
178763
- logger197.info(
178856
+ logger198.info(
178764
178857
  `${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
178765
178858
  );
178766
178859
  if (cleanAreaRooms && cleanAreaRooms.length > 0) {
178767
- logger197.info(
178860
+ logger198.info(
178768
178861
  `${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
178769
178862
  );
178770
178863
  device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
178771
178864
  } else if (customAreas && customAreas.length > 0) {
178772
- logger197.info(
178865
+ logger198.info(
178773
178866
  `${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
178774
178867
  );
178775
178868
  device = device.with(createCustomServiceAreaServer(customAreas));
178776
178869
  } else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
178777
- logger197.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
178870
+ logger198.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
178778
178871
  device = device.with(
178779
178872
  createVacuumServiceAreaServer(attributes7, roomEntities)
178780
178873
  );
178781
178874
  } else {
178782
- logger197.info(`${entityId}: Adding ServiceArea (default single-area)`);
178875
+ logger198.info(`${entityId}: Adding ServiceArea (default single-area)`);
178783
178876
  device = device.with(createDefaultServiceAreaServer());
178784
178877
  }
178785
178878
  const fanSpeedList = resolveFanSpeedList(
@@ -178790,7 +178883,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
178790
178883
  homeAssistantEntity.mapping?.mopIntensityEntity
178791
178884
  );
178792
178885
  if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
178793
- logger197.info(
178886
+ logger198.info(
178794
178887
  `${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
178795
178888
  );
178796
178889
  device = device.with(
@@ -178803,7 +178896,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
178803
178896
  )
178804
178897
  );
178805
178898
  } else {
178806
- logger197.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
178899
+ logger198.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
178807
178900
  device = device.with(createDefaultRvcCleanModeServer());
178808
178901
  }
178809
178902
  return device;
@@ -178969,7 +179062,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
178969
179062
  );
178970
179063
 
178971
179064
  // src/matter/endpoints/legacy/water-heater/index.ts
178972
- var logger198 = Logger.get("WaterHeaterDevice");
179065
+ var logger199 = Logger.get("WaterHeaterDevice");
178973
179066
  var WaterHeaterDeviceType = ThermostatDevice.with(
178974
179067
  BasicInformationServer2,
178975
179068
  IdentifyServer2,
@@ -178985,7 +179078,7 @@ function toMatterTemp2(value) {
178985
179078
  }
178986
179079
  function WaterHeaterDevice(homeAssistantEntity) {
178987
179080
  const attributes7 = homeAssistantEntity.entity.state.attributes;
178988
- logger198.debug(
179081
+ logger199.debug(
178989
179082
  `Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes7.min_temp}, max_temp=${attributes7.max_temp}`
178990
179083
  );
178991
179084
  const minLimit = toMatterTemp2(attributes7.min_temp) ?? 0;
@@ -179146,7 +179239,7 @@ var matterDeviceTypeFactories = {
179146
179239
  };
179147
179240
 
179148
179241
  // src/matter/endpoints/composed/user-composed-endpoint.ts
179149
- var logger199 = Logger.get("UserComposedEndpoint");
179242
+ var logger200 = Logger.get("UserComposedEndpoint");
179150
179243
  function stripBasicInformation(type) {
179151
179244
  const behaviors = { ...type.behaviors };
179152
179245
  delete behaviors.bridgedDeviceBasicInformation;
@@ -179202,7 +179295,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179202
179295
  { vacuumOnOff: registry2.isVacuumOnOffEnabled() }
179203
179296
  );
179204
179297
  if (!primaryType) {
179205
- logger199.warn(
179298
+ logger200.warn(
179206
179299
  `Cannot create endpoint type for primary entity ${primaryEntityId}`
179207
179300
  );
179208
179301
  return void 0;
@@ -179217,7 +179310,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179217
179310
  if (!sub.entityId) continue;
179218
179311
  const subPayload = buildEntityPayload3(registry2, sub.entityId);
179219
179312
  if (!subPayload) {
179220
- logger199.warn(
179313
+ logger200.warn(
179221
179314
  `Cannot find entity state for composed sub-entity ${sub.entityId}`
179222
179315
  );
179223
179316
  continue;
@@ -179228,7 +179321,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179228
179321
  };
179229
179322
  const subType = createLegacyEndpointType(subPayload, subMapping);
179230
179323
  if (!subType) {
179231
- logger199.warn(
179324
+ logger200.warn(
179232
179325
  `Cannot create endpoint type for composed sub-entity ${sub.entityId}`
179233
179326
  );
179234
179327
  continue;
@@ -179241,7 +179334,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179241
179334
  mappedIds.push(sub.entityId);
179242
179335
  }
179243
179336
  if (parts.length < 2) {
179244
- logger199.warn(
179337
+ logger200.warn(
179245
179338
  `User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
179246
179339
  );
179247
179340
  return void 0;
@@ -179264,7 +179357,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179264
179357
  const labels = parts.map(
179265
179358
  (_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
179266
179359
  ).join("+");
179267
- logger199.info(
179360
+ logger200.info(
179268
179361
  `Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
179269
179362
  );
179270
179363
  return endpoint;
@@ -179333,7 +179426,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179333
179426
  };
179334
179427
 
179335
179428
  // src/matter/endpoints/legacy/legacy-endpoint.ts
179336
- var logger200 = Logger.get("LegacyEndpoint");
179429
+ var logger201 = Logger.get("LegacyEndpoint");
179337
179430
  var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179338
179431
  static async create(registry2, entityId, mapping, pluginDomainMappings) {
179339
179432
  const deviceRegistry = registry2.deviceOf(entityId);
@@ -179343,25 +179436,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179343
179436
  return;
179344
179437
  }
179345
179438
  if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
179346
- logger200.debug(
179439
+ logger201.debug(
179347
179440
  `Skipping ${entityId} - already auto-assigned as battery to another device`
179348
179441
  );
179349
179442
  return;
179350
179443
  }
179351
179444
  if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
179352
- logger200.debug(
179445
+ logger201.debug(
179353
179446
  `Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
179354
179447
  );
179355
179448
  return;
179356
179449
  }
179357
179450
  if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
179358
- logger200.debug(
179451
+ logger201.debug(
179359
179452
  `Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
179360
179453
  );
179361
179454
  return;
179362
179455
  }
179363
179456
  if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
179364
- logger200.debug(
179457
+ logger201.debug(
179365
179458
  `Skipping ${entityId} - already consumed by a composed device`
179366
179459
  );
179367
179460
  return;
@@ -179381,7 +179474,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179381
179474
  humidityEntity: humidityEntityId
179382
179475
  };
179383
179476
  registry2.markHumidityEntityUsed(humidityEntityId);
179384
- logger200.debug(
179477
+ logger201.debug(
179385
179478
  `Auto-assigned humidity ${humidityEntityId} to ${entityId}`
179386
179479
  );
179387
179480
  }
@@ -179400,7 +179493,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179400
179493
  pressureEntity: pressureEntityId
179401
179494
  };
179402
179495
  registry2.markPressureEntityUsed(pressureEntityId);
179403
- logger200.debug(
179496
+ logger201.debug(
179404
179497
  `Auto-assigned pressure ${pressureEntityId} to ${entityId}`
179405
179498
  );
179406
179499
  }
@@ -179418,7 +179511,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179418
179511
  batteryEntity: batteryEntityId
179419
179512
  };
179420
179513
  registry2.markBatteryEntityUsed(batteryEntityId);
179421
- logger200.debug(
179514
+ logger201.debug(
179422
179515
  `Auto-assigned battery ${batteryEntityId} to ${entityId}`
179423
179516
  );
179424
179517
  }
@@ -179436,7 +179529,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179436
179529
  powerEntity: powerEntityId
179437
179530
  };
179438
179531
  registry2.markPowerEntityUsed(powerEntityId);
179439
- logger200.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
179532
+ logger201.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
179440
179533
  }
179441
179534
  }
179442
179535
  }
@@ -179453,7 +179546,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179453
179546
  energyEntity: energyEntityId
179454
179547
  };
179455
179548
  registry2.markEnergyEntityUsed(energyEntityId);
179456
- logger200.debug(
179549
+ logger201.debug(
179457
179550
  `Auto-assigned energy ${energyEntityId} to ${entityId}`
179458
179551
  );
179459
179552
  }
@@ -179469,7 +179562,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179469
179562
  entityId: effectiveMapping?.entityId ?? entityId,
179470
179563
  cleaningModeEntity: vacuumEntities.cleaningModeEntity
179471
179564
  };
179472
- logger200.info(
179565
+ logger201.info(
179473
179566
  `Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
179474
179567
  );
179475
179568
  }
@@ -179479,7 +179572,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179479
179572
  entityId: effectiveMapping?.entityId ?? entityId,
179480
179573
  suctionLevelEntity: vacuumEntities.suctionLevelEntity
179481
179574
  };
179482
- logger200.info(
179575
+ logger201.info(
179483
179576
  `Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
179484
179577
  );
179485
179578
  }
@@ -179489,7 +179582,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179489
179582
  entityId: effectiveMapping?.entityId ?? entityId,
179490
179583
  mopIntensityEntity: vacuumEntities.mopIntensityEntity
179491
179584
  };
179492
- logger200.info(
179585
+ logger201.info(
179493
179586
  `Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
179494
179587
  );
179495
179588
  }
@@ -179499,7 +179592,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179499
179592
  entityId: effectiveMapping?.entityId ?? entityId,
179500
179593
  currentRoomEntity: vacuumEntities.currentRoomEntity
179501
179594
  };
179502
- logger200.info(
179595
+ logger201.info(
179503
179596
  `Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
179504
179597
  );
179505
179598
  }
@@ -179514,7 +179607,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179514
179607
  entityId: effectiveMapping?.entityId ?? entityId,
179515
179608
  cleanAreaRooms
179516
179609
  };
179517
- logger200.info(
179610
+ logger201.info(
179518
179611
  `Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
179519
179612
  );
179520
179613
  }
@@ -179535,7 +179628,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179535
179628
  rooms: roomsObj
179536
179629
  }
179537
179630
  };
179538
- logger200.debug(
179631
+ logger201.debug(
179539
179632
  `Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
179540
179633
  );
179541
179634
  } else {
@@ -179552,7 +179645,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179552
179645
  rooms: roomsObj
179553
179646
  }
179554
179647
  };
179555
- logger200.debug(
179648
+ logger201.debug(
179556
179649
  `Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
179557
179650
  );
179558
179651
  }
@@ -179573,7 +179666,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179573
179666
  if (composed) {
179574
179667
  return composed;
179575
179668
  }
179576
- logger200.warn(
179669
+ logger201.warn(
179577
179670
  `User composed device creation failed for ${entityId}, falling back to standalone`
179578
179671
  );
179579
179672
  }
@@ -179674,11 +179767,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179674
179767
  }
179675
179768
  if (mappedChanged) {
179676
179769
  this.pendingMappedChange = true;
179677
- logger200.debug(
179770
+ logger201.debug(
179678
179771
  `Mapped entity change detected for ${this.entityId}, forcing update`
179679
179772
  );
179680
179773
  }
179681
- logger200.debug(
179774
+ logger201.debug(
179682
179775
  `State update received for ${this.entityId}: state=${state.state}`
179683
179776
  );
179684
179777
  this.lastState = state;
@@ -179731,7 +179824,7 @@ import {
179731
179824
  getCollection
179732
179825
  } from "home-assistant-js-websocket";
179733
179826
  import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
179734
- var logger201 = Logger.get("SubscribeEntities");
179827
+ var logger202 = Logger.get("SubscribeEntities");
179735
179828
  function processEvent(store, updates) {
179736
179829
  const state = { ...store.state };
179737
179830
  if (updates.a) {
@@ -179757,7 +179850,7 @@ function processEvent(store, updates) {
179757
179850
  for (const entityId in updates.c) {
179758
179851
  let entityState = state[entityId];
179759
179852
  if (!entityState) {
179760
- logger201.warn("Received state update for unknown entity", entityId);
179853
+ logger202.warn("Received state update for unknown entity", entityId);
179761
179854
  continue;
179762
179855
  }
179763
179856
  entityState = { ...entityState };
@@ -179828,7 +179921,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
179828
179921
  // src/services/bridges/entity-isolation-service.ts
179829
179922
  init_esm();
179830
179923
  init_diagnostic_event_bus();
179831
- var logger202 = Logger.get("EntityIsolation");
179924
+ var logger203 = Logger.get("EntityIsolation");
179832
179925
  var EntityIsolationServiceImpl = class {
179833
179926
  isolatedEntities = /* @__PURE__ */ new Map();
179834
179927
  isolationCallbacks = /* @__PURE__ */ new Map();
@@ -179893,13 +179986,13 @@ var EntityIsolationServiceImpl = class {
179893
179986
  }
179894
179987
  const parsed = this.parseEndpointPath(msg);
179895
179988
  if (!parsed) {
179896
- logger202.warn("Could not parse entity from error:", msg);
179989
+ logger203.warn("Could not parse entity from error:", msg);
179897
179990
  return false;
179898
179991
  }
179899
179992
  const { bridgeId, entityName } = parsed;
179900
179993
  const callback = this.isolationCallbacks.get(bridgeId);
179901
179994
  if (!callback) {
179902
- logger202.warn(
179995
+ logger203.warn(
179903
179996
  `No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
179904
179997
  );
179905
179998
  return false;
@@ -179910,7 +180003,7 @@ var EntityIsolationServiceImpl = class {
179910
180003
  }
179911
180004
  const reason = `${classification}. Entity isolated to protect bridge stability.`;
179912
180005
  this.isolatedEntities.set(key, { entityId: entityName, reason });
179913
- logger202.warn(
180006
+ logger203.warn(
179914
180007
  `Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
179915
180008
  );
179916
180009
  diagnosticEventBus.emit("entity_error", `Entity isolated: ${entityName}`, {
@@ -179922,7 +180015,7 @@ var EntityIsolationServiceImpl = class {
179922
180015
  await callback(entityName);
179923
180016
  return true;
179924
180017
  } catch (e) {
179925
- logger202.error(`Failed to isolate entity ${entityName}:`, e);
180018
+ logger203.error(`Failed to isolate entity ${entityName}:`, e);
179926
180019
  return false;
179927
180020
  }
179928
180021
  }
@@ -179988,6 +180081,7 @@ var BridgeEndpointManager = class extends Service {
179988
180081
  mappingFingerprints = /* @__PURE__ */ new Map();
179989
180082
  pluginEndpoints = /* @__PURE__ */ new Map();
179990
180083
  pluginStateUpdating = /* @__PURE__ */ new Set();
180084
+ pluginListeners = /* @__PURE__ */ new Map();
179991
180085
  get failedEntities() {
179992
180086
  const isolated = EntityIsolationService.getIsolatedEntities(this.bridgeId);
179993
180087
  return [...this._failedEntities, ...isolated];
@@ -180027,6 +180121,16 @@ var BridgeEndpointManager = class extends Service {
180027
180121
  }
180028
180122
  };
180029
180123
  this.pluginManager.onDeviceUnregistered = async (pluginName, deviceId) => {
180124
+ const listeners = this.pluginListeners.get(deviceId);
180125
+ if (listeners) {
180126
+ for (const { observable, listener } of listeners) {
180127
+ try {
180128
+ observable.off(listener);
180129
+ } catch {
180130
+ }
180131
+ }
180132
+ this.pluginListeners.delete(deviceId);
180133
+ }
180030
180134
  const endpoint = this.pluginEndpoints.get(deviceId);
180031
180135
  if (endpoint) {
180032
180136
  try {
@@ -180064,6 +180168,7 @@ var BridgeEndpointManager = class extends Service {
180064
180168
  wirePluginEndpointEvents(device, endpoint) {
180065
180169
  if (!device.onAttributeWrite) return;
180066
180170
  const allEvents = endpoint.events;
180171
+ const listeners = [];
180067
180172
  for (const behaviorId of Object.keys(endpoint.type.behaviors)) {
180068
180173
  if (behaviorId === "pluginDevice") continue;
180069
180174
  const behaviorEvents = allEvents[behaviorId];
@@ -180073,7 +180178,7 @@ var BridgeEndpointManager = class extends Service {
180073
180178
  const observable = behaviorEvents[eventName];
180074
180179
  if (!observable || typeof observable.on !== "function") continue;
180075
180180
  const attrName = eventName.slice(0, -"$Changed".length);
180076
- observable.on((newValue) => {
180181
+ const listener = (newValue) => {
180077
180182
  if (this.pluginStateUpdating.has(device.id)) return;
180078
180183
  device.onAttributeWrite?.(behaviorId, attrName, newValue).catch((e) => {
180079
180184
  this.log.debug(
@@ -180081,9 +180186,14 @@ var BridgeEndpointManager = class extends Service {
180081
180186
  e
180082
180187
  );
180083
180188
  });
180084
- });
180189
+ };
180190
+ observable.on(listener);
180191
+ listeners.push({ observable, listener });
180085
180192
  }
180086
180193
  }
180194
+ if (listeners.length > 0) {
180195
+ this.pluginListeners.set(device.id, listeners);
180196
+ }
180087
180197
  }
180088
180198
  async startPlugins() {
180089
180199
  if (!this.pluginManager) return;
@@ -180376,7 +180486,24 @@ var BridgeEndpointManager = class extends Service {
180376
180486
  this.startObserving();
180377
180487
  }
180378
180488
  }
180489
+ updateInFlight;
180490
+ pendingStates;
180379
180491
  async updateStates(states) {
180492
+ if (this.updateInFlight) {
180493
+ this.pendingStates = states;
180494
+ return this.updateInFlight;
180495
+ }
180496
+ this.updateInFlight = this.runUpdateStates(states).finally(() => {
180497
+ this.updateInFlight = void 0;
180498
+ const queued = this.pendingStates;
180499
+ this.pendingStates = void 0;
180500
+ if (queued) {
180501
+ void this.updateStates(queued);
180502
+ }
180503
+ });
180504
+ return this.updateInFlight;
180505
+ }
180506
+ async runUpdateStates(states) {
180380
180507
  const startMs = performance.now();
180381
180508
  this.registry.mergeExternalStates(states);
180382
180509
  const endpoints = this.root.parts.map((p) => p);
@@ -181141,11 +181268,11 @@ init_diagnostic_event_bus();
181141
181268
  var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
181142
181269
  var DEAD_SESSION_TIMEOUT_MS2 = 6e4;
181143
181270
  var ServerModeBridge = class {
181144
- constructor(logger205, dataProvider, endpointManager, server) {
181271
+ constructor(logger206, dataProvider, endpointManager, server) {
181145
181272
  this.dataProvider = dataProvider;
181146
181273
  this.endpointManager = endpointManager;
181147
181274
  this.server = server;
181148
- this.log = logger205.get(`ServerModeBridge / ${dataProvider.id}`);
181275
+ this.log = logger206.get(`ServerModeBridge / ${dataProvider.id}`);
181149
181276
  }
181150
181277
  dataProvider;
181151
181278
  endpointManager;
@@ -181667,7 +181794,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
181667
181794
  }
181668
181795
 
181669
181796
  // src/matter/endpoints/server-mode-vacuum-endpoint.ts
181670
- var logger203 = Logger.get("ServerModeVacuumEndpoint");
181797
+ var logger204 = Logger.get("ServerModeVacuumEndpoint");
181671
181798
  var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
181672
181799
  static async create(registry2, entityId, mapping) {
181673
181800
  const deviceRegistry = registry2.deviceOf(entityId);
@@ -181677,7 +181804,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181677
181804
  return void 0;
181678
181805
  }
181679
181806
  let effectiveMapping = mapping;
181680
- logger203.info(
181807
+ logger204.info(
181681
181808
  `${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
181682
181809
  );
181683
181810
  if (entity.device_id) {
@@ -181692,15 +181819,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181692
181819
  batteryEntity: batteryEntityId
181693
181820
  };
181694
181821
  registry2.markBatteryEntityUsed(batteryEntityId);
181695
- logger203.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
181822
+ logger204.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
181696
181823
  } else {
181697
181824
  const attrs = state.attributes;
181698
181825
  if (attrs.battery_level != null || attrs.battery != null) {
181699
- logger203.info(
181826
+ logger204.info(
181700
181827
  `${entityId}: No battery entity found, using battery attribute from vacuum state`
181701
181828
  );
181702
181829
  } else {
181703
- logger203.warn(
181830
+ logger204.warn(
181704
181831
  `${entityId}: No battery entity found for device ${entity.device_id}`
181705
181832
  );
181706
181833
  }
@@ -181715,7 +181842,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181715
181842
  entityId: effectiveMapping?.entityId ?? entityId,
181716
181843
  cleaningModeEntity: vacuumEntities.cleaningModeEntity
181717
181844
  };
181718
- logger203.info(
181845
+ logger204.info(
181719
181846
  `${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
181720
181847
  );
181721
181848
  }
@@ -181725,7 +181852,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181725
181852
  entityId: effectiveMapping?.entityId ?? entityId,
181726
181853
  suctionLevelEntity: vacuumEntities.suctionLevelEntity
181727
181854
  };
181728
- logger203.info(
181855
+ logger204.info(
181729
181856
  `${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
181730
181857
  );
181731
181858
  }
@@ -181735,7 +181862,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181735
181862
  entityId: effectiveMapping?.entityId ?? entityId,
181736
181863
  mopIntensityEntity: vacuumEntities.mopIntensityEntity
181737
181864
  };
181738
- logger203.info(
181865
+ logger204.info(
181739
181866
  `${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
181740
181867
  );
181741
181868
  }
@@ -181745,7 +181872,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181745
181872
  entityId: effectiveMapping?.entityId ?? entityId,
181746
181873
  currentRoomEntity: vacuumEntities.currentRoomEntity
181747
181874
  };
181748
- logger203.info(
181875
+ logger204.info(
181749
181876
  `${entityId}: Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity}`
181750
181877
  );
181751
181878
  }
@@ -181760,7 +181887,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181760
181887
  entityId: effectiveMapping?.entityId ?? entityId,
181761
181888
  cleanAreaRooms
181762
181889
  };
181763
- logger203.info(
181890
+ logger204.info(
181764
181891
  `${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
181765
181892
  );
181766
181893
  }
@@ -181781,7 +181908,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181781
181908
  rooms: roomsObj
181782
181909
  }
181783
181910
  };
181784
- logger203.info(
181911
+ logger204.info(
181785
181912
  `${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
181786
181913
  );
181787
181914
  } else {
@@ -181798,14 +181925,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181798
181925
  rooms: roomsObj
181799
181926
  }
181800
181927
  };
181801
- logger203.info(
181928
+ logger204.info(
181802
181929
  `${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
181803
181930
  );
181804
181931
  }
181805
181932
  }
181806
181933
  }
181807
181934
  } else {
181808
- logger203.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
181935
+ logger204.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
181809
181936
  }
181810
181937
  const payload = {
181811
181938
  entity_id: entityId,
@@ -181902,7 +182029,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181902
182029
  try {
181903
182030
  this.keepaliveCounter++;
181904
182031
  const counter = this.keepaliveCounter;
181905
- logger203.info(`Keepalive #${counter} for ${this.entityId}`);
182032
+ logger204.info(`Keepalive #${counter} for ${this.entityId}`);
181906
182033
  const opState = this.stateOf(RvcOperationalStateServer);
181907
182034
  await this.setStateOf(RvcOperationalStateServer, {
181908
182035
  operationalState: opState.operationalState,
@@ -181917,7 +182044,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181917
182044
  currentMode: runMode.currentMode
181918
182045
  });
181919
182046
  }
181920
- logger203.info(`Keepalive #${counter} committed for ${this.entityId}`);
182047
+ logger204.info(`Keepalive #${counter} committed for ${this.entityId}`);
181921
182048
  } catch (e) {
181922
182049
  if (e instanceof TransactionDestroyedError || e instanceof DestroyedDependencyError) {
181923
182050
  return;
@@ -181926,7 +182053,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181926
182053
  if (msg.includes("Endpoint storage inaccessible")) {
181927
182054
  return;
181928
182055
  }
181929
- logger203.warn(`Keepalive failed for ${this.entityId}: ${msg}`);
182056
+ logger204.warn(`Keepalive failed for ${this.entityId}: ${msg}`);
181930
182057
  }
181931
182058
  }
181932
182059
  async updateStates(states) {
@@ -181937,11 +182064,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181937
182064
  }
181938
182065
  if (mappedChanged) {
181939
182066
  this.pendingMappedChange = true;
181940
- logger203.debug(
182067
+ logger204.debug(
181941
182068
  `Mapped entity change detected for ${this.entityId}, forcing update`
181942
182069
  );
181943
182070
  }
181944
- logger203.debug(
182071
+ logger204.debug(
181945
182072
  `State update received for ${this.entityId}: state=${state.state}`
181946
182073
  );
181947
182074
  this.lastState = state;
@@ -182377,10 +182504,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
182377
182504
  // src/core/ioc/app-environment.ts
182378
182505
  var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182379
182506
  constructor(rootEnv, options) {
182380
- const logger205 = rootEnv.get(LoggerService);
182507
+ const logger206 = rootEnv.get(LoggerService);
182381
182508
  super({
182382
182509
  id: "App",
182383
- log: logger205.get("AppContainer"),
182510
+ log: logger206.get("AppContainer"),
182384
182511
  parent: rootEnv
182385
182512
  });
182386
182513
  this.options = options;
@@ -182394,8 +182521,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182394
182521
  }
182395
182522
  construction;
182396
182523
  async init() {
182397
- const logger205 = this.get(LoggerService);
182398
- this.set(LoggerService, logger205);
182524
+ const logger206 = this.get(LoggerService);
182525
+ this.set(LoggerService, logger206);
182399
182526
  this.set(AppStorage, new AppStorage(await this.load(StorageService)));
182400
182527
  this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
182401
182528
  this.set(
@@ -182412,7 +182539,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182412
182539
  );
182413
182540
  this.set(
182414
182541
  HomeAssistantClient,
182415
- new HomeAssistantClient(logger205, this.options.homeAssistant)
182542
+ new HomeAssistantClient(logger206, this.options.homeAssistant)
182416
182543
  );
182417
182544
  this.set(
182418
182545
  HomeAssistantConfig,
@@ -182420,7 +182547,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182420
182547
  );
182421
182548
  this.set(
182422
182549
  HomeAssistantActions,
182423
- new HomeAssistantActions(logger205, await this.load(HomeAssistantClient))
182550
+ new HomeAssistantActions(logger206, await this.load(HomeAssistantClient))
182424
182551
  );
182425
182552
  this.set(
182426
182553
  HomeAssistantRegistry,
@@ -182456,7 +182583,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182456
182583
  this.set(
182457
182584
  WebApi,
182458
182585
  new WebApi(
182459
- logger205,
182586
+ logger206,
182460
182587
  await this.load(BridgeService),
182461
182588
  await this.load(HomeAssistantClient),
182462
182589
  await this.load(HomeAssistantRegistry),
@@ -182482,7 +182609,7 @@ init_nodejs();
182482
182609
  init_level_control();
182483
182610
 
182484
182611
  // src/matter/patches/patch-level-control-tlv.ts
182485
- var logger204 = Logger.get("PatchLevelControlTlv");
182612
+ var logger205 = Logger.get("PatchLevelControlTlv");
182486
182613
  function patchLevelControlTlv() {
182487
182614
  let patched = 0;
182488
182615
  const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
@@ -182496,11 +182623,11 @@ function patchLevelControlTlv() {
182496
182623
  patched++;
182497
182624
  }
182498
182625
  if (patched > 0) {
182499
- logger204.info(
182626
+ logger205.info(
182500
182627
  `Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
182501
182628
  );
182502
182629
  } else {
182503
- logger204.warn(
182630
+ logger205.warn(
182504
182631
  "Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
182505
182632
  );
182506
182633
  }
@@ -182602,8 +182729,8 @@ async function startHandler(startOptions, webUiDist) {
182602
182729
  }
182603
182730
  try {
182604
182731
  await Promise.race([
182605
- bridgeService.dispose(),
182606
- new Promise((resolve6) => setTimeout(resolve6, 1e4))
182732
+ appEnvironment.dispose(),
182733
+ new Promise((resolve6) => setTimeout(resolve6, 15e3))
182607
182734
  ]);
182608
182735
  } catch (e) {
182609
182736
  console.warn("Error during graceful shutdown:", e);