@riddix/hamh 2.1.0-alpha.865 → 2.1.0-alpha.867
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
|
@@ -132391,6 +132391,18 @@ var init_bridge_config_schema = __esm({
|
|
|
132391
132391
|
maximum: 1e4,
|
|
132392
132392
|
default: 0
|
|
132393
132393
|
},
|
|
132394
|
+
advertiseSpecVersion151: {
|
|
132395
|
+
title: "Advertise Matter 1.5.1 (Alexa pairing diagnostic)",
|
|
132396
|
+
description: "Mask the Matter version identifiers as 1.5.1 instead of 1.6.0, in the BasicInformation attributes and the session parameters. The data model itself stays 1.6. Only for diagnosing Alexa pairing failures that stop right after the attestation step (#449): 2.0.49 was the last release to advertise 1.5.1 and the last with a confirmed Echo pairing. Every controller on this bridge sees the masked version on its next reconnect, so use a dedicated test bridge, and restart the bridge plus re-pair the Echo after changing it. Default off.",
|
|
132397
|
+
type: "boolean",
|
|
132398
|
+
default: false
|
|
132399
|
+
},
|
|
132400
|
+
supportTermsAndConditions: {
|
|
132401
|
+
title: "Accept Terms and Conditions commands (Alexa pairing diagnostic)",
|
|
132402
|
+
description: "Advertise the Matter 1.4 TermsAndConditions feature and accept the SetTcAcknowledgements command instead of rejecting it as unsupported. No terms are enforced, the bridge accepts any acknowledgement. Alexa sends this command during pairing and some Echo firmwares may stall when it fails (#449). Restart the bridge and re-pair after changing it. Default off.",
|
|
132403
|
+
type: "boolean",
|
|
132404
|
+
default: false
|
|
132405
|
+
},
|
|
132394
132406
|
fastSessionRecovery: {
|
|
132395
132407
|
title: "Fast Session Recovery (Google offline workaround)",
|
|
132396
132408
|
description: "When a controller drops all subscriptions, clean up the dead session and re-announce after 5 seconds instead of 60. Opt-in for Google Home users whose devices go offline after a cancelled subscription (#386). It shortens the offline window but cannot stop the controller from rejecting the subscription. Default off.",
|
|
@@ -155241,6 +155253,30 @@ function trimToLength(value, maxLength, suffix) {
|
|
|
155241
155253
|
return stringValue.substring(0, maxLength - suffix.length) + suffix;
|
|
155242
155254
|
}
|
|
155243
155255
|
|
|
155256
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/model.js
|
|
155257
|
+
init_nodejs();
|
|
155258
|
+
init_esm2();
|
|
155259
|
+
|
|
155260
|
+
// src/matter/legacy-spec-version.ts
|
|
155261
|
+
var SPEC_VERSION_1_5_1 = 17105152;
|
|
155262
|
+
var DATA_MODEL_REVISION_19 = 19;
|
|
155263
|
+
function specVersionValues(flags2) {
|
|
155264
|
+
return flags2?.advertiseSpecVersion151 ? {
|
|
155265
|
+
specificationVersion: SPEC_VERSION_1_5_1,
|
|
155266
|
+
dataModelRevision: DATA_MODEL_REVISION_19
|
|
155267
|
+
} : {
|
|
155268
|
+
specificationVersion: Specification.SPECIFICATION_VERSION,
|
|
155269
|
+
dataModelRevision: Specification.DATA_MODEL_REVISION
|
|
155270
|
+
};
|
|
155271
|
+
}
|
|
155272
|
+
function legacySpecBasicInformation(flags2) {
|
|
155273
|
+
if (!flags2?.advertiseSpecVersion151) return {};
|
|
155274
|
+
return specVersionValues(flags2);
|
|
155275
|
+
}
|
|
155276
|
+
function applyLegacySpecSessionParameters(sessionManager, flags2) {
|
|
155277
|
+
sessionManager.sessionParameters = specVersionValues(flags2);
|
|
155278
|
+
}
|
|
155279
|
+
|
|
155244
155280
|
// src/matter/subscription-options.ts
|
|
155245
155281
|
init_esm();
|
|
155246
155282
|
function matterSubscriptionOptions() {
|
|
@@ -155251,164 +155287,6 @@ function matterSubscriptionOptions() {
|
|
|
155251
155287
|
};
|
|
155252
155288
|
}
|
|
155253
155289
|
|
|
155254
|
-
// src/matter/endpoints/server-mode-server-node.ts
|
|
155255
|
-
var logger196 = Logger.get("ServerModeServerNode");
|
|
155256
|
-
var ServerModeServerNode = class extends ServerNode {
|
|
155257
|
-
deviceEndpoints = /* @__PURE__ */ new Map();
|
|
155258
|
-
featureFlags;
|
|
155259
|
-
serialNumberSuffix;
|
|
155260
|
-
constructor(env, bridgeData) {
|
|
155261
|
-
super({
|
|
155262
|
-
id: bridgeData.id,
|
|
155263
|
-
environment: env,
|
|
155264
|
-
network: {
|
|
155265
|
-
port: bridgeData.port,
|
|
155266
|
-
// Shared zero-jitter window, see matterSubscriptionOptions: 60s max so
|
|
155267
|
-
// iOS does not show a stale "Updating" tile (#287), no jitter so the
|
|
155268
|
-
// keepalive stays inside a controller's ceiling (#386).
|
|
155269
|
-
subscriptionOptions: matterSubscriptionOptions()
|
|
155270
|
-
},
|
|
155271
|
-
productDescription: {
|
|
155272
|
-
name: bridgeData.name,
|
|
155273
|
-
deviceType: DeviceTypeId(RoboticVacuumCleanerDevice.deviceType)
|
|
155274
|
-
},
|
|
155275
|
-
basicInformation: {
|
|
155276
|
-
uniqueId: bridgeData.id,
|
|
155277
|
-
nodeLabel: trimToLength(bridgeData.name, 32, "..."),
|
|
155278
|
-
vendorId: VendorId(bridgeData.basicInformation.vendorId),
|
|
155279
|
-
vendorName: bridgeData.basicInformation.vendorName,
|
|
155280
|
-
productId: bridgeData.basicInformation.productId,
|
|
155281
|
-
productName: bridgeData.basicInformation.productName,
|
|
155282
|
-
productLabel: bridgeData.basicInformation.productLabel,
|
|
155283
|
-
serialNumber: `server-${bridgeData.id}`.substring(0, 32),
|
|
155284
|
-
hardwareVersion: bridgeData.basicInformation.hardwareVersion,
|
|
155285
|
-
softwareVersion: bridgeData.basicInformation.softwareVersion,
|
|
155286
|
-
hardwareVersionString: bridgeData.basicInformation.hardwareVersionString,
|
|
155287
|
-
softwareVersionString: bridgeData.basicInformation.softwareVersionString ?? String(bridgeData.basicInformation.softwareVersion),
|
|
155288
|
-
...bridgeData.countryCode ? { location: bridgeData.countryCode } : {}
|
|
155289
|
-
},
|
|
155290
|
-
subscriptions: {
|
|
155291
|
-
persistenceEnabled: false
|
|
155292
|
-
}
|
|
155293
|
-
});
|
|
155294
|
-
this.featureFlags = bridgeData.featureFlags;
|
|
155295
|
-
this.serialNumberSuffix = bridgeData.serialNumberSuffix;
|
|
155296
|
-
}
|
|
155297
|
-
/** Number of device endpoints currently attached. */
|
|
155298
|
-
get deviceCount() {
|
|
155299
|
-
return this.deviceEndpoints.size;
|
|
155300
|
-
}
|
|
155301
|
-
/**
|
|
155302
|
-
* Add a device endpoint to this server node. Several endpoints per node are
|
|
155303
|
-
* supported (#301); the call is idempotent per endpoint id.
|
|
155304
|
-
*/
|
|
155305
|
-
async addDevice(endpoint) {
|
|
155306
|
-
if (this.deviceEndpoints.has(endpoint.id)) {
|
|
155307
|
-
return;
|
|
155308
|
-
}
|
|
155309
|
-
this.deviceEndpoints.set(endpoint.id, endpoint);
|
|
155310
|
-
await this.add(endpoint);
|
|
155311
|
-
}
|
|
155312
|
-
/**
|
|
155313
|
-
* Drop one device reference after the endpoint has been deleted externally.
|
|
155314
|
-
* Must be called before re-adding an endpoint with the same id.
|
|
155315
|
-
*/
|
|
155316
|
-
forgetDevice(endpoint) {
|
|
155317
|
-
this.deviceEndpoints.delete(endpoint.id);
|
|
155318
|
-
}
|
|
155319
|
-
/** Drop all device references after the endpoints were deleted externally. */
|
|
155320
|
-
clearDevices() {
|
|
155321
|
-
this.deviceEndpoints.clear();
|
|
155322
|
-
}
|
|
155323
|
-
/**
|
|
155324
|
-
* Update root-level BasicInformation with entity-specific data.
|
|
155325
|
-
* In server mode, controllers (Apple Home, Alexa) read the root node's
|
|
155326
|
-
* BasicInformation, not the device endpoint's BridgedDeviceBasicInformation.
|
|
155327
|
-
* Without this, server-mode devices show bridge defaults (e.g. "riddix" / "MatterHub").
|
|
155328
|
-
*/
|
|
155329
|
-
async updateDeviceIdentity(entityId, device, mapping, friendlyName) {
|
|
155330
|
-
const nodeLabel = trimToLength(mapping?.customName, 32, "...") ?? trimToLength(friendlyName, 32, "...") ?? trimToLength(entityId, 32, "...");
|
|
155331
|
-
const productNameFromNodeLabel = this.featureFlags?.productNameFromNodeLabel === true ? trimToLength(sanitizeMatterString(nodeLabel ?? ""), 32, "...") ?? void 0 : void 0;
|
|
155332
|
-
const maxRawLen = 32 - (this.serialNumberSuffix?.length ?? 0);
|
|
155333
|
-
const registrySerial = this.featureFlags?.useHaRegistrySerial ? trimToLength(device?.serial_number, maxRawLen, "...") : void 0;
|
|
155334
|
-
const rawSerial = trimToLength(mapping?.customSerialNumber, maxRawLen, "...") ?? registrySerial;
|
|
155335
|
-
const serialNumber = rawSerial && this.serialNumberSuffix ? `${rawSerial}${this.serialNumberSuffix}` : rawSerial;
|
|
155336
|
-
const basicInformation = dropUndefined({
|
|
155337
|
-
vendorName: trimToLength(mapping?.customVendorName, 32, "...") ?? trimToLength(device?.manufacturer, 32, "..."),
|
|
155338
|
-
productName: trimToLength(mapping?.customProductName, 32, "...") ?? productNameFromNodeLabel ?? trimToLength(device?.model_id, 32, "...") ?? trimToLength(device?.model, 32, "..."),
|
|
155339
|
-
productLabel: trimToLength(device?.model, 64, "..."),
|
|
155340
|
-
nodeLabel,
|
|
155341
|
-
serialNumber,
|
|
155342
|
-
hardwareVersionString: trimToLength(device?.hw_version, 64, "..."),
|
|
155343
|
-
softwareVersionString: trimToLength(device?.sw_version, 64, "...")
|
|
155344
|
-
});
|
|
155345
|
-
if (Object.keys(basicInformation).length === 0) {
|
|
155346
|
-
return;
|
|
155347
|
-
}
|
|
155348
|
-
try {
|
|
155349
|
-
await this.set({ basicInformation });
|
|
155350
|
-
} catch (e) {
|
|
155351
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
155352
|
-
logger196.warn(
|
|
155353
|
-
`Failed to apply server-mode identity for ${entityId}: ${msg}`
|
|
155354
|
-
);
|
|
155355
|
-
}
|
|
155356
|
-
}
|
|
155357
|
-
// align the pairing device-type hint with the real device (default is vacuum)
|
|
155358
|
-
async updateAdvertisedDeviceType(deviceType) {
|
|
155359
|
-
try {
|
|
155360
|
-
await this.set({ productDescription: { deviceType } });
|
|
155361
|
-
} catch (e) {
|
|
155362
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
155363
|
-
logger196.warn(`Failed to set server-mode device type: ${msg}`);
|
|
155364
|
-
}
|
|
155365
|
-
}
|
|
155366
|
-
async factoryReset() {
|
|
155367
|
-
await this.cancel();
|
|
155368
|
-
await this.erase();
|
|
155369
|
-
}
|
|
155370
|
-
};
|
|
155371
|
-
function dropUndefined(obj) {
|
|
155372
|
-
const result = {};
|
|
155373
|
-
for (const key in obj) {
|
|
155374
|
-
if (obj[key] !== void 0) {
|
|
155375
|
-
result[key] = obj[key];
|
|
155376
|
-
}
|
|
155377
|
-
}
|
|
155378
|
-
return result;
|
|
155379
|
-
}
|
|
155380
|
-
|
|
155381
|
-
// src/plugins/builtin/camera/camera-tcp-requirement.ts
|
|
155382
|
-
import { readFileSync as readFileSync6 } from "node:fs";
|
|
155383
|
-
var CAMERA_TCP_CONFIG = { incoming: true, outgoing: false };
|
|
155384
|
-
function parseCameraList(cameras) {
|
|
155385
|
-
if (typeof cameras !== "string") return [];
|
|
155386
|
-
return cameras.split(",").map((s) => s.trim()).filter(Boolean);
|
|
155387
|
-
}
|
|
155388
|
-
function bridgeNeedsTcpForCameras(storageDir, bridgeId) {
|
|
155389
|
-
try {
|
|
155390
|
-
const raw = readFileSync6(
|
|
155391
|
-
pluginStorageFilePath(storageDir, bridgeId, "camera"),
|
|
155392
|
-
"utf-8"
|
|
155393
|
-
);
|
|
155394
|
-
const json = JSON.parse(raw);
|
|
155395
|
-
return parseCameraList(json.config?.cameras).length > 0;
|
|
155396
|
-
} catch {
|
|
155397
|
-
return false;
|
|
155398
|
-
}
|
|
155399
|
-
}
|
|
155400
|
-
|
|
155401
|
-
// src/plugins/plugin-manager.ts
|
|
155402
|
-
init_esm();
|
|
155403
|
-
import * as fs10 from "node:fs";
|
|
155404
|
-
import * as path12 from "node:path";
|
|
155405
|
-
|
|
155406
|
-
// src/plugins/plugin-device-factory.ts
|
|
155407
|
-
init_esm();
|
|
155408
|
-
|
|
155409
|
-
// src/matter/behaviors/identify-server.ts
|
|
155410
|
-
init_esm();
|
|
155411
|
-
|
|
155412
155290
|
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/behaviors.js
|
|
155413
155291
|
init_nodejs();
|
|
155414
155292
|
|
|
@@ -155702,7 +155580,7 @@ init_esm4();
|
|
|
155702
155580
|
init_esm3();
|
|
155703
155581
|
init_access_control();
|
|
155704
155582
|
init_groupcast();
|
|
155705
|
-
var
|
|
155583
|
+
var logger196 = Logger.get("GroupcastServer");
|
|
155706
155584
|
var UNMAPPED_KEYSET_ID = 65535;
|
|
155707
155585
|
var GROUPCAST_IS_PROVISIONAL = true;
|
|
155708
155586
|
var GroupcastServer = class extends GroupcastBehavior {
|
|
@@ -156119,7 +155997,7 @@ var GroupcastServer = class extends GroupcastBehavior {
|
|
|
156119
155997
|
if (hasMembership) continue;
|
|
156120
155998
|
const fabricGroups = gkmState.groupTable.filter((g) => g.fabricIndex === fi);
|
|
156121
155999
|
if (fabricGroups.length === 0) continue;
|
|
156122
|
-
|
|
156000
|
+
logger196.info(`Migrating ${fabricGroups.length} legacy group(s) for fabric ${fi} to Groupcast`);
|
|
156123
156001
|
const newEntries = fabricGroups.map((group) => {
|
|
156124
156002
|
const keyMapping = gkmState.groupKeyMap.find((m) => m.fabricIndex === fi && m.groupId === group.groupId);
|
|
156125
156003
|
const mcastAddrPolicy = this.features.perGroup ? Groupcast3.MulticastAddrPolicy.PerGroup : Groupcast3.MulticastAddrPolicy.IanaAddr;
|
|
@@ -156141,7 +156019,7 @@ var GroupcastServer = class extends GroupcastBehavior {
|
|
|
156141
156019
|
}
|
|
156142
156020
|
if (migrated) {
|
|
156143
156021
|
this.#updateUsedMcastAddrCount();
|
|
156144
|
-
|
|
156022
|
+
logger196.info("Groupcast migration complete");
|
|
156145
156023
|
}
|
|
156146
156024
|
}
|
|
156147
156025
|
async [Symbol.asyncDispose]() {
|
|
@@ -156675,7 +156553,193 @@ var WebRtcTransportDefinitions3 = ClusterType(WebRtcTransportDefinitions2);
|
|
|
156675
156553
|
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
156676
156554
|
init_wi_fi_network_diagnostics();
|
|
156677
156555
|
|
|
156556
|
+
// src/matter/tc-general-commissioning.ts
|
|
156557
|
+
var TcBase = GeneralCommissioningServer.with(
|
|
156558
|
+
GeneralCommissioning3.Feature.TermsAndConditions
|
|
156559
|
+
);
|
|
156560
|
+
var TcGeneralCommissioningServer = class extends TcBase {
|
|
156561
|
+
setTcAcknowledgements({
|
|
156562
|
+
tcVersion
|
|
156563
|
+
}) {
|
|
156564
|
+
this.state.tcAcceptedVersion = tcVersion;
|
|
156565
|
+
return { errorCode: GeneralCommissioning3.CommissioningError.Ok };
|
|
156566
|
+
}
|
|
156567
|
+
};
|
|
156568
|
+
((TcGeneralCommissioningServer2) => {
|
|
156569
|
+
class State extends TcBase.State {
|
|
156570
|
+
tcAcceptedVersion = 0;
|
|
156571
|
+
tcMinRequiredVersion = 0;
|
|
156572
|
+
// typed number upstream, managed as a bitmap object at runtime
|
|
156573
|
+
tcAcknowledgements = {};
|
|
156574
|
+
// model default is true, but nothing is enforced here
|
|
156575
|
+
tcAcknowledgementsRequired = false;
|
|
156576
|
+
tcUpdateDeadline = null;
|
|
156577
|
+
}
|
|
156578
|
+
TcGeneralCommissioningServer2.State = State;
|
|
156579
|
+
})(TcGeneralCommissioningServer || (TcGeneralCommissioningServer = {}));
|
|
156580
|
+
function rootEndpointType(flags2) {
|
|
156581
|
+
return flags2?.supportTermsAndConditions ? ServerNode.RootEndpoint.with(TcGeneralCommissioningServer) : ServerNode.RootEndpoint;
|
|
156582
|
+
}
|
|
156583
|
+
|
|
156584
|
+
// src/matter/endpoints/server-mode-server-node.ts
|
|
156585
|
+
var logger197 = Logger.get("ServerModeServerNode");
|
|
156586
|
+
var ServerModeServerNode = class extends ServerNode {
|
|
156587
|
+
deviceEndpoints = /* @__PURE__ */ new Map();
|
|
156588
|
+
featureFlags;
|
|
156589
|
+
serialNumberSuffix;
|
|
156590
|
+
constructor(env, bridgeData) {
|
|
156591
|
+
super({
|
|
156592
|
+
type: rootEndpointType(bridgeData.featureFlags),
|
|
156593
|
+
id: bridgeData.id,
|
|
156594
|
+
environment: env,
|
|
156595
|
+
network: {
|
|
156596
|
+
port: bridgeData.port,
|
|
156597
|
+
// Shared zero-jitter window, see matterSubscriptionOptions: 60s max so
|
|
156598
|
+
// iOS does not show a stale "Updating" tile (#287), no jitter so the
|
|
156599
|
+
// keepalive stays inside a controller's ceiling (#386).
|
|
156600
|
+
subscriptionOptions: matterSubscriptionOptions()
|
|
156601
|
+
},
|
|
156602
|
+
productDescription: {
|
|
156603
|
+
name: bridgeData.name,
|
|
156604
|
+
deviceType: DeviceTypeId(RoboticVacuumCleanerDevice.deviceType)
|
|
156605
|
+
},
|
|
156606
|
+
basicInformation: {
|
|
156607
|
+
...legacySpecBasicInformation(bridgeData.featureFlags),
|
|
156608
|
+
uniqueId: bridgeData.id,
|
|
156609
|
+
nodeLabel: trimToLength(bridgeData.name, 32, "..."),
|
|
156610
|
+
vendorId: VendorId(bridgeData.basicInformation.vendorId),
|
|
156611
|
+
vendorName: bridgeData.basicInformation.vendorName,
|
|
156612
|
+
productId: bridgeData.basicInformation.productId,
|
|
156613
|
+
productName: bridgeData.basicInformation.productName,
|
|
156614
|
+
productLabel: bridgeData.basicInformation.productLabel,
|
|
156615
|
+
serialNumber: `server-${bridgeData.id}`.substring(0, 32),
|
|
156616
|
+
hardwareVersion: bridgeData.basicInformation.hardwareVersion,
|
|
156617
|
+
softwareVersion: bridgeData.basicInformation.softwareVersion,
|
|
156618
|
+
hardwareVersionString: bridgeData.basicInformation.hardwareVersionString,
|
|
156619
|
+
softwareVersionString: bridgeData.basicInformation.softwareVersionString ?? String(bridgeData.basicInformation.softwareVersion),
|
|
156620
|
+
...bridgeData.countryCode ? { location: bridgeData.countryCode } : {}
|
|
156621
|
+
},
|
|
156622
|
+
subscriptions: {
|
|
156623
|
+
persistenceEnabled: false
|
|
156624
|
+
}
|
|
156625
|
+
});
|
|
156626
|
+
this.featureFlags = bridgeData.featureFlags;
|
|
156627
|
+
this.serialNumberSuffix = bridgeData.serialNumberSuffix;
|
|
156628
|
+
}
|
|
156629
|
+
/** Number of device endpoints currently attached. */
|
|
156630
|
+
get deviceCount() {
|
|
156631
|
+
return this.deviceEndpoints.size;
|
|
156632
|
+
}
|
|
156633
|
+
/**
|
|
156634
|
+
* Add a device endpoint to this server node. Several endpoints per node are
|
|
156635
|
+
* supported (#301); the call is idempotent per endpoint id.
|
|
156636
|
+
*/
|
|
156637
|
+
async addDevice(endpoint) {
|
|
156638
|
+
if (this.deviceEndpoints.has(endpoint.id)) {
|
|
156639
|
+
return;
|
|
156640
|
+
}
|
|
156641
|
+
this.deviceEndpoints.set(endpoint.id, endpoint);
|
|
156642
|
+
await this.add(endpoint);
|
|
156643
|
+
}
|
|
156644
|
+
/**
|
|
156645
|
+
* Drop one device reference after the endpoint has been deleted externally.
|
|
156646
|
+
* Must be called before re-adding an endpoint with the same id.
|
|
156647
|
+
*/
|
|
156648
|
+
forgetDevice(endpoint) {
|
|
156649
|
+
this.deviceEndpoints.delete(endpoint.id);
|
|
156650
|
+
}
|
|
156651
|
+
/** Drop all device references after the endpoints were deleted externally. */
|
|
156652
|
+
clearDevices() {
|
|
156653
|
+
this.deviceEndpoints.clear();
|
|
156654
|
+
}
|
|
156655
|
+
/**
|
|
156656
|
+
* Update root-level BasicInformation with entity-specific data.
|
|
156657
|
+
* In server mode, controllers (Apple Home, Alexa) read the root node's
|
|
156658
|
+
* BasicInformation, not the device endpoint's BridgedDeviceBasicInformation.
|
|
156659
|
+
* Without this, server-mode devices show bridge defaults (e.g. "riddix" / "MatterHub").
|
|
156660
|
+
*/
|
|
156661
|
+
async updateDeviceIdentity(entityId, device, mapping, friendlyName) {
|
|
156662
|
+
const nodeLabel = trimToLength(mapping?.customName, 32, "...") ?? trimToLength(friendlyName, 32, "...") ?? trimToLength(entityId, 32, "...");
|
|
156663
|
+
const productNameFromNodeLabel = this.featureFlags?.productNameFromNodeLabel === true ? trimToLength(sanitizeMatterString(nodeLabel ?? ""), 32, "...") ?? void 0 : void 0;
|
|
156664
|
+
const maxRawLen = 32 - (this.serialNumberSuffix?.length ?? 0);
|
|
156665
|
+
const registrySerial = this.featureFlags?.useHaRegistrySerial ? trimToLength(device?.serial_number, maxRawLen, "...") : void 0;
|
|
156666
|
+
const rawSerial = trimToLength(mapping?.customSerialNumber, maxRawLen, "...") ?? registrySerial;
|
|
156667
|
+
const serialNumber = rawSerial && this.serialNumberSuffix ? `${rawSerial}${this.serialNumberSuffix}` : rawSerial;
|
|
156668
|
+
const basicInformation = dropUndefined({
|
|
156669
|
+
vendorName: trimToLength(mapping?.customVendorName, 32, "...") ?? trimToLength(device?.manufacturer, 32, "..."),
|
|
156670
|
+
productName: trimToLength(mapping?.customProductName, 32, "...") ?? productNameFromNodeLabel ?? trimToLength(device?.model_id, 32, "...") ?? trimToLength(device?.model, 32, "..."),
|
|
156671
|
+
productLabel: trimToLength(device?.model, 64, "..."),
|
|
156672
|
+
nodeLabel,
|
|
156673
|
+
serialNumber,
|
|
156674
|
+
hardwareVersionString: trimToLength(device?.hw_version, 64, "..."),
|
|
156675
|
+
softwareVersionString: trimToLength(device?.sw_version, 64, "...")
|
|
156676
|
+
});
|
|
156677
|
+
if (Object.keys(basicInformation).length === 0) {
|
|
156678
|
+
return;
|
|
156679
|
+
}
|
|
156680
|
+
try {
|
|
156681
|
+
await this.set({ basicInformation });
|
|
156682
|
+
} catch (e) {
|
|
156683
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
156684
|
+
logger197.warn(
|
|
156685
|
+
`Failed to apply server-mode identity for ${entityId}: ${msg}`
|
|
156686
|
+
);
|
|
156687
|
+
}
|
|
156688
|
+
}
|
|
156689
|
+
// align the pairing device-type hint with the real device (default is vacuum)
|
|
156690
|
+
async updateAdvertisedDeviceType(deviceType) {
|
|
156691
|
+
try {
|
|
156692
|
+
await this.set({ productDescription: { deviceType } });
|
|
156693
|
+
} catch (e) {
|
|
156694
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
156695
|
+
logger197.warn(`Failed to set server-mode device type: ${msg}`);
|
|
156696
|
+
}
|
|
156697
|
+
}
|
|
156698
|
+
async factoryReset() {
|
|
156699
|
+
await this.cancel();
|
|
156700
|
+
await this.erase();
|
|
156701
|
+
}
|
|
156702
|
+
};
|
|
156703
|
+
function dropUndefined(obj) {
|
|
156704
|
+
const result = {};
|
|
156705
|
+
for (const key in obj) {
|
|
156706
|
+
if (obj[key] !== void 0) {
|
|
156707
|
+
result[key] = obj[key];
|
|
156708
|
+
}
|
|
156709
|
+
}
|
|
156710
|
+
return result;
|
|
156711
|
+
}
|
|
156712
|
+
|
|
156713
|
+
// src/plugins/builtin/camera/camera-tcp-requirement.ts
|
|
156714
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
156715
|
+
var CAMERA_TCP_CONFIG = { incoming: true, outgoing: false };
|
|
156716
|
+
function parseCameraList(cameras) {
|
|
156717
|
+
if (typeof cameras !== "string") return [];
|
|
156718
|
+
return cameras.split(",").map((s) => s.trim()).filter(Boolean);
|
|
156719
|
+
}
|
|
156720
|
+
function bridgeNeedsTcpForCameras(storageDir, bridgeId) {
|
|
156721
|
+
try {
|
|
156722
|
+
const raw = readFileSync6(
|
|
156723
|
+
pluginStorageFilePath(storageDir, bridgeId, "camera"),
|
|
156724
|
+
"utf-8"
|
|
156725
|
+
);
|
|
156726
|
+
const json = JSON.parse(raw);
|
|
156727
|
+
return parseCameraList(json.config?.cameras).length > 0;
|
|
156728
|
+
} catch {
|
|
156729
|
+
return false;
|
|
156730
|
+
}
|
|
156731
|
+
}
|
|
156732
|
+
|
|
156733
|
+
// src/plugins/plugin-manager.ts
|
|
156734
|
+
init_esm();
|
|
156735
|
+
import * as fs10 from "node:fs";
|
|
156736
|
+
import * as path12 from "node:path";
|
|
156737
|
+
|
|
156738
|
+
// src/plugins/plugin-device-factory.ts
|
|
156739
|
+
init_esm();
|
|
156740
|
+
|
|
156678
156741
|
// src/matter/behaviors/identify-server.ts
|
|
156742
|
+
init_esm();
|
|
156679
156743
|
init_home_assistant_entity_behavior();
|
|
156680
156744
|
var logger198 = Logger.get("IdentifyServer");
|
|
156681
156745
|
var IDENTIFY_BUTTON_SUFFIXES = ["_identify", "_locate", "_find_me"];
|
|
@@ -158048,7 +158112,7 @@ Object.freeze(SecondaryNetworkInterfaceEndpointDefinition);
|
|
|
158048
158112
|
init_types2();
|
|
158049
158113
|
function createBridgeServerConfig(data, options) {
|
|
158050
158114
|
return {
|
|
158051
|
-
type:
|
|
158115
|
+
type: rootEndpointType(data.featureFlags),
|
|
158052
158116
|
id: data.id,
|
|
158053
158117
|
network: {
|
|
158054
158118
|
port: data.port,
|
|
@@ -158060,6 +158124,7 @@ function createBridgeServerConfig(data, options) {
|
|
|
158060
158124
|
deviceType: AggregatorEndpoint.deviceType
|
|
158061
158125
|
},
|
|
158062
158126
|
basicInformation: {
|
|
158127
|
+
...legacySpecBasicInformation(data.featureFlags),
|
|
158063
158128
|
uniqueId: data.id,
|
|
158064
158129
|
nodeLabel: trimToLength(data.name, 32, "..."),
|
|
158065
158130
|
vendorId: VendorId(data.basicInformation.vendorId),
|
|
@@ -158640,6 +158705,14 @@ var Bridge = class {
|
|
|
158640
158705
|
);
|
|
158641
158706
|
this.endpointManager.startObserving();
|
|
158642
158707
|
ensureCommissioningConfig(this.server);
|
|
158708
|
+
applyLegacySpecSessionParameters(
|
|
158709
|
+
this.server.env.get(SessionManager),
|
|
158710
|
+
this.dataProvider.featureFlags
|
|
158711
|
+
);
|
|
158712
|
+
await this.server.setStateOf(
|
|
158713
|
+
BasicInformationServer,
|
|
158714
|
+
specVersionValues(this.dataProvider.featureFlags)
|
|
158715
|
+
);
|
|
158643
158716
|
await this.server.start();
|
|
158644
158717
|
await this.endpointManager.startPlugins();
|
|
158645
158718
|
this.setStatus({ code: BridgeStatus.Running });
|
|
@@ -160080,12 +160153,6 @@ var HaElectricalPowerMeasurementServer = ElectricalPowerMeasurementServerBase.se
|
|
|
160080
160153
|
|
|
160081
160154
|
// src/matter/behaviors/fan-speed-memory.ts
|
|
160082
160155
|
init_esm7();
|
|
160083
|
-
|
|
160084
|
-
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/model.js
|
|
160085
|
-
init_nodejs();
|
|
160086
|
-
init_esm2();
|
|
160087
|
-
|
|
160088
|
-
// src/matter/behaviors/fan-speed-memory.ts
|
|
160089
160156
|
var FanSpeedMemoryBehavior = class extends Behavior {
|
|
160090
160157
|
static id = "fanSpeedMemory";
|
|
160091
160158
|
static schema = new DatatypeModel(
|
|
@@ -179276,6 +179343,14 @@ var ServerModeBridge = class {
|
|
|
179276
179343
|
logMemoryUsage(this.log, "after refreshDevices (server mode)");
|
|
179277
179344
|
this.endpointManager.startObserving();
|
|
179278
179345
|
ensureCommissioningConfig(this.server);
|
|
179346
|
+
applyLegacySpecSessionParameters(
|
|
179347
|
+
this.server.env.get(SessionManager),
|
|
179348
|
+
this.dataProvider.featureFlags
|
|
179349
|
+
);
|
|
179350
|
+
await this.server.setStateOf(
|
|
179351
|
+
BasicInformationServer,
|
|
179352
|
+
specVersionValues(this.dataProvider.featureFlags)
|
|
179353
|
+
);
|
|
179279
179354
|
await this.server.start();
|
|
179280
179355
|
this.setStatus({ code: BridgeStatus.Running });
|
|
179281
179356
|
this.startAutoForceSyncIfEnabled();
|
|
@@ -183476,6 +183551,7 @@ export {
|
|
|
183476
183551
|
@matter/node/dist/esm/devices/index.js:
|
|
183477
183552
|
@matter/main/dist/esm/devices.js:
|
|
183478
183553
|
@matter/main/dist/esm/node.js:
|
|
183554
|
+
@matter/main/dist/esm/model.js:
|
|
183479
183555
|
@matter/node/dist/esm/behaviors/account-login/index.js:
|
|
183480
183556
|
@matter/node/dist/esm/behaviors/actions/ActionsClient.js:
|
|
183481
183557
|
@matter/node/dist/esm/behaviors/actions/index.js:
|
|
@@ -183718,7 +183794,6 @@ export {
|
|
|
183718
183794
|
@matter/node/dist/esm/endpoints/secondary-network-interface.js:
|
|
183719
183795
|
@matter/node/dist/esm/endpoints/index.js:
|
|
183720
183796
|
@matter/main/dist/esm/endpoints.js:
|
|
183721
|
-
@matter/main/dist/esm/model.js:
|
|
183722
183797
|
@matter/main/dist/esm/forwards/clusters/level-control.js:
|
|
183723
183798
|
@matter/main/dist/esm/forwards/behaviors/boolean-state.js:
|
|
183724
183799
|
@matter/main/dist/esm/forwards/behaviors/smoke-co-alarm.js:
|