@riddix/hamh 2.1.0-alpha.494 → 2.1.0-alpha.496

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.
@@ -165658,13 +165658,150 @@ var WindowCoveringClientConstructor = ClientBehavior(WindowCovering3.Complete);
165658
165658
  var IdentifyServer2 = class extends IdentifyServer {
165659
165659
  };
165660
165660
 
165661
+ // src/matter/endpoints/validate-endpoint-type.ts
165662
+ init_esm();
165663
+ init_esm7();
165664
+ var logger158 = Logger.get("EndpointValidation");
165665
+ function toCamelCase(name) {
165666
+ return name.charAt(0).toLowerCase() + name.slice(1);
165667
+ }
165668
+ function validateEndpointType(endpointType, entityId) {
165669
+ const deviceTypeModel = Matter.deviceTypes.find(
165670
+ (dt) => dt.id === endpointType.deviceType
165671
+ );
165672
+ if (!deviceTypeModel) {
165673
+ return void 0;
165674
+ }
165675
+ const serverClusterReqs = deviceTypeModel.requirements.filter(
165676
+ (r) => r.element === "serverCluster"
165677
+ );
165678
+ const behaviorKeys = new Set(Object.keys(endpointType.behaviors));
165679
+ const missingMandatory = [];
165680
+ const availableOptional = [];
165681
+ const presentClusters = [];
165682
+ for (const req of serverClusterReqs) {
165683
+ const key = toCamelCase(req.name);
165684
+ if (behaviorKeys.has(key)) {
165685
+ presentClusters.push(req.name);
165686
+ } else if (req.isMandatory) {
165687
+ missingMandatory.push(req.name);
165688
+ } else {
165689
+ availableOptional.push(req.name);
165690
+ }
165691
+ }
165692
+ const prefix = entityId ? `[${entityId}] ` : "";
165693
+ if (missingMandatory.length > 0) {
165694
+ logger158.warn(
165695
+ `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): missing mandatory clusters: ${missingMandatory.join(", ")}`
165696
+ );
165697
+ }
165698
+ if (availableOptional.length > 0) {
165699
+ logger158.debug(
165700
+ `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): optional clusters not used: ${availableOptional.join(", ")}`
165701
+ );
165702
+ }
165703
+ return {
165704
+ deviceTypeName: deviceTypeModel.name,
165705
+ deviceTypeId: endpointType.deviceType,
165706
+ missingMandatory,
165707
+ availableOptional,
165708
+ presentClusters
165709
+ };
165710
+ }
165711
+
165661
165712
  // src/plugins/plugin-basic-information-server.ts
165662
165713
  init_esm7();
165663
165714
  import crypto4 from "node:crypto";
165664
165715
 
