@riddix/hamh 2.1.0-alpha.610 → 2.1.0-alpha.612

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.
@@ -146804,6 +146804,12 @@ var init_bridge_config_schema = __esm({
146804
146804
  title: "Vacuum: Include OnOff Cluster (Alexa)",
146805
146805
  description: "Add an OnOff cluster to robot vacuum endpoints. Alexa REQUIRES this (PowerController) to show robotic vacuums in the app. Without it, Alexa commissions the device but never displays it. In Server Mode this is enabled automatically \u2014 only check this for bridge mode. WARNING: OnOff is NOT part of the Matter RVC device type specification. Enabling this may break Apple Home (shows 'Updating') and Google Home.",
146806
146806
  type: "boolean"
146807
+ },
146808
+ alexaPreserveBrightnessOnTurnOn: {
146809
+ title: "Alexa: Preserve Brightness on Turn-On",
146810
+ description: "Workaround for Alexa resetting light brightness to 100% after subscription renewal. When enabled, the bridge ignores brightness commands that set lights to 100% within 200ms of a turn-on command for the same light. WARNING: breaks Apple Home's 'set room to 100%' Siri commands, which use the same on() + moveToLevel(254) pattern. Only enable on Alexa-only bridges.",
146811
+ type: "boolean",
146812
+ default: false
146807
146813
  }
146808
146814
  }
146809
146815
  };
@@ -151559,6 +151565,12 @@ var LoggerService = class {
151559
151565
  this._level = logLevelFromString(options.level ?? "info");
151560
151566
  this._jsonOutput = options.jsonOutput ?? false;
151561
151567
  Logger.level = this.customLogLevelMapping[this._level] ?? this._level;
151568
+ const protocolLevel = logLevelFromString(options.protocolLevel ?? "info");
151569
+ const resolvedProtocolLevel = this.customLogLevelMapping[protocolLevel] ?? protocolLevel;
151570
+ Logger.facilityLevels = {
151571
+ MessageChannel: resolvedProtocolLevel,
151572
+ MessageExchange: resolvedProtocolLevel
151573
+ };
151562
151574
  Logger.format = options.disableColors ? LogFormat.PLAIN : LogFormat.ANSI;
151563
151575
  }
