@riddix/hamh 2.1.0-alpha.613 → 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) {
@@ -147183,8 +147183,7 @@ var init_debounce_context = __esm({
147183
147183
  });
147184
147184
  }
147185
147185
  unregisterAll() {
147186
- const keys3 = Object.keys(this.fn);
147187
- for (const key of keys3) {
147186
+ for (const key of [...this.debouncers.keys()]) {
147188
147187
  this.unregister(key);
147189
147188
  }
147190
147189
  }
@@ -147282,6 +147281,33 @@ var init_retry = __esm({
147282
147281
  }
147283
147282
  });
147284
147283
 
147284
+ // src/utils/send-ha-message.ts
147285
+ function sendHaMessage(connection, message, timeoutMs = HA_MESSAGE_TIMEOUT_MS) {
147286
+ let timer;
147287
+ const timeout = new Promise((_, reject) => {
147288
+ timer = setTimeout(() => {
147289
+ reject(
147290
+ new Error(
147291
+ `HA message '${message.type}' timed out after ${timeoutMs}ms`
147292
+ )
147293
+ );
147294
+ }, timeoutMs);
147295
+ });
147296
+ return Promise.race([
147297
+ connection.sendMessagePromise(message),
147298
+ timeout
147299
+ ]).finally(() => {
147300
+ if (timer) clearTimeout(timer);
147301
+ });
147302
+ }
147303
+ var HA_MESSAGE_TIMEOUT_MS;
147304
+ var init_send_ha_message = __esm({
147305
+ "src/utils/send-ha-message.ts"() {
147306
+ "use strict";
147307
+ HA_MESSAGE_TIMEOUT_MS = 3e4;
147308
+ }
147309
+ });
147310
+
147285
147311
  // src/services/home-assistant/home-assistant-actions.ts
147286
147312
  import { callService } from "home-assistant-js-websocket";
147287
147313
  var defaultConfig, HomeAssistantActions;
