@riddix/hamh 2.1.0-alpha.793 → 2.1.0-alpha.794
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.
package/dist/backend/cli.js
CHANGED
|
@@ -125304,6 +125304,12 @@ var init_bridge_config_schema = __esm({
|
|
|
125304
125304
|
description: "Append a suffix to every entity serial number on this bridge. Useful for forcing controllers like Aqara to treat devices as new and bypass cached device data. Leave empty for default behavior.",
|
|
125305
125305
|
maxLength: 16
|
|
125306
125306
|
},
|
|
125307
|
+
uniqueIdSuffix: {
|
|
125308
|
+
title: "Unique ID Suffix",
|
|
125309
|
+
type: "string",
|
|
125310
|
+
description: "Mixed into the unique ID of every bridged device on this bridge (standard bridge mode). Controllers like Alexa cache device records keyed on the unique ID, so setting or changing this can help mint fresh identities. Applies after a bridge restart, then re-discover in the controller. Leave empty for default behavior.",
|
|
125311
|
+
maxLength: 16
|
|
125312
|
+
},
|
|
125307
125313
|
sessionMaxAgeHours: {
|
|
125308
125314
|
title: "Session Rotation Max Age (hours)",
|
|
125309
125315
|
type: "number",
|
|
@@ -147720,6 +147726,9 @@ var BridgeDataProvider = class extends Service {
|
|
|
147720
147726
|
get serialNumberSuffix() {
|
|
147721
147727
|
return this.data.serialNumberSuffix;
|
|
147722
147728
|
}
|
|
147729
|
+
get uniqueIdSuffix() {
|
|
147730
|
+
return this.data.uniqueIdSuffix;
|
|
147731
|
+
}
|
|
147723
147732
|
get sessionMaxAgeHours() {
|
|
147724
147733
|
return this.data.sessionMaxAgeHours;
|
|
147725
147734
|
}
|
|
@@ -147753,6 +147762,7 @@ var BridgeDataProvider = class extends Service {
|
|
|
147753
147762
|
icon: this.icon,
|
|
147754
147763
|
priority: this.priority,
|
|
147755
147764
|
serialNumberSuffix: this.serialNumberSuffix,
|
|
147765
|
+
uniqueIdSuffix: this.uniqueIdSuffix,
|
|
147756
147766
|
sessionMaxAgeHours: this.sessionMaxAgeHours,
|
|
147757
147767
|
status: status3.code,
|
|
147758
147768
|
statusReason: status3.reason,
|
|
@@ -149965,6 +149975,7 @@ init_esm7();
|
|
|
149965
149975
|
import crypto6 from "node:crypto";
|
|
149966
149976
|
init_home_assistant_entity_behavior();
|
|
149967
149977
|
var logger191 = Logger.get("BasicInformationServer");
|
|
149978
|
+
var appliedUniqueIds = /* @__PURE__ */ new Map();
|
|
149968
149979
|
var BasicInformationServer2 = class extends BridgedDeviceBasicInformationServer {
|
|
149969
149980
|
async initialize() {
|
|
149970
149981
|
await super.initialize();
|
|
@@ -150004,12 +150015,24 @@ var BasicInformationServer2 = class extends BridgedDeviceBasicInformationServer
|
|
|
150004
150015
|
serialNumber,
|
|
150005
150016
|
// UniqueId helps controllers (especially Alexa) identify devices across
|
|
150006
150017
|
// multiple fabric connections. Using MD5 hash of entity_id for stability.
|
|
150007
|
-
|
|
150018
|
+
// uniqueIdSuffix mints a fresh identity so stale controller cloud
|
|
150019
|
+
// records keyed on it can be shed (#385).
|
|
150020
|
+
uniqueId: this.frozenUniqueId(entity.entity_id)
|
|
150008
150021
|
});
|
|
150009
150022
|
logger191.debug(
|
|
150010
150023
|
`[${entity.entity_id}] basicInfo vendor=${this.state.vendorName} product=${this.state.productName} label=${this.state.productLabel} serial=${this.state.serialNumber} node=${this.state.nodeLabel}`
|
|
150011
150024
|
);
|
|
150012
150025
|
}
|
|
150026
|
+
frozenUniqueId(entityId) {
|
|
150027
|
+
const provider = this.env.get(BridgeDataProvider);
|
|
150028
|
+
const key = `${provider.id}:${entityId}`;
|
|
150029
|
+
let uniqueId = appliedUniqueIds.get(key);
|
|
150030
|
+
if (uniqueId == null) {
|
|
150031
|
+
uniqueId = crypto6.createHash("md5").update(entityId + (provider.uniqueIdSuffix ?? "")).digest("hex").substring(0, 32);
|
|
150032
|
+
appliedUniqueIds.set(key, uniqueId);
|
|
150033
|
+
}
|
|
150034
|
+
return uniqueId;
|
|
150035
|
+
}
|
|
150013
150036
|
};
|
|
150014
150037
|
function ellipse(maxLength, value) {
|
|
150015
150038
|
return trimToLength(value, maxLength, "...");
|