151564
151576
  get(nameOrService) {
@@ -151878,6 +151890,7 @@ var Options = class {
151878
151890
  get logging() {
151879
151891
  return {
151880
151892
  level: this.startOptions.logLevel,
151893
+ protocolLevel: this.startOptions.protocolLogLevel,
151881
151894
  disableColors: this.startOptions.disableLogColors ?? false,
151882
151895
  jsonOutput: this.startOptions.jsonLogs ?? false
151883
151896
  };
@@ -151927,7 +151940,8 @@ var Options = class {
151927
151940
  productName: "MatterHub",
151928
151941
  productLabel: "Home Assistant Matter Hub",
151929
151942
  hardwareVersion: (/* @__PURE__ */ new Date()).getFullYear(),
151930
- softwareVersion: (/* @__PURE__ */ new Date()).getFullYear()
151943
+ softwareVersion: (/* @__PURE__ */ new Date()).getFullYear(),
151944
+ softwareVersionString: resolveAppVersion()
151931
151945
  }
151932
151946
  };
151933
151947
  }
@@ -152176,12 +152190,25 @@ var BridgeService = class extends Service {
152176
152190
  recoveryInterval;
152177
152191
  async initialize() {
152178
152192
  for (const data of this.bridgeStorage.bridges) {
152179
- await this.addBridge(data);
152193
+ const normalized = this.normalizeBridgeData(data);
152194
+ await this.bridgeStorage.add(normalized);
152195
+ await this.addBridge(normalized);
152180
152196
  }
152181
152197
  if (this.autoRecoveryEnabled) {
152182
152198
  this.startAutoRecovery();
152183
152199
  }
152184
152200
  }
152201
+ normalizeBridgeData(bridgeData) {
152202
+ const { basicInformation } = bridgeData;
152203
+ return {
152204
+ ...bridgeData,
152205
+ basicInformation: {
152206
+ ...basicInformation,
152207
+ hardwareVersionString: basicInformation.hardwareVersionString ?? this.props.basicInformation.hardwareVersionString ?? String(basicInformation.hardwareVersion),
152208
+ softwareVersionString: basicInformation.softwareVersionString ?? this.props.basicInformation.softwareVersionString ?? String(basicInformation.softwareVersion)
152209
+ }
152210
+ };
152211
+ }
152185
152212
  startAutoRecovery() {
152186
152213
  const intervalMs = this.props.recoveryIntervalMs ?? 6e4;
152187
152214
  this.recoveryInterval = setInterval(() => {
@@ -165205,6 +165232,8 @@ var ServerModeServerNode = class extends ServerNode {
165205
165232
  serialNumber: `server-${bridgeData.id}`.substring(0, 32),
165206
165233
  hardwareVersion: bridgeData.basicInformation.hardwareVersion,
165207
165234
  softwareVersion: bridgeData.basicInformation.softwareVersion,
165235
+ hardwareVersionString: bridgeData.basicInformation.hardwareVersionString,
165236
+ softwareVersionString: bridgeData.basicInformation.softwareVersionString ?? String(bridgeData.basicInformation.softwareVersion),
165208
165237
  ...bridgeData.countryCode ? { location: bridgeData.countryCode } : {}
165209
165238
  },
165210
165239
  subscriptions: {
@@ -167332,6 +167361,8 @@ function createBridgeServerConfig(data) {
167332
167361
  serialNumber: crypto5.createHash("md5").update(`serial-${data.id}`).digest("hex").substring(0, 32),
167333
167362
  hardwareVersion: data.basicInformation.hardwareVersion,
167334
167363
  softwareVersion: data.basicInformation.softwareVersion,
167364
+ hardwareVersionString: data.basicInformation.hardwareVersionString,
167365
+ softwareVersionString: data.basicInformation.softwareVersionString ?? String(data.basicInformation.softwareVersion),
167335
167366
  ...data.countryCode ? { location: data.countryCode } : {}
167336
167367
  },
167337
167368
  subscriptions: {
@@ -167395,6 +167426,16 @@ var Bridge = class {
167395
167426
  this.dataProvider,
167396
167427
  this.endpointManager.root
167397
167428
  );
167429
+ const { basicInformation } = this.dataProvider;
167430
+ this.log.debugCtx("Root bridge BasicInformation configured", {
167431
+ vendorName: basicInformation.vendorName,
167432
+ productName: basicInformation.productName,
167433
+ productLabel: basicInformation.productLabel,
167434
+ hardwareVersion: basicInformation.hardwareVersion,
167435
+ hardwareVersionString: basicInformation.hardwareVersionString,
167436
+ softwareVersion: basicInformation.softwareVersion,
167437
+ softwareVersionString: basicInformation.softwareVersionString
167438
+ });
167398
167439
  }
167399
167440
  log;
167400
167441
  server;
@@ -168776,14 +168817,16 @@ var LevelControlServerBase = class extends FeaturedBase4 {
168776
168817
  const entityId = homeAssistant.entity.entity_id;
168777
168818
  const levelRange = this.maxLevel - this.minLevel;
168778
168819
  const levelPercent = (level - this.minLevel) / levelRange;
168779
- const lastTurnOn = lastTurnOnTimestamps.get(entityId);
168780
- const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
168781
- const isMaxBrightness = level >= this.maxLevel;
168782
- if (isMaxBrightness && timeSinceTurnOn < 200) {
168783
- logger168.debug(
168784
- `[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
168785
- );
168786
- return;
168820
+ const { featureFlags } = this.env.get(BridgeDataProvider);
168821
+ if (featureFlags?.alexaPreserveBrightnessOnTurnOn === true) {
168822
+ const lastTurnOn = lastTurnOnTimestamps.get(entityId);
168823
+ const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
168824
+ if (level >= this.maxLevel && timeSinceTurnOn < 200) {
168825
+ logger168.debug(
168826
+ `[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
168827
+ );
168828
+ return;
168829
+ }
168787
168830
  }
168788
168831
  const current = config10.getValuePercent(
168789
168832
  homeAssistant.entity.state,
@@ -182488,6 +182531,11 @@ function startOptionsBuilder(yargs2) {
182488
182531
  type: "string",
182489
182532
  choices: ["silly", "debug", "info", "notice", "warn", "error", "fatal"],
182490
182533
  default: "info"
182534
+ }).option("protocol-log-level", {
182535
+ type: "string",
182536
+ choices: ["silly", "debug", "info", "notice", "warn", "error", "fatal"],
182537
+ default: "info",
182538
+ description: "Log level for matter.js MessageChannel/MessageExchange facilities. These emit per-packet payloads at debug. Only lower it if you're debugging matter.js."
182491
182539
  }).option("disable-log-colors", {
182492
182540
  type: "boolean",
182493
182541
  default: false