@@ -147291,6 +147317,7 @@ var init_home_assistant_actions = __esm({
147291
147317
  init_service();
147292
147318
  init_debounce_context();
147293
147319
  init_retry();
147320
+ init_send_ha_message();
147294
147321
  init_diagnostic_event_bus();
147295
147322
  defaultConfig = {
147296
147323
  retryAttempts: 3,
@@ -147300,10 +147327,10 @@ var init_home_assistant_actions = __esm({
147300
147327
  circuitBreakerResetMs: 3e4
147301
147328
  };
147302
147329
  HomeAssistantActions = class extends Service {
147303
- constructor(logger205, client, config10) {
147330
+ constructor(logger206, client, config10) {
147304
147331
  super("HomeAssistantActions");
147305
147332
  this.client = client;
147306
- this.log = logger205.get(this);
147333
+ this.log = logger206.get(this);
147307
147334
  this.config = { ...defaultConfig, ...config10 };
147308
147335
  this.circuitBreaker = new CircuitBreaker(
147309
147336
  this.config.circuitBreakerThreshold,
@@ -147433,8 +147460,7 @@ var init_home_assistant_actions = __esm({
147433
147460
  };
147434
147461
  }
147435
147462
  fireEvent(eventType, eventData) {
147436
- const connection = this.client.connection;
147437
- connection.sendMessagePromise({
147463
+ sendHaMessage(this.client.connection, {
147438
147464
  type: "fire_event",
147439
147465
  event_type: eventType,
147440
147466
  event_data: eventData
@@ -147644,10 +147670,10 @@ var DiagnosticService = class {
147644
147670
  };
147645
147671
 
147646
147672
  // src/api/access-log.ts
147647
- function accessLogger(logger205) {
147673
+ function accessLogger(logger206) {
147648
147674
  return (req, res, next) => {
147649
147675
  res.on("finish", () => {
147650
- logger205.debug(
147676
+ logger206.debug(
147651
147677
  `${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
147652
147678
  );
147653
147679
  });
@@ -147879,7 +147905,7 @@ WARNING: ${includeIdentity ? "This backup contains sensitive Matter identity dat
147879
147905
  router.post("/restart", async (_, res) => {
147880
147906
  res.json({ message: "Restarting application..." });
147881
147907
  setTimeout(() => {
147882
- process.exit(0);
147908
+ process.kill(process.pid, "SIGTERM");
147883
147909
  }, 500);
147884
147910
  });
147885
147911
  router.get("/snapshots", async (_, res) => {
@@ -148127,7 +148153,9 @@ async function restoreBridgeIcon(zipDirectory, bridgeId, storageLocation) {
148127
148153
 
148128
148154
  // src/api/bridge-export-api.ts
148129
148155
  init_dist();
148156
+ init_esm();
148130
148157
  import express2 from "express";
148158
+ var logger142 = Logger.get("BridgeExportApi");
148131
148159
  function migrateFilter(legacyFilter) {
148132
148160
  if (!legacyFilter) {
148133
148161
  return { include: [], exclude: [] };
@@ -148276,8 +148304,10 @@ function bridgeExportApi(bridgeStorage) {
148276
148304
  }
148277
148305
  const result = { imported, skipped, errors };
148278
148306
  res.json(result);
148279
- } catch {
148280
- 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}` });
148281
148311
  }
148282
148312
  });
148283
148313
  return router;
@@ -150277,7 +150307,7 @@ init_esm();
150277
150307
  import { execFile } from "node:child_process";
150278
150308
  import * as fs4 from "node:fs";
150279
150309
  import * as path4 from "node:path";
150280
- var logger142 = Logger.get("PluginInstaller");
150310
+ var logger143 = Logger.get("PluginInstaller");
150281
150311
  var VALID_PACKAGE_RE = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*(@[^@\s]+)?$/;
150282
150312
  var PluginInstaller = class {
150283
150313
  pluginDir;
@@ -150317,7 +150347,7 @@ var PluginInstaller = class {
150317
150347
  error: `Invalid package name: "${packageName}"`
150318
150348
  };
150319
150349
  }
150320
- logger142.info(`Installing plugin: ${packageName}`);
150350
+ logger143.info(`Installing plugin: ${packageName}`);
150321
150351
  return new Promise((resolve6) => {
150322
150352
  execFile(
150323
150353
  "npm",
@@ -150329,7 +150359,7 @@ var PluginInstaller = class {
150329
150359
  },
150330
150360
  (error, _stdout, stderr) => {
150331
150361
  if (error) {
150332
- logger142.error(
150362
+ logger143.error(
150333
150363
  `Failed to install ${packageName}:`,
150334
150364
  stderr || error.message
150335
150365
  );
@@ -150341,7 +150371,7 @@ var PluginInstaller = class {
150341
150371
  return;
150342
150372
  }
150343
150373
  const version = this.getInstalledVersion(packageName);
150344
- logger142.info(
150374
+ logger143.info(
150345
150375
  `Successfully installed ${packageName}@${version || "unknown"}`
150346
150376
  );
150347
150377
  resolve6({
@@ -150361,7 +150391,7 @@ var PluginInstaller = class {
150361
150391
  error: `Invalid package name: "${packageName}"`
150362
150392
  };
150363
150393
  }
150364
- logger142.info(`Uninstalling plugin: ${packageName}`);
150394
+ logger143.info(`Uninstalling plugin: ${packageName}`);
150365
150395
  return new Promise((resolve6) => {
150366
150396
  execFile(
150367
150397
  "npm",
@@ -150372,7 +150402,7 @@ var PluginInstaller = class {
150372
150402
  },
150373
150403
  (error, _stdout, stderr) => {
150374
150404
  if (error) {
150375
- logger142.error(
150405
+ logger143.error(
150376
150406
  `Failed to uninstall ${packageName}:`,
150377
150407
  stderr || error.message
150378
150408
  );
@@ -150383,7 +150413,7 @@ var PluginInstaller = class {
150383
150413
  });
150384
150414
  return;
150385
150415
  }
150386
- logger142.info(`Successfully uninstalled ${packageName}`);
150416
+ logger143.info(`Successfully uninstalled ${packageName}`);
150387
150417
  resolve6({ success: true, packageName });
150388
150418
  }
150389
150419
  );
@@ -150433,7 +150463,7 @@ var PluginInstaller = class {
150433
150463
  return result;
150434
150464
  } catch (e) {
150435
150465
  const msg = e instanceof Error ? e.message : String(e);
150436
- logger142.error("Failed to install from tgz:", msg);
150466
+ logger143.error("Failed to install from tgz:", msg);
150437
150467
  return { success: false, packageName: "unknown", error: msg };
150438
150468
  } finally {
150439
150469
  try {
@@ -150520,7 +150550,7 @@ var PluginInstaller = class {
150520
150550
  }
150521
150551
  fs4.mkdirSync(path4.dirname(targetLink), { recursive: true });
150522
150552
  fs4.symlinkSync(resolvedPath, targetLink, "dir");
150523
- logger142.info(
150553
+ logger143.info(
150524
150554
  `Linked local plugin: ${packageName}@${pkg.version || "unknown"} \u2192 ${resolvedPath}`
150525
150555
  );
150526
150556
  return {
@@ -150551,7 +150581,7 @@ var PluginInstaller = class {
150551
150581
  init_esm();
150552
150582
  import * as fs5 from "node:fs";
150553
150583
  import * as path5 from "node:path";
150554
- var logger143 = Logger.get("PluginRegistry");
150584
+ var logger144 = Logger.get("PluginRegistry");
150555
150585
  var PluginRegistry = class {
150556
150586
  plugins = [];
150557
150587
  filePath;
@@ -150566,7 +150596,7 @@ var PluginRegistry = class {
150566
150596
  this.plugins = JSON.parse(raw);
150567
150597
  }
150568
150598
  } catch (e) {
150569
- logger143.warn("Failed to load plugin registry:", e);
150599
+ logger144.warn("Failed to load plugin registry:", e);
150570
150600
  this.plugins = [];
150571
150601
  }
150572
150602
  }
@@ -150582,7 +150612,7 @@ var PluginRegistry = class {
150582
150612
  "utf-8"
150583
150613
  );
150584
150614
  } catch (e) {
150585
- logger143.error("Failed to save plugin registry:", e);
150615
+ logger144.error("Failed to save plugin registry:", e);
150586
150616
  }
150587
150617
  }
150588
150618
  getAll() {
@@ -150996,7 +151026,7 @@ import { promisify } from "node:util";
150996
151026
  import v8 from "node:v8";
150997
151027
  import express15 from "express";
150998
151028
  var execAsync = promisify(exec);
150999
- var logger144 = Logger.get("SystemApi");
151029
+ var logger145 = Logger.get("SystemApi");
151000
151030
  function detectEnvironment2() {
151001
151031
  if (process.env.SUPERVISOR_TOKEN || process.env.HASSIO_TOKEN) {
151002
151032
  return "Home Assistant Add-on";
@@ -151041,7 +151071,7 @@ function systemApi(version) {
151041
151071
  environment: detectEnvironment2()
151042
151072
  });
151043
151073
  } catch (error) {
151044
- logger144.error("Failed to check for updates:", error);
151074
+ logger145.error("Failed to check for updates:", error);
151045
151075
  res.status(500).json({ error: "Failed to check for updates" });
151046
151076
  }
151047
151077
  });
@@ -151090,7 +151120,7 @@ function systemApi(version) {
151090
151120
  };
151091
151121
  res.json(systemInfo);
151092
151122
  } catch (error) {
151093
- logger144.error("Failed to get system info:", error);
151123
+ logger145.error("Failed to get system info:", error);
151094
151124
  res.status(500).json({ error: "Failed to get system info" });
151095
151125
  }
151096
151126
  });
@@ -151133,7 +151163,7 @@ async function getStorageInfo() {
151133
151163
  return await getUnixStorageInfo(pathToCheck);
151134
151164
  }
151135
151165
  } catch (error) {
151136
- logger144.error("Failed to get storage info:", error);
151166
+ logger145.error("Failed to get storage info:", error);
151137
151167
  return { total: 0, used: 0, free: 0 };
151138
151168
  }
151139
151169
  }
@@ -151363,7 +151393,7 @@ var WebSocketApi = class {
151363
151393
 
151364
151394
  // src/api/web-api.ts
151365
151395
  var WebApi = class extends Service {
151366
- constructor(logger205, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
151396
+ constructor(logger206, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
151367
151397
  super("WebApi");
151368
151398
  this.bridgeService = bridgeService;
151369
151399
  this.haClient = haClient;
@@ -151374,8 +151404,8 @@ var WebApi = class extends Service {
151374
151404
  this.settingsStorage = settingsStorage;
151375
151405
  this.backupService = backupService;
151376
151406
  this.props = props;
151377
- this.logger = logger205;
151378
- this.log = logger205.get(this);
151407
+ this.logger = logger206;
151408
+ this.log = logger206.get(this);
151379
151409
  this.accessLogger = accessLogger(this.log.createChild("Access Log"));
151380
151410
  this.startTime = Date.now();
151381
151411
  this.wsApi = new WebSocketApi(
@@ -151527,13 +151557,18 @@ var WebApi = class extends Service {
151527
151557
  if (this.server) {
151528
151558
  return;
151529
151559
  }
151530
- this.server = await new Promise((resolve6) => {
151560
+ this.server = await new Promise((resolve6, reject) => {
151531
151561
  const server = this.app.listen(this.props.port, () => {
151532
151562
  this.log.info(
151533
151563
  `HTTP server (API ${this.props.webUiDist ? "& Web App" : "only"}) listening on port ${this.props.port}`
151534
151564
  );
151535
151565
  resolve6(server);
151536
151566
  });
151567
+ server.on("error", (err) => {
151568
+ reject(
151569
+ err.code === "EADDRINUSE" ? new Error(`Port ${this.props.port} already in use`) : err
151570
+ );
151571
+ });
151537
151572
  });
151538
151573
  this.wsApi.attach(this.server, this.props.basePath);
151539
151574
  }
@@ -151856,12 +151891,12 @@ var CustomStorage = class extends StorageBackendDisk {
151856
151891
 
151857
151892
  // src/core/app/storage.ts
151858
151893
  function storage(environment, options) {
151859
- const logger205 = environment.get(LoggerService).get("CustomStorage");
151894
+ const logger206 = environment.get(LoggerService).get("CustomStorage");
151860
151895
  const location2 = resolveStorageLocation(options.location);
151861
151896
  fs8.mkdirSync(location2, { recursive: true });
151862
151897
  const storageService = environment.get(StorageService);
151863
151898
  storageService.location = location2;
151864
- storageService.factory = (ns) => new CustomStorage(logger205, path8.resolve(location2, ns));
151899
+ storageService.factory = (ns) => new CustomStorage(logger206, path8.resolve(location2, ns));
151865
151900
  }
151866
151901
  function resolveStorageLocation(storageLocation) {
151867
151902
  const homedir = os5.homedir();
@@ -152435,11 +152470,28 @@ import {
152435
152470
  ERR_INVALID_AUTH,
152436
152471
  getConfig
152437
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
+ }
152438
152490
  var HomeAssistantClient = class extends Service {
152439
- constructor(logger205, options) {
152491
+ constructor(logger206, options) {
152440
152492
  super("HomeAssistantClient");
152441
152493
  this.options = options;
152442
- this.log = logger205.get(this);
152494
+ this.log = logger206.get(this);
152443
152495
  }
152444
152496
  options;
152445
152497
  static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
@@ -152467,16 +152519,6 @@ var HomeAssistantClient = class extends Service {
152467
152519
  await this.waitForHomeAssistantToBeUpAndRunning(connection);
152468
152520
  return connection;
152469
152521
  } catch (reason) {
152470
- if (reason === ERR_CANNOT_CONNECT) {
152471
- this.log.warnCtx("Unable to connect to Home Assistant, retrying...", {
152472
- url: props.url,
152473
- attempt,
152474
- maxAttempts: maxConnectAttempts,
152475
- retryDelayMs: 5e3
152476
- });
152477
- await new Promise((resolve6) => setTimeout(resolve6, 5e3));
152478
- continue;
152479
- }
152480
152522
  if (reason === ERR_INVALID_AUTH) {
152481
152523
  this.log.errorCtx(
152482
152524
  "Authentication failed",
@@ -152487,6 +152529,17 @@ var HomeAssistantClient = class extends Service {
152487
152529
  "Authentication failed while connecting to home assistant"
152488
152530
  );
152489
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
+ }
152490
152543
  throw new Error(`Unable to connect to home assistant: ${reason}`);
152491
152544
  }
152492
152545
  }
@@ -152594,29 +152647,30 @@ function logStartupMemoryGuard(log) {
152594
152647
  init_retry();
152595
152648
 
152596
152649
  // src/services/home-assistant/api/get-registry.ts
152650
+ init_send_ha_message();
152597
152651
  async function getRegistry(connection) {
152598
- return await connection.sendMessagePromise({
152652
+ return sendHaMessage(connection, {
152599
152653
  type: "config/entity_registry/list"
152600
152654
  });
152601
152655
  }
152602
152656
  async function getDeviceRegistry(connection) {
152603
- return connection.sendMessagePromise({
152657
+ return sendHaMessage(connection, {
152604
152658
  type: "config/device_registry/list"
152605
152659
  });
152606
152660
  }
152607
152661
  async function getLabelRegistry(connection) {
152608
- return connection.sendMessagePromise({
152662
+ return sendHaMessage(connection, {
152609
152663
  type: "config/label_registry/list"
152610
152664
  });
152611
152665
  }
152612
152666
  async function getAreaRegistry(connection) {
152613
- return connection.sendMessagePromise({
152667
+ return sendHaMessage(connection, {
152614
152668
  type: "config/area_registry/list"
152615
152669
  });
152616
152670
  }
152617
152671
 
152618
152672
  // src/services/home-assistant/home-assistant-registry.ts
152619
- var logger145 = Logger.get("HomeAssistantRegistry");
152673
+ var logger146 = Logger.get("HomeAssistantRegistry");
152620
152674
  var HomeAssistantRegistry = class extends Service {
152621
152675
  constructor(client, options) {
152622
152676
  super("HomeAssistantRegistry");
@@ -152655,14 +152709,22 @@ var HomeAssistantRegistry = class extends Service {
152655
152709
  }
152656
152710
  enableAutoRefresh(onRefresh) {
152657
152711
  this.disableAutoRefresh();
152712
+ let refreshing = false;
152658
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;
152659
152719
  try {
152660
152720
  const changed = await this.reload();
152661
152721
  if (changed) {
152662
152722
  await onRefresh();
152663
152723
  }
152664
152724
  } catch (e) {
152665
- 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;
152666
152728
  }
152667
152729
  }, this.options.refreshInterval * 1e3);
152668
152730
  }
@@ -152678,7 +152740,7 @@ var HomeAssistantRegistry = class extends Service {
152678
152740
  baseDelayMs: 2e3,
152679
152741
  maxDelayMs: 3e4,
152680
152742
  onRetry: (attempt, error, delayMs) => {
152681
- logger145.warn(
152743
+ logger146.warn(
152682
152744
  `Registry fetch failed (attempt ${attempt}), retrying in ${delayMs}ms:`,
152683
152745
  error
152684
152746
  );
@@ -152688,7 +152750,7 @@ var HomeAssistantRegistry = class extends Service {
152688
152750
  async fetchRegistries() {
152689
152751
  const connection = this.client.connection;
152690
152752
  if (!connection.connected) {
152691
- logger145.debug("Connection not ready, waiting for reconnect...");
152753
+ logger146.debug("Connection not ready, waiting for reconnect...");
152692
152754
  await new Promise((resolve6) => {
152693
152755
  const timeout = setTimeout(() => {
152694
152756
  connection.removeEventListener("ready", onReady);
@@ -152744,7 +152806,7 @@ var HomeAssistantRegistry = class extends Service {
152744
152806
  const fingerprint = hash2.digest("hex");
152745
152807
  this._states = keyBy(statesList, "entity_id");
152746
152808
  if (fingerprint === this.lastRegistryFingerprint) {
152747
- logger145.debug("Registry unchanged, skipping full refresh");
152809
+ logger146.debug("Registry unchanged, skipping full refresh");
152748
152810
  return false;
152749
152811
  }
152750
152812
  this.lastRegistryFingerprint = fingerprint;
@@ -152765,10 +152827,10 @@ var HomeAssistantRegistry = class extends Service {
152765
152827
  const missingDevices = fromPairs(missingDeviceIds.map((d) => [d, { id: d }]));
152766
152828
  this._devices = { ...missingDevices, ...realDevices };
152767
152829
  this._entities = allEntities;
152768
- logger145.debug(
152830
+ logger146.debug(
152769
152831
  `Loaded HA registry: ${keys(allEntities).length} entities, ${keys(realDevices).length} devices, ${keys(this._states).length} states`
152770
152832
  );
152771
- logMemoryUsage(logger145, "after HA registry load");
152833
+ logMemoryUsage(logger146, "after HA registry load");
152772
152834
  this._labels = labels;
152773
152835
  this._areas = new Map(areas.map((a) => [a.area_id, a.name]));
152774
152836
  return true;
@@ -153486,7 +153548,7 @@ var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError40('Cannot
153486
153548
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
153487
153549
  var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
153488
153550
  var __privateMethod2 = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
153489
- var logger146 = Logger.get("ScenesManagementServer");
153551
+ var logger147 = Logger.get("ScenesManagementServer");
153490
153552
  var UNDEFINED_SCENE_ID = 255;
153491
153553
  var GLOBAL_SCENE_ID = 0;
153492
153554
  var UNDEFINED_GROUP = GroupId(0);
@@ -153645,11 +153707,11 @@ var ScenesManagementServer = class extends ScenesManagementBase {
153645
153707
  return { status: Status2.ResourceExhausted, groupId: groupId22, sceneId };
153646
153708
  }
153647
153709
  this.state.sceneTable.push(sceneData);
153648
- logger146.debug(`Added scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
153710
+ logger147.debug(`Added scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
153649
153711
  this.#updateFabricSceneInfoCountsForFabric(fabricIndex);
153650
153712
  } else {
153651
153713
  this.state.sceneTable[existingSceneIndex] = sceneData;
153652
- logger146.debug(`Updated scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
153714
+ logger147.debug(`Updated scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
153653
153715
  }
153654
153716
  return { status: Status2.Success, groupId: groupId22, sceneId };
153655
153717
  }
@@ -153952,20 +154014,20 @@ var ScenesManagementServer = class extends ScenesManagementBase {
153952
154014
  }
153953
154015
  }
153954
154016
  if (fieldCount !== 2) {
153955
- logger146.warn(
154017
+ logger147.warn(
153956
154018
  `AttributeValuePair has invalid number (${fieldCount}) of fields (${serialize(attributeValuePair)})`
153957
154019
  );
153958
154020
  return void 0;
153959
154021
  }
153960
154022
  const value = attributeValuePair[mappedType];
153961
154023
  if (value === void 0) {
153962
- logger146.warn(
154024
+ logger147.warn(
153963
154025
  `AttributeValuePair missing value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
153964
154026
  );
153965
154027
  return void 0;
153966
154028
  }
153967
154029
  if (typeof value !== "number" && typeof value !== "bigint") {
153968
- logger146.warn(
154030
+ logger147.warn(
153969
154031
  `AttributeValuePair has invalid non-numeric value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
153970
154032
  // Should never happen
153971
154033
  );
@@ -154063,7 +154125,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154063
154125
  } else if (schema6.schema.baseTypeMin < 0 && schema6.schema.min > schema6.schema.baseTypeMin) {
154064
154126
  return { attributeId, [mappedType]: schema6.schema.baseTypeMin };
154065
154127
  } else {
154066
- logger146.warn(
154128
+ logger147.warn(
154067
154129
  `Cannot determine out-of-bounds value for attribute schema, returning min value of datatype schema`
154068
154130
  );
154069
154131
  }
@@ -154084,7 +154146,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154084
154146
  }
154085
154147
  }
154086
154148
  });
154087
- 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)}`);
154088
154150
  return sceneValues;
154089
154151
  }
154090
154152
  /**
@@ -154123,7 +154185,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154123
154185
  }
154124
154186
  const attrType = attribute2.primitiveBase?.name;
154125
154187
  if (attrType === void 0 || DataTypeToSceneAttributeDataMap[attrType] === void 0) {
154126
- logger146.warn(
154188
+ logger147.warn(
154127
154189
  `Scene Attribute ${attribute2.name} on Cluster ${clusterName} has unsupported datatype ${attrType} for scene management on Endpoint ${this.endpoint.id}`
154128
154190
  );
154129
154191
  continue;
@@ -154138,7 +154200,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154138
154200
  });
154139
154201
  }
154140
154202
  if (sceneClusterDetails) {
154141
- logger146.info(
154203
+ logger147.info(
154142
154204
  `Registered ${sceneClusterDetails.attributes.size} scene attributes for Cluster ${clusterName} on Endpoint ${this.endpoint.id}`
154143
154205
  );
154144
154206
  this.internal.endpointSceneableBehaviors.add(sceneClusterDetails);
@@ -154146,7 +154208,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154146
154208
  }
154147
154209
  /** Apply scene attribute values in the various clusters on the endpoint. */
154148
154210
  #applySceneAttributeValues(sceneValues, transitionTime = null) {
154149
- 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)}`);
154150
154212
  const agent = this.endpoint.agentFor(this.context);
154151
154213
  const promises = [];
154152
154214
  for (const [clusterName, clusterAttributes] of Object.entries(sceneValues)) {
@@ -154157,7 +154219,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154157
154219
  promises.push(result);
154158
154220
  }
154159
154221
  } else {
154160
- logger146.warn(
154222
+ logger147.warn(
154161
154223
  `No scenes implementation found for cluster ${clusterName} on Endpoint ${this.endpoint.id} during scene recall. Values are ignored`
154162
154224
  );
154163
154225
  }
@@ -154165,7 +154227,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
154165
154227
  if (promises.length) {
154166
154228
  return Promise.all(promises).then(
154167
154229
  () => void 0,
154168
- (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)
154169
154231
  );
154170
154232
  }
154171
154233
  }
@@ -154356,7 +154418,7 @@ var GroupsBehaviorConstructor = ClusterBehavior.withInterface().for(Groups3.Clus
154356
154418
  var GroupsBehavior = GroupsBehaviorConstructor;
154357
154419
 
154358
154420
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/groups/GroupsServer.js
154359
- var logger147 = Logger.get("GroupsServer");
154421
+ var logger148 = Logger.get("GroupsServer");
154360
154422
  Groups3.Cluster.commands = {
154361
154423
  ...Groups3.Cluster.commands,
154362
154424
  addGroup: Command(
@@ -154420,7 +154482,7 @@ var GroupsServer = class extends GroupsBase {
154420
154482
  (fabric2, gkm) => gkm.addEndpointForGroup(fabric2, groupId3, endpointNumber, groupName)
154421
154483
  );
154422
154484
  } catch (error) {
154423
- logger147.error(error);
154485
+ logger148.error(error);
154424
154486
  StatusResponseError.accept(error);
154425
154487
  return { status: error.code, groupId: groupId3 };
154426
154488
  }
@@ -157460,7 +157522,7 @@ function miredsToXy(mireds) {
157460
157522
  }
157461
157523
 
157462
157524
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/color-control/ColorControlServer.js
157463
- var logger148 = Logger.get("ColorControlServer");
157525
+ var logger149 = Logger.get("ColorControlServer");
157464
157526
  var ColorControlBase = ColorControlBehavior.with(
157465
157527
  ColorControl3.Feature.HueSaturation,
157466
157528
  ColorControl3.Feature.EnhancedHue,
@@ -158641,7 +158703,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158641
158703
  switch (oldMode) {
158642
158704
  case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
158643
158705
  if (this.state.currentHue === void 0 || this.state.currentSaturation === void 0) {
158644
- 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");
158645
158707
  break;
158646
158708
  }
158647
158709
  switch (newMode) {
@@ -158653,7 +158715,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158653
158715
  case ColorControl3.ColorMode.ColorTemperatureMireds:
158654
158716
  const mireds = hsvToMireds(this.hue, this.saturation);
158655
158717
  if (mireds === void 0) {
158656
- logger148.warn(
158718
+ logger149.warn(
158657
158719
  `Could not convert hue/saturation (${this.hue}/${this.saturation}) to color temperature`
158658
158720
  );
158659
158721
  } else {
@@ -158664,7 +158726,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158664
158726
  break;
158665
158727
  case ColorControl3.ColorMode.CurrentXAndCurrentY:
158666
158728
  if (this.state.currentX === void 0 || this.state.currentY === void 0) {
158667
- 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");
158668
158730
  break;
158669
158731
  }
158670
158732
  switch (newMode) {
@@ -158676,7 +158738,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158676
158738
  case ColorControl3.ColorMode.ColorTemperatureMireds:
158677
158739
  const mireds = xyToMireds(this.x, this.y);
158678
158740
  if (mireds === void 0) {
158679
- 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`);
158680
158742
  } else {
158681
158743
  this.mireds = mireds;
158682
158744
  }
@@ -158685,14 +158747,14 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158685
158747
  break;
158686
158748
  case ColorControl3.ColorMode.ColorTemperatureMireds:
158687
158749
  if (this.state.colorTemperatureMireds === void 0) {
158688
- 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");
158689
158751
  break;
158690
158752
  }
158691
158753
  switch (newMode) {
158692
158754
  case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
158693
158755
  const hsvResult = miredsToHsv(this.mireds);
158694
158756
  if (hsvResult === void 0) {
158695
- 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`);
158696
158758
  } else {
158697
158759
  const [hue, saturation] = hsvResult;
158698
158760
  this.hue = hue;
@@ -158702,7 +158764,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158702
158764
  case ColorControl3.ColorMode.CurrentXAndCurrentY:
158703
158765
  const xyResult = miredsToXy(this.mireds);
158704
158766
  if (xyResult === void 0) {
158705
- logger148.warn("Could not convert color temperature to xy");
158767
+ logger149.warn("Could not convert color temperature to xy");
158706
158768
  } else {
158707
158769
  const [x, y] = xyResult;
158708
158770
  this.x = x;
@@ -158751,7 +158813,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158751
158813
  );
158752
158814
  newColorTemp = tempPhysMax - tempDelta;
158753
158815
  }
158754
- 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}`);
158755
158817
  return this.moveToColorTemperatureLogic(newColorTemp, 0);
158756
158818
  }
158757
158819
  #assertRate(mode, rate) {
@@ -158955,7 +159017,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158955
159017
  targetEnhancedColorMode = values4.enhancedColorMode;
158956
159018
  }
158957
159019
  if (!this.#supportsColorMode(targetEnhancedColorMode)) {
158958
- logger148.info(
159020
+ logger149.info(
158959
159021
  `Can not apply scene with unsupported color mode: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
158960
159022
  );
158961
159023
  }
@@ -158997,7 +159059,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
158997
159059
  }
158998
159060
  break;
158999
159061
  default:
159000
- logger148.info(
159062
+ logger149.info(
159001
159063
  `No supported color mode found to apply scene: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
159002
159064
  );
159003
159065
  break;
@@ -159090,7 +159152,7 @@ init_esm();
159090
159152
  init_ServerNode();
159091
159153
  init_esm4();
159092
159154
  init_esm3();
159093
- var logger149 = Logger.get("LevelControlServer");
159155
+ var logger150 = Logger.get("LevelControlServer");
159094
159156
  var LevelControlBase = LevelControlBehavior.with(LevelControl3.Feature.OnOff, LevelControl3.Feature.Lighting);
159095
159157
  var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlBase {
159096
159158
  /** Returns the minimum level, including feature specific fallback value handling. */
@@ -159177,17 +159239,17 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
159177
159239
  */
159178
159240
  initializeLighting() {
159179
159241
  if (this.state.currentLevel === 0) {
159180
- logger149.warn(
159242
+ logger150.warn(
159181
159243
  `The currentLevel value of ${this.state.currentLevel} is invalid according to Matter specification. The value must not be 0.`
159182
159244
  );
159183
159245
  }
159184
159246
  if (this.minLevel !== 1) {
159185
- logger149.warn(
159247
+ logger150.warn(
159186
159248
  `The minLevel value of ${this.minLevel} is invalid according to Matter specification. The value should be 1.`
159187
159249
  );
159188
159250
  }
159189
159251
  if (this.maxLevel !== 254) {
159190
- logger149.warn(
159252
+ logger150.warn(
159191
159253
  `The maxLevel value of ${this.maxLevel} is invalid according to Matter specification. The value should be 254.`
159192
159254
  );
159193
159255
  }
@@ -159498,7 +159560,7 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
159498
159560
  if (!onOff || this.state.onLevel === null) {
159499
159561
  return;
159500
159562
  }
159501
- 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}`);
159502
159564
  this.state.currentLevel = this.state.onLevel;
159503
159565
  }
159504
159566
  #calculateEffectiveOptions(optionsMask, optionsOverride) {
@@ -160535,7 +160597,7 @@ var SwitchBehavior = SwitchBehaviorConstructor;
160535
160597
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/switch/SwitchServer.js
160536
160598
  var DEFAULT_MULTIPRESS_DELAY = Millis(300);
160537
160599
  var DEFAULT_LONG_PRESS_DELAY = Seconds(2);
160538
- var logger150 = Logger.get("SwitchServer");
160600
+ var logger151 = Logger.get("SwitchServer");
160539
160601
  var SwitchServerBase = SwitchBehavior.for(Switch3.Complete).with(
160540
160602
  Switch3.Feature.LatchingSwitch,
160541
160603
  Switch3.Feature.MomentarySwitch,
@@ -160589,7 +160651,7 @@ var SwitchBaseServer = class extends SwitchServerBase {
160589
160651
  this.internal.currentIsLongPress = false;
160590
160652
  this.internal.multiPressTimer?.stop();
160591
160653
  this.internal.longPressTimer?.stop();
160592
- logger150.info("State of Switch got reset");
160654
+ logger151.info("State of Switch got reset");
160593
160655
  }
160594
160656
  // TODO remove when Validator logic can assess that with 1.3 introduction
160595
160657
  #assertPositionInRange(position) {
@@ -161116,7 +161178,7 @@ var ModeSelectBehaviorConstructor = ClusterBehavior.withInterface().for(ModeSele
161116
161178
  var ModeSelectBehavior = ModeSelectBehaviorConstructor;
161117
161179
 
161118
161180
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/mode-select/ModeSelectServer.js
161119
- var logger151 = Logger.get("ModeSelectServer");
161181
+ var logger152 = Logger.get("ModeSelectServer");
161120
161182
  var ModeSelectBase = ModeSelectBehavior.with(ModeSelect3.Feature.OnOff);
161121
161183
  var ModeSelectBaseServer = class extends ModeSelectBase {
161122
161184
  initialize() {
@@ -161133,7 +161195,7 @@ var ModeSelectBaseServer = class extends ModeSelectBase {
161133
161195
  }
161134
161196
  this.reactTo(onOffServer.events.onOff$Changed, this.#handleOnOffDependency);
161135
161197
  } else {
161136
- logger151.warn("OnOffServer not found on endpoint, but OnMode is set.");
161198
+ logger152.warn("OnOffServer not found on endpoint, but OnMode is set.");
161137
161199
  }
161138
161200
  }
161139
161201
  if (!currentModeOverridden && this.state.startUpMode !== void 0 && this.state.startUpMode !== null && this.#getBootReason() !== GeneralDiagnostics3.BootReason.SoftwareUpdateCompleted) {
@@ -161354,7 +161416,7 @@ init_IdentifyServer();
161354
161416
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/occupancy-sensing/OccupancySensingServer.js
161355
161417
  init_occupancy_sensing();
161356
161418
  init_esm();
161357
- var logger152 = Logger.get("OccupancySensingServer");
161419
+ var logger153 = Logger.get("OccupancySensingServer");
161358
161420
  var holdTimeDependencies = [
161359
161421
  "holdTimeLimits",
161360
161422
  "pirOccupiedToUnoccupiedDelay",
@@ -161370,7 +161432,7 @@ var holdTimeDependencies = [
161370
161432
  var OccupancySensingServer = class extends OccupancySensingBehavior {
161371
161433
  initialize() {
161372
161434
  if (!Object.values(this.features).some((feature) => feature)) {
161373
- logger152.error(
161435
+ logger153.error(
161374
161436
  `OccupancySensingServer: Since revision 5 of the cluster features need to be set based on the detector type. Currently no features are enabled.`
161375
161437
  );
161376
161438
  } else if (!Object.values(this.state.occupancySensorTypeBitmap).some((feature) => feature) || this.state.occupancySensorType === void 0) {
@@ -161397,7 +161459,7 @@ var OccupancySensingServer = class extends OccupancySensingBehavior {
161397
161459
  } else if (this.state.occupancySensorTypeBitmap.physicalContact) {
161398
161460
  this.state.occupancySensorType = OccupancySensing3.OccupancySensorType.PhysicalContact;
161399
161461
  }
161400
- logger152.debug(
161462
+ logger153.debug(
161401
161463
  "Sync occupancySensorType to",
161402
161464
  OccupancySensing3.OccupancySensorType[this.state.occupancySensorType],
161403
161465
  "and occupancySensorTypeBitmap to",
@@ -162362,7 +162424,7 @@ init_esm3();
162362
162424
 
162363
162425
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteState.js
162364
162426
  init_esm();
162365
- var logger153 = Logger.get("AtomicWriteState");
162427
+ var logger154 = Logger.get("AtomicWriteState");
162366
162428
  var MAXIMUM_ALLOWED_TIMEOUT = Seconds(9);
162367
162429
  var AtomicWriteState = class {
162368
162430
  peerAddress;
@@ -162397,19 +162459,19 @@ var AtomicWriteState = class {
162397
162459
  });
162398
162460
  }
162399
162461
  start() {
162400
- logger153.debug(
162462
+ logger154.debug(
162401
162463
  `Starting atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
162402
162464
  );
162403
162465
  this.#timer.start();
162404
162466
  }
162405
162467
  #timeoutTriggered() {
162406
- logger153.debug(
162468
+ logger154.debug(
162407
162469
  `Atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id} timed out`
162408
162470
  );
162409
162471
  this.close();
162410
162472
  }
162411
162473
  close() {
162412
- logger153.debug(
162474
+ logger154.debug(
162413
162475
  `Closing atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
162414
162476
  );
162415
162477
  if (this.#timer.isRunning) {
@@ -162420,7 +162482,7 @@ var AtomicWriteState = class {
162420
162482
  };
162421
162483
 
162422
162484
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteHandler.js
162423
- var logger154 = Logger.get("AtomicWriteHandler");
162485
+ var logger155 = Logger.get("AtomicWriteHandler");
162424
162486
  var AtomicWriteHandler = class _AtomicWriteHandler {
162425
162487
  #observers = new ObserverGroup();
162426
162488
  #pendingWrites = new BasicSet();
@@ -162490,7 +162552,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162490
162552
  );
162491
162553
  this.#pendingWrites.add(state);
162492
162554
  state.closed.on(() => void this.#pendingWrites.delete(state));
162493
- logger154.debug("Added atomic write state:", state);
162555
+ logger155.debug("Added atomic write state:", state);
162494
162556
  return state;
162495
162557
  }
162496
162558
  if (existingState === void 0) {
@@ -162557,10 +162619,10 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162557
162619
  writeAttribute(context, endpoint, cluster2, attribute2, value) {
162558
162620
  const state = this.#assertPendingWriteForAttributeAndPeer(context, endpoint, cluster2, attribute2);
162559
162621
  const attributeName = state.attributeNames.get(attribute2);
162560
- 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);
162561
162623
  endpoint.eventsOf(cluster2.id)[`${attributeName}$AtomicChanging`]?.emit(value, state.pendingAttributeValues[attribute2] !== void 0 ? state.pendingAttributeValues[attribute2] : state.initialValues[attribute2], context);
162562
162624
  state.pendingAttributeValues[attribute2] = value;
162563
- logger154.debug("Atomic write state after current write:", state);
162625
+ logger155.debug("Atomic write state after current write:", state);
162564
162626
  }
162565
162627
  /**
162566
162628
  * Implements the commit logic for an atomic write.
@@ -162579,7 +162641,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162579
162641
  await context.transaction?.commit();
162580
162642
  } catch (error) {
162581
162643
  await context.transaction?.rollback();
162582
- 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}`);
162583
162645
  statusCode = error instanceof StatusResponseError ? error.code : Status2.Failure;
162584
162646
  commandStatusCode = commandStatusCode === Status2.Failure ? Status2.Failure : commandStatusCode === Status2.ConstraintError ? Status2.ConstraintError : Status2.Failure;
162585
162647
  }
@@ -162615,7 +162677,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162615
162677
  const fabricIndex = fabric.fabricIndex;
162616
162678
  for (const writeState of Array.from(this.#pendingWrites)) {
162617
162679
  if (writeState.peerAddress.fabricIndex === fabricIndex) {
162618
- logger154.debug(
162680
+ logger155.debug(
162619
162681
  `Closing atomic write state for peer ${writeState.peerAddress.toString()} on endpoint ${writeState.endpoint.id} due to fabric removal`
162620
162682
  );
162621
162683
  writeState.close();
@@ -162656,7 +162718,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162656
162718
  if (!PeerAddress.is(attrWriteState.peerAddress, peerAddress)) {
162657
162719
  return void 0;
162658
162720
  }
162659
- logger154.debug(
162721
+ logger155.debug(
162660
162722
  `Found pending value for attribute ${attribute2} for peer ${peerAddress.nodeId}`,
162661
162723
  serialize(attrWriteState.pendingAttributeValues[attribute2])
162662
162724
  );
@@ -162692,7 +162754,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
162692
162754
  };
162693
162755
 
162694
162756
  // ../../node_modules/.pnpm/@matter+node@0.16.11/node_modules/@matter/node/dist/esm/behaviors/thermostat/ThermostatServer.js
162695
- var logger155 = Logger.get("ThermostatServer");
162757
+ var logger156 = Logger.get("ThermostatServer");
162696
162758
  var ThermostatBehaviorLogicBase = ThermostatBehavior.with(
162697
162759
  Thermostat3.Feature.Heating,
162698
162760
  Thermostat3.Feature.Cooling,
@@ -162721,7 +162783,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
162721
162783
  throw new ImplementationError("Setback feature is deprecated and not allowed to be enabled");
162722
162784
  }
162723
162785
  if (this.features.matterScheduleConfiguration) {
162724
- 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");
162725
162787
  }
162726
162788
  const options = this.endpoint.behaviors.optionsFor(_ThermostatBaseServer);
162727
162789
  if (this.features.presets && this.state.persistedPresets === void 0) {
@@ -162839,7 +162901,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
162839
162901
  throw new StatusResponse.InvalidCommandError("Requested PresetHandle not found");
162840
162902
  }
162841
162903
  }
162842
- logger155.info(`Setting active preset handle to`, presetHandle);
162904
+ logger156.info(`Setting active preset handle to`, presetHandle);
162843
162905
  this.state.activePresetHandle = presetHandle;
162844
162906
  return preset;
162845
162907
  }
@@ -162909,7 +162971,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
162909
162971
  }
162910
162972
  if (this.state.setpointHoldExpiryTimestamp === void 0) {
162911
162973
  } else {
162912
- logger155.warn(
162974
+ logger156.warn(
162913
162975
  "Handling for setpointHoldExpiryTimestamp is not yet implemented. To use this attribute you need to install the needed logic yourself"
162914
162976
  );
162915
162977
  }
@@ -162982,7 +163044,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
162982
163044
  "RemoteSensing cannot be set to LocalTemperature when LocalTemperatureNotExposed feature is enabled"
162983
163045
  );
162984
163046
  }
162985
- logger155.debug("LocalTemperatureNotExposed feature is enabled, ignoring local temperature measurement");
163047
+ logger156.debug("LocalTemperatureNotExposed feature is enabled, ignoring local temperature measurement");
162986
163048
  this.state.localTemperature = null;
162987
163049
  }
162988
163050
  let localTemperature = null;
@@ -162991,11 +163053,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
162991
163053
  const endpoints = this.env.get(ServerNode).endpoints;
162992
163054
  const endpoint = endpoints.has(localTempEndpoint) ? endpoints.for(localTempEndpoint) : void 0;
162993
163055
  if (endpoint !== void 0 && endpoint.behaviors.has(TemperatureMeasurementServer)) {
162994
- logger155.debug(
163056
+ logger156.debug(
162995
163057
  `Using existing TemperatureMeasurement cluster on endpoint #${localTempEndpoint} for local temperature measurement`
162996
163058
  );
162997
163059
  if (this.state.externalMeasuredIndoorTemperature !== void 0) {
162998
- logger155.warn(
163060
+ logger156.warn(
162999
163061
  "Both local TemperatureMeasurement cluster and externalMeasuredIndoorTemperature state are set, using local cluster"
163000
163062
  );
163001
163063
  }
@@ -163005,19 +163067,19 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163005
163067
  );
163006
163068
  localTemperature = endpoint.stateOf(TemperatureMeasurementServer).measuredValue;
163007
163069
  } else {
163008
- logger155.warn(
163070
+ logger156.warn(
163009
163071
  `No TemperatureMeasurement cluster found on endpoint #${localTempEndpoint}, falling back to externalMeasuredIndoorTemperature state if set`
163010
163072
  );
163011
163073
  }
163012
163074
  } else {
163013
163075
  if (this.state.externalMeasuredIndoorTemperature === void 0) {
163014
163076
  if (this.state.localTemperatureCalibration !== void 0) {
163015
- logger155.warn(
163077
+ logger156.warn(
163016
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"
163017
163079
  );
163018
163080
  }
163019
163081
  } else {
163020
- logger155.info("Using measured temperature via externalMeasuredIndoorTemperature state");
163082
+ logger156.info("Using measured temperature via externalMeasuredIndoorTemperature state");
163021
163083
  localTemperature = this.state.externalMeasuredIndoorTemperature ?? null;
163022
163084
  }
163023
163085
  this.reactTo(this.events.externalMeasuredIndoorTemperature$Changed, this.#handleMeasuredTemperatureChange);
@@ -163057,28 +163119,28 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163057
163119
  const endpoints = this.env.get(ServerNode).endpoints;
163058
163120
  const endpoint = endpoints.has(localOccupancyEndpoint) ? endpoints.for(localOccupancyEndpoint) : void 0;
163059
163121
  if (endpoint !== void 0 && endpoint.behaviors.has(OccupancySensingServer)) {
163060
- logger155.debug(
163122
+ logger156.debug(
163061
163123
  `Using existing OccupancySensing cluster on endpoint ${localOccupancyEndpoint} for local occupancy sensing`
163062
163124
  );
163063
163125
  if (this.state.externallyMeasuredOccupancy !== void 0) {
163064
- logger155.warn(
163126
+ logger156.warn(
163065
163127
  "Both local OccupancySensing cluster and externallyMeasuredOccupancy state are set, using local cluster"
163066
163128
  );
163067
163129
  }
163068
163130
  this.reactTo(endpoint.eventsOf(OccupancySensingServer).occupancy$Changed, this.#handleOccupancyChange);
163069
163131
  currentOccupancy = !!endpoint.stateOf(OccupancySensingServer).occupancy.occupied;
163070
163132
  } else {
163071
- logger155.warn(
163133
+ logger156.warn(
163072
163134
  `No OccupancySensing cluster found on endpoint ${localOccupancyEndpoint}, falling back to externallyMeasuredOccupancy state if set`
163073
163135
  );
163074
163136
  }
163075
163137
  } else {
163076
163138
  if (this.state.externallyMeasuredOccupancy === void 0) {
163077
- logger155.warn(
163139
+ logger156.warn(
163078
163140
  "No local OccupancySensing cluster available and externallyMeasuredOccupancy state not set"
163079
163141
  );
163080
163142
  } else {
163081
- logger155.info("Using occupancy via externallyMeasuredOccupancy state");
163143
+ logger156.info("Using occupancy via externallyMeasuredOccupancy state");
163082
163144
  currentOccupancy = this.state.externallyMeasuredOccupancy;
163083
163145
  }
163084
163146
  this.reactTo(this.events.externallyMeasuredOccupancy$Changed, this.#handleExternalOccupancyChange);
@@ -163345,7 +163407,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163345
163407
  max = this.state[`max${scope}`] ?? defaults.absMax,
163346
163408
  absMax = this.state[`absMax${scope}`] ?? defaults.absMax
163347
163409
  } = details;
163348
- logger155.debug(
163410
+ logger156.debug(
163349
163411
  `Validating user setpoint limits for ${scope}: absMin=${absMin}, min=${min}, max=${max}, absMax=${absMax}`
163350
163412
  );
163351
163413
  if (absMin > min) {
@@ -163392,7 +163454,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163392
163454
  const limitMax = scope === "Heat" ? this.heatSetpointMaximum : this.coolSetpointMaximum;
163393
163455
  const result = cropValueRange(setpoint, limitMin, limitMax);
163394
163456
  if (result !== setpoint) {
163395
- logger155.debug(
163457
+ logger156.debug(
163396
163458
  `${scope} setpoint (${setpoint}) is out of limits [${limitMin}, ${limitMax}], clamping to ${result}`
163397
163459
  );
163398
163460
  }
@@ -163429,7 +163491,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163429
163491
  const otherLimit = otherType === "Heating" ? this.heatSetpointMinimum : this.coolSetpointMaximum;
163430
163492
  if (otherType === "Cooling") {
163431
163493
  const minValidSetpoint = value + deadband;
163432
- logger155.debug(
163494
+ logger156.debug(
163433
163495
  `Ensuring deadband for ${type}${otherType}Setpoint, min valid setpoint is ${minValidSetpoint}`
163434
163496
  );
163435
163497
  if (otherSetpoint >= minValidSetpoint) {
@@ -163440,11 +163502,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163440
163502
  `Cannot adjust cooling setpoint to maintain deadband, would exceed max cooling setpoint (${otherLimit})`
163441
163503
  );
163442
163504
  }
163443
- logger155.debug(`Adjusting ${type}${otherType}Setpoint to ${minValidSetpoint} to maintain deadband`);
163505
+ logger156.debug(`Adjusting ${type}${otherType}Setpoint to ${minValidSetpoint} to maintain deadband`);
163444
163506
  this.state[`${type}${otherType}Setpoint`] = minValidSetpoint;
163445
163507
  } else {
163446
163508
  const maxValidSetpoint = value - deadband;
163447
- logger155.debug(
163509
+ logger156.debug(
163448
163510
  `Ensuring deadband for ${type}${otherType}Setpoint, max valid setpoint is ${maxValidSetpoint}`
163449
163511
  );
163450
163512
  if (otherSetpoint <= maxValidSetpoint) {
@@ -163455,7 +163517,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163455
163517
  `Cannot adjust heating setpoint to maintain deadband, would exceed min heating setpoint (${otherLimit})`
163456
163518
  );
163457
163519
  }
163458
- logger155.debug(`Adjusting ${type}${otherType}Setpoint to ${maxValidSetpoint} to maintain deadband`);
163520
+ logger156.debug(`Adjusting ${type}${otherType}Setpoint to ${maxValidSetpoint} to maintain deadband`);
163459
163521
  this.state[`${type}${otherType}Setpoint`] = maxValidSetpoint;
163460
163522
  }
163461
163523
  }
@@ -163723,7 +163785,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163723
163785
  */
163724
163786
  #handlePersistedPresetsChanged(newPresets, oldPresets) {
163725
163787
  if (oldPresets === void 0) {
163726
- logger155.debug(
163788
+ logger156.debug(
163727
163789
  "Old presets is undefined, skipping some checks. This should only happen on setup of the behavior."
163728
163790
  );
163729
163791
  }
@@ -163732,7 +163794,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163732
163794
  const newPresetHandles = /* @__PURE__ */ new Set();
163733
163795
  for (const preset of newPresets) {
163734
163796
  if (preset.presetHandle === null) {
163735
- logger155.error("Preset is missing presetHandle, generating a new one");
163797
+ logger156.error("Preset is missing presetHandle, generating a new one");
163736
163798
  preset.presetHandle = entropy.randomBytes(16);
163737
163799
  changed = true;
163738
163800
  }
@@ -163781,7 +163843,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
163781
163843
  throw new StatusResponse.InvalidInStateError(`ActivePresetHandle references non-existing presetHandle`);
163782
163844
  }
163783
163845
  if (changed) {
163784
- logger155.error("PresetHandles or BuiltIn flags were updated, updating persistedPresets");
163846
+ logger156.error("PresetHandles or BuiltIn flags were updated, updating persistedPresets");
163785
163847
  this.state.persistedPresets = deepCopy(newPresets);
163786
163848
  }
163787
163849
  }
@@ -164684,7 +164746,7 @@ init_IdentifyServer();
164684
164746
  init_window_covering();
164685
164747
  init_esm();
164686
164748
  init_esm3();
164687
- var logger156 = Logger.get("WindowCoveringServer");
164749
+ var logger157 = Logger.get("WindowCoveringServer");
164688
164750
  var WindowCoveringBase = WindowCoveringBehavior.with(
164689
164751
  WindowCovering3.Feature.Lift,
164690
164752
  WindowCovering3.Feature.Tilt,
@@ -164769,7 +164831,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164769
164831
  this.state.configStatus = configStatus;
164770
164832
  });
164771
164833
  }
164772
- logger156.debug(
164834
+ logger157.debug(
164773
164835
  `Mode changed to ${Diagnostic.json(mode)} and config status to ${Diagnostic.json(configStatus)} and internal calibration mode to ${this.internal.calibrationMode}`
164774
164836
  );
164775
164837
  }
@@ -164777,7 +164839,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164777
164839
  #handleOperationalStatusChanging(operationalStatus) {
164778
164840
  const globalStatus = operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped ? operationalStatus.lift : operationalStatus.tilt;
164779
164841
  operationalStatus.global = globalStatus;
164780
- logger156.debug(
164842
+ logger157.debug(
164781
164843
  `Operational status changed to ${Diagnostic.json(operationalStatus)} with new global status ${globalStatus}`
164782
164844
  );
164783
164845
  this.state.operationalStatus = operationalStatus;
@@ -164806,10 +164868,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164806
164868
  this.state.currentPositionLiftPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
164807
164869
  if (this.state.operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionLiftPercent100ths) {
164808
164870
  this.state.operationalStatus.lift = WindowCovering3.MovementStatus.Stopped;
164809
- logger156.debug("Lift movement stopped, target value reached");
164871
+ logger157.debug("Lift movement stopped, target value reached");
164810
164872
  }
164811
164873
  }
164812
- logger156.debug(
164874
+ logger157.debug(
164813
164875
  `Syncing lift position ${this.state.currentPositionLiftPercent100ths === null ? null : (this.state.currentPositionLiftPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionLiftPercentage}%`
164814
164876
  );
164815
164877
  }
@@ -164819,10 +164881,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164819
164881
  this.state.currentPositionTiltPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
164820
164882
  if (this.state.operationalStatus.tilt !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionTiltPercent100ths) {
164821
164883
  this.state.operationalStatus.tilt = WindowCovering3.MovementStatus.Stopped;
164822
- logger156.debug("Tilt movement stopped, target value reached");
164884
+ logger157.debug("Tilt movement stopped, target value reached");
164823
164885
  }
164824
164886
  }
164825
- logger156.debug(
164887
+ logger157.debug(
164826
164888
  `Syncing tilt position ${this.state.currentPositionTiltPercent100ths === null ? null : (this.state.currentPositionTiltPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionTiltPercentage}%`
164827
164889
  );
164828
164890
  }
@@ -164910,7 +164972,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164910
164972
  }
164911
164973
  const directionInfo = direction === 2 ? ` in direction by position` : ` in direction ${direction === 1 ? "Close" : "Open"}`;
164912
164974
  const targetInfo = targetPercent100ths === void 0 ? "" : ` to target position ${(targetPercent100ths / 100).toFixed(2)}`;
164913
- logger156.debug(
164975
+ logger157.debug(
164914
164976
  `Moving the device ${type === 0 ? "Lift" : "Tilt"}${directionInfo} (reversed=${reversed})${targetInfo}`
164915
164977
  );
164916
164978
  }
@@ -164932,7 +164994,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
164932
164994
  );
164933
164995
  }
164934
164996
  if (type === 0 && this.state.configStatus.liftMovementReversed) {
164935
- logger156.debug("Lift movement is reversed");
164997
+ logger157.debug("Lift movement is reversed");
164936
164998
  }
164937
164999
  switch (type) {
164938
165000
  case 0:
@@ -165162,7 +165224,7 @@ init_esm3();
165162
165224
 
165163
165225
  // src/utils/apply-patch-state.ts
165164
165226
  init_esm();
165165
- var logger157 = Logger.get("ApplyPatchState");
165227
+ var logger158 = Logger.get("ApplyPatchState");
165166
165228
  function applyPatchState(state, patch, options) {
165167
165229
  return applyPatch(state, patch, options?.force);
165168
165230
  }
@@ -165189,23 +165251,23 @@ function applyPatch(state, patch, force = false) {
165189
165251
  if (errorMessage.includes(
165190
165252
  "Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
165191
165253
  )) {
165192
- logger157.debug(
165254
+ logger158.debug(
165193
165255
  `Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
165194
165256
  );
165195
165257
  return actualPatch;
165196
165258
  }
165197
165259
  if (errorMessage.includes("synchronous-transaction-conflict")) {
165198
- logger157.warn(
165260
+ logger158.warn(
165199
165261
  `Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
165200
165262
  );
165201
165263
  return actualPatch;
165202
165264
  }
165203
165265
  failedKeys.push(key);
165204
- logger157.warn(`Failed to set property '${key}': ${errorMessage}`);
165266
+ logger158.warn(`Failed to set property '${key}': ${errorMessage}`);
165205
165267
  }
165206
165268
  }
165207
165269
  if (failedKeys.length > 0) {
165208
- logger157.warn(
165270
+ logger158.warn(
165209
165271
  `${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
165210
165272
  );
165211
165273
  }
@@ -165414,7 +165476,7 @@ init_basic_information2();
165414
165476
  init_descriptor2();
165415
165477
  init_aggregator();
165416
165478
  init_esm();
165417
- var logger158 = Logger.get("BridgedDeviceBasicInformationServer");
165479
+ var logger159 = Logger.get("BridgedDeviceBasicInformationServer");
165418
165480
  var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInformationBehavior {
165419
165481
  async initialize() {
165420
165482
  if (this.endpoint.lifecycle.isInstalled) {
@@ -165429,7 +165491,7 @@ var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInform
165429
165491
  this.state.uniqueId = BasicInformationServer.createUniqueId();
165430
165492
  }
165431
165493
  if (serialNumber !== void 0 && uniqueId === this.state.serialNumber) {
165432
- logger158.warn("uniqueId and serialNumber shall not be the same.");
165494
+ logger159.warn("uniqueId and serialNumber shall not be the same.");
165433
165495
  }
165434
165496
  }
165435
165497
  static schema = BasicInformationServer.enableUniqueIdPersistence(
@@ -166301,7 +166363,7 @@ var IdentifyServer2 = class extends IdentifyServer {
166301
166363
  // src/matter/endpoints/validate-endpoint-type.ts
166302
166364
  init_esm();
166303
166365
  init_esm7();
166304
- var logger159 = Logger.get("EndpointValidation");
166366
+ var logger160 = Logger.get("EndpointValidation");
166305
166367
  function toCamelCase(name) {
166306
166368
  return name.charAt(0).toLowerCase() + name.slice(1);
166307
166369
  }
@@ -166331,12 +166393,12 @@ function validateEndpointType(endpointType, entityId) {
166331
166393
  }
166332
166394
  const prefix = entityId ? `[${entityId}] ` : "";
166333
166395
  if (missingMandatory.length > 0) {
166334
- logger159.warn(
166396
+ logger160.warn(
166335
166397
  `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): missing mandatory clusters: ${missingMandatory.join(", ")}`
166336
166398
  );
166337
166399
  }
166338
166400
  if (availableOptional.length > 0) {
166339
- logger159.debug(
166401
+ logger160.debug(
166340
166402
  `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): optional clusters not used: ${availableOptional.join(", ")}`
166341
166403
  );
166342
166404
  }
@@ -166490,7 +166552,7 @@ function truncate(maxLength, value) {
166490
166552
  }
166491
166553
 
166492
166554
  // src/plugins/plugin-device-factory.ts
166493
- var logger160 = Logger.get("PluginDeviceFactory");
166555
+ var logger161 = Logger.get("PluginDeviceFactory");
166494
166556
  var deviceTypeMap = {
166495
166557
  on_off_light: () => OnOffLightDevice.with(
166496
166558
  IdentifyServer2,
@@ -166596,7 +166658,7 @@ var deviceTypeMap = {
166596
166658
  function createPluginEndpointType(deviceType) {
166597
166659
  const factory = deviceTypeMap[deviceType];
166598
166660
  if (!factory) {
166599
- logger160.warn(`Unsupported plugin device type: "${deviceType}"`);
166661
+ logger161.warn(`Unsupported plugin device type: "${deviceType}"`);
166600
166662
  return void 0;
166601
166663
  }
166602
166664
  const endpoint = factory();
@@ -166611,7 +166673,7 @@ function getSupportedPluginDeviceTypes() {
166611
166673
  init_esm();
166612
166674
  import * as fs10 from "node:fs";
166613
166675
  import * as path11 from "node:path";
166614
- var logger161 = Logger.get("PluginStorage");
166676
+ var logger162 = Logger.get("PluginStorage");
166615
166677
  var SAVE_DEBOUNCE_MS = 500;
166616
166678
  var FilePluginStorage = class {
166617
166679
  data = {};
@@ -166647,7 +166709,7 @@ var FilePluginStorage = class {
166647
166709
  this.data = JSON.parse(raw);
166648
166710
  }
166649
166711
  } catch (e) {
166650
- logger161.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
166712
+ logger162.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
166651
166713
  this.data = {};
166652
166714
  }
166653
166715
  }
@@ -166669,7 +166731,7 @@ var FilePluginStorage = class {
166669
166731
  fs10.writeFileSync(this.filePath, JSON.stringify(this.data, null, 2));
166670
166732
  this.dirty = false;
166671
166733
  } catch (e) {
166672
- logger161.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
166734
+ logger162.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
166673
166735
  }
166674
166736
  }
166675
166737
  flush() {
@@ -166679,7 +166741,7 @@ var FilePluginStorage = class {
166679
166741
 
166680
166742
  // src/plugins/safe-plugin-runner.ts
166681
166743
  init_esm();
166682
- var logger162 = Logger.get("SafePluginRunner");
166744
+ var logger163 = Logger.get("SafePluginRunner");
166683
166745
  var DEFAULT_TIMEOUT_MS = 1e4;
166684
166746
  var CIRCUIT_BREAKER_THRESHOLD = 3;
166685
166747
  var SafePluginRunner = class {
@@ -166712,7 +166774,7 @@ var SafePluginRunner = class {
166712
166774
  async run(pluginName, operation, fn, timeoutMs = DEFAULT_TIMEOUT_MS) {
166713
166775
  const state = this.getState(pluginName);
166714
166776
  if (state.disabled) {
166715
- logger162.debug(
166777
+ logger163.debug(
166716
166778
  `Plugin "${pluginName}" is disabled (circuit breaker open), skipping ${operation}`
166717
166779
  );
166718
166780
  return void 0;
@@ -166730,13 +166792,13 @@ var SafePluginRunner = class {
166730
166792
  timeout.clear();
166731
166793
  state.failures++;
166732
166794
  state.lastError = error instanceof Error ? error.message : String(error);
166733
- logger162.error(
166795
+ logger163.error(
166734
166796
  `Plugin "${pluginName}" failed during ${operation} (failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
166735
166797
  );
166736
166798
  if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
166737
166799
  state.disabled = true;
166738
166800
  state.disabledAt = Date.now();
166739
- logger162.error(
166801
+ logger163.error(
166740
166802
  `Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures. Last error: ${state.lastError}`
166741
166803
  );
166742
166804
  }
@@ -166758,13 +166820,13 @@ var SafePluginRunner = class {
166758
166820
  } catch (error) {
166759
166821
  state.failures++;
166760
166822
  state.lastError = error instanceof Error ? error.message : String(error);
166761
- logger162.error(
166823
+ logger163.error(
166762
166824
  `Plugin "${pluginName}" failed during ${operation} (sync, failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
166763
166825
  );
166764
166826
  if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
166765
166827
  state.disabled = true;
166766
166828
  state.disabledAt = Date.now();
166767
- logger162.error(
166829
+ logger163.error(
166768
166830
  `Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures.`
166769
166831
  );
166770
166832
  }
@@ -166790,7 +166852,7 @@ var SafePluginRunner = class {
166790
166852
  };
166791
166853
 
166792
166854
  // src/plugins/plugin-manager.ts
166793
- var logger163 = Logger.get("PluginManager");
166855
+ var logger164 = Logger.get("PluginManager");
166794
166856
  var PLUGIN_API_VERSION = 1;
166795
166857
  var MAX_PLUGIN_DEVICE_ID_LENGTH = 100;
166796
166858
  function validatePluginDevice(device) {
@@ -166873,7 +166935,7 @@ var PluginManager = class {
166873
166935
  throw new Error(`Plugin at ${packagePath} package.json missing "main"`);
166874
166936
  }
166875
166937
  if (manifest.hamhPluginApiVersion != null && manifest.hamhPluginApiVersion !== PLUGIN_API_VERSION) {
166876
- logger163.warn(
166938
+ logger164.warn(
166877
166939
  `Plugin "${manifest.name}" declares API version ${manifest.hamhPluginApiVersion}, current is ${PLUGIN_API_VERSION}. It may not work correctly.`
166878
166940
  );
166879
166941
  }
@@ -166904,7 +166966,7 @@ var PluginManager = class {
166904
166966
  };
166905
166967
  await this.register(plugin, metadata);
166906
166968
  } catch (e) {
166907
- logger163.error(`Failed to load external plugin from ${packagePath}:`, e);
166969
+ logger164.error(`Failed to load external plugin from ${packagePath}:`, e);
166908
166970
  throw e;
166909
166971
  }
166910
166972
  }
@@ -166981,7 +167043,7 @@ var PluginManager = class {
166981
167043
  devices,
166982
167044
  started: false
166983
167045
  });
166984
- logger163.info(
167046
+ logger164.info(
166985
167047
  `Registered plugin: ${plugin.name} v${plugin.version} (${metadata.source})`
166986
167048
  );
166987
167049
  }
@@ -166992,13 +167054,13 @@ var PluginManager = class {
166992
167054
  for (const [name, instance] of this.instances) {
166993
167055
  if (!instance.metadata.enabled) continue;
166994
167056
  if (this.runner.isDisabled(name)) {
166995
- logger163.warn(
167057
+ logger164.warn(
166996
167058
  `Plugin "${name}" is disabled (circuit breaker), skipping start`
166997
167059
  );
166998
167060
  instance.metadata.enabled = false;
166999
167061
  continue;
167000
167062
  }
167001
- logger163.info(`Starting plugin: ${name}`);
167063
+ logger164.info(`Starting plugin: ${name}`);
167002
167064
  await this.runner.run(
167003
167065
  name,
167004
167066
  "onStart",
@@ -167046,7 +167108,7 @@ var PluginManager = class {
167046
167108
  storage2.flush();
167047
167109
  }
167048
167110
  instance.started = false;
167049
- logger163.info(`Plugin "${name}" shut down`);
167111
+ logger164.info(`Plugin "${name}" shut down`);
167050
167112
  }
167051
167113
  this.instances.clear();
167052
167114
  }
@@ -167457,10 +167519,10 @@ init_diagnostic_event_bus();
167457
167519
  var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
167458
167520
  var DEAD_SESSION_TIMEOUT_MS = 6e4;
167459
167521
  var Bridge = class {
167460
- constructor(env, logger205, dataProvider, endpointManager) {
167522
+ constructor(env, logger206, dataProvider, endpointManager) {
167461
167523
  this.dataProvider = dataProvider;
167462
167524
  this.endpointManager = endpointManager;
167463
- this.log = logger205.get(`Bridge / ${dataProvider.id}`);
167525
+ this.log = logger206.get(`Bridge / ${dataProvider.id}`);
167464
167526
  this.server = new BridgeServerNode(
167465
167527
  env,
167466
167528
  this.dataProvider,
@@ -167492,6 +167554,10 @@ var Bridge = class {
167492
167554
  autoForceSyncTimer = null;
167493
167555
  deadSessionTimer = null;
167494
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;
167495
167561
  // Tracks the last synced state JSON per entity to avoid pushing unchanged states.
167496
167562
  // Key: entity_id, Value: JSON.stringify of entity.state
167497
167563
  lastSyncedStates = /* @__PURE__ */ new Map();
@@ -167608,6 +167674,15 @@ var Bridge = class {
167608
167674
  if (this.status.code === BridgeStatus.Running) {
167609
167675
  return;
167610
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() {
167611
167686
  this.lastSyncedStates.clear();
167612
167687
  try {
167613
167688
  this.setStatus({
@@ -167645,6 +167720,15 @@ ${e?.toString()}`);
167645
167720
  }
167646
167721
  }
167647
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) {
167648
167732
  this.unwireSessionDiagnostics();
167649
167733
  this.stopAutoForceSync();
167650
167734
  await this.endpointManager.stopPlugins();
@@ -168258,7 +168342,7 @@ init_clusters();
168258
168342
 
168259
168343
  // src/matter/behaviors/electrical-energy-measurement-server.ts
168260
168344
  init_home_assistant_entity_behavior();
168261
- var logger164 = Logger.get("ElectricalEnergyMeasurementServer");
168345
+ var logger165 = Logger.get("ElectricalEnergyMeasurementServer");
168262
168346
  var FeaturedBase = ElectricalEnergyMeasurementServer.with("CumulativeEnergy", "ImportedEnergy");
168263
168347
  var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
168264
168348
  async initialize() {
@@ -168267,7 +168351,7 @@ var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
168267
168351
  const entityId = homeAssistant.entityId;
168268
168352
  const energyEntity = homeAssistant.state.mapping?.energyEntity;
168269
168353
  if (energyEntity) {
168270
- logger164.debug(
168354
+ logger165.debug(
168271
168355
  `[${entityId}] ElectricalEnergyMeasurement using mapped energy entity: ${energyEntity}`
168272
168356
  );
168273
168357
  }
@@ -168319,7 +168403,7 @@ var HaElectricalEnergyMeasurementServer = ElectricalEnergyMeasurementServerBase.
168319
168403
  // src/matter/behaviors/electrical-power-measurement-server.ts
168320
168404
  init_esm();
168321
168405
  init_home_assistant_entity_behavior();
168322
- var logger165 = Logger.get("ElectricalPowerMeasurementServer");
168406
+ var logger166 = Logger.get("ElectricalPowerMeasurementServer");
168323
168407
  var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurementServer {
168324
168408
  async initialize() {
168325
168409
  await super.initialize();
@@ -168327,7 +168411,7 @@ var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurem
168327
168411
  const entityId = homeAssistant.entityId;
168328
168412
  const powerEntity = homeAssistant.state.mapping?.powerEntity;
168329
168413
  if (powerEntity) {
168330
- logger165.debug(
168414
+ logger166.debug(
168331
168415
  `[${entityId}] ElectricalPowerMeasurement using mapped power entity: ${powerEntity}`
168332
168416
  );
168333
168417
  }
@@ -168379,7 +168463,7 @@ init_home_assistant_entity_behavior();
168379
168463
  // src/matter/behaviors/humidity-measurement-server.ts
168380
168464
  init_esm();
168381
168465
  init_home_assistant_entity_behavior();
168382
- var logger166 = Logger.get("HumidityMeasurementServer");
168466
+ var logger167 = Logger.get("HumidityMeasurementServer");
168383
168467
  var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementServer {
168384
168468
  async initialize() {
168385
168469
  await super.initialize();
@@ -168392,7 +168476,7 @@ var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementSer
168392
168476
  return;
168393
168477
  }
168394
168478
  const humidity = this.getHumidity(this.state.config, entity.state);
168395
- logger166.debug(
168479
+ logger167.debug(
168396
168480
  `Humidity ${entity.state.entity_id} raw=${entity.state.state} measuredValue=${humidity}`
168397
168481
  );
168398
168482
  applyPatchState(this.state, {
@@ -168422,7 +168506,7 @@ function HumidityMeasurementServer(config10) {
168422
168506
  // src/matter/behaviors/power-source-server.ts
168423
168507
  init_esm();
168424
168508
  init_home_assistant_entity_behavior();
168425
- var logger167 = Logger.get("PowerSourceServer");
168509
+ var logger168 = Logger.get("PowerSourceServer");
168426
168510
  var FeaturedBase2 = PowerSourceServer.with("Battery", "Rechargeable");
168427
168511
  var PowerSourceServerBase = class extends FeaturedBase2 {
168428
168512
  async initialize() {
@@ -168434,17 +168518,17 @@ var PowerSourceServerBase = class extends FeaturedBase2 {
168434
168518
  applyPatchState(this.state, {
168435
168519
  endpointList: [endpointNumber]
168436
168520
  });
168437
- logger167.debug(
168521
+ logger168.debug(
168438
168522
  `[${entityId}] PowerSource initialized with endpointList=[${endpointNumber}]`
168439
168523
  );
168440
168524
  } else {
168441
- logger167.warn(
168525
+ logger168.warn(
168442
168526
  `[${entityId}] PowerSource endpoint number is null during initialize - endpointList will be empty!`
168443
168527
  );
168444
168528
  }
168445
168529
  const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
168446
168530
  if (batteryEntity) {
168447
- logger167.debug(
168531
+ logger168.debug(
168448
168532
  `[${entityId}] PowerSource using mapped battery entity: ${batteryEntity}`
168449
168533
  );
168450
168534
  }
@@ -168769,13 +168853,30 @@ init_home_assistant_entity_behavior();
168769
168853
  init_esm();
168770
168854
  init_home_assistant_entity_behavior();
168771
168855
  var lastTurnOnTimestamps = /* @__PURE__ */ new Map();
168856
+ var LAST_TURN_ON_TTL_MS = 6e4;
168772
168857
  var optimisticLevelState = /* @__PURE__ */ new Map();
168773
168858
  var OPTIMISTIC_TIMEOUT_MS = 3e3;
168774
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
+ }
168775
168874
  function notifyLightTurnedOn(entityId) {
168776
- lastTurnOnTimestamps.set(entityId, Date.now());
168875
+ const now = Date.now();
168876
+ sweepLastTurnOn(now);
168877
+ lastTurnOnTimestamps.set(entityId, now);
168777
168878
  }
168778
- var logger168 = Logger.get("LevelControlServer");
168879
+ var logger169 = Logger.get("LevelControlServer");
168779
168880
  var FeaturedBase4 = LevelControlServer.with("OnOff", "Lighting");
168780
168881
  var LevelControlServerBase = class extends FeaturedBase4 {
168781
168882
  pendingTransitionTime;
@@ -168790,12 +168891,12 @@ var LevelControlServerBase = class extends FeaturedBase4 {
168790
168891
  this.state.maxLevel = 254;
168791
168892
  }
168792
168893
  this.state.onLevel = null;
168793
- logger168.debug(`initialize: calling super.initialize()`);
168894
+ logger169.debug(`initialize: calling super.initialize()`);
168794
168895
  try {
168795
168896
  await super.initialize();
168796
- logger168.debug(`initialize: super.initialize() completed successfully`);
168897
+ logger169.debug(`initialize: super.initialize() completed successfully`);
168797
168898
  } catch (error) {
168798
- logger168.error(`initialize: super.initialize() FAILED:`, error);
168899
+ logger169.error(`initialize: super.initialize() FAILED:`, error);
168799
168900
  throw error;
168800
168901
  }
168801
168902
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
@@ -168872,7 +168973,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
168872
168973
  const lastTurnOn = lastTurnOnTimestamps.get(entityId);
168873
168974
  const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
168874
168975
  if (level >= this.maxLevel && timeSinceTurnOn < 200) {
168875
- logger168.debug(
168976
+ logger169.debug(
168876
168977
  `[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
168877
168978
  );
168878
168979
  return;
@@ -168895,9 +168996,11 @@ var LevelControlServerBase = class extends FeaturedBase4 {
168895
168996
  };
168896
168997
  }
168897
168998
  this.state.currentLevel = level;
168999
+ const now = Date.now();
169000
+ sweepOptimisticLevel(now);
168898
169001
  optimisticLevelState.set(entityId, {
168899
169002
  expectedLevel: level,
168900
- timestamp: Date.now()
169003
+ timestamp: now
168901
169004
  });
168902
169005
  homeAssistant.callAction(action);
168903
169006
  }
@@ -168916,9 +169019,16 @@ function LevelControlServer2(config10) {
168916
169019
  }
168917
169020
 
168918
169021
  // src/matter/behaviors/on-off-server.ts
168919
- var logger169 = Logger.get("OnOffServer");
169022
+ var logger170 = Logger.get("OnOffServer");
168920
169023
  var optimisticOnOffState = /* @__PURE__ */ new Map();
168921
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
+ }
168922
169032
  var OnOffServerBase = class extends OnOffServer {
168923
169033
  async initialize() {
168924
169034
  await super.initialize();
@@ -168960,11 +169070,13 @@ var OnOffServerBase = class extends OnOffServer {
168960
169070
  if (!action) {
168961
169071
  return;
168962
169072
  }
168963
- logger169.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
169073
+ logger170.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
168964
169074
  notifyLightTurnedOn(homeAssistant.entityId);
169075
+ const now = Date.now();
169076
+ sweepOptimisticOnOff(now);
168965
169077
  optimisticOnOffState.set(homeAssistant.entityId, {
168966
169078
  expectedOnOff: true,
168967
- timestamp: Date.now()
169079
+ timestamp: now
168968
169080
  });
168969
169081
  homeAssistant.callAction(action);
168970
169082
  if (turnOff === null) {
@@ -168983,10 +169095,12 @@ var OnOffServerBase = class extends OnOffServer {
168983
169095
  if (!action) {
168984
169096
  return;
168985
169097
  }
168986
- 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);
168987
169101
  optimisticOnOffState.set(homeAssistant.entityId, {
168988
169102
  expectedOnOff: false,
168989
- timestamp: Date.now()
169103
+ timestamp: now
168990
169104
  });
168991
169105
  homeAssistant.callAction(action);
168992
169106
  }
@@ -169006,14 +169120,16 @@ function OnOffServer2(config10 = {}) {
169006
169120
  return OnOffServerBase.set({ config: config10 });
169007
169121
  }
169008
169122
  function setOptimisticOnOff(entityId, expectedOnOff) {
169123
+ const now = Date.now();
169124
+ sweepOptimisticOnOff(now);
169009
169125
  optimisticOnOffState.set(entityId, {
169010
169126
  expectedOnOff,
169011
- timestamp: Date.now()
169127
+ timestamp: now
169012
169128
  });
169013
169129
  }
169014
169130
 
169015
169131
  // src/matter/behaviors/fan-control-server.ts
169016
- var logger170 = Logger.get("FanControlServer");
169132
+ var logger171 = Logger.get("FanControlServer");
169017
169133
  var defaultStepSize = 33.33;
169018
169134
  var minSpeedMax = 3;
169019
169135
  var maxSpeedMax = 100;
@@ -169389,7 +169505,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
169389
169505
  const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
169390
169506
  setOptimisticOnOff(entityId, on);
169391
169507
  } catch (e) {
169392
- logger170.debug(
169508
+ logger171.debug(
169393
169509
  `syncOnOff(${on}) failed: ${e instanceof Error ? e.message : String(e)}`
169394
169510
  );
169395
169511
  }
@@ -169477,7 +169593,7 @@ var FanOnOffServer = OnOffServer2({
169477
169593
  });
169478
169594
 
169479
169595
  // src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
169480
- var logger171 = Logger.get("ComposedAirPurifierEndpoint");
169596
+ var logger172 = Logger.get("ComposedAirPurifierEndpoint");
169481
169597
  var temperatureConfig = {
169482
169598
  getValue(entity, agent) {
169483
169599
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
@@ -169690,7 +169806,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
169690
169806
  config10.powerEntityId ? "+Pwr" : "",
169691
169807
  config10.energyEntityId ? "+Nrg" : ""
169692
169808
  ].filter(Boolean).join("");
169693
- logger171.info(
169809
+ logger172.info(
169694
169810
  `Created composed air purifier ${primaryEntityId}: ${clusterLabels}`
169695
169811
  );
169696
169812
  return endpoint;
@@ -169790,7 +169906,7 @@ init_home_assistant_entity_behavior();
169790
169906
  // src/matter/behaviors/pressure-measurement-server.ts
169791
169907
  init_esm();
169792
169908
  init_home_assistant_entity_behavior();
169793
- var logger172 = Logger.get("PressureMeasurementServer");
169909
+ var logger173 = Logger.get("PressureMeasurementServer");
169794
169910
  var MIN_PRESSURE = 300;
169795
169911
  var MAX_PRESSURE = 1100;
169796
169912
  var PressureMeasurementServerBase = class extends PressureMeasurementServer {
@@ -169818,7 +169934,7 @@ var PressureMeasurementServerBase = class extends PressureMeasurementServer {
169818
169934
  }
169819
169935
  const rounded = Math.round(value);
169820
169936
  if (rounded < MIN_PRESSURE || rounded > MAX_PRESSURE) {
169821
- logger172.warn(
169937
+ logger173.warn(
169822
169938
  `Pressure value ${rounded} (raw: ${value}) for ${entity.entity_id} is outside valid range [${MIN_PRESSURE}-${MAX_PRESSURE}], ignoring`
169823
169939
  );
169824
169940
  return null;
@@ -169837,7 +169953,7 @@ function PressureMeasurementServer2(config10) {
169837
169953
  }
169838
169954
 
169839
169955
  // src/matter/endpoints/composed/composed-sensor-endpoint.ts
169840
- var logger173 = Logger.get("ComposedSensorEndpoint");
169956
+ var logger174 = Logger.get("ComposedSensorEndpoint");
169841
169957
  var temperatureConfig2 = {
169842
169958
  getValue(entity, agent) {
169843
169959
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
@@ -170011,7 +170127,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
170011
170127
  if (config10.pressureEntityId && pressSub) {
170012
170128
  endpoint.subEndpoints.set(config10.pressureEntityId, pressSub);
170013
170129
  }
170014
- logger173.info(
170130
+ logger174.info(
170015
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" : ""}`
170016
170132
  );
170017
170133
  return endpoint;
@@ -170147,7 +170263,7 @@ init_home_assistant_entity_behavior();
170147
170263
  // src/matter/behaviors/mode-select-server.ts
170148
170264
  init_esm();
170149
170265
  init_home_assistant_entity_behavior();
170150
- var logger174 = Logger.get("ModeSelectServer");
170266
+ var logger175 = Logger.get("ModeSelectServer");
170151
170267
  var ModeSelectServerBase = class extends ModeSelectServer {
170152
170268
  async initialize() {
170153
170269
  await super.initialize();
@@ -170176,13 +170292,13 @@ var ModeSelectServerBase = class extends ModeSelectServer {
170176
170292
  const options = config10.getOptions(homeAssistant.entity);
170177
170293
  const { newMode } = request;
170178
170294
  if (newMode < 0 || newMode >= options.length) {
170179
- logger174.warn(
170295
+ logger175.warn(
170180
170296
  `[${homeAssistant.entityId}] Invalid mode ${newMode}, options: [${options.join(", ")}]`
170181
170297
  );
170182
170298
  return;
170183
170299
  }
170184
170300
  const option = options[newMode];
170185
- logger174.info(
170301
+ logger175.info(
170186
170302
  `[${homeAssistant.entityId}] changeToMode(${newMode}) -> "${option}"`
170187
170303
  );
170188
170304
  applyPatchState(this.state, { currentMode: newMode });
@@ -170704,7 +170820,7 @@ var WaterLeakDetectorType = WaterLeakDetectorDevice.with(
170704
170820
  );
170705
170821
 
170706
170822
  // src/matter/endpoints/legacy/binary-sensor/index.ts
170707
- var logger175 = Logger.get("BinarySensorDevice");
170823
+ var logger176 = Logger.get("BinarySensorDevice");
170708
170824
  var deviceClasses = {
170709
170825
  [BinarySensorDeviceClass.CarbonMonoxide]: CoAlarmType,
170710
170826
  [BinarySensorDeviceClass.Gas]: CoAlarmType,
@@ -170756,11 +170872,11 @@ function BinarySensorDevice(homeAssistantEntity) {
170756
170872
  const originalTypeName = type.name;
170757
170873
  if (hasBattery && batteryTypes.has(type)) {
170758
170874
  type = batteryTypes.get(type);
170759
- logger175.info(
170875
+ logger176.info(
170760
170876
  `[${entityId}] Using battery variant: ${originalTypeName} -> ${type.name}, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
170761
170877
  );
170762
170878
  } else if (hasBattery) {
170763
- logger175.warn(
170879
+ logger176.warn(
170764
170880
  `[${entityId}] Has battery but no variant available for ${originalTypeName}`
170765
170881
  );
170766
170882
  }
@@ -170914,7 +171030,7 @@ init_home_assistant_entity_behavior();
170914
171030
  // src/matter/behaviors/thermostat-server.ts
170915
171031
  init_esm();
170916
171032
  init_home_assistant_entity_behavior();
170917
- var logger176 = Logger.get("ThermostatServer");
171033
+ var logger177 = Logger.get("ThermostatServer");
170918
171034
  var SystemMode = Thermostat3.SystemMode;
170919
171035
  var RunningMode = Thermostat3.ThermostatRunningMode;
170920
171036
  var nudgingSetpoints = /* @__PURE__ */ new Set();
@@ -170972,7 +171088,7 @@ var HeatingAndCoolingFeaturedBase = ThermostatServer.with("Heating", "Cooling").
170972
171088
  );
170973
171089
  function thermostatPreInitialize(self) {
170974
171090
  const currentLocal = self.state.localTemperature;
170975
- logger176.debug(
171091
+ logger177.debug(
170976
171092
  `initialize: features - heating=${self.features.heating}, cooling=${self.features.cooling}`
170977
171093
  );
170978
171094
  const localValue = typeof currentLocal === "number" && !Number.isNaN(currentLocal) ? currentLocal : currentLocal === null ? null : 2100;
@@ -170995,7 +171111,7 @@ function thermostatPreInitialize(self) {
170995
171111
  const coolingValue = typeof currentCooling === "number" && !Number.isNaN(currentCooling) ? currentCooling : 2400;
170996
171112
  self.state.occupiedCoolingSetpoint = coolingValue;
170997
171113
  }
170998
- logger176.debug(
171114
+ logger177.debug(
170999
171115
  `initialize: after force-set - local=${self.state.localTemperature}`
171000
171116
  );
171001
171117
  self.state.thermostatRunningState = runningStateAllOff;
@@ -171077,7 +171193,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171077
171193
  maxCoolLimit,
171078
171194
  "cool"
171079
171195
  );
171080
- logger176.debug(
171196
+ logger177.debug(
171081
171197
  `update: limits heat=[${minHeatLimit}, ${maxHeatLimit}], cool=[${minCoolLimit}, ${maxCoolLimit}], systemMode=${systemMode}, runningMode=${runningMode}`
171082
171198
  );
171083
171199
  let controlSequence = config10.getControlSequence(entity.state, this.agent);
@@ -171150,18 +171266,18 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171150
171266
  */
171151
171267
  // biome-ignore lint/correctness/noUnusedPrivateClassMembers: Called via thermostatPostInitialize + prototype copy
171152
171268
  heatingSetpointChanging(value, _oldValue, context) {
171153
- logger176.debug(
171269
+ logger177.debug(
171154
171270
  `heatingSetpointChanging: value=${value}, oldValue=${_oldValue}, isOffline=${transactionIsOffline(context)}`
171155
171271
  );
171156
171272
  if (transactionIsOffline(context)) {
171157
- logger176.debug(
171273
+ logger177.debug(
171158
171274
  "heatingSetpointChanging: skipping - transaction is offline"
171159
171275
  );
171160
171276
  return;
171161
171277
  }
171162
171278
  const next = Temperature.celsius(value / 100);
171163
171279
  if (!next) {
171164
- logger176.debug("heatingSetpointChanging: skipping - invalid temperature");
171280
+ logger177.debug("heatingSetpointChanging: skipping - invalid temperature");
171165
171281
  return;
171166
171282
  }
171167
171283
  this.agent.asLocalActor(() => {
@@ -171172,7 +171288,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171172
171288
  this.agent
171173
171289
  );
171174
171290
  const currentMode = this.state.systemMode;
171175
- logger176.debug(
171291
+ logger177.debug(
171176
171292
  `heatingSetpointChanging: supportsRange=${supportsRange}, systemMode=${currentMode}, features.heating=${this.features.heating}, features.cooling=${this.features.cooling}`
171177
171293
  );
171178
171294
  if (!supportsRange) {
@@ -171182,12 +171298,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171182
171298
  const isOff = currentMode === Thermostat3.SystemMode.Off;
171183
171299
  if (isOff && this.features.heating) {
171184
171300
  if (nudgingSetpoints.has(homeAssistant.entityId)) {
171185
- logger176.debug(
171301
+ logger177.debug(
171186
171302
  `heatingSetpointChanging: skipping auto-resume - nudge write in progress`
171187
171303
  );
171188
171304
  return;
171189
171305
  }
171190
- logger176.info(
171306
+ logger177.info(
171191
171307
  `heatingSetpointChanging: auto-resume - switching to Heat (was Off)`
171192
171308
  );
171193
171309
  const modeAction = config10.setSystemMode(
@@ -171196,17 +171312,17 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171196
171312
  );
171197
171313
  homeAssistant.callAction(modeAction);
171198
171314
  } else if (!isAutoMode && !isHeatingMode) {
171199
- logger176.debug(
171315
+ logger177.debug(
171200
171316
  `heatingSetpointChanging: skipping - not in heating/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
171201
171317
  );
171202
171318
  return;
171203
171319
  }
171204
- logger176.debug(
171320
+ logger177.debug(
171205
171321
  `heatingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isHeatingMode=${isHeatingMode}, isOff=${isOff}, haMode=${haHvacMode}`
171206
171322
  );
171207
171323
  }
171208
171324
  const coolingSetpoint = this.features.cooling ? this.state.occupiedCoolingSetpoint : value;
171209
- logger176.debug(
171325
+ logger177.debug(
171210
171326
  `heatingSetpointChanging: calling setTemperature with heat=${next.celsius(true)}, cool=${coolingSetpoint}`
171211
171327
  );
171212
171328
  this.setTemperature(
@@ -171245,12 +171361,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171245
171361
  const isOff = currentMode === Thermostat3.SystemMode.Off;
171246
171362
  if (isOff && !this.features.heating && this.features.cooling) {
171247
171363
  if (nudgingSetpoints.has(homeAssistant.entityId)) {
171248
- logger176.debug(
171364
+ logger177.debug(
171249
171365
  `coolingSetpointChanging: skipping auto-resume - nudge write in progress`
171250
171366
  );
171251
171367
  return;
171252
171368
  }
171253
- logger176.info(
171369
+ logger177.info(
171254
171370
  `coolingSetpointChanging: auto-resume - switching to Cool (was Off)`
171255
171371
  );
171256
171372
  const modeAction = config10.setSystemMode(
@@ -171259,12 +171375,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171259
171375
  );
171260
171376
  homeAssistant.callAction(modeAction);
171261
171377
  } else if (!isAutoMode && !isCoolingMode) {
171262
- logger176.debug(
171378
+ logger177.debug(
171263
171379
  `coolingSetpointChanging: skipping - not in cooling/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
171264
171380
  );
171265
171381
  return;
171266
171382
  }
171267
- logger176.debug(
171383
+ logger177.debug(
171268
171384
  `coolingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isCoolingMode=${isCoolingMode}, isOff=${isOff}, haMode=${haHvacMode}`
171269
171385
  );
171270
171386
  }
@@ -171361,7 +171477,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
171361
171477
  const effectiveMax = max ?? 5e3;
171362
171478
  if (value == null || Number.isNaN(value)) {
171363
171479
  const defaultValue = type === "heat" ? 2e3 : 2400;
171364
- logger176.debug(
171480
+ logger177.debug(
171365
171481
  `${type} setpoint is undefined, using default: ${defaultValue}`
171366
171482
  );
171367
171483
  return Math.max(effectiveMin, Math.min(effectiveMax, defaultValue));
@@ -171806,7 +171922,7 @@ init_home_assistant_entity_behavior();
171806
171922
  init_esm();
171807
171923
  init_home_assistant_actions();
171808
171924
  init_home_assistant_entity_behavior();
171809
- var logger177 = Logger.get("WindowCoveringServer");
171925
+ var logger178 = Logger.get("WindowCoveringServer");
171810
171926
  var MovementStatus = WindowCovering3.MovementStatus;
171811
171927
  var FeaturedBase6 = WindowCoveringServer.with(
171812
171928
  "Lift",
@@ -171922,7 +172038,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
171922
172038
  }
171923
172039
  return existing100ths ?? current100ths;
171924
172040
  };
171925
- logger177.debug(
172041
+ logger178.debug(
171926
172042
  `Cover update for ${entity.entity_id}: state=${state.state}, lift=${currentLift}%, tilt=${currentTilt}%, movement=${MovementStatus[movementStatus]}`
171927
172043
  );
171928
172044
  const appliedPatch = applyPatchState(
@@ -171965,9 +172081,9 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
171965
172081
  );
171966
172082
  if (Object.keys(appliedPatch).length > 0) {
171967
172083
  const hasOperationalChange = "operationalStatus" in appliedPatch;
171968
- const log = hasOperationalChange ? logger177.info : logger177.debug;
172084
+ const log = hasOperationalChange ? logger178.info : logger178.debug;
171969
172085
  log.call(
171970
- logger177,
172086
+ logger178,
171971
172087
  `Cover ${entity.entity_id} state changed: ${JSON.stringify(appliedPatch)}`
171972
172088
  );
171973
172089
  }
@@ -171975,7 +172091,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
171975
172091
  async handleMovement(type, _, direction, targetPercent100ths) {
171976
172092
  const currentLift = this.state.currentPositionLiftPercent100ths ?? 0;
171977
172093
  const currentTilt = this.state.currentPositionTiltPercent100ths ?? 0;
171978
- logger177.info(
172094
+ logger178.info(
171979
172095
  `handleMovement: type=${MovementType[type]}, direction=${MovementDirection[direction]}, target=${targetPercent100ths}, currentLift=${currentLift}, currentTilt=${currentTilt}, absolutePosition=${this.features.absolutePosition}`
171980
172096
  );
171981
172097
  if (type === MovementType.Lift) {
@@ -171994,7 +172110,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
171994
172110
  }
171995
172111
  } else if (type === MovementType.Tilt) {
171996
172112
  if (targetPercent100ths == null && this.lastLiftMovementDirection === direction && Date.now() - this.lastLiftMovementMs < 50) {
171997
- logger177.info(
172113
+ logger178.info(
171998
172114
  `Skipping tilt ${MovementDirection[direction]} \u2014 lift already moving in same direction`
171999
172115
  );
172000
172116
  return;
@@ -172019,13 +172135,13 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
172019
172135
  handleLiftOpen() {
172020
172136
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
172021
172137
  const action = this.state.config.openCoverLift(void 0, this.agent);
172022
- logger177.info(`handleLiftOpen: calling action=${action.action}`);
172138
+ logger178.info(`handleLiftOpen: calling action=${action.action}`);
172023
172139
  homeAssistant.callAction(action);
172024
172140
  }
172025
172141
  handleLiftClose() {
172026
172142
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
172027
172143
  const action = this.state.config.closeCoverLift(void 0, this.agent);
172028
- logger177.info(`handleLiftClose: calling action=${action.action}`);
172144
+ logger178.info(`handleLiftClose: calling action=${action.action}`);
172029
172145
  homeAssistant.callAction(action);
172030
172146
  }
172031
172147
  handleGoToLiftPosition(targetPercent100ths) {
@@ -172046,7 +172162,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
172046
172162
  this.lastLiftCommandTime = now;
172047
172163
  const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
172048
172164
  const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
172049
- logger177.debug(
172165
+ logger178.debug(
172050
172166
  `Lift command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
172051
172167
  );
172052
172168
  if (this.liftDebounceTimer) {
@@ -172095,7 +172211,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
172095
172211
  this.lastTiltCommandTime = now;
172096
172212
  const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
172097
172213
  const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
172098
- logger177.debug(
172214
+ logger178.debug(
172099
172215
  `Tilt command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
172100
172216
  );
172101
172217
  if (this.tiltDebounceTimer) {
@@ -172154,7 +172270,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
172154
172270
  }
172155
172271
 
172156
172272
  // src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
172157
- var logger178 = Logger.get("CoverWindowCoveringServer");
172273
+ var logger179 = Logger.get("CoverWindowCoveringServer");
172158
172274
  var attributes5 = (entity) => entity.attributes;
172159
172275
  var MATTER_SEMANTIC_PLATFORMS = [
172160
172276
  // Currently empty - no known platforms use Matter semantics by default
@@ -172172,7 +172288,7 @@ var adjustPositionForReading2 = (position, agent) => {
172172
172288
  const { featureFlags } = agent.env.get(BridgeDataProvider);
172173
172289
  const matterSem = usesMatterSemantics(agent);
172174
172290
  const result = adjustPositionForReading(position, featureFlags, matterSem);
172175
- logger178.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
172291
+ logger179.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
172176
172292
  return result;
172177
172293
  };
172178
172294
  var adjustPositionForWriting2 = (position, agent) => {
@@ -172279,7 +172395,7 @@ var config5 = {
172279
172395
  var CoverWindowCoveringServer = WindowCoveringServer2(config5);
172280
172396
 
172281
172397
  // src/matter/endpoints/legacy/cover/index.ts
172282
- var logger179 = Logger.get("CoverDevice");
172398
+ var logger180 = Logger.get("CoverDevice");
172283
172399
  var DISCRETE_COVER_CLASSES = /* @__PURE__ */ new Set(["garage", "gate"]);
172284
172400
  var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
172285
172401
  const features2 = /* @__PURE__ */ new Set();
@@ -172290,7 +172406,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
172290
172406
  features2.add("AbsolutePosition");
172291
172407
  }
172292
172408
  } else {
172293
- logger179.warn(
172409
+ logger180.warn(
172294
172410
  `[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
172295
172411
  );
172296
172412
  features2.add("Lift");
@@ -172309,7 +172425,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
172309
172425
  features2.add("AbsolutePosition");
172310
172426
  }
172311
172427
  }
172312
- logger179.info(
172428
+ logger180.info(
172313
172429
  `[${entityId}] Creating WindowCovering with features: [${[...features2].join(", ")}], supported_features=${supportedFeatures}`
172314
172430
  );
172315
172431
  const baseBehaviors = [
@@ -172333,18 +172449,18 @@ function CoverDevice(homeAssistantEntity) {
172333
172449
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
172334
172450
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
172335
172451
  if (hasBattery) {
172336
- logger179.info(
172452
+ logger180.info(
172337
172453
  `[${entityId}] Creating cover with PowerSource cluster, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
172338
172454
  );
172339
172455
  } else {
172340
- logger179.debug(
172456
+ logger180.debug(
172341
172457
  `[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
172342
172458
  );
172343
172459
  }
172344
172460
  const deviceClass = attributes7.device_class;
172345
172461
  const isDiscrete = typeof deviceClass === "string" && DISCRETE_COVER_CLASSES.has(deviceClass.toLowerCase());
172346
172462
  if (isDiscrete) {
172347
- logger179.info(
172463
+ logger180.info(
172348
172464
  `[${entityId}] Garage/gate cover (device_class=${deviceClass}): using discrete Open/Close mode`
172349
172465
  );
172350
172466
  }
@@ -172461,7 +172577,7 @@ function DishwasherEndpoint(homeAssistantEntity) {
172461
172577
  // src/matter/behaviors/generic-switch-server.ts
172462
172578
  init_esm();
172463
172579
  init_home_assistant_entity_behavior();
172464
- var logger180 = Logger.get("GenericSwitchServer");
172580
+ var logger181 = Logger.get("GenericSwitchServer");
172465
172581
  var SimpleBase = SwitchServer.with(
172466
172582
  "MomentarySwitch",
172467
172583
  "MomentarySwitchRelease",
@@ -172503,7 +172619,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
172503
172619
  await super.initialize();
172504
172620
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
172505
172621
  const entityId = homeAssistant.entityId;
172506
- logger180.debug(`[${entityId}] GenericSwitch initialized (simple)`);
172622
+ logger181.debug(`[${entityId}] GenericSwitch initialized (simple)`);
172507
172623
  this.reactTo(homeAssistant.onChange, this.handleEventChange);
172508
172624
  }
172509
172625
  handleEventChange() {
@@ -172514,7 +172630,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
172514
172630
  const eventType = attrs.event_type;
172515
172631
  if (!eventType) return;
172516
172632
  const entityId = homeAssistant.entityId;
172517
- logger180.debug(`[${entityId}] Event fired: ${eventType}`);
172633
+ logger181.debug(`[${entityId}] Event fired: ${eventType}`);
172518
172634
  this.triggerPress(eventType);
172519
172635
  }
172520
172636
  triggerPress(eventType) {
@@ -172560,7 +172676,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
172560
172676
  await super.initialize();
172561
172677
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
172562
172678
  const entityId = homeAssistant.entityId;
172563
- logger180.debug(`[${entityId}] GenericSwitch initialized (multi)`);
172679
+ logger181.debug(`[${entityId}] GenericSwitch initialized (multi)`);
172564
172680
  this.reactTo(homeAssistant.onChange, this.handleEventChange);
172565
172681
  }
172566
172682
  handleEventChange() {
@@ -172571,7 +172687,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
172571
172687
  const eventType = attrs.event_type;
172572
172688
  if (!eventType) return;
172573
172689
  const entityId = homeAssistant.entityId;
172574
- logger180.debug(`[${entityId}] Event fired: ${eventType}`);
172690
+ logger181.debug(`[${entityId}] Event fired: ${eventType}`);
172575
172691
  this.triggerPress(eventType);
172576
172692
  }
172577
172693
  triggerPress(eventType) {
@@ -172901,7 +173017,7 @@ init_nodejs();
172901
173017
 
172902
173018
  // src/matter/behaviors/color-control-server.ts
172903
173019
  init_home_assistant_entity_behavior();
172904
- var logger181 = Logger.get("ColorControlServer");
173020
+ var logger182 = Logger.get("ColorControlServer");
172905
173021
  var optimisticColorState = /* @__PURE__ */ new Map();
172906
173022
  var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
172907
173023
  var OPTIMISTIC_TOLERANCE2 = 5;
@@ -172940,7 +173056,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
172940
173056
  if (this.state.startUpColorTemperatureMireds == null) {
172941
173057
  this.state.startUpColorTemperatureMireds = defaultMireds;
172942
173058
  }
172943
- logger181.debug(
173059
+ logger182.debug(
172944
173060
  `initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
172945
173061
  );
172946
173062
  }
@@ -173373,7 +173489,7 @@ init_home_assistant_entity_behavior();
173373
173489
  // src/matter/behaviors/lock-server.ts
173374
173490
  init_esm();
173375
173491
  init_home_assistant_entity_behavior();
173376
- var logger182 = Logger.get("LockServer");
173492
+ var logger183 = Logger.get("LockServer");
173377
173493
  function hasStoredCredentialHelper(env, entityId) {
173378
173494
  try {
173379
173495
  const storage2 = env.get(LockCredentialStorage);
@@ -173531,7 +173647,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
173531
173647
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
173532
173648
  const action = this.state.config.lock(void 0, this.agent);
173533
173649
  const hasPinProvided = !!request.pinCode;
173534
- logger182.debug(
173650
+ logger183.debug(
173535
173651
  `lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
173536
173652
  );
173537
173653
  if (request.pinCode) {
@@ -173544,12 +173660,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
173544
173660
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
173545
173661
  const action = this.state.config.unlock(void 0, this.agent);
173546
173662
  const hasPinProvided = !!request.pinCode;
173547
- logger182.debug(
173663
+ logger183.debug(
173548
173664
  `unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
173549
173665
  );
173550
173666
  if (this.state.requirePinForRemoteOperation) {
173551
173667
  if (!request.pinCode) {
173552
- logger182.info(
173668
+ logger183.info(
173553
173669
  `unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
173554
173670
  );
173555
173671
  throw new StatusResponseError(
@@ -173559,12 +173675,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
173559
173675
  }
173560
173676
  const providedPin = new TextDecoder().decode(request.pinCode);
173561
173677
  if (!this.verifyStoredPin(homeAssistant.entityId, providedPin)) {
173562
- logger182.info(
173678
+ logger183.info(
173563
173679
  `unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
173564
173680
  );
173565
173681
  throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
173566
173682
  }
173567
- logger182.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
173683
+ logger183.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
173568
173684
  action.data = { ...action.data, code: providedPin };
173569
173685
  }
173570
173686
  homeAssistant.callAction(action);
@@ -173725,7 +173841,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173725
173841
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
173726
173842
  const action = this.state.config.lock(void 0, this.agent);
173727
173843
  const hasPinProvided = !!request.pinCode;
173728
- logger182.debug(
173844
+ logger183.debug(
173729
173845
  `lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
173730
173846
  );
173731
173847
  if (request.pinCode) {
@@ -173739,12 +173855,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173739
173855
  const unlatchConfig = this.state.config.unlatch;
173740
173856
  const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
173741
173857
  const hasPinProvided = !!request.pinCode;
173742
- logger182.debug(
173858
+ logger183.debug(
173743
173859
  `unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
173744
173860
  );
173745
173861
  if (this.state.requirePinForRemoteOperation) {
173746
173862
  if (!request.pinCode) {
173747
- logger182.info(
173863
+ logger183.info(
173748
173864
  `unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
173749
173865
  );
173750
173866
  throw new StatusResponseError(
@@ -173754,12 +173870,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173754
173870
  }
173755
173871
  const providedPin = new TextDecoder().decode(request.pinCode);
173756
173872
  if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
173757
- logger182.info(
173873
+ logger183.info(
173758
173874
  `unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
173759
173875
  );
173760
173876
  throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
173761
173877
  }
173762
- logger182.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
173878
+ logger183.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
173763
173879
  action.data = { ...action.data, code: providedPin };
173764
173880
  }
173765
173881
  homeAssistant.callAction(action);
@@ -173774,12 +173890,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173774
173890
  }
173775
173891
  const action = unlatchConfig(void 0, this.agent);
173776
173892
  const hasPinProvided = !!request.pinCode;
173777
- logger182.debug(
173893
+ logger183.debug(
173778
173894
  `unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
173779
173895
  );
173780
173896
  if (this.state.requirePinForRemoteOperation) {
173781
173897
  if (!request.pinCode) {
173782
- logger182.info(
173898
+ logger183.info(
173783
173899
  `unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
173784
173900
  );
173785
173901
  throw new StatusResponseError(
@@ -173789,12 +173905,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
173789
173905
  }
173790
173906
  const providedPin = new TextDecoder().decode(request.pinCode);
173791
173907
  if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
173792
- logger182.info(
173908
+ logger183.info(
173793
173909
  `unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
173794
173910
  );
173795
173911
  throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
173796
173912
  }
173797
- logger182.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
173913
+ logger183.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
173798
173914
  action.data = { ...action.data, code: providedPin };
173799
173915
  }
173800
173916
  homeAssistant.callAction(action);
@@ -173945,7 +174061,7 @@ init_home_assistant_entity_behavior();
173945
174061
  init_dist();
173946
174062
  init_esm();
173947
174063
  init_home_assistant_entity_behavior();
173948
- var logger183 = Logger.get("MediaPlayerKeypadInputServer");
174064
+ var logger184 = Logger.get("MediaPlayerKeypadInputServer");
173949
174065
  var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
173950
174066
  sendKey(request) {
173951
174067
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
@@ -173956,12 +174072,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
173956
174072
  const features2 = attributes7.supported_features ?? 0;
173957
174073
  const action = this.mapKeyToAction(request.keyCode, features2);
173958
174074
  if (!action) {
173959
- logger183.debug(
174075
+ logger184.debug(
173960
174076
  `Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
173961
174077
  );
173962
174078
  return { status: KeypadInput3.Status.UnsupportedKey };
173963
174079
  }
173964
- logger183.debug(
174080
+ logger184.debug(
173965
174081
  `sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
173966
174082
  );
173967
174083
  homeAssistant.callAction({ action });
@@ -174240,10 +174356,17 @@ init_home_assistant_entity_behavior();
174240
174356
  // src/matter/behaviors/speaker-level-control-server.ts
174241
174357
  init_esm();
174242
174358
  init_home_assistant_entity_behavior();
174243
- var logger184 = Logger.get("SpeakerLevelControlServer");
174359
+ var logger185 = Logger.get("SpeakerLevelControlServer");
174244
174360
  var optimisticLevelState2 = /* @__PURE__ */ new Map();
174245
174361
  var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
174246
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
+ }
174247
174370
  var FeaturedBase8 = LevelControlServer.with("OnOff");
174248
174371
  var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
174249
174372
  async initialize() {
@@ -174276,7 +174399,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
174276
174399
  currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
174277
174400
  }
174278
174401
  const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
174279
- logger184.debug(
174402
+ logger185.debug(
174280
174403
  `[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
174281
174404
  );
174282
174405
  const optimistic = optimisticLevelState2.get(entity.entity_id);
@@ -174324,7 +174447,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
174324
174447
  const config10 = this.state.config;
174325
174448
  const entityId = homeAssistant.entity.entity_id;
174326
174449
  const levelPercent = level / 254;
174327
- logger184.debug(
174450
+ logger185.debug(
174328
174451
  `[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
174329
174452
  );
174330
174453
  const current = config10.getValuePercent(
@@ -174335,9 +174458,11 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
174335
174458
  return;
174336
174459
  }
174337
174460
  this.state.currentLevel = level;
174461
+ const now = Date.now();
174462
+ sweepOptimisticLevel2(now);
174338
174463
  optimisticLevelState2.set(entityId, {
174339
174464
  expectedLevel: level,
174340
- timestamp: Date.now()
174465
+ timestamp: now
174341
174466
  });
174342
174467
  homeAssistant.callAction(
174343
174468
  config10.moveToLevelPercent(levelPercent, this.agent)
@@ -175686,7 +175811,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
175686
175811
  };
175687
175812
 
175688
175813
  // src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
175689
- var logger185 = Logger.get("TvocSensor");
175814
+ var logger186 = Logger.get("TvocSensor");
175690
175815
  function airQualityFromUgm3(value) {
175691
175816
  if (value <= 300) return AirQuality3.AirQualityEnum.Good;
175692
175817
  if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
@@ -175727,17 +175852,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
175727
175852
  const attributes7 = entity.state.attributes;
175728
175853
  const deviceClass = attributes7.device_class;
175729
175854
  let airQuality = AirQuality3.AirQualityEnum.Unknown;
175730
- logger185.debug(
175855
+ logger186.debug(
175731
175856
  `[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
175732
175857
  );
175733
175858
  if (state != null && !Number.isNaN(+state)) {
175734
175859
  const value = +state;
175735
175860
  airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
175736
- logger185.debug(
175861
+ logger186.debug(
175737
175862
  `[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
175738
175863
  );
175739
175864
  } else {
175740
- logger185.warn(
175865
+ logger186.warn(
175741
175866
  `[${entity.entity_id}] TVOC state not a valid number: "${state}"`
175742
175867
  );
175743
175868
  }
@@ -175951,7 +176076,7 @@ init_home_assistant_entity_behavior();
175951
176076
  // src/matter/behaviors/pm25-concentration-measurement-server.ts
175952
176077
  init_esm();
175953
176078
  init_home_assistant_entity_behavior();
175954
- var logger186 = Logger.get("Pm25ConcentrationMeasurementServer");
176079
+ var logger187 = Logger.get("Pm25ConcentrationMeasurementServer");
175955
176080
  var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
175956
176081
  ConcentrationMeasurement3.Feature.NumericMeasurement
175957
176082
  );
@@ -175975,11 +176100,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
175975
176100
  if (this.state.measurementMedium === void 0) {
175976
176101
  this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
175977
176102
  }
175978
- logger186.debug(
176103
+ logger187.debug(
175979
176104
  "Pm25ConcentrationMeasurementServer: before super.initialize()"
175980
176105
  );
175981
176106
  await super.initialize();
175982
- logger186.debug(
176107
+ logger187.debug(
175983
176108
  "Pm25ConcentrationMeasurementServer: after super.initialize()"
175984
176109
  );
175985
176110
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
@@ -176002,7 +176127,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
176002
176127
  };
176003
176128
 
176004
176129
  // src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
176005
- var logger187 = Logger.get("Pm25AirQualityServer");
176130
+ var logger188 = Logger.get("Pm25AirQualityServer");
176006
176131
  var Pm25AirQualityServerBase = AirQualityServer.with(
176007
176132
  AirQuality3.Feature.Fair,
176008
176133
  AirQuality3.Feature.Moderate,
@@ -176014,9 +176139,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
176014
176139
  if (this.state.airQuality === void 0) {
176015
176140
  this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
176016
176141
  }
176017
- logger187.debug("Pm25AirQualityServer: before super.initialize()");
176142
+ logger188.debug("Pm25AirQualityServer: before super.initialize()");
176018
176143
  await super.initialize();
176019
- logger187.debug("Pm25AirQualityServer: after super.initialize()");
176144
+ logger188.debug("Pm25AirQualityServer: after super.initialize()");
176020
176145
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
176021
176146
  this.update(homeAssistant.entity);
176022
176147
  this.reactTo(homeAssistant.onChange, this.update);
@@ -176396,7 +176521,7 @@ init_home_assistant_entity_behavior();
176396
176521
  init_dist();
176397
176522
  init_esm();
176398
176523
  init_home_assistant_entity_behavior();
176399
- var logger188 = Logger.get("VacuumIdentifyServer");
176524
+ var logger189 = Logger.get("VacuumIdentifyServer");
176400
176525
  var VacuumIdentifyServer = class extends IdentifyServer2 {
176401
176526
  triggerEffect(effect) {
176402
176527
  this.#locate("triggerEffect");
@@ -176413,11 +176538,11 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
176413
176538
  const features2 = homeAssistant.entity.state.attributes.supported_features ?? 0;
176414
176539
  const hasLocate = testBit(features2, VacuumDeviceFeature.LOCATE);
176415
176540
  if (!hasLocate) {
176416
- logger188.warn(
176541
+ logger189.warn(
176417
176542
  `${source} for ${homeAssistant.entityId} \u2014 LOCATE not in supported_features (${features2}), calling vacuum.locate anyway`
176418
176543
  );
176419
176544
  } else {
176420
- logger188.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
176545
+ logger189.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
176421
176546
  }
176422
176547
  homeAssistant.callAction({ action: "vacuum.locate" });
176423
176548
  }
@@ -176436,7 +176561,7 @@ init_rvc_run_mode();
176436
176561
 
176437
176562
  // src/matter/behaviors/rvc-run-mode-server.ts
176438
176563
  init_home_assistant_entity_behavior();
176439
- var logger189 = Logger.get("RvcRunModeServer");
176564
+ var logger190 = Logger.get("RvcRunModeServer");
176440
176565
  var ROOM_MODE_BASE = 100;
176441
176566
  function isRoomMode(mode) {
176442
176567
  return mode >= ROOM_MODE_BASE;
@@ -176517,7 +176642,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
176517
176642
  const s = getSession(this.endpoint);
176518
176643
  if (s.loggedShortCircuits.has(reason)) return;
176519
176644
  s.loggedShortCircuits.add(reason);
176520
- logger189.info(message);
176645
+ logger190.info(message);
176521
176646
  }
176522
176647
  /**
176523
176648
  * Read the currentRoomEntity sensor and update currentArea + progress
@@ -176578,7 +176703,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
176578
176703
  }
176579
176704
  }
176580
176705
  if (matchedAreaId === null) {
176581
- logger189.info(
176706
+ logger190.info(
176582
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(", ")}]`
176583
176708
  );
176584
176709
  return;
@@ -176588,14 +176713,14 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
176588
176713
  s.completedAreas.add(s.lastCurrentArea);
176589
176714
  }
176590
176715
  s.lastCurrentArea = matchedAreaId;
176591
- logger189.info(
176716
+ logger190.info(
176592
176717
  `currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
176593
176718
  );
176594
176719
  this.trySetCurrentArea(matchedAreaId);
176595
176720
  } catch (e) {
176596
176721
  const msg = e instanceof Error ? e.message : String(e);
176597
176722
  if (!msg.includes("No provider for") && !msg.includes("not supported")) {
176598
- logger189.warn(`currentRoom sensor update failed: ${msg}`);
176723
+ logger190.warn(`currentRoom sensor update failed: ${msg}`);
176599
176724
  }
176600
176725
  }
176601
176726
  }
@@ -176610,7 +176735,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
176610
176735
  const serviceArea = this.agent.get(ServiceAreaBehavior);
176611
176736
  if (serviceArea.state.currentArea !== areaId) {
176612
176737
  serviceArea.state.currentArea = areaId;
176613
- logger189.debug(`currentArea set to ${areaId}`);
176738
+ logger190.debug(`currentArea set to ${areaId}`);
176614
176739
  }
176615
176740
  this.updateProgress(serviceArea, areaId);
176616
176741
  } catch {
@@ -176958,14 +177083,14 @@ init_esm();
176958
177083
 
176959
177084
  // src/matter/behaviors/service-area-server.ts
176960
177085
  init_esm();
176961
- var logger190 = Logger.get("ServiceAreaServer");
177086
+ var logger191 = Logger.get("ServiceAreaServer");
176962
177087
  var ServiceAreaWithProgress = ServiceAreaBehavior.with(
176963
177088
  ServiceArea3.Feature.ProgressReporting
176964
177089
  );
176965
177090
  var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
176966
177091
  selectAreas(request) {
176967
177092
  const { newAreas } = request;
176968
- logger190.info(
177093
+ logger191.info(
176969
177094
  `ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
176970
177095
  );
176971
177096
  const uniqueAreas = [...new Set(newAreas)];
@@ -176974,7 +177099,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
176974
177099
  (id) => !supportedAreaIds.includes(id)
176975
177100
  );
176976
177101
  if (invalidAreas.length > 0) {
176977
- logger190.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
177102
+ logger191.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
176978
177103
  return {
176979
177104
  status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
176980
177105
  statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
@@ -176985,7 +177110,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
176985
177110
  areaId,
176986
177111
  status: ServiceArea3.OperationalStatus.Pending
176987
177112
  }));
176988
- logger190.info(
177113
+ logger191.info(
176989
177114
  `ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
176990
177115
  );
176991
177116
  return {
@@ -177006,7 +177131,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
177006
177131
  ServiceAreaServerBase2.State = State;
177007
177132
  })(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
177008
177133
  function ServiceAreaServer2(initialState) {
177009
- logger190.info(
177134
+ logger191.info(
177010
177135
  `Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
177011
177136
  );
177012
177137
  return ServiceAreaServerBase.set({
@@ -177023,7 +177148,7 @@ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
177023
177148
  var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
177024
177149
  selectAreas(request) {
177025
177150
  const { newAreas } = request;
177026
- logger190.info(
177151
+ logger191.info(
177027
177152
  `ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
177028
177153
  );
177029
177154
  const uniqueAreas = [...new Set(newAreas)];
@@ -177032,7 +177157,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
177032
177157
  (id) => !supportedAreaIds.includes(id)
177033
177158
  );
177034
177159
  if (invalidAreas.length > 0) {
177035
- logger190.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
177160
+ logger191.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
177036
177161
  return {
177037
177162
  status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
177038
177163
  statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
@@ -177043,7 +177168,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
177043
177168
  areaId,
177044
177169
  status: ServiceArea3.OperationalStatus.Pending
177045
177170
  }));
177046
- logger190.info(
177171
+ logger191.info(
177047
177172
  `ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
177048
177173
  );
177049
177174
  return {
@@ -177064,14 +177189,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
177064
177189
  ServiceAreaServerWithMapsBase2.State = State;
177065
177190
  })(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
177066
177191
  function ServiceAreaServerWithMaps(initialState) {
177067
- logger190.info(
177192
+ logger191.info(
177068
177193
  `Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
177069
177194
  );
177070
177195
  for (const map of initialState.supportedMaps) {
177071
177196
  const areaCount = initialState.supportedAreas.filter(
177072
177197
  (a) => a.mapId === map.mapId
177073
177198
  ).length;
177074
- logger190.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
177199
+ logger191.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
177075
177200
  }
177076
177201
  return ServiceAreaServerWithMapsBase.set({
177077
177202
  supportedAreas: initialState.supportedAreas,
@@ -177083,7 +177208,7 @@ function ServiceAreaServerWithMaps(initialState) {
177083
177208
  }
177084
177209
 
177085
177210
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
177086
- var logger191 = Logger.get("VacuumServiceAreaServer");
177211
+ var logger192 = Logger.get("VacuumServiceAreaServer");
177087
177212
  function toAreaId(roomId) {
177088
177213
  if (typeof roomId === "number") {
177089
177214
  return roomId;
@@ -177162,13 +177287,13 @@ function createVacuumServiceAreaServer(attributes7, roomEntities, includeUnnamed
177162
177287
  let rooms;
177163
177288
  if (roomEntities && roomEntities.length > 0) {
177164
177289
  rooms = buttonEntitiesToRooms(roomEntities, attributes7);
177165
- logger191.info(
177290
+ logger192.info(
177166
177291
  `Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
177167
177292
  );
177168
177293
  } else {
177169
177294
  rooms = parseVacuumRooms(attributes7, includeUnnamedRooms);
177170
177295
  if (rooms.length > 0) {
177171
- logger191.info(
177296
+ logger192.info(
177172
177297
  `Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
177173
177298
  );
177174
177299
  }
@@ -177222,7 +177347,7 @@ function createCustomServiceAreaServer(customAreas) {
177222
177347
  landmarkInfo: null
177223
177348
  }
177224
177349
  }));
177225
- logger191.info(
177350
+ logger192.info(
177226
177351
  `Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
177227
177352
  );
177228
177353
  return ServiceAreaServer2({
@@ -177244,7 +177369,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
177244
177369
  landmarkInfo: null
177245
177370
  }
177246
177371
  }));
177247
- logger191.info(
177372
+ logger192.info(
177248
177373
  `Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
177249
177374
  );
177250
177375
  return ServiceAreaServer2({
@@ -177255,11 +177380,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
177255
177380
  }
177256
177381
 
177257
177382
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
177258
- var logger192 = Logger.get("VacuumRvcRunModeServer");
177383
+ var logger193 = Logger.get("VacuumRvcRunModeServer");
177259
177384
  function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
177260
177385
  const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
177261
177386
  const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
177262
- logger192.info(
177387
+ logger193.info(
177263
177388
  `Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
177264
177389
  );
177265
177390
  return {
@@ -177321,12 +177446,12 @@ function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, ser
177321
177446
  const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
177322
177447
  serviceArea.state.selectedAreas = [];
177323
177448
  if (matched.length === 0) {
177324
- logger192.warn(
177449
+ logger193.warn(
177325
177450
  `Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
177326
177451
  );
177327
177452
  return { action: "vacuum.start" };
177328
177453
  }
177329
- logger192.info(
177454
+ logger193.info(
177330
177455
  `Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
177331
177456
  );
177332
177457
  for (let i = 1; i < matched.length; i++) {
@@ -177366,7 +177491,7 @@ var vacuumRvcRunModeConfig = {
177366
177491
  VacuumState.paused
177367
177492
  ];
177368
177493
  const isCleaning = cleaningStates.includes(state);
177369
- logger192.debug(
177494
+ logger193.debug(
177370
177495
  `Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
177371
177496
  );
177372
177497
  return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
@@ -177398,7 +177523,7 @@ var vacuumRvcRunModeConfig = {
177398
177523
  const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
177399
177524
  serviceArea.state.selectedAreas = [];
177400
177525
  if (haAreaIds.length > 0) {
177401
- logger192.info(
177526
+ logger193.info(
177402
177527
  `CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
177403
177528
  );
177404
177529
  return {
@@ -177419,7 +177544,7 @@ var vacuumRvcRunModeConfig = {
177419
177544
  }
177420
177545
  }
177421
177546
  if (buttonEntityIds.length > 0) {
177422
- logger192.info(
177547
+ logger193.info(
177423
177548
  `Roborock: Pressing button entities for selected rooms: ${buttonEntityIds.join(", ")}`
177424
177549
  );
177425
177550
  serviceArea.state.selectedAreas = [];
@@ -177457,7 +177582,7 @@ var vacuumRvcRunModeConfig = {
177457
177582
  }
177458
177583
  }
177459
177584
  if (roomIds.length > 0) {
177460
- logger192.info(
177585
+ logger193.info(
177461
177586
  `Starting cleaning with selected areas: ${roomIds.join(", ")}`
177462
177587
  );
177463
177588
  serviceArea.state.selectedAreas = [];
@@ -177465,7 +177590,7 @@ var vacuumRvcRunModeConfig = {
177465
177590
  if (targetMapName) {
177466
177591
  const vacName = vacuumEntityId.replace("vacuum.", "");
177467
177592
  const selectedMapEntity = `select.${vacName}_selected_map`;
177468
- logger192.info(
177593
+ logger193.info(
177469
177594
  `Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
177470
177595
  );
177471
177596
  homeAssistant.callAction({
@@ -177492,7 +177617,7 @@ var vacuumRvcRunModeConfig = {
177492
177617
  }
177493
177618
  if (isEcovacsVacuum(attributes7)) {
177494
177619
  const roomIdStr = roomIds.join(",");
177495
- logger192.info(
177620
+ logger193.info(
177496
177621
  `Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
177497
177622
  );
177498
177623
  return {
@@ -177507,14 +177632,14 @@ var vacuumRvcRunModeConfig = {
177507
177632
  }
177508
177633
  };
177509
177634
  }
177510
- logger192.warn(
177635
+ logger193.warn(
177511
177636
  `Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
177512
177637
  );
177513
177638
  }
177514
177639
  }
177515
177640
  } catch {
177516
177641
  }
177517
- logger192.info("Starting regular cleaning (no areas selected)");
177642
+ logger193.info("Starting regular cleaning (no areas selected)");
177518
177643
  return { action: "vacuum.start" };
177519
177644
  },
177520
177645
  returnToBase: () => ({ action: "vacuum.return_to_base" }),
@@ -177529,7 +177654,7 @@ var vacuumRvcRunModeConfig = {
177529
177654
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
177530
177655
  const entity = homeAssistant.entity;
177531
177656
  const attributes7 = entity.state.attributes;
177532
- logger192.info(`cleanRoom called: roomMode=${roomMode}`);
177657
+ logger193.info(`cleanRoom called: roomMode=${roomMode}`);
177533
177658
  const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
177534
177659
  if (cleanAreaRooms && cleanAreaRooms.length > 0) {
177535
177660
  const sorted = [...cleanAreaRooms].sort(
@@ -177538,7 +177663,7 @@ var vacuumRvcRunModeConfig = {
177538
177663
  const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
177539
177664
  if (areaIndex >= 0 && areaIndex < sorted.length) {
177540
177665
  const area = sorted[areaIndex];
177541
- logger192.info(
177666
+ logger193.info(
177542
177667
  `cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
177543
177668
  );
177544
177669
  return {
@@ -177555,7 +177680,7 @@ var vacuumRvcRunModeConfig = {
177555
177680
  const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
177556
177681
  if (areaIndex >= 0 && areaIndex < sorted.length) {
177557
177682
  const area = sorted[areaIndex];
177558
- logger192.info(
177683
+ logger193.info(
177559
177684
  `cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
177560
177685
  );
177561
177686
  return {
@@ -177576,7 +177701,7 @@ var vacuumRvcRunModeConfig = {
177576
177701
  }
177577
177702
  const rooms = parseVacuumRooms(attributes7);
177578
177703
  const numericIdFromMode = getRoomIdFromMode(roomMode);
177579
- logger192.info(
177704
+ logger193.info(
177580
177705
  `cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
177581
177706
  );
177582
177707
  const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
@@ -177586,7 +177711,7 @@ var vacuumRvcRunModeConfig = {
177586
177711
  if (room.mapName) {
177587
177712
  const vacuumName = vacuumEntityId.replace("vacuum.", "");
177588
177713
  const selectedMapEntity = `select.${vacuumName}_selected_map`;
177589
- logger192.info(
177714
+ logger193.info(
177590
177715
  `Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
177591
177716
  );
177592
177717
  homeAssistant.callAction({
@@ -177595,7 +177720,7 @@ var vacuumRvcRunModeConfig = {
177595
177720
  data: { option: room.mapName }
177596
177721
  });
177597
177722
  }
177598
- logger192.debug(
177723
+ logger193.debug(
177599
177724
  `Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
177600
177725
  );
177601
177726
  return {
@@ -177606,7 +177731,7 @@ var vacuumRvcRunModeConfig = {
177606
177731
  };
177607
177732
  }
177608
177733
  if (isRoborockVacuum(attributes7) || isXiaomiMiotVacuum(attributes7)) {
177609
- logger192.debug(
177734
+ logger193.debug(
177610
177735
  `Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
177611
177736
  );
177612
177737
  return {
@@ -177619,7 +177744,7 @@ var vacuumRvcRunModeConfig = {
177619
177744
  }
177620
177745
  if (isEcovacsVacuum(attributes7)) {
177621
177746
  const roomIdStr = String(commandId3);
177622
- logger192.info(
177747
+ logger193.info(
177623
177748
  `Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
177624
177749
  );
177625
177750
  return {
@@ -177634,7 +177759,7 @@ var vacuumRvcRunModeConfig = {
177634
177759
  }
177635
177760
  };
177636
177761
  }
177637
- logger192.warn(
177762
+ logger193.warn(
177638
177763
  `Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
177639
177764
  );
177640
177765
  }
@@ -177650,20 +177775,20 @@ function createVacuumRvcRunModeServer(attributes7, includeUnnamedRooms = false,
177650
177775
  includeUnnamedRooms,
177651
177776
  customAreas
177652
177777
  );
177653
- logger192.info(
177778
+ logger193.info(
177654
177779
  `Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
177655
177780
  );
177656
177781
  if (rooms.length > 0) {
177657
- logger192.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
177782
+ logger193.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
177658
177783
  }
177659
177784
  if (filteredCount > 0) {
177660
177785
  const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
177661
- logger192.info(
177786
+ logger193.info(
177662
177787
  `Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
177663
177788
  );
177664
177789
  }
177665
177790
  if (allRooms.length === 0) {
177666
- logger192.debug(
177791
+ logger193.debug(
177667
177792
  `No rooms found. Attributes: rooms=${JSON.stringify(attributes7.rooms)}, segments=${JSON.stringify(attributes7.segments)}, room_list=${attributes7.room_list}`
177668
177793
  );
177669
177794
  }
@@ -177697,7 +177822,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
177697
177822
  modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
177698
177823
  });
177699
177824
  }
177700
- logger192.info(
177825
+ logger193.info(
177701
177826
  `Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
177702
177827
  );
177703
177828
  return RvcRunModeServer2(vacuumRvcRunModeConfig, {
@@ -177758,7 +177883,7 @@ init_rvc_clean_mode();
177758
177883
 
177759
177884
  // src/matter/behaviors/rvc-clean-mode-server.ts
177760
177885
  init_home_assistant_entity_behavior();
177761
- var logger193 = Logger.get("RvcCleanModeServerBase");
177886
+ var logger194 = Logger.get("RvcCleanModeServerBase");
177762
177887
  var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
177763
177888
  // Pending mode from a recent changeToMode command.
177764
177889
  // Prevents stale HA state (from a different entity like select.xxx)
@@ -177801,14 +177926,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
177801
177926
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
177802
177927
  const { newMode } = request;
177803
177928
  if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
177804
- logger193.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
177929
+ logger194.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
177805
177930
  return {
177806
177931
  status: ModeBase3.ModeChangeStatus.UnsupportedMode,
177807
177932
  statusText: `Unsupported mode: ${newMode}`
177808
177933
  };
177809
177934
  }
177810
177935
  const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
177811
- logger193.info(
177936
+ logger194.info(
177812
177937
  `changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
177813
177938
  );
177814
177939
  this.pendingMode = newMode;
@@ -177816,7 +177941,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
177816
177941
  this.state.currentMode = newMode;
177817
177942
  const action = this.state.config.setCleanMode(newMode, this.agent);
177818
177943
  if (action) {
177819
- logger193.info(
177944
+ logger194.info(
177820
177945
  `changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
177821
177946
  );
177822
177947
  homeAssistant.callAction(action);
@@ -177849,7 +177974,7 @@ function RvcCleanModeServer2(config10, initialState) {
177849
177974
  }
177850
177975
 
177851
177976
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
177852
- var logger194 = Logger.get("VacuumRvcCleanModeServer");
177977
+ var logger195 = Logger.get("VacuumRvcCleanModeServer");
177853
177978
  var MODE_VACUUM = 0;
177854
177979
  var MODE_VACUUM_AND_MOP = 1;
177855
177980
  var MODE_MOP = 2;
@@ -178148,7 +178273,7 @@ function findMatchingCleanOption(ct, availableOptions) {
178148
178273
  if (match) return match;
178149
178274
  }
178150
178275
  }
178151
- logger194.warn(
178276
+ logger195.warn(
178152
178277
  `No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
178153
178278
  );
178154
178279
  return aliases[0];
@@ -178157,7 +178282,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
178157
178282
  const selectEntityId = getCleaningModeSelectEntity(agent);
178158
178283
  const { options } = readSelectEntity(selectEntityId, agent);
178159
178284
  const optionToUse = findMatchingCleanOption(targetCleanType, options);
178160
- logger194.info(
178285
+ logger195.info(
178161
178286
  `Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
178162
178287
  );
178163
178288
  return {
@@ -178246,7 +178371,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178246
178371
  }
178247
178372
  }
178248
178373
  if (speedMode !== void 0) {
178249
- logger194.debug(
178374
+ logger195.debug(
178250
178375
  `Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
178251
178376
  );
178252
178377
  return speedMode;
@@ -178267,7 +178392,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178267
178392
  }
178268
178393
  }
178269
178394
  if (mopMode !== void 0) {
178270
- logger194.debug(
178395
+ logger195.debug(
178271
178396
  `Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
178272
178397
  );
178273
178398
  return mopMode;
@@ -178285,14 +178410,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178285
178410
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
178286
178411
  const vacuumEntityId = homeAssistant.entityId;
178287
178412
  const mapping = homeAssistant.state.mapping;
178288
- logger194.info(
178413
+ logger195.info(
178289
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 ?? {})}`
178290
178415
  );
178291
178416
  if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
178292
178417
  const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
178293
178418
  const mopName = mopIntensityList[mopIndex];
178294
178419
  if (!mopName) {
178295
- logger194.warn(`Invalid mop intensity mode index: ${mopIndex}`);
178420
+ logger195.warn(`Invalid mop intensity mode index: ${mopIndex}`);
178296
178421
  return void 0;
178297
178422
  }
178298
178423
  if (hasCleanTypes) {
@@ -178305,18 +178430,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178305
178430
  mapping.mopIntensityEntity,
178306
178431
  agent
178307
178432
  );
178308
- logger194.info(
178433
+ logger195.info(
178309
178434
  `Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
178310
178435
  );
178311
178436
  let option = matchMopIntensityOption(mopName, options);
178312
178437
  if (!option && options && mopIndex < options.length) {
178313
178438
  option = options[mopIndex];
178314
- logger194.info(
178439
+ logger195.info(
178315
178440
  `Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
178316
178441
  );
178317
178442
  }
178318
178443
  if (option) {
178319
- logger194.info(
178444
+ logger195.info(
178320
178445
  `Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
178321
178446
  );
178322
178447
  return {
@@ -178325,11 +178450,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178325
178450
  target: mapping.mopIntensityEntity
178326
178451
  };
178327
178452
  }
178328
- logger194.warn(
178453
+ logger195.warn(
178329
178454
  `No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
178330
178455
  );
178331
178456
  } else {
178332
- logger194.warn(
178457
+ logger195.warn(
178333
178458
  `Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
178334
178459
  );
178335
178460
  }
@@ -178339,7 +178464,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178339
178464
  const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
178340
178465
  const fanSpeedName = fanSpeedList[fanSpeedIndex];
178341
178466
  if (!fanSpeedName) {
178342
- logger194.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
178467
+ logger195.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
178343
178468
  return void 0;
178344
178469
  }
178345
178470
  if (mapping?.suctionLevelEntity) {
@@ -178352,7 +178477,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178352
178477
  mapping.suctionLevelEntity,
178353
178478
  agent
178354
178479
  );
178355
- logger194.info(
178480
+ logger195.info(
178356
178481
  `Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
178357
178482
  );
178358
178483
  let option = matchFanSpeedOption(
@@ -178362,12 +178487,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178362
178487
  );
178363
178488
  if (!option && options && fanSpeedIndex < options.length) {
178364
178489
  option = options[fanSpeedIndex];
178365
- logger194.info(
178490
+ logger195.info(
178366
178491
  `Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
178367
178492
  );
178368
178493
  }
178369
178494
  if (option) {
178370
- logger194.info(
178495
+ logger195.info(
178371
178496
  `Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
178372
178497
  );
178373
178498
  return {
@@ -178376,7 +178501,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178376
178501
  target: mapping.suctionLevelEntity
178377
178502
  };
178378
178503
  }
178379
- logger194.warn(
178504
+ logger195.warn(
178380
178505
  `No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
178381
178506
  );
178382
178507
  return void 0;
@@ -178386,7 +178511,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178386
178511
  buildCleaningModeAction(0 /* Sweeping */, agent)
178387
178512
  );
178388
178513
  }
178389
- logger194.info(
178514
+ logger195.info(
178390
178515
  `Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
178391
178516
  );
178392
178517
  return {
@@ -178396,7 +178521,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178396
178521
  };
178397
178522
  }
178398
178523
  if (!hasCleanTypes) {
178399
- logger194.debug(
178524
+ logger195.debug(
178400
178525
  `Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
178401
178526
  );
178402
178527
  return void 0;
@@ -178408,7 +178533,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
178408
178533
  agent
178409
178534
  );
178410
178535
  const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
178411
- logger194.info(
178536
+ logger195.info(
178412
178537
  `Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
178413
178538
  );
178414
178539
  return {
@@ -178426,10 +178551,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
178426
178551
  cleaningModeOptions,
178427
178552
  customFanSpeedTags
178428
178553
  );
178429
- logger194.info(
178554
+ logger195.info(
178430
178555
  `Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
178431
178556
  );
178432
- logger194.info(
178557
+ logger195.info(
178433
178558
  `Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
178434
178559
  );
178435
178560
  const initialState = {
@@ -178507,7 +178632,7 @@ init_rvc_operational_state();
178507
178632
  init_home_assistant_entity_behavior();
178508
178633
  var OperationalState4 = RvcOperationalState3.OperationalState;
178509
178634
  var ErrorState = RvcOperationalState3.ErrorState;
178510
- var logger195 = Logger.get("RvcOperationalStateServer");
178635
+ var logger196 = Logger.get("RvcOperationalStateServer");
178511
178636
  var activeStates = /* @__PURE__ */ new Set([
178512
178637
  OperationalState4.Running,
178513
178638
  OperationalState4.SeekingCharger
@@ -178556,7 +178681,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
178556
178681
  { force: true }
178557
178682
  );
178558
178683
  if (activeStates.has(previousState) && !activeStates.has(newState)) {
178559
- logger195.info(
178684
+ logger196.info(
178560
178685
  `Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
178561
178686
  );
178562
178687
  try {
@@ -178569,7 +178694,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
178569
178694
  this.context
178570
178695
  );
178571
178696
  } catch (e) {
178572
- logger195.debug("Failed to emit operationCompletion event:", e);
178697
+ logger196.debug("Failed to emit operationCompletion event:", e);
178573
178698
  }
178574
178699
  }
178575
178700
  }
@@ -178604,7 +178729,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
178604
178729
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
178605
178730
  homeAssistant.callAction(goHomeAction(void 0, this.agent));
178606
178731
  } else {
178607
- logger195.warn("GoHome command received but no goHome action configured");
178732
+ logger196.warn("GoHome command received but no goHome action configured");
178608
178733
  }
178609
178734
  return {
178610
178735
  commandResponseState: {
@@ -178624,7 +178749,7 @@ function RvcOperationalStateServer2(config10) {
178624
178749
  }
178625
178750
 
178626
178751
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
178627
- var logger196 = Logger.get("VacuumRvcOperationalStateServer");
178752
+ var logger197 = Logger.get("VacuumRvcOperationalStateServer");
178628
178753
  function isCharging(entity) {
178629
178754
  const attrs = entity.attributes;
178630
178755
  if (attrs.battery_icon?.includes("charging")) return true;
@@ -178666,16 +178791,16 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
178666
178791
  operationalState = RvcOperationalState3.OperationalState.Error;
178667
178792
  } else {
178668
178793
  if (state.toLowerCase().includes("clean")) {
178669
- logger196.info(
178794
+ logger197.info(
178670
178795
  `Unknown vacuum state "${state}" contains 'clean', treating as Running`
178671
178796
  );
178672
178797
  operationalState = RvcOperationalState3.OperationalState.Running;
178673
178798
  } else {
178674
- logger196.info(`Unknown vacuum state "${state}", treating as Stopped`);
178799
+ logger197.info(`Unknown vacuum state "${state}", treating as Stopped`);
178675
178800
  operationalState = RvcOperationalState3.OperationalState.Stopped;
178676
178801
  }
178677
178802
  }
178678
- logger196.debug(
178803
+ logger197.debug(
178679
178804
  `Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
178680
178805
  );
178681
178806
  return operationalState;
@@ -178696,7 +178821,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
178696
178821
  });
178697
178822
 
178698
178823
  // src/matter/endpoints/legacy/vacuum/index.ts
178699
- var logger197 = Logger.get("VacuumDevice");
178824
+ var logger198 = Logger.get("VacuumDevice");
178700
178825
  var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
178701
178826
  BasicInformationServer2,
178702
178827
  VacuumIdentifyServer,
@@ -178710,7 +178835,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
178710
178835
  const entityId = homeAssistantEntity.entity.entity_id;
178711
178836
  const attributes7 = homeAssistantEntity.entity.state.attributes;
178712
178837
  const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
178713
- logger197.info(
178838
+ logger198.info(
178714
178839
  `Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
178715
178840
  );
178716
178841
  const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
@@ -178722,32 +178847,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
178722
178847
  )
178723
178848
  ).set({ homeAssistantEntity });
178724
178849
  if (includeOnOff) {
178725
- logger197.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
178850
+ logger198.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
178726
178851
  device = device.with(VacuumOnOffServer);
178727
178852
  }
178728
178853
  device = device.with(VacuumPowerSourceServer);
178729
178854
  const roomEntities = homeAssistantEntity.mapping?.roomEntities;
178730
178855
  const rooms = parseVacuumRooms(attributes7);
178731
- logger197.info(
178856
+ logger198.info(
178732
178857
  `${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
178733
178858
  );
178734
178859
  if (cleanAreaRooms && cleanAreaRooms.length > 0) {
178735
- logger197.info(
178860
+ logger198.info(
178736
178861
  `${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
178737
178862
  );
178738
178863
  device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
178739
178864
  } else if (customAreas && customAreas.length > 0) {
178740
- logger197.info(
178865
+ logger198.info(
178741
178866
  `${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
178742
178867
  );
178743
178868
  device = device.with(createCustomServiceAreaServer(customAreas));
178744
178869
  } else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
178745
- logger197.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
178870
+ logger198.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
178746
178871
  device = device.with(
178747
178872
  createVacuumServiceAreaServer(attributes7, roomEntities)
178748
178873
  );
178749
178874
  } else {
178750
- logger197.info(`${entityId}: Adding ServiceArea (default single-area)`);
178875
+ logger198.info(`${entityId}: Adding ServiceArea (default single-area)`);
178751
178876
  device = device.with(createDefaultServiceAreaServer());
178752
178877
  }
178753
178878
  const fanSpeedList = resolveFanSpeedList(
@@ -178758,7 +178883,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
178758
178883
  homeAssistantEntity.mapping?.mopIntensityEntity
178759
178884
  );
178760
178885
  if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
178761
- logger197.info(
178886
+ logger198.info(
178762
178887
  `${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
178763
178888
  );
178764
178889
  device = device.with(
@@ -178771,7 +178896,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
178771
178896
  )
178772
178897
  );
178773
178898
  } else {
178774
- logger197.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
178899
+ logger198.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
178775
178900
  device = device.with(createDefaultRvcCleanModeServer());
178776
178901
  }
178777
178902
  return device;
@@ -178937,7 +179062,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
178937
179062
  );
178938
179063
 
178939
179064
  // src/matter/endpoints/legacy/water-heater/index.ts
178940
- var logger198 = Logger.get("WaterHeaterDevice");
179065
+ var logger199 = Logger.get("WaterHeaterDevice");
178941
179066
  var WaterHeaterDeviceType = ThermostatDevice.with(
178942
179067
  BasicInformationServer2,
178943
179068
  IdentifyServer2,
@@ -178953,7 +179078,7 @@ function toMatterTemp2(value) {
178953
179078
  }
178954
179079
  function WaterHeaterDevice(homeAssistantEntity) {
178955
179080
  const attributes7 = homeAssistantEntity.entity.state.attributes;
178956
- logger198.debug(
179081
+ logger199.debug(
178957
179082
  `Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes7.min_temp}, max_temp=${attributes7.max_temp}`
178958
179083
  );
178959
179084
  const minLimit = toMatterTemp2(attributes7.min_temp) ?? 0;
@@ -179114,7 +179239,7 @@ var matterDeviceTypeFactories = {
179114
179239
  };
179115
179240
 
179116
179241
  // src/matter/endpoints/composed/user-composed-endpoint.ts
179117
- var logger199 = Logger.get("UserComposedEndpoint");
179242
+ var logger200 = Logger.get("UserComposedEndpoint");
179118
179243
  function stripBasicInformation(type) {
179119
179244
  const behaviors = { ...type.behaviors };
179120
179245
  delete behaviors.bridgedDeviceBasicInformation;
@@ -179170,7 +179295,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179170
179295
  { vacuumOnOff: registry2.isVacuumOnOffEnabled() }
179171
179296
  );
179172
179297
  if (!primaryType) {
179173
- logger199.warn(
179298
+ logger200.warn(
179174
179299
  `Cannot create endpoint type for primary entity ${primaryEntityId}`
179175
179300
  );
179176
179301
  return void 0;
@@ -179185,7 +179310,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179185
179310
  if (!sub.entityId) continue;
179186
179311
  const subPayload = buildEntityPayload3(registry2, sub.entityId);
179187
179312
  if (!subPayload) {
179188
- logger199.warn(
179313
+ logger200.warn(
179189
179314
  `Cannot find entity state for composed sub-entity ${sub.entityId}`
179190
179315
  );
179191
179316
  continue;
@@ -179196,7 +179321,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179196
179321
  };
179197
179322
  const subType = createLegacyEndpointType(subPayload, subMapping);
179198
179323
  if (!subType) {
179199
- logger199.warn(
179324
+ logger200.warn(
179200
179325
  `Cannot create endpoint type for composed sub-entity ${sub.entityId}`
179201
179326
  );
179202
179327
  continue;
@@ -179209,7 +179334,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179209
179334
  mappedIds.push(sub.entityId);
179210
179335
  }
179211
179336
  if (parts.length < 2) {
179212
- logger199.warn(
179337
+ logger200.warn(
179213
179338
  `User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
179214
179339
  );
179215
179340
  return void 0;
@@ -179232,7 +179357,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179232
179357
  const labels = parts.map(
179233
179358
  (_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
179234
179359
  ).join("+");
179235
- logger199.info(
179360
+ logger200.info(
179236
179361
  `Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
179237
179362
  );
179238
179363
  return endpoint;
@@ -179301,7 +179426,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
179301
179426
  };
179302
179427
 
179303
179428
  // src/matter/endpoints/legacy/legacy-endpoint.ts
179304
- var logger200 = Logger.get("LegacyEndpoint");
179429
+ var logger201 = Logger.get("LegacyEndpoint");
179305
179430
  var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179306
179431
  static async create(registry2, entityId, mapping, pluginDomainMappings) {
179307
179432
  const deviceRegistry = registry2.deviceOf(entityId);
@@ -179311,25 +179436,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179311
179436
  return;
179312
179437
  }
179313
179438
  if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
179314
- logger200.debug(
179439
+ logger201.debug(
179315
179440
  `Skipping ${entityId} - already auto-assigned as battery to another device`
179316
179441
  );
179317
179442
  return;
179318
179443
  }
179319
179444
  if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
179320
- logger200.debug(
179445
+ logger201.debug(
179321
179446
  `Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
179322
179447
  );
179323
179448
  return;
179324
179449
  }
179325
179450
  if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
179326
- logger200.debug(
179451
+ logger201.debug(
179327
179452
  `Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
179328
179453
  );
179329
179454
  return;
179330
179455
  }
179331
179456
  if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
179332
- logger200.debug(
179457
+ logger201.debug(
179333
179458
  `Skipping ${entityId} - already consumed by a composed device`
179334
179459
  );
179335
179460
  return;
@@ -179349,7 +179474,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179349
179474
  humidityEntity: humidityEntityId
179350
179475
  };
179351
179476
  registry2.markHumidityEntityUsed(humidityEntityId);
179352
- logger200.debug(
179477
+ logger201.debug(
179353
179478
  `Auto-assigned humidity ${humidityEntityId} to ${entityId}`
179354
179479
  );
179355
179480
  }
@@ -179368,7 +179493,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179368
179493
  pressureEntity: pressureEntityId
179369
179494
  };
179370
179495
  registry2.markPressureEntityUsed(pressureEntityId);
179371
- logger200.debug(
179496
+ logger201.debug(
179372
179497
  `Auto-assigned pressure ${pressureEntityId} to ${entityId}`
179373
179498
  );
179374
179499
  }
@@ -179386,7 +179511,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179386
179511
  batteryEntity: batteryEntityId
179387
179512
  };
179388
179513
  registry2.markBatteryEntityUsed(batteryEntityId);
179389
- logger200.debug(
179514
+ logger201.debug(
179390
179515
  `Auto-assigned battery ${batteryEntityId} to ${entityId}`
179391
179516
  );
179392
179517
  }
@@ -179404,7 +179529,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179404
179529
  powerEntity: powerEntityId
179405
179530
  };
179406
179531
  registry2.markPowerEntityUsed(powerEntityId);
179407
- logger200.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
179532
+ logger201.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
179408
179533
  }
179409
179534
  }
179410
179535
  }
@@ -179421,7 +179546,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179421
179546
  energyEntity: energyEntityId
179422
179547
  };
179423
179548
  registry2.markEnergyEntityUsed(energyEntityId);
179424
- logger200.debug(
179549
+ logger201.debug(
179425
179550
  `Auto-assigned energy ${energyEntityId} to ${entityId}`
179426
179551
  );
179427
179552
  }
@@ -179437,7 +179562,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179437
179562
  entityId: effectiveMapping?.entityId ?? entityId,
179438
179563
  cleaningModeEntity: vacuumEntities.cleaningModeEntity
179439
179564
  };
179440
- logger200.info(
179565
+ logger201.info(
179441
179566
  `Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
179442
179567
  );
179443
179568
  }
@@ -179447,7 +179572,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179447
179572
  entityId: effectiveMapping?.entityId ?? entityId,
179448
179573
  suctionLevelEntity: vacuumEntities.suctionLevelEntity
179449
179574
  };
179450
- logger200.info(
179575
+ logger201.info(
179451
179576
  `Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
179452
179577
  );
179453
179578
  }
@@ -179457,7 +179582,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179457
179582
  entityId: effectiveMapping?.entityId ?? entityId,
179458
179583
  mopIntensityEntity: vacuumEntities.mopIntensityEntity
179459
179584
  };
179460
- logger200.info(
179585
+ logger201.info(
179461
179586
  `Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
179462
179587
  );
179463
179588
  }
@@ -179467,7 +179592,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179467
179592
  entityId: effectiveMapping?.entityId ?? entityId,
179468
179593
  currentRoomEntity: vacuumEntities.currentRoomEntity
179469
179594
  };
179470
- logger200.info(
179595
+ logger201.info(
179471
179596
  `Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
179472
179597
  );
179473
179598
  }
@@ -179482,7 +179607,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179482
179607
  entityId: effectiveMapping?.entityId ?? entityId,
179483
179608
  cleanAreaRooms
179484
179609
  };
179485
- logger200.info(
179610
+ logger201.info(
179486
179611
  `Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
179487
179612
  );
179488
179613
  }
@@ -179503,7 +179628,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179503
179628
  rooms: roomsObj
179504
179629
  }
179505
179630
  };
179506
- logger200.debug(
179631
+ logger201.debug(
179507
179632
  `Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
179508
179633
  );
179509
179634
  } else {
@@ -179520,7 +179645,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179520
179645
  rooms: roomsObj
179521
179646
  }
179522
179647
  };
179523
- logger200.debug(
179648
+ logger201.debug(
179524
179649
  `Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
179525
179650
  );
179526
179651
  }
@@ -179541,7 +179666,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179541
179666
  if (composed) {
179542
179667
  return composed;
179543
179668
  }
179544
- logger200.warn(
179669
+ logger201.warn(
179545
179670
  `User composed device creation failed for ${entityId}, falling back to standalone`
179546
179671
  );
179547
179672
  }
@@ -179642,11 +179767,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
179642
179767
  }
179643
179768
  if (mappedChanged) {
179644
179769
  this.pendingMappedChange = true;
179645
- logger200.debug(
179770
+ logger201.debug(
179646
179771
  `Mapped entity change detected for ${this.entityId}, forcing update`
179647
179772
  );
179648
179773
  }
179649
- logger200.debug(
179774
+ logger201.debug(
179650
179775
  `State update received for ${this.entityId}: state=${state.state}`
179651
179776
  );
179652
179777
  this.lastState = state;
@@ -179699,7 +179824,7 @@ import {
179699
179824
  getCollection
179700
179825
  } from "home-assistant-js-websocket";
179701
179826
  import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
179702
- var logger201 = Logger.get("SubscribeEntities");
179827
+ var logger202 = Logger.get("SubscribeEntities");
179703
179828
  function processEvent(store, updates) {
179704
179829
  const state = { ...store.state };
179705
179830
  if (updates.a) {
@@ -179725,7 +179850,7 @@ function processEvent(store, updates) {
179725
179850
  for (const entityId in updates.c) {
179726
179851
  let entityState = state[entityId];
179727
179852
  if (!entityState) {
179728
- logger201.warn("Received state update for unknown entity", entityId);
179853
+ logger202.warn("Received state update for unknown entity", entityId);
179729
179854
  continue;
179730
179855
  }
179731
179856
  entityState = { ...entityState };
@@ -179796,7 +179921,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
179796
179921
  // src/services/bridges/entity-isolation-service.ts
179797
179922
  init_esm();
179798
179923
  init_diagnostic_event_bus();
179799
- var logger202 = Logger.get("EntityIsolation");
179924
+ var logger203 = Logger.get("EntityIsolation");
179800
179925
  var EntityIsolationServiceImpl = class {
179801
179926
  isolatedEntities = /* @__PURE__ */ new Map();
179802
179927
  isolationCallbacks = /* @__PURE__ */ new Map();
@@ -179861,13 +179986,13 @@ var EntityIsolationServiceImpl = class {
179861
179986
  }
179862
179987
  const parsed = this.parseEndpointPath(msg);
179863
179988
  if (!parsed) {
179864
- logger202.warn("Could not parse entity from error:", msg);
179989
+ logger203.warn("Could not parse entity from error:", msg);
179865
179990
  return false;
179866
179991
  }
179867
179992
  const { bridgeId, entityName } = parsed;
179868
179993
  const callback = this.isolationCallbacks.get(bridgeId);
179869
179994
  if (!callback) {
179870
- logger202.warn(
179995
+ logger203.warn(
179871
179996
  `No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
179872
179997
  );
179873
179998
  return false;
@@ -179878,7 +180003,7 @@ var EntityIsolationServiceImpl = class {
179878
180003
  }
179879
180004
  const reason = `${classification}. Entity isolated to protect bridge stability.`;
179880
180005
  this.isolatedEntities.set(key, { entityId: entityName, reason });
179881
- logger202.warn(
180006
+ logger203.warn(
179882
180007
  `Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
179883
180008
  );
179884
180009
  diagnosticEventBus.emit("entity_error", `Entity isolated: ${entityName}`, {
@@ -179890,7 +180015,7 @@ var EntityIsolationServiceImpl = class {
179890
180015
  await callback(entityName);
179891
180016
  return true;
179892
180017
  } catch (e) {
179893
- logger202.error(`Failed to isolate entity ${entityName}:`, e);
180018
+ logger203.error(`Failed to isolate entity ${entityName}:`, e);
179894
180019
  return false;
179895
180020
  }
179896
180021
  }
@@ -179956,6 +180081,7 @@ var BridgeEndpointManager = class extends Service {
179956
180081
  mappingFingerprints = /* @__PURE__ */ new Map();
179957
180082
  pluginEndpoints = /* @__PURE__ */ new Map();
179958
180083
  pluginStateUpdating = /* @__PURE__ */ new Set();
180084
+ pluginListeners = /* @__PURE__ */ new Map();
179959
180085
  get failedEntities() {
179960
180086
  const isolated = EntityIsolationService.getIsolatedEntities(this.bridgeId);
179961
180087
  return [...this._failedEntities, ...isolated];
@@ -179995,6 +180121,16 @@ var BridgeEndpointManager = class extends Service {
179995
180121
  }
179996
180122
  };
179997
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
+ }
179998
180134
  const endpoint = this.pluginEndpoints.get(deviceId);
179999
180135
  if (endpoint) {
180000
180136
  try {
@@ -180032,6 +180168,7 @@ var BridgeEndpointManager = class extends Service {
180032
180168
  wirePluginEndpointEvents(device, endpoint) {
180033
180169
  if (!device.onAttributeWrite) return;
180034
180170
  const allEvents = endpoint.events;
180171
+ const listeners = [];
180035
180172
  for (const behaviorId of Object.keys(endpoint.type.behaviors)) {
180036
180173
  if (behaviorId === "pluginDevice") continue;
180037
180174
  const behaviorEvents = allEvents[behaviorId];
@@ -180041,7 +180178,7 @@ var BridgeEndpointManager = class extends Service {
180041
180178
  const observable = behaviorEvents[eventName];
180042
180179
  if (!observable || typeof observable.on !== "function") continue;
180043
180180
  const attrName = eventName.slice(0, -"$Changed".length);
180044
- observable.on((newValue) => {
180181
+ const listener = (newValue) => {
180045
180182
  if (this.pluginStateUpdating.has(device.id)) return;
180046
180183
  device.onAttributeWrite?.(behaviorId, attrName, newValue).catch((e) => {
180047
180184
  this.log.debug(
@@ -180049,9 +180186,14 @@ var BridgeEndpointManager = class extends Service {
180049
180186
  e
180050
180187
  );
180051
180188
  });
180052
- });
180189
+ };
180190
+ observable.on(listener);
180191
+ listeners.push({ observable, listener });
180053
180192
  }
180054
180193
  }
180194
+ if (listeners.length > 0) {
180195
+ this.pluginListeners.set(device.id, listeners);
180196
+ }
180055
180197
  }
180056
180198
  async startPlugins() {
180057
180199
  if (!this.pluginManager) return;
@@ -180344,7 +180486,24 @@ var BridgeEndpointManager = class extends Service {
180344
180486
  this.startObserving();
180345
180487
  }
180346
180488
  }
180489
+ updateInFlight;
180490
+ pendingStates;
180347
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) {
180348
180507
  const startMs = performance.now();
180349
180508
  this.registry.mergeExternalStates(states);
180350
180509
  const endpoints = this.root.parts.map((p) => p);
@@ -180424,6 +180583,7 @@ var BridgeEndpointManager = class extends Service {
180424
180583
  // src/services/bridges/bridge-registry.ts
180425
180584
  init_dist();
180426
180585
  init_esm();
180586
+ init_send_ha_message();
180427
180587
  import { callService as callService2 } from "home-assistant-js-websocket";
180428
180588
  import { keys as keys2, pickBy as pickBy2, values as values3 } from "lodash-es";
180429
180589
  var BridgeRegistry = class _BridgeRegistry {
@@ -180795,7 +180955,7 @@ var BridgeRegistry = class _BridgeRegistry {
180795
180955
  if (!this.client) return [];
180796
180956
  if (!(supportedFeatures & VacuumDeviceFeature.CLEAN_AREA)) return [];
180797
180957
  try {
180798
- const entry = await this.client.connection.sendMessagePromise({
180958
+ const entry = await sendHaMessage(this.client.connection, {
180799
180959
  type: "config/entity_registry/get",
180800
180960
  entity_id: entityId
180801
180961
  });
@@ -180809,7 +180969,7 @@ var BridgeRegistry = class _BridgeRegistry {
180809
180969
  }
180810
180970
  let validSegmentIds;
180811
180971
  try {
180812
- const segmentsResponse = await this.client.connection.sendMessagePromise({
180972
+ const segmentsResponse = await sendHaMessage(this.client.connection, {
180813
180973
  type: "vacuum/get_segments",
180814
180974
  entity_id: entityId
180815
180975
  });
@@ -181108,11 +181268,11 @@ init_diagnostic_event_bus();
181108
181268
  var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
181109
181269
  var DEAD_SESSION_TIMEOUT_MS2 = 6e4;
181110
181270
  var ServerModeBridge = class {
181111
- constructor(logger205, dataProvider, endpointManager, server) {
181271
+ constructor(logger206, dataProvider, endpointManager, server) {
181112
181272
  this.dataProvider = dataProvider;
181113
181273
  this.endpointManager = endpointManager;
181114
181274
  this.server = server;
181115
- this.log = logger205.get(`ServerModeBridge / ${dataProvider.id}`);
181275
+ this.log = logger206.get(`ServerModeBridge / ${dataProvider.id}`);
181116
181276
  }
181117
181277
  dataProvider;
181118
181278
  endpointManager;
@@ -181634,7 +181794,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
181634
181794
  }
181635
181795
 
181636
181796
  // src/matter/endpoints/server-mode-vacuum-endpoint.ts
181637
- var logger203 = Logger.get("ServerModeVacuumEndpoint");
181797
+ var logger204 = Logger.get("ServerModeVacuumEndpoint");
181638
181798
  var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
181639
181799
  static async create(registry2, entityId, mapping) {
181640
181800
  const deviceRegistry = registry2.deviceOf(entityId);
@@ -181644,7 +181804,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181644
181804
  return void 0;
181645
181805
  }
181646
181806
  let effectiveMapping = mapping;
181647
- logger203.info(
181807
+ logger204.info(
181648
181808
  `${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
181649
181809
  );
181650
181810
  if (entity.device_id) {
@@ -181659,15 +181819,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181659
181819
  batteryEntity: batteryEntityId
181660
181820
  };
181661
181821
  registry2.markBatteryEntityUsed(batteryEntityId);
181662
- logger203.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
181822
+ logger204.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
181663
181823
  } else {
181664
181824
  const attrs = state.attributes;
181665
181825
  if (attrs.battery_level != null || attrs.battery != null) {
181666
- logger203.info(
181826
+ logger204.info(
181667
181827
  `${entityId}: No battery entity found, using battery attribute from vacuum state`
181668
181828
  );
181669
181829
  } else {
181670
- logger203.warn(
181830
+ logger204.warn(
181671
181831
  `${entityId}: No battery entity found for device ${entity.device_id}`
181672
181832
  );
181673
181833
  }
@@ -181682,7 +181842,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181682
181842
  entityId: effectiveMapping?.entityId ?? entityId,
181683
181843
  cleaningModeEntity: vacuumEntities.cleaningModeEntity
181684
181844
  };
181685
- logger203.info(
181845
+ logger204.info(
181686
181846
  `${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
181687
181847
  );
181688
181848
  }
@@ -181692,7 +181852,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181692
181852
  entityId: effectiveMapping?.entityId ?? entityId,
181693
181853
  suctionLevelEntity: vacuumEntities.suctionLevelEntity
181694
181854
  };
181695
- logger203.info(
181855
+ logger204.info(
181696
181856
  `${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
181697
181857
  );
181698
181858
  }
@@ -181702,7 +181862,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181702
181862
  entityId: effectiveMapping?.entityId ?? entityId,
181703
181863
  mopIntensityEntity: vacuumEntities.mopIntensityEntity
181704
181864
  };
181705
- logger203.info(
181865
+ logger204.info(
181706
181866
  `${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
181707
181867
  );
181708
181868
  }
@@ -181712,7 +181872,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181712
181872
  entityId: effectiveMapping?.entityId ?? entityId,
181713
181873
  currentRoomEntity: vacuumEntities.currentRoomEntity
181714
181874
  };
181715
- logger203.info(
181875
+ logger204.info(
181716
181876
  `${entityId}: Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity}`
181717
181877
  );
181718
181878
  }
@@ -181727,7 +181887,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181727
181887
  entityId: effectiveMapping?.entityId ?? entityId,
181728
181888
  cleanAreaRooms
181729
181889
  };
181730
- logger203.info(
181890
+ logger204.info(
181731
181891
  `${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
181732
181892
  );
181733
181893
  }
@@ -181748,7 +181908,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181748
181908
  rooms: roomsObj
181749
181909
  }
181750
181910
  };
181751
- logger203.info(
181911
+ logger204.info(
181752
181912
  `${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
181753
181913
  );
181754
181914
  } else {
@@ -181765,14 +181925,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181765
181925
  rooms: roomsObj
181766
181926
  }
181767
181927
  };
181768
- logger203.info(
181928
+ logger204.info(
181769
181929
  `${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
181770
181930
  );
181771
181931
  }
181772
181932
  }
181773
181933
  }
181774
181934
  } else {
181775
- logger203.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
181935
+ logger204.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
181776
181936
  }
181777
181937
  const payload = {
181778
181938
  entity_id: entityId,
@@ -181869,7 +182029,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181869
182029
  try {
181870
182030
  this.keepaliveCounter++;
181871
182031
  const counter = this.keepaliveCounter;
181872
- logger203.info(`Keepalive #${counter} for ${this.entityId}`);
182032
+ logger204.info(`Keepalive #${counter} for ${this.entityId}`);
181873
182033
  const opState = this.stateOf(RvcOperationalStateServer);
181874
182034
  await this.setStateOf(RvcOperationalStateServer, {
181875
182035
  operationalState: opState.operationalState,
@@ -181884,7 +182044,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181884
182044
  currentMode: runMode.currentMode
181885
182045
  });
181886
182046
  }
181887
- logger203.info(`Keepalive #${counter} committed for ${this.entityId}`);
182047
+ logger204.info(`Keepalive #${counter} committed for ${this.entityId}`);
181888
182048
  } catch (e) {
181889
182049
  if (e instanceof TransactionDestroyedError || e instanceof DestroyedDependencyError) {
181890
182050
  return;
@@ -181893,7 +182053,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181893
182053
  if (msg.includes("Endpoint storage inaccessible")) {
181894
182054
  return;
181895
182055
  }
181896
- logger203.warn(`Keepalive failed for ${this.entityId}: ${msg}`);
182056
+ logger204.warn(`Keepalive failed for ${this.entityId}: ${msg}`);
181897
182057
  }
181898
182058
  }
181899
182059
  async updateStates(states) {
@@ -181904,11 +182064,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
181904
182064
  }
181905
182065
  if (mappedChanged) {
181906
182066
  this.pendingMappedChange = true;
181907
- logger203.debug(
182067
+ logger204.debug(
181908
182068
  `Mapped entity change detected for ${this.entityId}, forcing update`
181909
182069
  );
181910
182070
  }
181911
- logger203.debug(
182071
+ logger204.debug(
181912
182072
  `State update received for ${this.entityId}: state=${state.state}`
181913
182073
  );
181914
182074
  this.lastState = state;
@@ -182344,10 +182504,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
182344
182504
  // src/core/ioc/app-environment.ts
182345
182505
  var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182346
182506
  constructor(rootEnv, options) {
182347
- const logger205 = rootEnv.get(LoggerService);
182507
+ const logger206 = rootEnv.get(LoggerService);
182348
182508
  super({
182349
182509
  id: "App",
182350
- log: logger205.get("AppContainer"),
182510
+ log: logger206.get("AppContainer"),
182351
182511
  parent: rootEnv
182352
182512
  });
182353
182513
  this.options = options;
@@ -182361,8 +182521,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182361
182521
  }
182362
182522
  construction;
182363
182523
  async init() {
182364
- const logger205 = this.get(LoggerService);
182365
- this.set(LoggerService, logger205);
182524
+ const logger206 = this.get(LoggerService);
182525
+ this.set(LoggerService, logger206);
182366
182526
  this.set(AppStorage, new AppStorage(await this.load(StorageService)));
182367
182527
  this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
182368
182528
  this.set(
@@ -182379,7 +182539,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182379
182539
  );
182380
182540
  this.set(
182381
182541
  HomeAssistantClient,
182382
- new HomeAssistantClient(logger205, this.options.homeAssistant)
182542
+ new HomeAssistantClient(logger206, this.options.homeAssistant)
182383
182543
  );
182384
182544
  this.set(
182385
182545
  HomeAssistantConfig,
@@ -182387,7 +182547,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182387
182547
  );
182388
182548
  this.set(
182389
182549
  HomeAssistantActions,
182390
- new HomeAssistantActions(logger205, await this.load(HomeAssistantClient))
182550
+ new HomeAssistantActions(logger206, await this.load(HomeAssistantClient))
182391
182551
  );
182392
182552
  this.set(
182393
182553
  HomeAssistantRegistry,
@@ -182423,7 +182583,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
182423
182583
  this.set(
182424
182584
  WebApi,
182425
182585
  new WebApi(
182426
- logger205,
182586
+ logger206,
182427
182587
  await this.load(BridgeService),
182428
182588
  await this.load(HomeAssistantClient),
182429
182589
  await this.load(HomeAssistantRegistry),
@@ -182449,7 +182609,7 @@ init_nodejs();
182449
182609
  init_level_control();
182450
182610
 
182451
182611
  // src/matter/patches/patch-level-control-tlv.ts
182452
- var logger204 = Logger.get("PatchLevelControlTlv");
182612
+ var logger205 = Logger.get("PatchLevelControlTlv");
182453
182613
  function patchLevelControlTlv() {
182454
182614
  let patched = 0;
182455
182615
  const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
@@ -182463,11 +182623,11 @@ function patchLevelControlTlv() {
182463
182623
  patched++;
182464
182624
  }
182465
182625
  if (patched > 0) {
182466
- logger204.info(
182626
+ logger205.info(
182467
182627
  `Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
182468
182628
  );
182469
182629
  } else {
182470
- logger204.warn(
182630
+ logger205.warn(
182471
182631
  "Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
182472
182632
  );
182473
182633
  }
@@ -182569,8 +182729,8 @@ async function startHandler(startOptions, webUiDist) {
182569
182729
  }
182570
182730
  try {
182571
182731
  await Promise.race([
182572
- bridgeService.dispose(),
182573
- new Promise((resolve6) => setTimeout(resolve6, 1e4))
182732
+ appEnvironment.dispose(),
182733
+ new Promise((resolve6) => setTimeout(resolve6, 15e3))
182574
182734
  ]);
182575
182735
  } catch (e) {
182576
182736
  console.warn("Error during graceful shutdown:", e);