@riddix/hamh 2.1.0-alpha.797 → 2.1.0-alpha.799
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
|
@@ -124292,6 +124292,9 @@ var init_clusters = __esm({
|
|
|
124292
124292
|
function classifyController(vendorId3) {
|
|
124293
124293
|
return controllerByVendorId[vendorId3];
|
|
124294
124294
|
}
|
|
124295
|
+
function alexaPairingPortProblem(vendorId3, port) {
|
|
124296
|
+
return classifyController(vendorId3) === "alexa" && port !== 5540;
|
|
124297
|
+
}
|
|
124295
124298
|
function computeControllerWarnings(controllers, exposed) {
|
|
124296
124299
|
const seen = /* @__PURE__ */ new Set();
|
|
124297
124300
|
const warnings = [];
|
|
@@ -148999,6 +149002,9 @@ var Bridge = class {
|
|
|
148999
149002
|
sessionAddedHandler;
|
|
149000
149003
|
// biome-ignore lint/suspicious/noExplicitAny: matter.js internal types
|
|
149001
149004
|
sessionDeletedHandler;
|
|
149005
|
+
// Warns when Alexa pairs on a non-5540 port, the fabric rolls back later (#401).
|
|
149006
|
+
// biome-ignore lint/suspicious/noExplicitAny: matter.js internal types
|
|
149007
|
+
fabricAddedHandler;
|
|
149002
149008
|
get id() {
|
|
149003
149009
|
return this.dataProvider.id;
|
|
149004
149010
|
}
|
|
@@ -149168,6 +149174,7 @@ var Bridge = class {
|
|
|
149168
149174
|
});
|
|
149169
149175
|
}
|
|
149170
149176
|
this.wireSessionDiagnostics();
|
|
149177
|
+
this.wireFabricWarnings();
|
|
149171
149178
|
this.startSessionRotation();
|
|
149172
149179
|
logMemoryUsage(this.log, "bridge running");
|
|
149173
149180
|
diagnosticEventBus.emit("bridge_started", `Bridge started`, {
|
|
@@ -149193,6 +149200,7 @@ ${e?.toString()}`);
|
|
|
149193
149200
|
}
|
|
149194
149201
|
async runStop(code, reason) {
|
|
149195
149202
|
this.unwireSessionDiagnostics();
|
|
149203
|
+
this.unwireFabricWarnings();
|
|
149196
149204
|
this.stopAutoForceSync();
|
|
149197
149205
|
await this.closeActiveSessions();
|
|
149198
149206
|
await this.endpointManager.stopPlugins();
|
|
@@ -149530,6 +149538,35 @@ ${e?.toString()}`);
|
|
|
149530
149538
|
this.stopSessionRotation();
|
|
149531
149539
|
this.sessionStartedAt.clear();
|
|
149532
149540
|
}
|
|
149541
|
+
// Warn at the fabric-added event when Alexa pairs on a non-5540 port. Alexa
|
|
149542
|
+
// completes AddNOC but never CASEs, so the fabric rolls back on failsafe
|
|
149543
|
+
// expiry ~20s later and the committed-fabric warning path never sees it (#401).
|
|
149544
|
+
wireFabricWarnings() {
|
|
149545
|
+
this.unwireFabricWarnings();
|
|
149546
|
+
try {
|
|
149547
|
+
const fabrics = this.server.env.get(FabricManager);
|
|
149548
|
+
this.fabricAddedHandler = (fabric) => {
|
|
149549
|
+
const port = this.dataProvider.port;
|
|
149550
|
+
if (alexaPairingPortProblem(fabric.rootVendorId, port)) {
|
|
149551
|
+
this.log.warn(
|
|
149552
|
+
`Fabric added by Amazon Alexa (vendor ${fabric.rootVendorId}) on port ${port}. Alexa only completes pairing on port 5540, this attempt will roll back about 20s after AddNOC. Recreate the bridge on port 5540 (#401)`
|
|
149553
|
+
);
|
|
149554
|
+
}
|
|
149555
|
+
};
|
|
149556
|
+
fabrics.events.added.on(this.fabricAddedHandler);
|
|
149557
|
+
} catch {
|
|
149558
|
+
}
|
|
149559
|
+
}
|
|
149560
|
+
unwireFabricWarnings() {
|
|
149561
|
+
try {
|
|
149562
|
+
const fabrics = this.server.env.get(FabricManager);
|
|
149563
|
+
if (this.fabricAddedHandler) {
|
|
149564
|
+
fabrics.events.added.off(this.fabricAddedHandler);
|
|
149565
|
+
}
|
|
149566
|
+
} catch {
|
|
149567
|
+
}
|
|
149568
|
+
this.fabricAddedHandler = void 0;
|
|
149569
|
+
}
|
|
149533
149570
|
stopAutoForceSync() {
|
|
149534
149571
|
if (this.autoForceSyncTimer) {
|
|
149535
149572
|
clearInterval(this.autoForceSyncTimer);
|
|
@@ -150858,9 +150895,8 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
150858
150895
|
const config11 = this.state.config;
|
|
150859
150896
|
const minLevel = 1;
|
|
150860
150897
|
const maxLevel = 254;
|
|
150861
|
-
const levelRange = maxLevel - minLevel;
|
|
150862
150898
|
const currentLevelPercent = config11.getValuePercent(state, this.agent);
|
|
150863
|
-
let currentLevel = currentLevelPercent != null ? Math.round(currentLevelPercent *
|
|
150899
|
+
let currentLevel = currentLevelPercent != null ? Math.round(currentLevelPercent * maxLevel) : null;
|
|
150864
150900
|
if (currentLevel != null) {
|
|
150865
150901
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
150866
150902
|
}
|
|
@@ -150913,8 +150949,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
150913
150949
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
150914
150950
|
const config11 = this.state.config;
|
|
150915
150951
|
const entityId = homeAssistant.entity.entity_id;
|
|
150916
|
-
const
|
|
150917
|
-
const levelPercent = (level - this.minLevel) / levelRange;
|
|
150952
|
+
const levelPercent = level / this.maxLevel;
|
|
150918
150953
|
const { featureFlags } = this.env.get(BridgeDataProvider);
|
|
150919
150954
|
if (featureFlags?.alexaPreserveBrightnessOnTurnOn === true) {
|
|
150920
150955
|
const lastTurnOn = lastTurnOnTimestamps.get(entityId);
|
|
@@ -165313,6 +165348,9 @@ var ServerModeBridge = class {
|
|
|
165313
165348
|
sessionAddedHandler;
|
|
165314
165349
|
// biome-ignore lint/suspicious/noExplicitAny: matter.js internal types
|
|
165315
165350
|
sessionDeletedHandler;
|
|
165351
|
+
// Warns when Alexa pairs on a non-5540 port, the fabric rolls back later (#401).
|
|
165352
|
+
// biome-ignore lint/suspicious/noExplicitAny: matter.js internal types
|
|
165353
|
+
fabricAddedHandler;
|
|
165316
165354
|
get id() {
|
|
165317
165355
|
return this.dataProvider.id;
|
|
165318
165356
|
}
|
|
@@ -165438,6 +165476,7 @@ var ServerModeBridge = class {
|
|
|
165438
165476
|
});
|
|
165439
165477
|
}
|
|
165440
165478
|
this.wireSessionDiagnostics();
|
|
165479
|
+
this.wireFabricWarnings();
|
|
165441
165480
|
this.startSessionRotation();
|
|
165442
165481
|
this.scheduleWarmStart();
|
|
165443
165482
|
logMemoryUsage(this.log, "server mode bridge running");
|
|
@@ -165456,6 +165495,7 @@ ${e?.toString()}`);
|
|
|
165456
165495
|
async stop(code = BridgeStatus.Stopped, reason = "Manually stopped") {
|
|
165457
165496
|
this.stopSessionRotation();
|
|
165458
165497
|
this.unwireSessionDiagnostics();
|
|
165498
|
+
this.unwireFabricWarnings();
|
|
165459
165499
|
this.cancelWarmStart();
|
|
165460
165500
|
this.stopAutoForceSync();
|
|
165461
165501
|
await this.closeActiveSessions();
|
|
@@ -165794,6 +165834,35 @@ ${e?.toString()}`);
|
|
|
165794
165834
|
this.staleSessionTimers.clear();
|
|
165795
165835
|
this.sessionStartedAt.clear();
|
|
165796
165836
|
}
|
|
165837
|
+
// Warn at the fabric-added event when Alexa pairs on a non-5540 port. Alexa
|
|
165838
|
+
// completes AddNOC but never CASEs, so the fabric rolls back on failsafe
|
|
165839
|
+
// expiry ~20s later and the committed-fabric warning path never sees it (#401).
|
|
165840
|
+
wireFabricWarnings() {
|
|
165841
|
+
this.unwireFabricWarnings();
|
|
165842
|
+
try {
|
|
165843
|
+
const fabrics = this.server.env.get(FabricManager);
|
|
165844
|
+
this.fabricAddedHandler = (fabric) => {
|
|
165845
|
+
const port = this.dataProvider.port;
|
|
165846
|
+
if (alexaPairingPortProblem(fabric.rootVendorId, port)) {
|
|
165847
|
+
this.log.warn(
|
|
165848
|
+
`Fabric added by Amazon Alexa (vendor ${fabric.rootVendorId}) on port ${port}. Alexa only completes pairing on port 5540, this attempt will roll back about 20s after AddNOC. Recreate the bridge on port 5540 (#401)`
|
|
165849
|
+
);
|
|
165850
|
+
}
|
|
165851
|
+
};
|
|
165852
|
+
fabrics.events.added.on(this.fabricAddedHandler);
|
|
165853
|
+
} catch {
|
|
165854
|
+
}
|
|
165855
|
+
}
|
|
165856
|
+
unwireFabricWarnings() {
|
|
165857
|
+
try {
|
|
165858
|
+
const fabrics = this.server.env.get(FabricManager);
|
|
165859
|
+
if (this.fabricAddedHandler) {
|
|
165860
|
+
fabrics.events.added.off(this.fabricAddedHandler);
|
|
165861
|
+
}
|
|
165862
|
+
} catch {
|
|
165863
|
+
}
|
|
165864
|
+
this.fabricAddedHandler = void 0;
|
|
165865
|
+
}
|
|
165797
165866
|
// Start the periodic age-based session rotation (#287).
|
|
165798
165867
|
startSessionRotation() {
|
|
165799
165868
|
this.stopSessionRotation();
|