@riddix/hamh 2.1.0-alpha.527 → 2.1.0-alpha.528
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
|
@@ -166283,6 +166283,7 @@ function validatePluginDevice(device) {
|
|
|
166283
166283
|
}
|
|
166284
166284
|
var PluginManager = class {
|
|
166285
166285
|
instances = /* @__PURE__ */ new Map();
|
|
166286
|
+
domainMappings = /* @__PURE__ */ new Map();
|
|
166286
166287
|
storageDir;
|
|
166287
166288
|
bridgeId;
|
|
166288
166289
|
runner = new SafePluginRunner();
|
|
@@ -166414,6 +166415,21 @@ var PluginManager = class {
|
|
|
166414
166415
|
clusterId3,
|
|
166415
166416
|
attributes7
|
|
166416
166417
|
);
|
|
166418
|
+
},
|
|
166419
|
+
registerDomainMapping: (mapping) => {
|
|
166420
|
+
if (!mapping.domain || typeof mapping.domain !== "string" || !mapping.matterDeviceType || typeof mapping.matterDeviceType !== "string") {
|
|
166421
|
+
pluginLogger.warn("Invalid domain mapping, skipping");
|
|
166422
|
+
return;
|
|
166423
|
+
}
|
|
166424
|
+
if (this.domainMappings.has(mapping.domain)) {
|
|
166425
|
+
pluginLogger.warn(
|
|
166426
|
+
`Domain "${mapping.domain}" already mapped by another plugin, overwriting`
|
|
166427
|
+
);
|
|
166428
|
+
}
|
|
166429
|
+
this.domainMappings.set(mapping.domain, mapping);
|
|
166430
|
+
pluginLogger.info(
|
|
166431
|
+
`Registered domain mapping: ${mapping.domain} \u2192 ${mapping.matterDeviceType}`
|
|
166432
|
+
);
|
|
166417
166433
|
}
|
|
166418
166434
|
};
|
|
166419
166435
|
this.instances.set(plugin.name, {
|
|
@@ -166539,6 +166555,9 @@ var PluginManager = class {
|
|
|
166539
166555
|
if (!instance) return void 0;
|
|
166540
166556
|
return instance.plugin.getConfigSchema?.();
|
|
166541
166557
|
}
|
|
166558
|
+
getDomainMappings() {
|
|
166559
|
+
return new Map(this.domainMappings);
|
|
166560
|
+
}
|
|
166542
166561
|
async updateConfig(pluginName, config10) {
|
|
166543
166562
|
const instance = this.instances.get(pluginName);
|
|
166544
166563
|
if (!instance) return false;
|
|
@@ -169227,6 +169246,9 @@ init_esm7();
|
|
|
169227
169246
|
import debounce4 from "debounce";
|
|
169228
169247
|
init_home_assistant_entity_behavior();
|
|
169229
169248
|
|
|
169249
|
+
// src/matter/endpoints/legacy/create-legacy-endpoint-type.ts
|
|
169250
|
+
init_esm();
|
|
169251
|
+
|
|
169230
169252
|
// src/matter/endpoints/legacy/air-purifier/index.ts
|
|
169231
169253
|
init_dist();
|
|
169232
169254
|
init_home_assistant_entity_behavior();
|
|
@@ -177825,6 +177847,7 @@ function WaterHeaterDevice(homeAssistantEntity) {
|
|
|
177825
177847
|
}
|
|
177826
177848
|
|
|
177827
177849
|
// src/matter/endpoints/legacy/create-legacy-endpoint-type.ts
|
|
177850
|
+
var legacyLogger = Logger.get("LegacyEndpointType");
|
|
177828
177851
|
function createLegacyEndpointType(entity, mapping, areaName, options) {
|
|
177829
177852
|
const domain = entity.entity_id.split(".")[0];
|
|
177830
177853
|
const customName = mapping?.customName;
|
|
@@ -177844,10 +177867,20 @@ function createLegacyEndpointType(entity, mapping, areaName, options) {
|
|
|
177844
177867
|
);
|
|
177845
177868
|
} else {
|
|
177846
177869
|
const factory = deviceCtrs[domain];
|
|
177847
|
-
if (
|
|
177870
|
+
if (factory) {
|
|
177871
|
+
type = factory({ entity, customName, mapping });
|
|
177872
|
+
} else if (options?.pluginDomainMappings?.has(domain)) {
|
|
177873
|
+
const mappedType = options.pluginDomainMappings.get(domain);
|
|
177874
|
+
const mappedFactory = matterDeviceTypeFactories[mappedType];
|
|
177875
|
+
if (mappedFactory) {
|
|
177876
|
+
legacyLogger.info(
|
|
177877
|
+
`Using plugin domain mapping for "${domain}" \u2192 "${mappedType}"`
|
|
177878
|
+
);
|
|
177879
|
+
type = mappedFactory({ entity, customName, mapping });
|
|
177880
|
+
}
|
|
177881
|
+
} else {
|
|
177848
177882
|
return void 0;
|
|
177849
177883
|
}
|
|
177850
|
-
type = factory({ entity, customName, mapping });
|
|
177851
177884
|
}
|
|
177852
177885
|
}
|
|
177853
177886
|
if (!type) {
|
|
@@ -178190,7 +178223,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178190
178223
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
178191
178224
|
var logger199 = Logger.get("LegacyEndpoint");
|
|
178192
178225
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
178193
|
-
static async create(registry2, entityId, mapping) {
|
|
178226
|
+
static async create(registry2, entityId, mapping, pluginDomainMappings) {
|
|
178194
178227
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
178195
178228
|
let state = registry2.initialState(entityId);
|
|
178196
178229
|
const entity = registry2.entity(entityId);
|
|
@@ -178485,7 +178518,8 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178485
178518
|
const areaName = registry2.getAreaName(entityId);
|
|
178486
178519
|
const type = createLegacyEndpointType(payload, effectiveMapping, areaName, {
|
|
178487
178520
|
vacuumOnOff: registry2.isVacuumOnOffEnabled(),
|
|
178488
|
-
cleaningModeOptions
|
|
178521
|
+
cleaningModeOptions,
|
|
178522
|
+
pluginDomainMappings
|
|
178489
178523
|
});
|
|
178490
178524
|
if (!type) {
|
|
178491
178525
|
return;
|
|
@@ -178989,6 +179023,16 @@ var BridgeEndpointManager = class extends Service {
|
|
|
178989
179023
|
}
|
|
178990
179024
|
}
|
|
178991
179025
|
}
|
|
179026
|
+
getPluginDomainMappings() {
|
|
179027
|
+
if (!this.pluginManager) return void 0;
|
|
179028
|
+
const mappings = this.pluginManager.getDomainMappings();
|
|
179029
|
+
if (mappings.size === 0) return void 0;
|
|
179030
|
+
const result = /* @__PURE__ */ new Map();
|
|
179031
|
+
for (const [domain, mapping] of mappings) {
|
|
179032
|
+
result.set(domain, mapping.matterDeviceType);
|
|
179033
|
+
}
|
|
179034
|
+
return result;
|
|
179035
|
+
}
|
|
178992
179036
|
getEntityMapping(entityId) {
|
|
178993
179037
|
return this.mappingStorage.getMapping(this.bridgeId, entityId);
|
|
178994
179038
|
}
|
|
@@ -179144,10 +179188,12 @@ var BridgeEndpointManager = class extends Service {
|
|
|
179144
179188
|
let endpoint = existingEndpoints.find((e) => e.entityId === entityId);
|
|
179145
179189
|
if (!endpoint) {
|
|
179146
179190
|
try {
|
|
179191
|
+
const domainMappings = this.getPluginDomainMappings();
|
|
179147
179192
|
endpoint = await LegacyEndpoint.create(
|
|
179148
179193
|
this.registry,
|
|
179149
179194
|
entityId,
|
|
179150
|
-
mapping
|
|
179195
|
+
mapping,
|
|
179196
|
+
domainMappings
|
|
179151
179197
|
);
|
|
179152
179198
|
} catch (e) {
|
|
179153
179199
|
const reason = this.extractErrorReason(e);
|
|
@@ -181170,8 +181216,7 @@ process.on("unhandledRejection", (reason) => {
|
|
|
181170
181216
|
if (shouldSuppressError(reason)) {
|
|
181171
181217
|
return;
|
|
181172
181218
|
}
|
|
181173
|
-
console.error("Unhandled rejection:", reason);
|
|
181174
|
-
process.exit(1);
|
|
181219
|
+
console.error("Unhandled rejection (process continuing):", reason);
|
|
181175
181220
|
});
|
|
181176
181221
|
function registerFinalErrorHandlers() {
|
|
181177
181222
|
process.removeAllListeners("uncaughtException");
|
|
@@ -181197,8 +181242,7 @@ function registerFinalErrorHandlers() {
|
|
|
181197
181242
|
console.warn("Suppressed Matter.js internal error:", reason);
|
|
181198
181243
|
return;
|
|
181199
181244
|
}
|
|
181200
|
-
console.error("Unhandled rejection:", reason);
|
|
181201
|
-
process.exit(1);
|
|
181245
|
+
console.error("Unhandled rejection (process continuing):", reason);
|
|
181202
181246
|
});
|
|
181203
181247
|
}
|
|
181204
181248
|
async function startHandler(startOptions, webUiDist) {
|