165716
+ // src/services/bridges/bridge-data-provider.ts
165717
+ init_service();
165718
+ import { values as values2 } from "lodash-es";
165719
+ var BridgeDataProvider = class extends Service {
165720
+ data;
165721
+ constructor(initial) {
165722
+ super("BridgeDataProvider");
165723
+ this.data = Object.assign({}, initial);
165724
+ }
165725
+ /************************************************
165726
+ * BridgeData interface
165727
+ ************************************************/
165728
+ get id() {
165729
+ return this.data.id;
165730
+ }
165731
+ get basicInformation() {
165732
+ return this.data.basicInformation;
165733
+ }
165734
+ get name() {
165735
+ return this.data.name;
165736
+ }
165737
+ get port() {
165738
+ return this.data.port;
165739
+ }
165740
+ get filter() {
165741
+ return this.data.filter;
165742
+ }
165743
+ get featureFlags() {
165744
+ return this.data.featureFlags;
165745
+ }
165746
+ get countryCode() {
165747
+ return this.data.countryCode;
165748
+ }
165749
+ get icon() {
165750
+ return this.data.icon;
165751
+ }
165752
+ get priority() {
165753
+ return this.data.priority;
165754
+ }
165755
+ /************************************************
165756
+ * Functions
165757
+ ************************************************/
165758
+ update(data) {
165759
+ if (this.id !== data.id) {
165760
+ throw new Error("ID of update request does not match bridge data id.");
165761
+ }
165762
+ Object.assign(this.data, data);
165763
+ }
165764
+ /**
165765
+ * @deprecated
165766
+ */
165767
+ withMetadata(status3, serverNode, deviceCount, failedEntities = []) {
165768
+ const commissioning = serverNode.state.commissioning;
165769
+ return {
165770
+ id: this.id,
165771
+ name: this.name,
165772
+ filter: this.filter,
165773
+ port: this.port,
165774
+ featureFlags: this.featureFlags,
165775
+ basicInformation: this.basicInformation,
165776
+ countryCode: this.countryCode,
165777
+ icon: this.icon,
165778
+ priority: this.priority,
165779
+ status: status3.code,
165780
+ statusReason: status3.reason,
165781
+ commissioning: commissioning ? {
165782
+ isCommissioned: commissioning.commissioned,
165783
+ passcode: commissioning.passcode,
165784
+ discriminator: commissioning.discriminator,
165785
+ manualPairingCode: commissioning.pairingCodes.manualPairingCode,
165786
+ qrPairingCode: commissioning.pairingCodes.qrPairingCode,
165787
+ fabrics: values2(commissioning.fabrics).map((fabric) => ({
165788
+ fabricIndex: fabric.fabricIndex,
165789
+ fabricId: Number(fabric.fabricId),
165790
+ nodeId: Number(fabric.nodeId),
165791
+ rootNodeId: Number(fabric.rootNodeId),
165792
+ rootVendorId: fabric.rootVendorId,
165793
+ label: fabric.label
165794
+ }))
165795
+ } : void 0,
165796
+ deviceCount,
165797
+ failedEntities: failedEntities.length > 0 ? failedEntities : void 0
165798
+ };
165799
+ }
165800
+ };
165801
+
165665
165802
  // src/utils/apply-patch-state.ts
165666
165803
  init_esm();
165667
- var logger158 = Logger.get("ApplyPatchState");
165804
+ var logger159 = Logger.get("ApplyPatchState");
165668
165805
  function applyPatchState(state, patch, options) {
165669
165806
  return applyPatch(state, patch, options?.force);
165670
165807
  }
@@ -165691,23 +165828,23 @@ function applyPatch(state, patch, force = false) {
165691
165828
  if (errorMessage.includes(
165692
165829
  "Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
165693
165830
  )) {
165694
- logger158.debug(
165831
+ logger159.debug(
165695
165832
  `Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
165696
165833
  );
165697
165834
  return actualPatch;
165698
165835
  }
165699
165836
  if (errorMessage.includes("synchronous-transaction-conflict")) {
165700
- logger158.warn(
165837
+ logger159.warn(
165701
165838
  `Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
165702
165839
  );
165703
165840
  return actualPatch;
165704
165841
  }
165705
165842
  failedKeys.push(key);
165706
- logger158.warn(`Failed to set property '${key}': ${errorMessage}`);
165843
+ logger159.warn(`Failed to set property '${key}': ${errorMessage}`);
165707
165844
  }
165708
165845
  }
165709
165846
  if (failedKeys.length > 0) {
165710
- logger158.warn(
165847
+ logger159.warn(
165711
165848
  `${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
165712
165849
  );
165713
165850
  }
@@ -165759,8 +165896,9 @@ var PluginBasicInformationServer = class extends BridgedDeviceBasicInformationSe
165759
165896
  await super.initialize();
165760
165897
  const pluginDevice = this.agent.get(PluginDeviceBehavior);
165761
165898
  const device = pluginDevice.device;
165899
+ const { basicInformation } = this.env.get(BridgeDataProvider);
165762
165900
  applyPatchState(this.state, {
165763
- vendorId: VendorId(65521),
165901
+ vendorId: VendorId(basicInformation.vendorId),
165764
165902
  vendorName: truncate(32, pluginDevice.pluginName),
165765
165903
  productName: truncate(32, device.deviceType),
165766
165904
  nodeLabel: truncate(32, device.name),
@@ -165776,7 +165914,7 @@ function truncate(maxLength, value) {
165776
165914
  }
165777
165915
 
165778
165916
  // src/plugins/plugin-device-factory.ts
165779
- var logger159 = Logger.get("PluginDeviceFactory");
165917
+ var logger160 = Logger.get("PluginDeviceFactory");
165780
165918
  var deviceTypeMap = {
165781
165919
  on_off_light: () => OnOffLightDevice.with(
165782
165920
  IdentifyServer2,
@@ -165882,10 +166020,12 @@ var deviceTypeMap = {
165882
166020
  function createPluginEndpointType(deviceType) {
165883
166021
  const factory = deviceTypeMap[deviceType];
165884
166022
  if (!factory) {
165885
- logger159.warn(`Unsupported plugin device type: "${deviceType}"`);
166023
+ logger160.warn(`Unsupported plugin device type: "${deviceType}"`);
165886
166024
  return void 0;
165887
166025
  }
165888
- return factory();
166026
+ const endpoint = factory();
166027
+ validateEndpointType(endpoint, `plugin:${deviceType}`);
166028
+ return endpoint;
165889
166029
  }
165890
166030
  function getSupportedPluginDeviceTypes() {
165891
166031
  return Object.keys(deviceTypeMap);
@@ -165895,7 +166035,7 @@ function getSupportedPluginDeviceTypes() {
165895
166035
  init_esm();
165896
166036
  import * as fs10 from "node:fs";
165897
166037
  import * as path11 from "node:path";
165898
- var logger160 = Logger.get("PluginStorage");
166038
+ var logger161 = Logger.get("PluginStorage");
165899
166039
  var SAVE_DEBOUNCE_MS = 500;
165900
166040
  var FilePluginStorage = class {
165901
166041
  data = {};
@@ -165931,7 +166071,7 @@ var FilePluginStorage = class {
165931
166071
  this.data = JSON.parse(raw);
165932
166072
  }
165933
166073
  } catch (e) {
165934
- logger160.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
166074
+ logger161.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
165935
166075
  this.data = {};
165936
166076
  }
165937
166077
  }
@@ -165953,7 +166093,7 @@ var FilePluginStorage = class {
165953
166093
  fs10.writeFileSync(this.filePath, JSON.stringify(this.data, null, 2));
165954
166094
  this.dirty = false;
165955
166095
  } catch (e) {
165956
- logger160.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
166096
+ logger161.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
165957
166097
  }
165958
166098
  }
165959
166099
  flush() {
@@ -165963,7 +166103,7 @@ var FilePluginStorage = class {
165963
166103
 
165964
166104
  // src/plugins/safe-plugin-runner.ts
165965
166105
  init_esm();
165966
- var logger161 = Logger.get("SafePluginRunner");
166106
+ var logger162 = Logger.get("SafePluginRunner");
165967
166107
  var DEFAULT_TIMEOUT_MS = 1e4;
165968
166108
  var CIRCUIT_BREAKER_THRESHOLD = 3;
165969
166109
  var SafePluginRunner = class {
@@ -165996,7 +166136,7 @@ var SafePluginRunner = class {
165996
166136
  async run(pluginName, operation, fn, timeoutMs = DEFAULT_TIMEOUT_MS) {
165997
166137
  const state = this.getState(pluginName);
165998
166138
  if (state.disabled) {
165999
- logger161.debug(
166139
+ logger162.debug(
166000
166140
  `Plugin "${pluginName}" is disabled (circuit breaker open), skipping ${operation}`
166001
166141
  );
166002
166142
  return void 0;
@@ -166014,13 +166154,13 @@ var SafePluginRunner = class {
166014
166154
  timeout.clear();
166015
166155
  state.failures++;
166016
166156
  state.lastError = error instanceof Error ? error.message : String(error);
166017
- logger161.error(
166157
+ logger162.error(
166018
166158
  `Plugin "${pluginName}" failed during ${operation} (failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
166019
166159
  );
166020
166160
  if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
166021
166161
  state.disabled = true;
166022
166162
  state.disabledAt = Date.now();
166023
- logger161.error(
166163
+ logger162.error(
166024
166164
  `Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures. Last error: ${state.lastError}`
166025
166165
  );
166026
166166
  }
@@ -166042,13 +166182,13 @@ var SafePluginRunner = class {
166042
166182
  } catch (error) {
166043
166183
  state.failures++;
166044
166184
  state.lastError = error instanceof Error ? error.message : String(error);
166045
- logger161.error(
166185
+ logger162.error(
166046
166186
  `Plugin "${pluginName}" failed during ${operation} (sync, failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
166047
166187
  );
166048
166188
  if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
166049
166189
  state.disabled = true;
166050
166190
  state.disabledAt = Date.now();
166051
- logger161.error(
166191
+ logger162.error(
166052
166192
  `Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures.`
166053
166193
  );
166054
166194
  }
@@ -166074,7 +166214,7 @@ var SafePluginRunner = class {
166074
166214
  };
166075
166215
 
166076
166216
  // src/plugins/plugin-manager.ts
166077
- var logger162 = Logger.get("PluginManager");
166217
+ var logger163 = Logger.get("PluginManager");
166078
166218
  var PLUGIN_API_VERSION = 1;
166079
166219
  var MAX_PLUGIN_DEVICE_ID_LENGTH = 100;
166080
166220
  function validatePluginDevice(device) {
@@ -166151,7 +166291,7 @@ var PluginManager = class {
166151
166291
  throw new Error(`Plugin at ${packagePath} package.json missing "main"`);
166152
166292
  }
166153
166293
  if (manifest.hamhPluginApiVersion != null && manifest.hamhPluginApiVersion !== PLUGIN_API_VERSION) {
166154
- logger162.warn(
166294
+ logger163.warn(
166155
166295
  `Plugin "${manifest.name}" declares API version ${manifest.hamhPluginApiVersion}, current is ${PLUGIN_API_VERSION}. It may not work correctly.`
166156
166296
  );
166157
166297
  }
@@ -166182,7 +166322,7 @@ var PluginManager = class {
166182
166322
  };
166183
166323
  await this.register(plugin, metadata);
166184
166324
  } catch (e) {
166185
- logger162.error(`Failed to load external plugin from ${packagePath}:`, e);
166325
+ logger163.error(`Failed to load external plugin from ${packagePath}:`, e);
166186
166326
  throw e;
166187
166327
  }
166188
166328
  }
@@ -166243,7 +166383,7 @@ var PluginManager = class {
166243
166383
  devices,
166244
166384
  started: false
166245
166385
  });
166246
- logger162.info(
166386
+ logger163.info(
166247
166387
  `Registered plugin: ${plugin.name} v${plugin.version} (${metadata.source})`
166248
166388
  );
166249
166389
  }
@@ -166254,13 +166394,13 @@ var PluginManager = class {
166254
166394
  for (const [name, instance] of this.instances) {
166255
166395
  if (!instance.metadata.enabled) continue;
166256
166396
  if (this.runner.isDisabled(name)) {
166257
- logger162.warn(
166397
+ logger163.warn(
166258
166398
  `Plugin "${name}" is disabled (circuit breaker), skipping start`
166259
166399
  );
166260
166400
  instance.metadata.enabled = false;
166261
166401
  continue;
166262
166402
  }
166263
- logger162.info(`Starting plugin: ${name}`);
166403
+ logger163.info(`Starting plugin: ${name}`);
166264
166404
  await this.runner.run(
166265
166405
  name,
166266
166406
  "onStart",
@@ -166308,7 +166448,7 @@ var PluginManager = class {
166308
166448
  storage2.flush();
166309
166449
  }
166310
166450
  instance.started = false;
166311
- logger162.info(`Plugin "${name}" shut down`);
166451
+ logger163.info(`Plugin "${name}" shut down`);
166312
166452
  }
166313
166453
  this.instances.clear();
166314
166454
  }
@@ -167064,92 +167204,6 @@ ${e?.toString()}`);
167064
167204
  }
167065
167205
  };
167066
167206
 
167067
- // src/services/bridges/bridge-data-provider.ts
167068
- init_service();
167069
- import { values as values2 } from "lodash-es";
167070
- var BridgeDataProvider = class extends Service {
167071
- data;
167072
- constructor(initial) {
167073
- super("BridgeDataProvider");
167074
- this.data = Object.assign({}, initial);
167075
- }
167076
- /************************************************
167077
- * BridgeData interface
167078
- ************************************************/
167079
- get id() {
167080
- return this.data.id;
167081
- }
167082
- get basicInformation() {
167083
- return this.data.basicInformation;
167084
- }
167085
- get name() {
167086
- return this.data.name;
167087
- }
167088
- get port() {
167089
- return this.data.port;
167090
- }
167091
- get filter() {
167092
- return this.data.filter;
167093
- }
167094
- get featureFlags() {
167095
- return this.data.featureFlags;
167096
- }
167097
- get countryCode() {
167098
- return this.data.countryCode;
167099
- }
167100
- get icon() {
167101
- return this.data.icon;
167102
- }
167103
- get priority() {
167104
- return this.data.priority;
167105
- }
167106
- /************************************************
167107
- * Functions
167108
- ************************************************/
167109
- update(data) {
167110
- if (this.id !== data.id) {
167111
- throw new Error("ID of update request does not match bridge data id.");
167112
- }
167113
- Object.assign(this.data, data);
167114
- }
167115
- /**
167116
- * @deprecated
167117
- */
167118
- withMetadata(status3, serverNode, deviceCount, failedEntities = []) {
167119
- const commissioning = serverNode.state.commissioning;
167120
- return {
167121
- id: this.id,
167122
- name: this.name,
167123
- filter: this.filter,
167124
- port: this.port,
167125
- featureFlags: this.featureFlags,
167126
- basicInformation: this.basicInformation,
167127
- countryCode: this.countryCode,
167128
- icon: this.icon,
167129
- priority: this.priority,
167130
- status: status3.code,
167131
- statusReason: status3.reason,
167132
- commissioning: commissioning ? {
167133
- isCommissioned: commissioning.commissioned,
167134
- passcode: commissioning.passcode,
167135
- discriminator: commissioning.discriminator,
167136
- manualPairingCode: commissioning.pairingCodes.manualPairingCode,
167137
- qrPairingCode: commissioning.pairingCodes.qrPairingCode,
167138
- fabrics: values2(commissioning.fabrics).map((fabric) => ({
167139
- fabricIndex: fabric.fabricIndex,
167140
- fabricId: Number(fabric.fabricId),
167141
- nodeId: Number(fabric.nodeId),
167142
- rootNodeId: Number(fabric.rootNodeId),
167143
- rootVendorId: fabric.rootVendorId,
167144
- label: fabric.label
167145
- }))
167146
- } : void 0,
167147
- deviceCount,
167148
- failedEntities: failedEntities.length > 0 ? failedEntities : void 0
167149
- };
167150
- }
167151
- };
167152
-
167153
167207
  // src/services/bridges/bridge-endpoint-manager.ts
167154
167208
  init_esm7();
167155
167209
  init_service();
@@ -167410,7 +167464,7 @@ init_home_assistant_entity_behavior();
167410
167464
  // src/matter/behaviors/humidity-measurement-server.ts
167411
167465
  init_esm();
167412
167466
  init_home_assistant_entity_behavior();
167413
- var logger163 = Logger.get("HumidityMeasurementServer");
167467
+ var logger164 = Logger.get("HumidityMeasurementServer");
167414
167468
  var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementServer {
167415
167469
  async initialize() {
167416
167470
  await super.initialize();
@@ -167423,7 +167477,7 @@ var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementSer
167423
167477
  return;
167424
167478
  }
167425
167479
  const humidity = this.getHumidity(this.state.config, entity.state);
167426
- logger163.debug(
167480
+ logger164.debug(
167427
167481
  `Humidity ${entity.state.entity_id} raw=${entity.state.state} measuredValue=${humidity}`
167428
167482
  );
167429
167483
  applyPatchState(this.state, {
@@ -167459,7 +167513,7 @@ init_clusters();
167459
167513
 
167460
167514
  // src/matter/behaviors/power-source-server.ts
167461
167515
  init_home_assistant_entity_behavior();
167462
- var logger164 = Logger.get("PowerSourceServer");
167516
+ var logger165 = Logger.get("PowerSourceServer");
167463
167517
  var FeaturedBase = PowerSourceServer.with("Battery", "Rechargeable");
167464
167518
  var PowerSourceServerBase = class extends FeaturedBase {
167465
167519
  async initialize() {
@@ -167471,17 +167525,17 @@ var PowerSourceServerBase = class extends FeaturedBase {
167471
167525
  applyPatchState(this.state, {
167472
167526
  endpointList: [endpointNumber]
167473
167527
  });
167474
- logger164.debug(
167528
+ logger165.debug(
167475
167529
  `[${entityId}] PowerSource initialized with endpointList=[${endpointNumber}]`
167476
167530
  );
167477
167531
  } else {
167478
- logger164.warn(
167532
+ logger165.warn(
167479
167533
  `[${entityId}] PowerSource endpoint number is null during initialize - endpointList will be empty!`
167480
167534
  );
167481
167535
  }
167482
167536
  const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
167483
167537
  if (batteryEntity) {
167484
- logger164.debug(
167538
+ logger165.debug(
167485
167539
  `[${entityId}] PowerSource using mapped battery entity: ${batteryEntity}`
167486
167540
  );
167487
167541
  }
@@ -167788,7 +167842,7 @@ var OPTIMISTIC_TOLERANCE = 5;
167788
167842
  function notifyLightTurnedOn(entityId) {
167789
167843
  lastTurnOnTimestamps.set(entityId, Date.now());
167790
167844
  }
167791
- var logger165 = Logger.get("LevelControlServer");
167845
+ var logger166 = Logger.get("LevelControlServer");
167792
167846
  var FeaturedBase3 = LevelControlServer.with("OnOff", "Lighting");
167793
167847
  var LevelControlServerBase = class extends FeaturedBase3 {
167794
167848
  pendingTransitionTime;
@@ -167803,12 +167857,12 @@ var LevelControlServerBase = class extends FeaturedBase3 {
167803
167857
  this.state.maxLevel = 254;
167804
167858
  }
167805
167859
  this.state.onLevel = null;
167806
- logger165.debug(`initialize: calling super.initialize()`);
167860
+ logger166.debug(`initialize: calling super.initialize()`);
167807
167861
  try {
167808
167862
  await super.initialize();
167809
- logger165.debug(`initialize: super.initialize() completed successfully`);
167863
+ logger166.debug(`initialize: super.initialize() completed successfully`);
167810
167864
  } catch (error) {
167811
- logger165.error(`initialize: super.initialize() FAILED:`, error);
167865
+ logger166.error(`initialize: super.initialize() FAILED:`, error);
167812
167866
  throw error;
167813
167867
  }
167814
167868
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
@@ -167884,7 +167938,7 @@ var LevelControlServerBase = class extends FeaturedBase3 {
167884
167938
  const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
167885
167939
  const isMaxBrightness = level >= this.maxLevel;
167886
167940
  if (isMaxBrightness && timeSinceTurnOn < 200) {
167887
- logger165.debug(
167941
+ logger166.debug(
167888
167942
  `[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
167889
167943
  );
167890
167944
  return;
@@ -167927,7 +167981,7 @@ function LevelControlServer2(config10) {
167927
167981
  }
167928
167982
 
167929
167983
  // src/matter/behaviors/on-off-server.ts
167930
- var logger166 = Logger.get("OnOffServer");
167984
+ var logger167 = Logger.get("OnOffServer");
167931
167985
  var optimisticOnOffState = /* @__PURE__ */ new Map();
167932
167986
  var OPTIMISTIC_TIMEOUT_MS2 = 3e3;
167933
167987
  var OnOffServerBase = class extends OnOffServer {
@@ -167965,7 +168019,7 @@ var OnOffServerBase = class extends OnOffServer {
167965
168019
  const action = turnOn?.(void 0, this.agent) ?? {
167966
168020
  action: "homeassistant.turn_on"
167967
168021
  };
167968
- logger166.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
168022
+ logger167.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
167969
168023
  notifyLightTurnedOn(homeAssistant.entityId);
167970
168024
  applyPatchState(this.state, { onOff: true });
167971
168025
  optimisticOnOffState.set(homeAssistant.entityId, {
@@ -167987,7 +168041,7 @@ var OnOffServerBase = class extends OnOffServer {
167987
168041
  const action = turnOff?.(void 0, this.agent) ?? {
167988
168042
  action: "homeassistant.turn_off"
167989
168043
  };
167990
- logger166.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
168044
+ logger167.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
167991
168045
  applyPatchState(this.state, { onOff: false });
167992
168046
  optimisticOnOffState.set(homeAssistant.entityId, {
167993
168047
  expectedOnOff: false,
@@ -168018,7 +168072,7 @@ function setOptimisticOnOff(entityId, expectedOnOff) {
168018
168072
  }
168019
168073
 
168020
168074
  // src/matter/behaviors/fan-control-server.ts
168021
- var logger167 = Logger.get("FanControlServer");
168075
+ var logger168 = Logger.get("FanControlServer");
168022
168076
  var defaultStepSize = 33.33;
168023
168077
  var minSpeedMax = 3;
168024
168078
  var maxSpeedMax = 100;
@@ -168377,7 +168431,7 @@ var FanControlServerBase = class extends FeaturedBase4 {
168377
168431
  const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
168378
168432
  setOptimisticOnOff(entityId, on);
168379
168433
  } catch (e) {
168380
- logger167.debug(
168434
+ logger168.debug(
168381
168435
  `syncOnOff(${on}) failed: ${e instanceof Error ? e.message : String(e)}`
168382
168436
  );
168383
168437
  }
@@ -168465,7 +168519,7 @@ var FanOnOffServer = OnOffServer2({
168465
168519
  });
168466
168520
 
168467
168521
  // src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
168468
- var logger168 = Logger.get("ComposedAirPurifierEndpoint");
168522
+ var logger169 = Logger.get("ComposedAirPurifierEndpoint");
168469
168523
  function createTemperatureConfig(temperatureEntityId) {
168470
168524
  return {
168471
168525
  getValue(_entity, agent) {
@@ -168623,7 +168677,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
168623
168677
  config10.humidityEntityId ? "+Hum" : "",
168624
168678
  config10.batteryEntityId ? "+Bat" : ""
168625
168679
  ].filter(Boolean).join("");
168626
- logger168.info(`Created air purifier ${primaryEntityId}: ${clusterLabels}`);
168680
+ logger169.info(`Created air purifier ${primaryEntityId}: ${clusterLabels}`);
168627
168681
  return endpoint;
168628
168682
  }
168629
168683
  constructor(type, entityId, id, trackedEntityIds, mappedEntityIds) {
@@ -168719,7 +168773,7 @@ init_home_assistant_entity_behavior();
168719
168773
  // src/matter/behaviors/pressure-measurement-server.ts
168720
168774
  init_esm();
168721
168775
  init_home_assistant_entity_behavior();
168722
- var logger169 = Logger.get("PressureMeasurementServer");
168776
+ var logger170 = Logger.get("PressureMeasurementServer");
168723
168777
  var MIN_PRESSURE = 300;
168724
168778
  var MAX_PRESSURE = 1100;
168725
168779
  var PressureMeasurementServerBase = class extends PressureMeasurementServer {
@@ -168747,7 +168801,7 @@ var PressureMeasurementServerBase = class extends PressureMeasurementServer {
168747
168801
  }
168748
168802
  const rounded = Math.round(value);
168749
168803
  if (rounded < MIN_PRESSURE || rounded > MAX_PRESSURE) {
168750
- logger169.warn(
168804
+ logger170.warn(
168751
168805
  `Pressure value ${rounded} (raw: ${value}) for ${entity.entity_id} is outside valid range [${MIN_PRESSURE}-${MAX_PRESSURE}], ignoring`
168752
168806
  );
168753
168807
  return null;
@@ -168766,7 +168820,7 @@ function PressureMeasurementServer2(config10) {
168766
168820
  }
168767
168821
 
168768
168822
  // src/matter/endpoints/composed/composed-sensor-endpoint.ts
168769
- var logger170 = Logger.get("ComposedSensorEndpoint");
168823
+ var logger171 = Logger.get("ComposedSensorEndpoint");
168770
168824
  var temperatureConfig = {
168771
168825
  getValue(entity, agent) {
168772
168826
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
@@ -168930,7 +168984,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
168930
168984
  if (config10.pressureEntityId && pressSub) {
168931
168985
  endpoint.subEndpoints.set(config10.pressureEntityId, pressSub);
168932
168986
  }
168933
- logger170.info(
168987
+ logger171.info(
168934
168988
  `Created composed sensor ${primaryEntityId} with ${parts.length} sub-endpoint(s): T${humSub ? "+H" : ""}${pressSub ? "+P" : ""}${config10.batteryEntityId ? "+Bat" : ""}`
168935
168989
  );
168936
168990
  return endpoint;
@@ -168998,57 +169052,6 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
168998
169052
  }
168999
169053
  };
169000
169054
 
169001
- // src/matter/endpoints/validate-endpoint-type.ts
169002
- init_esm();
169003
- init_esm7();
169004
- var logger171 = Logger.get("EndpointValidation");
169005
- function toCamelCase(name) {
169006
- return name.charAt(0).toLowerCase() + name.slice(1);
169007
- }
169008
- function validateEndpointType(endpointType, entityId) {
169009
- const deviceTypeModel = Matter.deviceTypes.find(
169010
- (dt) => dt.id === endpointType.deviceType
169011
- );
169012
- if (!deviceTypeModel) {
169013
- return void 0;
169014
- }
169015
- const serverClusterReqs = deviceTypeModel.requirements.filter(
169016
- (r) => r.element === "serverCluster"
169017
- );
169018
- const behaviorKeys = new Set(Object.keys(endpointType.behaviors));
169019
- const missingMandatory = [];
169020
- const availableOptional = [];
169021
- const presentClusters = [];
169022
- for (const req of serverClusterReqs) {
169023
- const key = toCamelCase(req.name);
169024
- if (behaviorKeys.has(key)) {
169025
- presentClusters.push(req.name);
169026
- } else if (req.isMandatory) {
169027
- missingMandatory.push(req.name);
169028
- } else {
169029
- availableOptional.push(req.name);
169030
- }
169031
- }
169032
- const prefix = entityId ? `[${entityId}] ` : "";
169033
- if (missingMandatory.length > 0) {
169034
- logger171.warn(
169035
- `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): missing mandatory clusters: ${missingMandatory.join(", ")}`
169036
- );
169037
- }
169038
- if (availableOptional.length > 0) {
169039
- logger171.debug(
169040
- `${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): optional clusters not used: ${availableOptional.join(", ")}`
169041
- );
169042
- }
169043
- return {
169044
- deviceTypeName: deviceTypeModel.name,
169045
- deviceTypeId: endpointType.deviceType,
169046
- missingMandatory,
169047
- availableOptional,
169048
- presentClusters
169049
- };
169050
- }
169051
-
169052
169055
  // src/matter/endpoints/legacy/air-purifier/index.ts
169053
169056
  init_dist();
169054
169057
  init_home_assistant_entity_behavior();