@riddix/hamh 2.1.0-alpha.621 → 2.1.0-alpha.623
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
|
@@ -1743,8 +1743,8 @@ var init_Cancelable = __esm({
|
|
|
1743
1743
|
};
|
|
1744
1744
|
return result;
|
|
1745
1745
|
}
|
|
1746
|
-
static set logger(
|
|
1747
|
-
this.#logger =
|
|
1746
|
+
static set logger(logger207) {
|
|
1747
|
+
this.#logger = logger207;
|
|
1748
1748
|
}
|
|
1749
1749
|
static get logger() {
|
|
1750
1750
|
return this.#logger;
|
|
@@ -3422,13 +3422,13 @@ var init_Logger = __esm({
|
|
|
3422
3422
|
*
|
|
3423
3423
|
* @deprecated use {@link destinations}
|
|
3424
3424
|
*/
|
|
3425
|
-
static addLogger(identifier,
|
|
3425
|
+
static addLogger(identifier, logger207, options) {
|
|
3426
3426
|
if (identifier in this.destinations) {
|
|
3427
3427
|
throw new ImplementationError(`Logger "${identifier}" already exists`);
|
|
3428
3428
|
}
|
|
3429
3429
|
const dest = LogDestination({ name: identifier });
|
|
3430
3430
|
const legacy = adaptDestinationToLegacy(dest);
|
|
3431
|
-
legacy.log =
|
|
3431
|
+
legacy.log = logger207;
|
|
3432
3432
|
if (options?.defaultLogLevel !== void 0) {
|
|
3433
3433
|
legacy.defaultLogLevel = options.defaultLogLevel;
|
|
3434
3434
|
}
|
|
@@ -5538,8 +5538,8 @@ function Construction(subject, initializer) {
|
|
|
5538
5538
|
}
|
|
5539
5539
|
}
|
|
5540
5540
|
function unhandledError(...args) {
|
|
5541
|
-
const
|
|
5542
|
-
|
|
5541
|
+
const logger207 = Logger.get(subject.constructor.name);
|
|
5542
|
+
logger207.error(...args);
|
|
5543
5543
|
}
|
|
5544
5544
|
function createErrorHandler(name) {
|
|
5545
5545
|
return (e) => {
|
|
@@ -135999,11 +135999,11 @@ var init_Api = __esm({
|
|
|
135999
135999
|
}
|
|
136000
136000
|
Api2.resourceFor = resourceFor;
|
|
136001
136001
|
function log(level, facility, id, ...message) {
|
|
136002
|
-
let
|
|
136003
|
-
if (!
|
|
136004
|
-
loggers.set(facility,
|
|
136002
|
+
let logger207 = loggers.get(facility);
|
|
136003
|
+
if (!logger207) {
|
|
136004
|
+
loggers.set(facility, logger207 = Logger.get(facility));
|
|
136005
136005
|
}
|
|
136006
|
-
|
|
136006
|
+
logger207[level](Diagnostic.via(id || "(anon)"), message);
|
|
136007
136007
|
}
|
|
136008
136008
|
Api2.log = log;
|
|
136009
136009
|
function logRequest(facility, id, method, target) {
|
|
@@ -147332,10 +147332,10 @@ var init_home_assistant_actions = __esm({
|
|
|
147332
147332
|
circuitBreakerResetMs: 3e4
|
|
147333
147333
|
};
|
|
147334
147334
|
HomeAssistantActions = class extends Service {
|
|
147335
|
-
constructor(
|
|
147335
|
+
constructor(logger207, client, config10) {
|
|
147336
147336
|
super("HomeAssistantActions");
|
|
147337
147337
|
this.client = client;
|
|
147338
|
-
this.log =
|
|
147338
|
+
this.log = logger207.get(this);
|
|
147339
147339
|
this.config = { ...defaultConfig, ...config10 };
|
|
147340
147340
|
this.circuitBreaker = new CircuitBreaker(
|
|
147341
147341
|
this.config.circuitBreakerThreshold,
|
|
@@ -147675,10 +147675,10 @@ var DiagnosticService = class {
|
|
|
147675
147675
|
};
|
|
147676
147676
|
|
|
147677
147677
|
// src/api/access-log.ts
|
|
147678
|
-
function accessLogger(
|
|
147678
|
+
function accessLogger(logger207) {
|
|
147679
147679
|
return (req, res, next) => {
|
|
147680
147680
|
res.on("finish", () => {
|
|
147681
|
-
|
|
147681
|
+
logger207.debug(
|
|
147682
147682
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
147683
147683
|
);
|
|
147684
147684
|
});
|
|
@@ -151396,7 +151396,7 @@ var WebSocketApi = class {
|
|
|
151396
151396
|
|
|
151397
151397
|
// src/api/web-api.ts
|
|
151398
151398
|
var WebApi = class extends Service {
|
|
151399
|
-
constructor(
|
|
151399
|
+
constructor(logger207, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
|
|
151400
151400
|
super("WebApi");
|
|
151401
151401
|
this.bridgeService = bridgeService;
|
|
151402
151402
|
this.haClient = haClient;
|
|
@@ -151407,8 +151407,8 @@ var WebApi = class extends Service {
|
|
|
151407
151407
|
this.settingsStorage = settingsStorage;
|
|
151408
151408
|
this.backupService = backupService;
|
|
151409
151409
|
this.props = props;
|
|
151410
|
-
this.logger =
|
|
151411
|
-
this.log =
|
|
151410
|
+
this.logger = logger207;
|
|
151411
|
+
this.log = logger207.get(this);
|
|
151412
151412
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
151413
151413
|
this.startTime = Date.now();
|
|
151414
151414
|
this.wsApi = new WebSocketApi(
|
|
@@ -151894,12 +151894,12 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
151894
151894
|
|
|
151895
151895
|
// src/core/app/storage.ts
|
|
151896
151896
|
function storage(environment, options) {
|
|
151897
|
-
const
|
|
151897
|
+
const logger207 = environment.get(LoggerService).get("CustomStorage");
|
|
151898
151898
|
const location2 = resolveStorageLocation(options.location);
|
|
151899
151899
|
fs8.mkdirSync(location2, { recursive: true });
|
|
151900
151900
|
const storageService = environment.get(StorageService);
|
|
151901
151901
|
storageService.location = location2;
|
|
151902
|
-
storageService.factory = (ns) => new CustomStorage(
|
|
151902
|
+
storageService.factory = (ns) => new CustomStorage(logger207, path8.resolve(location2, ns));
|
|
151903
151903
|
}
|
|
151904
151904
|
function resolveStorageLocation(storageLocation) {
|
|
151905
151905
|
const homedir = os5.homedir();
|
|
@@ -152498,10 +152498,10 @@ function isTransientConnectError(reason) {
|
|
|
152498
152498
|
return msg.includes("socket hang up") || msg.includes("tls") || msg.includes("TLS");
|
|
152499
152499
|
}
|
|
152500
152500
|
var HomeAssistantClient = class extends Service {
|
|
152501
|
-
constructor(
|
|
152501
|
+
constructor(logger207, options) {
|
|
152502
152502
|
super("HomeAssistantClient");
|
|
152503
152503
|
this.options = options;
|
|
152504
|
-
this.log =
|
|
152504
|
+
this.log = logger207.get(this);
|
|
152505
152505
|
}
|
|
152506
152506
|
options;
|
|
152507
152507
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
@@ -153451,6 +153451,9 @@ var LockCredentialStorage = class extends Service {
|
|
|
153451
153451
|
}
|
|
153452
153452
|
};
|
|
153453
153453
|
|
|
153454
|
+
// src/matter/endpoints/server-mode-server-node.ts
|
|
153455
|
+
init_esm();
|
|
153456
|
+
|
|
153454
153457
|
// ../../node_modules/.pnpm/@matter+main@0.16.11/node_modules/@matter/main/dist/esm/devices.js
|
|
153455
153458
|
init_nodejs();
|
|
153456
153459
|
|
|
@@ -165228,74 +165231,6 @@ init_esm5();
|
|
|
165228
165231
|
init_nodejs();
|
|
165229
165232
|
init_esm3();
|
|
165230
165233
|
|
|
165231
|
-
// src/utils/apply-patch-state.ts
|
|
165232
|
-
init_esm();
|
|
165233
|
-
var logger158 = Logger.get("ApplyPatchState");
|
|
165234
|
-
function applyPatchState(state, patch, options) {
|
|
165235
|
-
return applyPatch(state, patch, options?.force);
|
|
165236
|
-
}
|
|
165237
|
-
function applyPatch(state, patch, force = false) {
|
|
165238
|
-
const actualPatch = {};
|
|
165239
|
-
for (const key in patch) {
|
|
165240
|
-
if (Object.hasOwn(patch, key)) {
|
|
165241
|
-
const patchValue = patch[key];
|
|
165242
|
-
if (patchValue !== void 0) {
|
|
165243
|
-
const stateValue = state[key];
|
|
165244
|
-
if (force || !deepEqual(stateValue, patchValue)) {
|
|
165245
|
-
actualPatch[key] = patchValue;
|
|
165246
|
-
}
|
|
165247
|
-
}
|
|
165248
|
-
}
|
|
165249
|
-
}
|
|
165250
|
-
const failedKeys = [];
|
|
165251
|
-
for (const key in actualPatch) {
|
|
165252
|
-
if (!Object.hasOwn(actualPatch, key)) continue;
|
|
165253
|
-
try {
|
|
165254
|
-
state[key] = actualPatch[key];
|
|
165255
|
-
} catch (e) {
|
|
165256
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
165257
|
-
if (errorMessage.includes(
|
|
165258
|
-
"Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
|
|
165259
|
-
)) {
|
|
165260
|
-
logger158.debug(
|
|
165261
|
-
`Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
|
|
165262
|
-
);
|
|
165263
|
-
return actualPatch;
|
|
165264
|
-
}
|
|
165265
|
-
if (errorMessage.includes("synchronous-transaction-conflict")) {
|
|
165266
|
-
logger158.warn(
|
|
165267
|
-
`Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
|
|
165268
|
-
);
|
|
165269
|
-
return actualPatch;
|
|
165270
|
-
}
|
|
165271
|
-
failedKeys.push(key);
|
|
165272
|
-
logger158.warn(`Failed to set property '${key}': ${errorMessage}`);
|
|
165273
|
-
}
|
|
165274
|
-
}
|
|
165275
|
-
if (failedKeys.length > 0) {
|
|
165276
|
-
logger158.warn(
|
|
165277
|
-
`${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
|
|
165278
|
-
);
|
|
165279
|
-
}
|
|
165280
|
-
return actualPatch;
|
|
165281
|
-
}
|
|
165282
|
-
function deepEqual(a, b) {
|
|
165283
|
-
if (a == null || b == null) {
|
|
165284
|
-
return a === b;
|
|
165285
|
-
}
|
|
165286
|
-
if (typeof a !== typeof b || Array.isArray(a) !== Array.isArray(b)) {
|
|
165287
|
-
return false;
|
|
165288
|
-
}
|
|
165289
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
165290
|
-
return a.length === b.length && a.every((vA, idx) => deepEqual(vA, b[idx]));
|
|
165291
|
-
}
|
|
165292
|
-
if (typeof a === "object" && typeof b === "object") {
|
|
165293
|
-
const keys3 = Object.keys({ ...a, ...b });
|
|
165294
|
-
return keys3.every((key) => deepEqual(a[key], b[key]));
|
|
165295
|
-
}
|
|
165296
|
-
return a === b;
|
|
165297
|
-
}
|
|
165298
|
-
|
|
165299
165234
|
// src/utils/sanitize-matter-string.ts
|
|
165300
165235
|
function sanitizeMatterString(value) {
|
|
165301
165236
|
return value.replace(/[*!~\x00-\x1f\x7f]/g, "").trim();
|
|
@@ -165314,6 +165249,7 @@ function trimToLength(value, maxLength, suffix) {
|
|
|
165314
165249
|
}
|
|
165315
165250
|
|
|
165316
165251
|
// src/matter/endpoints/server-mode-server-node.ts
|
|
165252
|
+
var logger158 = Logger.get("ServerModeServerNode");
|
|
165317
165253
|
var ServerModeServerNode = class extends ServerNode {
|
|
165318
165254
|
deviceEndpoint;
|
|
165319
165255
|
featureFlags;
|
|
@@ -165376,12 +165312,12 @@ var ServerModeServerNode = class extends ServerNode {
|
|
|
165376
165312
|
* BasicInformation — not the device endpoint's BridgedDeviceBasicInformation.
|
|
165377
165313
|
* Without this, server-mode devices show bridge defaults (e.g. "riddix" / "MatterHub").
|
|
165378
165314
|
*/
|
|
165379
|
-
updateDeviceIdentity(entityId, device, mapping, friendlyName) {
|
|
165315
|
+
async updateDeviceIdentity(entityId, device, mapping, friendlyName) {
|
|
165380
165316
|
const nodeLabel = trimToLength(mapping?.customName, 32, "...") ?? trimToLength(friendlyName, 32, "...") ?? trimToLength(entityId, 32, "...");
|
|
165381
165317
|
const productNameFromNodeLabel = this.featureFlags?.productNameFromNodeLabel === true ? trimToLength(sanitizeMatterString(nodeLabel ?? ""), 32, "...") ?? void 0 : void 0;
|
|
165382
165318
|
const rawSerial = trimToLength(mapping?.customSerialNumber, 32, "...");
|
|
165383
165319
|
const serialNumber = rawSerial && this.serialNumberSuffix ? trimToLength(`${rawSerial}${this.serialNumberSuffix}`, 32, "...") : rawSerial;
|
|
165384
|
-
|
|
165320
|
+
const basicInformation = dropUndefined({
|
|
165385
165321
|
vendorName: trimToLength(mapping?.customVendorName, 32, "...") ?? trimToLength(device?.manufacturer, 32, "..."),
|
|
165386
165322
|
productName: trimToLength(mapping?.customProductName, 32, "...") ?? productNameFromNodeLabel ?? trimToLength(device?.model_id, 32, "...") ?? trimToLength(device?.model, 32, "..."),
|
|
165387
165323
|
productLabel: trimToLength(device?.model, 64, "..."),
|
|
@@ -165390,12 +165326,32 @@ var ServerModeServerNode = class extends ServerNode {
|
|
|
165390
165326
|
hardwareVersionString: trimToLength(device?.hw_version, 64, "..."),
|
|
165391
165327
|
softwareVersionString: trimToLength(device?.sw_version, 64, "...")
|
|
165392
165328
|
});
|
|
165329
|
+
if (Object.keys(basicInformation).length === 0) {
|
|
165330
|
+
return;
|
|
165331
|
+
}
|
|
165332
|
+
try {
|
|
165333
|
+
await this.set({ basicInformation });
|
|
165334
|
+
} catch (e) {
|
|
165335
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
165336
|
+
logger158.warn(
|
|
165337
|
+
`Failed to apply server-mode identity for ${entityId}: ${msg}`
|
|
165338
|
+
);
|
|
165339
|
+
}
|
|
165393
165340
|
}
|
|
165394
165341
|
async factoryReset() {
|
|
165395
165342
|
await this.cancel();
|
|
165396
165343
|
await this.erase();
|
|
165397
165344
|
}
|
|
165398
165345
|
};
|
|
165346
|
+
function dropUndefined(obj) {
|
|
165347
|
+
const result = {};
|
|
165348
|
+
for (const key in obj) {
|
|
165349
|
+
if (obj[key] !== void 0) {
|
|
165350
|
+
result[key] = obj[key];
|
|
165351
|
+
}
|
|
165352
|
+
}
|
|
165353
|
+
return result;
|
|
165354
|
+
}
|
|
165399
165355
|
|
|
165400
165356
|
// src/plugins/plugin-manager.ts
|
|
165401
165357
|
init_esm();
|
|
@@ -166511,6 +166467,74 @@ var BridgeDataProvider = class extends Service {
|
|
|
166511
166467
|
}
|
|
166512
166468
|
};
|
|
166513
166469
|
|
|
166470
|
+
// src/utils/apply-patch-state.ts
|
|
166471
|
+
init_esm();
|
|
166472
|
+
var logger161 = Logger.get("ApplyPatchState");
|
|
166473
|
+
function applyPatchState(state, patch, options) {
|
|
166474
|
+
return applyPatch(state, patch, options?.force);
|
|
166475
|
+
}
|
|
166476
|
+
function applyPatch(state, patch, force = false) {
|
|
166477
|
+
const actualPatch = {};
|
|
166478
|
+
for (const key in patch) {
|
|
166479
|
+
if (Object.hasOwn(patch, key)) {
|
|
166480
|
+
const patchValue = patch[key];
|
|
166481
|
+
if (patchValue !== void 0) {
|
|
166482
|
+
const stateValue = state[key];
|
|
166483
|
+
if (force || !deepEqual(stateValue, patchValue)) {
|
|
166484
|
+
actualPatch[key] = patchValue;
|
|
166485
|
+
}
|
|
166486
|
+
}
|
|
166487
|
+
}
|
|
166488
|
+
}
|
|
166489
|
+
const failedKeys = [];
|
|
166490
|
+
for (const key in actualPatch) {
|
|
166491
|
+
if (!Object.hasOwn(actualPatch, key)) continue;
|
|
166492
|
+
try {
|
|
166493
|
+
state[key] = actualPatch[key];
|
|
166494
|
+
} catch (e) {
|
|
166495
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
166496
|
+
if (errorMessage.includes(
|
|
166497
|
+
"Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
|
|
166498
|
+
)) {
|
|
166499
|
+
logger161.debug(
|
|
166500
|
+
`Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
|
|
166501
|
+
);
|
|
166502
|
+
return actualPatch;
|
|
166503
|
+
}
|
|
166504
|
+
if (errorMessage.includes("synchronous-transaction-conflict")) {
|
|
166505
|
+
logger161.warn(
|
|
166506
|
+
`Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
|
|
166507
|
+
);
|
|
166508
|
+
return actualPatch;
|
|
166509
|
+
}
|
|
166510
|
+
failedKeys.push(key);
|
|
166511
|
+
logger161.warn(`Failed to set property '${key}': ${errorMessage}`);
|
|
166512
|
+
}
|
|
166513
|
+
}
|
|
166514
|
+
if (failedKeys.length > 0) {
|
|
166515
|
+
logger161.warn(
|
|
166516
|
+
`${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
|
|
166517
|
+
);
|
|
166518
|
+
}
|
|
166519
|
+
return actualPatch;
|
|
166520
|
+
}
|
|
166521
|
+
function deepEqual(a, b) {
|
|
166522
|
+
if (a == null || b == null) {
|
|
166523
|
+
return a === b;
|
|
166524
|
+
}
|
|
166525
|
+
if (typeof a !== typeof b || Array.isArray(a) !== Array.isArray(b)) {
|
|
166526
|
+
return false;
|
|
166527
|
+
}
|
|
166528
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
166529
|
+
return a.length === b.length && a.every((vA, idx) => deepEqual(vA, b[idx]));
|
|
166530
|
+
}
|
|
166531
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
166532
|
+
const keys3 = Object.keys({ ...a, ...b });
|
|
166533
|
+
return keys3.every((key) => deepEqual(a[key], b[key]));
|
|
166534
|
+
}
|
|
166535
|
+
return a === b;
|
|
166536
|
+
}
|
|
166537
|
+
|
|
166514
166538
|
// src/plugins/plugin-behavior.ts
|
|
166515
166539
|
init_esm7();
|
|
166516
166540
|
var PluginDeviceBehavior = class extends Behavior {
|
|
@@ -166558,7 +166582,7 @@ function truncate(maxLength, value) {
|
|
|
166558
166582
|
}
|
|
166559
166583
|
|
|
166560
166584
|
// src/plugins/plugin-device-factory.ts
|
|
166561
|
-
var
|
|
166585
|
+
var logger162 = Logger.get("PluginDeviceFactory");
|
|
166562
166586
|
var deviceTypeMap = {
|
|
166563
166587
|
on_off_light: () => OnOffLightDevice.with(
|
|
166564
166588
|
IdentifyServer2,
|
|
@@ -166664,7 +166688,7 @@ var deviceTypeMap = {
|
|
|
166664
166688
|
function createPluginEndpointType(deviceType) {
|
|
166665
166689
|
const factory = deviceTypeMap[deviceType];
|
|
166666
166690
|
if (!factory) {
|
|
166667
|
-
|
|
166691
|
+
logger162.warn(`Unsupported plugin device type: "${deviceType}"`);
|
|
166668
166692
|
return void 0;
|
|
166669
166693
|
}
|
|
166670
166694
|
const endpoint = factory();
|
|
@@ -166679,7 +166703,7 @@ function getSupportedPluginDeviceTypes() {
|
|
|
166679
166703
|
init_esm();
|
|
166680
166704
|
import * as fs10 from "node:fs";
|
|
166681
166705
|
import * as path11 from "node:path";
|
|
166682
|
-
var
|
|
166706
|
+
var logger163 = Logger.get("PluginStorage");
|
|
166683
166707
|
var SAVE_DEBOUNCE_MS = 500;
|
|
166684
166708
|
var FilePluginStorage = class {
|
|
166685
166709
|
data = {};
|
|
@@ -166715,7 +166739,7 @@ var FilePluginStorage = class {
|
|
|
166715
166739
|
this.data = JSON.parse(raw);
|
|
166716
166740
|
}
|
|
166717
166741
|
} catch (e) {
|
|
166718
|
-
|
|
166742
|
+
logger163.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
|
|
166719
166743
|
this.data = {};
|
|
166720
166744
|
}
|
|
166721
166745
|
}
|
|
@@ -166737,7 +166761,7 @@ var FilePluginStorage = class {
|
|
|
166737
166761
|
fs10.writeFileSync(this.filePath, JSON.stringify(this.data, null, 2));
|
|
166738
166762
|
this.dirty = false;
|
|
166739
166763
|
} catch (e) {
|
|
166740
|
-
|
|
166764
|
+
logger163.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
|
|
166741
166765
|
}
|
|
166742
166766
|
}
|
|
166743
166767
|
flush() {
|
|
@@ -166747,7 +166771,7 @@ var FilePluginStorage = class {
|
|
|
166747
166771
|
|
|
166748
166772
|
// src/plugins/safe-plugin-runner.ts
|
|
166749
166773
|
init_esm();
|
|
166750
|
-
var
|
|
166774
|
+
var logger164 = Logger.get("SafePluginRunner");
|
|
166751
166775
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
166752
166776
|
var CIRCUIT_BREAKER_THRESHOLD = 3;
|
|
166753
166777
|
var SafePluginRunner = class {
|
|
@@ -166780,7 +166804,7 @@ var SafePluginRunner = class {
|
|
|
166780
166804
|
async run(pluginName, operation, fn, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
166781
166805
|
const state = this.getState(pluginName);
|
|
166782
166806
|
if (state.disabled) {
|
|
166783
|
-
|
|
166807
|
+
logger164.debug(
|
|
166784
166808
|
`Plugin "${pluginName}" is disabled (circuit breaker open), skipping ${operation}`
|
|
166785
166809
|
);
|
|
166786
166810
|
return void 0;
|
|
@@ -166798,13 +166822,13 @@ var SafePluginRunner = class {
|
|
|
166798
166822
|
timeout.clear();
|
|
166799
166823
|
state.failures++;
|
|
166800
166824
|
state.lastError = error instanceof Error ? error.message : String(error);
|
|
166801
|
-
|
|
166825
|
+
logger164.error(
|
|
166802
166826
|
`Plugin "${pluginName}" failed during ${operation} (failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
|
|
166803
166827
|
);
|
|
166804
166828
|
if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
|
|
166805
166829
|
state.disabled = true;
|
|
166806
166830
|
state.disabledAt = Date.now();
|
|
166807
|
-
|
|
166831
|
+
logger164.error(
|
|
166808
166832
|
`Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures. Last error: ${state.lastError}`
|
|
166809
166833
|
);
|
|
166810
166834
|
}
|
|
@@ -166826,13 +166850,13 @@ var SafePluginRunner = class {
|
|
|
166826
166850
|
} catch (error) {
|
|
166827
166851
|
state.failures++;
|
|
166828
166852
|
state.lastError = error instanceof Error ? error.message : String(error);
|
|
166829
|
-
|
|
166853
|
+
logger164.error(
|
|
166830
166854
|
`Plugin "${pluginName}" failed during ${operation} (sync, failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
|
|
166831
166855
|
);
|
|
166832
166856
|
if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
|
|
166833
166857
|
state.disabled = true;
|
|
166834
166858
|
state.disabledAt = Date.now();
|
|
166835
|
-
|
|
166859
|
+
logger164.error(
|
|
166836
166860
|
`Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures.`
|
|
166837
166861
|
);
|
|
166838
166862
|
}
|
|
@@ -166858,7 +166882,7 @@ var SafePluginRunner = class {
|
|
|
166858
166882
|
};
|
|
166859
166883
|
|
|
166860
166884
|
// src/plugins/plugin-manager.ts
|
|
166861
|
-
var
|
|
166885
|
+
var logger165 = Logger.get("PluginManager");
|
|
166862
166886
|
var PLUGIN_API_VERSION = 1;
|
|
166863
166887
|
var MAX_PLUGIN_DEVICE_ID_LENGTH = 100;
|
|
166864
166888
|
function validatePluginDevice(device) {
|
|
@@ -166941,7 +166965,7 @@ var PluginManager = class {
|
|
|
166941
166965
|
throw new Error(`Plugin at ${packagePath} package.json missing "main"`);
|
|
166942
166966
|
}
|
|
166943
166967
|
if (manifest.hamhPluginApiVersion != null && manifest.hamhPluginApiVersion !== PLUGIN_API_VERSION) {
|
|
166944
|
-
|
|
166968
|
+
logger165.warn(
|
|
166945
166969
|
`Plugin "${manifest.name}" declares API version ${manifest.hamhPluginApiVersion}, current is ${PLUGIN_API_VERSION}. It may not work correctly.`
|
|
166946
166970
|
);
|
|
166947
166971
|
}
|
|
@@ -166972,7 +166996,7 @@ var PluginManager = class {
|
|
|
166972
166996
|
};
|
|
166973
166997
|
await this.register(plugin, metadata);
|
|
166974
166998
|
} catch (e) {
|
|
166975
|
-
|
|
166999
|
+
logger165.error(`Failed to load external plugin from ${packagePath}:`, e);
|
|
166976
167000
|
throw e;
|
|
166977
167001
|
}
|
|
166978
167002
|
}
|
|
@@ -167049,7 +167073,7 @@ var PluginManager = class {
|
|
|
167049
167073
|
devices,
|
|
167050
167074
|
started: false
|
|
167051
167075
|
});
|
|
167052
|
-
|
|
167076
|
+
logger165.info(
|
|
167053
167077
|
`Registered plugin: ${plugin.name} v${plugin.version} (${metadata.source})`
|
|
167054
167078
|
);
|
|
167055
167079
|
}
|
|
@@ -167060,13 +167084,13 @@ var PluginManager = class {
|
|
|
167060
167084
|
for (const [name, instance] of this.instances) {
|
|
167061
167085
|
if (!instance.metadata.enabled) continue;
|
|
167062
167086
|
if (this.runner.isDisabled(name)) {
|
|
167063
|
-
|
|
167087
|
+
logger165.warn(
|
|
167064
167088
|
`Plugin "${name}" is disabled (circuit breaker), skipping start`
|
|
167065
167089
|
);
|
|
167066
167090
|
instance.metadata.enabled = false;
|
|
167067
167091
|
continue;
|
|
167068
167092
|
}
|
|
167069
|
-
|
|
167093
|
+
logger165.info(`Starting plugin: ${name}`);
|
|
167070
167094
|
await this.runner.run(
|
|
167071
167095
|
name,
|
|
167072
167096
|
"onStart",
|
|
@@ -167114,7 +167138,7 @@ var PluginManager = class {
|
|
|
167114
167138
|
storage2.flush();
|
|
167115
167139
|
}
|
|
167116
167140
|
instance.started = false;
|
|
167117
|
-
|
|
167141
|
+
logger165.info(`Plugin "${name}" shut down`);
|
|
167118
167142
|
}
|
|
167119
167143
|
this.instances.clear();
|
|
167120
167144
|
}
|
|
@@ -167525,10 +167549,10 @@ init_diagnostic_event_bus();
|
|
|
167525
167549
|
var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
167526
167550
|
var DEAD_SESSION_TIMEOUT_MS = 6e4;
|
|
167527
167551
|
var Bridge = class {
|
|
167528
|
-
constructor(env,
|
|
167552
|
+
constructor(env, logger207, dataProvider, endpointManager) {
|
|
167529
167553
|
this.dataProvider = dataProvider;
|
|
167530
167554
|
this.endpointManager = endpointManager;
|
|
167531
|
-
this.log =
|
|
167555
|
+
this.log = logger207.get(`Bridge / ${dataProvider.id}`);
|
|
167532
167556
|
this.server = new BridgeServerNode(
|
|
167533
167557
|
env,
|
|
167534
167558
|
this.dataProvider,
|
|
@@ -168349,7 +168373,7 @@ init_clusters();
|
|
|
168349
168373
|
|
|
168350
168374
|
// src/matter/behaviors/electrical-energy-measurement-server.ts
|
|
168351
168375
|
init_home_assistant_entity_behavior();
|
|
168352
|
-
var
|
|
168376
|
+
var logger166 = Logger.get("ElectricalEnergyMeasurementServer");
|
|
168353
168377
|
var FeaturedBase = ElectricalEnergyMeasurementServer.with("CumulativeEnergy", "ImportedEnergy");
|
|
168354
168378
|
var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
|
|
168355
168379
|
async initialize() {
|
|
@@ -168358,7 +168382,7 @@ var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
|
|
|
168358
168382
|
const entityId = homeAssistant.entityId;
|
|
168359
168383
|
const energyEntity = homeAssistant.state.mapping?.energyEntity;
|
|
168360
168384
|
if (energyEntity) {
|
|
168361
|
-
|
|
168385
|
+
logger166.debug(
|
|
168362
168386
|
`[${entityId}] ElectricalEnergyMeasurement using mapped energy entity: ${energyEntity}`
|
|
168363
168387
|
);
|
|
168364
168388
|
}
|
|
@@ -168410,7 +168434,7 @@ var HaElectricalEnergyMeasurementServer = ElectricalEnergyMeasurementServerBase.
|
|
|
168410
168434
|
// src/matter/behaviors/electrical-power-measurement-server.ts
|
|
168411
168435
|
init_esm();
|
|
168412
168436
|
init_home_assistant_entity_behavior();
|
|
168413
|
-
var
|
|
168437
|
+
var logger167 = Logger.get("ElectricalPowerMeasurementServer");
|
|
168414
168438
|
var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurementServer {
|
|
168415
168439
|
async initialize() {
|
|
168416
168440
|
await super.initialize();
|
|
@@ -168418,7 +168442,7 @@ var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurem
|
|
|
168418
168442
|
const entityId = homeAssistant.entityId;
|
|
168419
168443
|
const powerEntity = homeAssistant.state.mapping?.powerEntity;
|
|
168420
168444
|
if (powerEntity) {
|
|
168421
|
-
|
|
168445
|
+
logger167.debug(
|
|
168422
168446
|
`[${entityId}] ElectricalPowerMeasurement using mapped power entity: ${powerEntity}`
|
|
168423
168447
|
);
|
|
168424
168448
|
}
|
|
@@ -168470,7 +168494,7 @@ init_home_assistant_entity_behavior();
|
|
|
168470
168494
|
// src/matter/behaviors/humidity-measurement-server.ts
|
|
168471
168495
|
init_esm();
|
|
168472
168496
|
init_home_assistant_entity_behavior();
|
|
168473
|
-
var
|
|
168497
|
+
var logger168 = Logger.get("HumidityMeasurementServer");
|
|
168474
168498
|
var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementServer {
|
|
168475
168499
|
async initialize() {
|
|
168476
168500
|
await super.initialize();
|
|
@@ -168483,7 +168507,7 @@ var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementSer
|
|
|
168483
168507
|
return;
|
|
168484
168508
|
}
|
|
168485
168509
|
const humidity = this.getHumidity(this.state.config, entity.state);
|
|
168486
|
-
|
|
168510
|
+
logger168.debug(
|
|
168487
168511
|
`Humidity ${entity.state.entity_id} raw=${entity.state.state} measuredValue=${humidity}`
|
|
168488
168512
|
);
|
|
168489
168513
|
applyPatchState(this.state, {
|
|
@@ -168513,7 +168537,7 @@ function HumidityMeasurementServer(config10) {
|
|
|
168513
168537
|
// src/matter/behaviors/power-source-server.ts
|
|
168514
168538
|
init_esm();
|
|
168515
168539
|
init_home_assistant_entity_behavior();
|
|
168516
|
-
var
|
|
168540
|
+
var logger169 = Logger.get("PowerSourceServer");
|
|
168517
168541
|
var FeaturedBase2 = PowerSourceServer.with("Battery", "Rechargeable");
|
|
168518
168542
|
var PowerSourceServerBase = class extends FeaturedBase2 {
|
|
168519
168543
|
async initialize() {
|
|
@@ -168525,17 +168549,17 @@ var PowerSourceServerBase = class extends FeaturedBase2 {
|
|
|
168525
168549
|
applyPatchState(this.state, {
|
|
168526
168550
|
endpointList: [endpointNumber]
|
|
168527
168551
|
});
|
|
168528
|
-
|
|
168552
|
+
logger169.debug(
|
|
168529
168553
|
`[${entityId}] PowerSource initialized with endpointList=[${endpointNumber}]`
|
|
168530
168554
|
);
|
|
168531
168555
|
} else {
|
|
168532
|
-
|
|
168556
|
+
logger169.warn(
|
|
168533
168557
|
`[${entityId}] PowerSource endpoint number is null during initialize - endpointList will be empty!`
|
|
168534
168558
|
);
|
|
168535
168559
|
}
|
|
168536
168560
|
const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
|
|
168537
168561
|
if (batteryEntity) {
|
|
168538
|
-
|
|
168562
|
+
logger169.debug(
|
|
168539
168563
|
`[${entityId}] PowerSource using mapped battery entity: ${batteryEntity}`
|
|
168540
168564
|
);
|
|
168541
168565
|
}
|
|
@@ -168883,7 +168907,7 @@ function notifyLightTurnedOn(entityId) {
|
|
|
168883
168907
|
sweepLastTurnOn(now);
|
|
168884
168908
|
lastTurnOnTimestamps.set(entityId, now);
|
|
168885
168909
|
}
|
|
168886
|
-
var
|
|
168910
|
+
var logger170 = Logger.get("LevelControlServer");
|
|
168887
168911
|
var FeaturedBase4 = LevelControlServer.with("OnOff", "Lighting");
|
|
168888
168912
|
var LevelControlServerBase = class extends FeaturedBase4 {
|
|
168889
168913
|
pendingTransitionTime;
|
|
@@ -168901,7 +168925,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
168901
168925
|
try {
|
|
168902
168926
|
await super.initialize();
|
|
168903
168927
|
} catch (error) {
|
|
168904
|
-
|
|
168928
|
+
logger170.error("super.initialize() failed:", error);
|
|
168905
168929
|
throw error;
|
|
168906
168930
|
}
|
|
168907
168931
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -168978,7 +169002,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
168978
169002
|
const lastTurnOn = lastTurnOnTimestamps.get(entityId);
|
|
168979
169003
|
const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
|
|
168980
169004
|
if (level >= this.maxLevel && timeSinceTurnOn < 200) {
|
|
168981
|
-
|
|
169005
|
+
logger170.debug(
|
|
168982
169006
|
`[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
|
|
168983
169007
|
);
|
|
168984
169008
|
return;
|
|
@@ -169024,7 +169048,7 @@ function LevelControlServer2(config10) {
|
|
|
169024
169048
|
}
|
|
169025
169049
|
|
|
169026
169050
|
// src/matter/behaviors/on-off-server.ts
|
|
169027
|
-
var
|
|
169051
|
+
var logger171 = Logger.get("OnOffServer");
|
|
169028
169052
|
var optimisticOnOffState = /* @__PURE__ */ new Map();
|
|
169029
169053
|
var OPTIMISTIC_TIMEOUT_MS2 = 3e3;
|
|
169030
169054
|
function sweepOptimisticOnOff(now) {
|
|
@@ -169075,7 +169099,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
169075
169099
|
if (!action) {
|
|
169076
169100
|
return;
|
|
169077
169101
|
}
|
|
169078
|
-
|
|
169102
|
+
logger171.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
|
|
169079
169103
|
notifyLightTurnedOn(homeAssistant.entityId);
|
|
169080
169104
|
const now = Date.now();
|
|
169081
169105
|
sweepOptimisticOnOff(now);
|
|
@@ -169100,7 +169124,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
169100
169124
|
if (!action) {
|
|
169101
169125
|
return;
|
|
169102
169126
|
}
|
|
169103
|
-
|
|
169127
|
+
logger171.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
|
|
169104
169128
|
const now = Date.now();
|
|
169105
169129
|
sweepOptimisticOnOff(now);
|
|
169106
169130
|
optimisticOnOffState.set(homeAssistant.entityId, {
|
|
@@ -169134,7 +169158,7 @@ function setOptimisticOnOff(entityId, expectedOnOff) {
|
|
|
169134
169158
|
}
|
|
169135
169159
|
|
|
169136
169160
|
// src/matter/behaviors/fan-control-server.ts
|
|
169137
|
-
var
|
|
169161
|
+
var logger172 = Logger.get("FanControlServer");
|
|
169138
169162
|
var defaultStepSize = 33.33;
|
|
169139
169163
|
var minSpeedMax = 3;
|
|
169140
169164
|
var maxSpeedMax = 100;
|
|
@@ -169510,7 +169534,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
169510
169534
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
169511
169535
|
setOptimisticOnOff(entityId, on);
|
|
169512
169536
|
} catch (e) {
|
|
169513
|
-
|
|
169537
|
+
logger172.debug(
|
|
169514
169538
|
`syncOnOff(${on}) failed: ${e instanceof Error ? e.message : String(e)}`
|
|
169515
169539
|
);
|
|
169516
169540
|
}
|
|
@@ -169601,7 +169625,7 @@ var FanOnOffServer = OnOffServer2({
|
|
|
169601
169625
|
});
|
|
169602
169626
|
|
|
169603
169627
|
// src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
|
|
169604
|
-
var
|
|
169628
|
+
var logger173 = Logger.get("ComposedAirPurifierEndpoint");
|
|
169605
169629
|
var temperatureConfig = {
|
|
169606
169630
|
getValue(entity, agent) {
|
|
169607
169631
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
@@ -169814,7 +169838,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
169814
169838
|
config10.powerEntityId ? "+Pwr" : "",
|
|
169815
169839
|
config10.energyEntityId ? "+Nrg" : ""
|
|
169816
169840
|
].filter(Boolean).join("");
|
|
169817
|
-
|
|
169841
|
+
logger173.info(
|
|
169818
169842
|
`Created composed air purifier ${primaryEntityId}: ${clusterLabels}`
|
|
169819
169843
|
);
|
|
169820
169844
|
return endpoint;
|
|
@@ -169914,7 +169938,7 @@ init_home_assistant_entity_behavior();
|
|
|
169914
169938
|
// src/matter/behaviors/pressure-measurement-server.ts
|
|
169915
169939
|
init_esm();
|
|
169916
169940
|
init_home_assistant_entity_behavior();
|
|
169917
|
-
var
|
|
169941
|
+
var logger174 = Logger.get("PressureMeasurementServer");
|
|
169918
169942
|
var MIN_PRESSURE = 300;
|
|
169919
169943
|
var MAX_PRESSURE = 1100;
|
|
169920
169944
|
var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
@@ -169942,7 +169966,7 @@ var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
|
169942
169966
|
}
|
|
169943
169967
|
const rounded = Math.round(value);
|
|
169944
169968
|
if (rounded < MIN_PRESSURE || rounded > MAX_PRESSURE) {
|
|
169945
|
-
|
|
169969
|
+
logger174.warn(
|
|
169946
169970
|
`Pressure value ${rounded} (raw: ${value}) for ${entity.entity_id} is outside valid range [${MIN_PRESSURE}-${MAX_PRESSURE}], ignoring`
|
|
169947
169971
|
);
|
|
169948
169972
|
return null;
|
|
@@ -169961,7 +169985,7 @@ function PressureMeasurementServer2(config10) {
|
|
|
169961
169985
|
}
|
|
169962
169986
|
|
|
169963
169987
|
// src/matter/endpoints/composed/composed-sensor-endpoint.ts
|
|
169964
|
-
var
|
|
169988
|
+
var logger175 = Logger.get("ComposedSensorEndpoint");
|
|
169965
169989
|
var temperatureConfig2 = {
|
|
169966
169990
|
getValue(entity, agent) {
|
|
169967
169991
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
@@ -170135,7 +170159,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
|
|
|
170135
170159
|
if (config10.pressureEntityId && pressSub) {
|
|
170136
170160
|
endpoint.subEndpoints.set(config10.pressureEntityId, pressSub);
|
|
170137
170161
|
}
|
|
170138
|
-
|
|
170162
|
+
logger175.info(
|
|
170139
170163
|
`Created composed sensor ${primaryEntityId} with ${parts.length} sub-endpoint(s): T${humSub ? "+H" : ""}${pressSub ? "+P" : ""}${config10.batteryEntityId ? "+Bat" : ""}${config10.powerEntityId ? "+Pwr" : ""}${config10.energyEntityId ? "+Nrg" : ""}`
|
|
170140
170164
|
);
|
|
170141
170165
|
return endpoint;
|
|
@@ -170271,7 +170295,7 @@ init_home_assistant_entity_behavior();
|
|
|
170271
170295
|
// src/matter/behaviors/mode-select-server.ts
|
|
170272
170296
|
init_esm();
|
|
170273
170297
|
init_home_assistant_entity_behavior();
|
|
170274
|
-
var
|
|
170298
|
+
var logger176 = Logger.get("ModeSelectServer");
|
|
170275
170299
|
var ModeSelectServerBase = class extends ModeSelectServer {
|
|
170276
170300
|
async initialize() {
|
|
170277
170301
|
await super.initialize();
|
|
@@ -170300,13 +170324,13 @@ var ModeSelectServerBase = class extends ModeSelectServer {
|
|
|
170300
170324
|
const options = config10.getOptions(homeAssistant.entity);
|
|
170301
170325
|
const { newMode } = request;
|
|
170302
170326
|
if (newMode < 0 || newMode >= options.length) {
|
|
170303
|
-
|
|
170327
|
+
logger176.warn(
|
|
170304
170328
|
`[${homeAssistant.entityId}] Invalid mode ${newMode}, options: [${options.join(", ")}]`
|
|
170305
170329
|
);
|
|
170306
170330
|
return;
|
|
170307
170331
|
}
|
|
170308
170332
|
const option = options[newMode];
|
|
170309
|
-
|
|
170333
|
+
logger176.info(
|
|
170310
170334
|
`[${homeAssistant.entityId}] changeToMode(${newMode}) -> "${option}"`
|
|
170311
170335
|
);
|
|
170312
170336
|
applyPatchState(this.state, { currentMode: newMode });
|
|
@@ -170833,7 +170857,7 @@ var WaterLeakDetectorType = WaterLeakDetectorDevice.with(
|
|
|
170833
170857
|
);
|
|
170834
170858
|
|
|
170835
170859
|
// src/matter/endpoints/legacy/binary-sensor/index.ts
|
|
170836
|
-
var
|
|
170860
|
+
var logger177 = Logger.get("BinarySensorDevice");
|
|
170837
170861
|
var deviceClasses = {
|
|
170838
170862
|
[BinarySensorDeviceClass.CarbonMonoxide]: CoAlarmType,
|
|
170839
170863
|
[BinarySensorDeviceClass.Gas]: CoAlarmType,
|
|
@@ -170885,11 +170909,11 @@ function BinarySensorDevice(homeAssistantEntity) {
|
|
|
170885
170909
|
const originalTypeName = type.name;
|
|
170886
170910
|
if (hasBattery && batteryTypes.has(type)) {
|
|
170887
170911
|
type = batteryTypes.get(type);
|
|
170888
|
-
|
|
170912
|
+
logger177.info(
|
|
170889
170913
|
`[${entityId}] Using battery variant: ${originalTypeName} -> ${type.name}, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
170890
170914
|
);
|
|
170891
170915
|
} else if (hasBattery) {
|
|
170892
|
-
|
|
170916
|
+
logger177.warn(
|
|
170893
170917
|
`[${entityId}] Has battery but no variant available for ${originalTypeName}`
|
|
170894
170918
|
);
|
|
170895
170919
|
}
|
|
@@ -171043,7 +171067,7 @@ init_home_assistant_entity_behavior();
|
|
|
171043
171067
|
// src/matter/behaviors/thermostat-server.ts
|
|
171044
171068
|
init_esm();
|
|
171045
171069
|
init_home_assistant_entity_behavior();
|
|
171046
|
-
var
|
|
171070
|
+
var logger178 = Logger.get("ThermostatServer");
|
|
171047
171071
|
var SystemMode = Thermostat3.SystemMode;
|
|
171048
171072
|
var RunningMode = Thermostat3.ThermostatRunningMode;
|
|
171049
171073
|
var nudgingSetpoints = /* @__PURE__ */ new Set();
|
|
@@ -171101,7 +171125,7 @@ var HeatingAndCoolingFeaturedBase = ThermostatServer.with("Heating", "Cooling").
|
|
|
171101
171125
|
);
|
|
171102
171126
|
function thermostatPreInitialize(self) {
|
|
171103
171127
|
const currentLocal = self.state.localTemperature;
|
|
171104
|
-
|
|
171128
|
+
logger178.debug(
|
|
171105
171129
|
`initialize: features - heating=${self.features.heating}, cooling=${self.features.cooling}`
|
|
171106
171130
|
);
|
|
171107
171131
|
const localValue = typeof currentLocal === "number" && !Number.isNaN(currentLocal) ? currentLocal : currentLocal === null ? null : 2100;
|
|
@@ -171124,7 +171148,7 @@ function thermostatPreInitialize(self) {
|
|
|
171124
171148
|
const coolingValue = typeof currentCooling === "number" && !Number.isNaN(currentCooling) ? currentCooling : 2400;
|
|
171125
171149
|
self.state.occupiedCoolingSetpoint = coolingValue;
|
|
171126
171150
|
}
|
|
171127
|
-
|
|
171151
|
+
logger178.debug(
|
|
171128
171152
|
`initialize: after force-set - local=${self.state.localTemperature}`
|
|
171129
171153
|
);
|
|
171130
171154
|
self.state.thermostatRunningState = runningStateAllOff;
|
|
@@ -171206,7 +171230,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
171206
171230
|
maxCoolLimit,
|
|
171207
171231
|
"cool"
|
|
171208
171232
|
);
|
|
171209
|
-
|
|
171233
|
+
logger178.debug(
|
|
171210
171234
|
`update: limits heat=[${minHeatLimit}, ${maxHeatLimit}], cool=[${minCoolLimit}, ${maxCoolLimit}], systemMode=${systemMode}, runningMode=${runningMode}`
|
|
171211
171235
|
);
|
|
171212
171236
|
let controlSequence = config10.getControlSequence(entity.state, this.agent);
|
|
@@ -171279,18 +171303,18 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
171279
171303
|
*/
|
|
171280
171304
|
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: Called via thermostatPostInitialize + prototype copy
|
|
171281
171305
|
heatingSetpointChanging(value, _oldValue, context) {
|
|
171282
|
-
|
|
171306
|
+
logger178.debug(
|
|
171283
171307
|
`heatingSetpointChanging: value=${value}, oldValue=${_oldValue}, isOffline=${transactionIsOffline(context)}`
|
|
171284
171308
|
);
|
|
171285
171309
|
if (transactionIsOffline(context)) {
|
|
171286
|
-
|
|
171310
|
+
logger178.debug(
|
|
171287
171311
|
"heatingSetpointChanging: skipping - transaction is offline"
|
|
171288
171312
|
);
|
|
171289
171313
|
return;
|
|
171290
171314
|
}
|
|
171291
171315
|
const next = Temperature.celsius(value / 100);
|
|
171292
171316
|
if (!next) {
|
|
171293
|
-
|
|
171317
|
+
logger178.debug("heatingSetpointChanging: skipping - invalid temperature");
|
|
171294
171318
|
return;
|
|
171295
171319
|
}
|
|
171296
171320
|
this.agent.asLocalActor(() => {
|
|
@@ -171301,7 +171325,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
171301
171325
|
this.agent
|
|
171302
171326
|
);
|
|
171303
171327
|
const currentMode = this.state.systemMode;
|
|
171304
|
-
|
|
171328
|
+
logger178.debug(
|
|
171305
171329
|
`heatingSetpointChanging: supportsRange=${supportsRange}, systemMode=${currentMode}, features.heating=${this.features.heating}, features.cooling=${this.features.cooling}`
|
|
171306
171330
|
);
|
|
171307
171331
|
if (!supportsRange) {
|
|
@@ -171311,12 +171335,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
171311
171335
|
const isOff = currentMode === Thermostat3.SystemMode.Off;
|
|
171312
171336
|
if (isOff && this.features.heating) {
|
|
171313
171337
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
171314
|
-
|
|
171338
|
+
logger178.debug(
|
|
171315
171339
|
`heatingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
171316
171340
|
);
|
|
171317
171341
|
return;
|
|
171318
171342
|
}
|
|
171319
|
-
|
|
171343
|
+
logger178.info(
|
|
171320
171344
|
`heatingSetpointChanging: auto-resume - switching to Heat (was Off)`
|
|
171321
171345
|
);
|
|
171322
171346
|
const modeAction = config10.setSystemMode(
|
|
@@ -171325,17 +171349,17 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
171325
171349
|
);
|
|
171326
171350
|
homeAssistant.callAction(modeAction);
|
|
171327
171351
|
} else if (!isAutoMode && !isHeatingMode) {
|
|
171328
|
-
|
|
171352
|
+
logger178.debug(
|
|
171329
171353
|
`heatingSetpointChanging: skipping - not in heating/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
|
|
171330
171354
|
);
|
|
171331
171355
|
return;
|
|
171332
171356
|
}
|
|
171333
|
-
|
|
171357
|
+
logger178.debug(
|
|
171334
171358
|
`heatingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isHeatingMode=${isHeatingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
171335
171359
|
);
|
|
171336
171360
|
}
|
|
171337
171361
|
const coolingSetpoint = this.features.cooling ? this.state.occupiedCoolingSetpoint : value;
|
|
171338
|
-
|
|
171362
|
+
logger178.debug(
|
|
171339
171363
|
`heatingSetpointChanging: calling setTemperature with heat=${next.celsius(true)}, cool=${coolingSetpoint}`
|
|
171340
171364
|
);
|
|
171341
171365
|
this.setTemperature(
|
|
@@ -171374,12 +171398,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
171374
171398
|
const isOff = currentMode === Thermostat3.SystemMode.Off;
|
|
171375
171399
|
if (isOff && !this.features.heating && this.features.cooling) {
|
|
171376
171400
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
171377
|
-
|
|
171401
|
+
logger178.debug(
|
|
171378
171402
|
`coolingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
171379
171403
|
);
|
|
171380
171404
|
return;
|
|
171381
171405
|
}
|
|
171382
|
-
|
|
171406
|
+
logger178.info(
|
|
171383
171407
|
`coolingSetpointChanging: auto-resume - switching to Cool (was Off)`
|
|
171384
171408
|
);
|
|
171385
171409
|
const modeAction = config10.setSystemMode(
|
|
@@ -171388,12 +171412,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
171388
171412
|
);
|
|
171389
171413
|
homeAssistant.callAction(modeAction);
|
|
171390
171414
|
} else if (!isAutoMode && !isCoolingMode) {
|
|
171391
|
-
|
|
171415
|
+
logger178.debug(
|
|
171392
171416
|
`coolingSetpointChanging: skipping - not in cooling/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
|
|
171393
171417
|
);
|
|
171394
171418
|
return;
|
|
171395
171419
|
}
|
|
171396
|
-
|
|
171420
|
+
logger178.debug(
|
|
171397
171421
|
`coolingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isCoolingMode=${isCoolingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
171398
171422
|
);
|
|
171399
171423
|
}
|
|
@@ -171492,7 +171516,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
171492
171516
|
const effectiveMax = max ?? 5e3;
|
|
171493
171517
|
if (value == null || Number.isNaN(value)) {
|
|
171494
171518
|
const defaultValue = type === "heat" ? 2e3 : 2400;
|
|
171495
|
-
|
|
171519
|
+
logger178.debug(
|
|
171496
171520
|
`${type} setpoint is undefined, using default: ${defaultValue}`
|
|
171497
171521
|
);
|
|
171498
171522
|
return Math.max(effectiveMin, Math.min(effectiveMax, defaultValue));
|
|
@@ -171940,7 +171964,7 @@ init_home_assistant_entity_behavior();
|
|
|
171940
171964
|
init_esm();
|
|
171941
171965
|
init_home_assistant_actions();
|
|
171942
171966
|
init_home_assistant_entity_behavior();
|
|
171943
|
-
var
|
|
171967
|
+
var logger179 = Logger.get("WindowCoveringServer");
|
|
171944
171968
|
var MovementStatus = WindowCovering3.MovementStatus;
|
|
171945
171969
|
var FeaturedBase6 = WindowCoveringServer.with(
|
|
171946
171970
|
"Lift",
|
|
@@ -172056,7 +172080,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
172056
172080
|
}
|
|
172057
172081
|
return existing100ths ?? current100ths;
|
|
172058
172082
|
};
|
|
172059
|
-
|
|
172083
|
+
logger179.debug(
|
|
172060
172084
|
`Cover update for ${entity.entity_id}: state=${state.state}, lift=${currentLift}%, tilt=${currentTilt}%, movement=${MovementStatus[movementStatus]}`
|
|
172061
172085
|
);
|
|
172062
172086
|
const overrideType = config10.getCoverType?.(state, this.agent);
|
|
@@ -172101,9 +172125,9 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
172101
172125
|
);
|
|
172102
172126
|
if (Object.keys(appliedPatch).length > 0) {
|
|
172103
172127
|
const hasOperationalChange = "operationalStatus" in appliedPatch;
|
|
172104
|
-
const log = hasOperationalChange ?
|
|
172128
|
+
const log = hasOperationalChange ? logger179.info : logger179.debug;
|
|
172105
172129
|
log.call(
|
|
172106
|
-
|
|
172130
|
+
logger179,
|
|
172107
172131
|
`Cover ${entity.entity_id} state changed: ${JSON.stringify(appliedPatch)}`
|
|
172108
172132
|
);
|
|
172109
172133
|
}
|
|
@@ -172111,7 +172135,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
172111
172135
|
async handleMovement(type, _, direction, targetPercent100ths) {
|
|
172112
172136
|
const currentLift = this.state.currentPositionLiftPercent100ths ?? 0;
|
|
172113
172137
|
const currentTilt = this.state.currentPositionTiltPercent100ths ?? 0;
|
|
172114
|
-
|
|
172138
|
+
logger179.info(
|
|
172115
172139
|
`handleMovement: type=${MovementType[type]}, direction=${MovementDirection[direction]}, target=${targetPercent100ths}, currentLift=${currentLift}, currentTilt=${currentTilt}, absolutePosition=${this.features.absolutePosition}`
|
|
172116
172140
|
);
|
|
172117
172141
|
if (type === MovementType.Lift) {
|
|
@@ -172130,7 +172154,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
172130
172154
|
}
|
|
172131
172155
|
} else if (type === MovementType.Tilt) {
|
|
172132
172156
|
if (targetPercent100ths == null && this.lastLiftMovementDirection === direction && Date.now() - this.lastLiftMovementMs < 50) {
|
|
172133
|
-
|
|
172157
|
+
logger179.info(
|
|
172134
172158
|
`Skipping tilt ${MovementDirection[direction]} \u2014 lift already moving in same direction`
|
|
172135
172159
|
);
|
|
172136
172160
|
return;
|
|
@@ -172155,13 +172179,13 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
172155
172179
|
handleLiftOpen() {
|
|
172156
172180
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
172157
172181
|
const action = this.state.config.openCoverLift(void 0, this.agent);
|
|
172158
|
-
|
|
172182
|
+
logger179.info(`handleLiftOpen: calling action=${action.action}`);
|
|
172159
172183
|
homeAssistant.callAction(action);
|
|
172160
172184
|
}
|
|
172161
172185
|
handleLiftClose() {
|
|
172162
172186
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
172163
172187
|
const action = this.state.config.closeCoverLift(void 0, this.agent);
|
|
172164
|
-
|
|
172188
|
+
logger179.info(`handleLiftClose: calling action=${action.action}`);
|
|
172165
172189
|
homeAssistant.callAction(action);
|
|
172166
172190
|
}
|
|
172167
172191
|
handleGoToLiftPosition(targetPercent100ths) {
|
|
@@ -172182,7 +172206,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
172182
172206
|
this.lastLiftCommandTime = now;
|
|
172183
172207
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
172184
172208
|
const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
172185
|
-
|
|
172209
|
+
logger179.debug(
|
|
172186
172210
|
`Lift command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
|
|
172187
172211
|
);
|
|
172188
172212
|
if (this.liftDebounceTimer) {
|
|
@@ -172231,7 +172255,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
172231
172255
|
this.lastTiltCommandTime = now;
|
|
172232
172256
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
172233
172257
|
const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
172234
|
-
|
|
172258
|
+
logger179.debug(
|
|
172235
172259
|
`Tilt command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
|
|
172236
172260
|
);
|
|
172237
172261
|
if (this.tiltDebounceTimer) {
|
|
@@ -172283,7 +172307,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
|
|
|
172283
172307
|
}
|
|
172284
172308
|
|
|
172285
172309
|
// src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
|
|
172286
|
-
var
|
|
172310
|
+
var logger180 = Logger.get("CoverWindowCoveringServer");
|
|
172287
172311
|
var attributes5 = (entity) => entity.attributes;
|
|
172288
172312
|
var DEVICE_CLASS_TO_MATTER_TYPE = {
|
|
172289
172313
|
curtain: {
|
|
@@ -172310,7 +172334,17 @@ var DEVICE_CLASS_TO_MATTER_TYPE = {
|
|
|
172310
172334
|
var deviceClassMapping = (entity) => {
|
|
172311
172335
|
const raw = entity.attributes.device_class;
|
|
172312
172336
|
if (typeof raw !== "string") return void 0;
|
|
172313
|
-
|
|
172337
|
+
const mapping = DEVICE_CLASS_TO_MATTER_TYPE[raw.toLowerCase()];
|
|
172338
|
+
if (!mapping) return void 0;
|
|
172339
|
+
const supportedFeatures = attributes5(entity).supported_features ?? 0;
|
|
172340
|
+
const hasTilt = (supportedFeatures & CoverSupportedFeatures.support_open_tilt) !== 0;
|
|
172341
|
+
if (mapping.type === WindowCovering3.WindowCoveringType.TiltBlindTiltOnly && !hasTilt) {
|
|
172342
|
+
return {
|
|
172343
|
+
type: WindowCovering3.WindowCoveringType.Rollershade,
|
|
172344
|
+
endProductType: mapping.endProductType
|
|
172345
|
+
};
|
|
172346
|
+
}
|
|
172347
|
+
return mapping;
|
|
172314
172348
|
};
|
|
172315
172349
|
var MATTER_SEMANTIC_PLATFORMS = [
|
|
172316
172350
|
// Currently empty - no known platforms use Matter semantics by default
|
|
@@ -172328,7 +172362,7 @@ var adjustPositionForReading2 = (position, agent) => {
|
|
|
172328
172362
|
const { featureFlags } = agent.env.get(BridgeDataProvider);
|
|
172329
172363
|
const matterSem = usesMatterSemantics(agent);
|
|
172330
172364
|
const result = adjustPositionForReading(position, featureFlags, matterSem);
|
|
172331
|
-
|
|
172365
|
+
logger180.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
|
|
172332
172366
|
return result;
|
|
172333
172367
|
};
|
|
172334
172368
|
var adjustPositionForWriting2 = (position, agent) => {
|
|
@@ -172437,7 +172471,7 @@ var config5 = {
|
|
|
172437
172471
|
var CoverWindowCoveringServer = WindowCoveringServer2(config5);
|
|
172438
172472
|
|
|
172439
172473
|
// src/matter/endpoints/legacy/cover/index.ts
|
|
172440
|
-
var
|
|
172474
|
+
var logger181 = Logger.get("CoverDevice");
|
|
172441
172475
|
var DISCRETE_COVER_CLASSES = /* @__PURE__ */ new Set(["garage", "gate"]);
|
|
172442
172476
|
var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
|
|
172443
172477
|
const features2 = /* @__PURE__ */ new Set();
|
|
@@ -172448,7 +172482,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
|
|
|
172448
172482
|
features2.add("AbsolutePosition");
|
|
172449
172483
|
}
|
|
172450
172484
|
} else {
|
|
172451
|
-
|
|
172485
|
+
logger181.warn(
|
|
172452
172486
|
`[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
|
|
172453
172487
|
);
|
|
172454
172488
|
features2.add("Lift");
|
|
@@ -172467,7 +172501,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
|
|
|
172467
172501
|
features2.add("AbsolutePosition");
|
|
172468
172502
|
}
|
|
172469
172503
|
}
|
|
172470
|
-
|
|
172504
|
+
logger181.info(
|
|
172471
172505
|
`[${entityId}] Creating WindowCovering with features: [${[...features2].join(", ")}], supported_features=${supportedFeatures}`
|
|
172472
172506
|
);
|
|
172473
172507
|
const baseBehaviors = [
|
|
@@ -172491,18 +172525,18 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
172491
172525
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
172492
172526
|
const hasBattery = hasBatteryAttr || hasBatteryEntity;
|
|
172493
172527
|
if (hasBattery) {
|
|
172494
|
-
|
|
172528
|
+
logger181.info(
|
|
172495
172529
|
`[${entityId}] Creating cover with PowerSource cluster, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
172496
172530
|
);
|
|
172497
172531
|
} else {
|
|
172498
|
-
|
|
172532
|
+
logger181.debug(
|
|
172499
172533
|
`[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
|
|
172500
172534
|
);
|
|
172501
172535
|
}
|
|
172502
172536
|
const deviceClass = attributes7.device_class;
|
|
172503
172537
|
const isDiscrete = typeof deviceClass === "string" && DISCRETE_COVER_CLASSES.has(deviceClass.toLowerCase());
|
|
172504
172538
|
if (isDiscrete) {
|
|
172505
|
-
|
|
172539
|
+
logger181.info(
|
|
172506
172540
|
`[${entityId}] Garage/gate cover (device_class=${deviceClass}): using discrete Open/Close mode`
|
|
172507
172541
|
);
|
|
172508
172542
|
}
|
|
@@ -172619,7 +172653,7 @@ function DishwasherEndpoint(homeAssistantEntity) {
|
|
|
172619
172653
|
// src/matter/behaviors/generic-switch-server.ts
|
|
172620
172654
|
init_esm();
|
|
172621
172655
|
init_home_assistant_entity_behavior();
|
|
172622
|
-
var
|
|
172656
|
+
var logger182 = Logger.get("GenericSwitchServer");
|
|
172623
172657
|
var SimpleBase = SwitchServer.with(
|
|
172624
172658
|
"MomentarySwitch",
|
|
172625
172659
|
"MomentarySwitchRelease",
|
|
@@ -172661,7 +172695,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
|
|
|
172661
172695
|
await super.initialize();
|
|
172662
172696
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172663
172697
|
const entityId = homeAssistant.entityId;
|
|
172664
|
-
|
|
172698
|
+
logger182.debug(`[${entityId}] GenericSwitch initialized (simple)`);
|
|
172665
172699
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
172666
172700
|
}
|
|
172667
172701
|
handleEventChange() {
|
|
@@ -172672,7 +172706,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
|
|
|
172672
172706
|
const eventType = attrs.event_type;
|
|
172673
172707
|
if (!eventType) return;
|
|
172674
172708
|
const entityId = homeAssistant.entityId;
|
|
172675
|
-
|
|
172709
|
+
logger182.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
172676
172710
|
this.triggerPress(eventType);
|
|
172677
172711
|
}
|
|
172678
172712
|
triggerPress(eventType) {
|
|
@@ -172718,7 +172752,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
|
|
|
172718
172752
|
await super.initialize();
|
|
172719
172753
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172720
172754
|
const entityId = homeAssistant.entityId;
|
|
172721
|
-
|
|
172755
|
+
logger182.debug(`[${entityId}] GenericSwitch initialized (multi)`);
|
|
172722
172756
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
172723
172757
|
}
|
|
172724
172758
|
handleEventChange() {
|
|
@@ -172729,7 +172763,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
|
|
|
172729
172763
|
const eventType = attrs.event_type;
|
|
172730
172764
|
if (!eventType) return;
|
|
172731
172765
|
const entityId = homeAssistant.entityId;
|
|
172732
|
-
|
|
172766
|
+
logger182.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
172733
172767
|
this.triggerPress(eventType);
|
|
172734
172768
|
}
|
|
172735
172769
|
triggerPress(eventType) {
|
|
@@ -173065,7 +173099,7 @@ init_nodejs();
|
|
|
173065
173099
|
|
|
173066
173100
|
// src/matter/behaviors/color-control-server.ts
|
|
173067
173101
|
init_home_assistant_entity_behavior();
|
|
173068
|
-
var
|
|
173102
|
+
var logger183 = Logger.get("ColorControlServer");
|
|
173069
173103
|
var optimisticColorState = /* @__PURE__ */ new Map();
|
|
173070
173104
|
var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
|
|
173071
173105
|
var OPTIMISTIC_TOLERANCE2 = 5;
|
|
@@ -173104,7 +173138,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
173104
173138
|
if (this.state.startUpColorTemperatureMireds == null) {
|
|
173105
173139
|
this.state.startUpColorTemperatureMireds = defaultMireds;
|
|
173106
173140
|
}
|
|
173107
|
-
|
|
173141
|
+
logger183.debug(
|
|
173108
173142
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
173109
173143
|
);
|
|
173110
173144
|
}
|
|
@@ -173557,7 +173591,7 @@ init_home_assistant_entity_behavior();
|
|
|
173557
173591
|
// src/matter/behaviors/lock-server.ts
|
|
173558
173592
|
init_esm();
|
|
173559
173593
|
init_home_assistant_entity_behavior();
|
|
173560
|
-
var
|
|
173594
|
+
var logger184 = Logger.get("LockServer");
|
|
173561
173595
|
function hasStoredCredentialHelper(env, entityId) {
|
|
173562
173596
|
try {
|
|
173563
173597
|
const storage2 = env.get(LockCredentialStorage);
|
|
@@ -173715,7 +173749,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
173715
173749
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
173716
173750
|
const action = this.state.config.lock(void 0, this.agent);
|
|
173717
173751
|
const hasPinProvided = !!request.pinCode;
|
|
173718
|
-
|
|
173752
|
+
logger184.debug(
|
|
173719
173753
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
173720
173754
|
);
|
|
173721
173755
|
if (request.pinCode) {
|
|
@@ -173728,12 +173762,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
173728
173762
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
173729
173763
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
173730
173764
|
const hasPinProvided = !!request.pinCode;
|
|
173731
|
-
|
|
173765
|
+
logger184.debug(
|
|
173732
173766
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
173733
173767
|
);
|
|
173734
173768
|
if (this.state.requirePinForRemoteOperation) {
|
|
173735
173769
|
if (!request.pinCode) {
|
|
173736
|
-
|
|
173770
|
+
logger184.info(
|
|
173737
173771
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
173738
173772
|
);
|
|
173739
173773
|
throw new StatusResponseError(
|
|
@@ -173743,12 +173777,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
173743
173777
|
}
|
|
173744
173778
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
173745
173779
|
if (!this.verifyStoredPin(homeAssistant.entityId, providedPin)) {
|
|
173746
|
-
|
|
173780
|
+
logger184.info(
|
|
173747
173781
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
173748
173782
|
);
|
|
173749
173783
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
173750
173784
|
}
|
|
173751
|
-
|
|
173785
|
+
logger184.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
173752
173786
|
action.data = { ...action.data, code: providedPin };
|
|
173753
173787
|
}
|
|
173754
173788
|
homeAssistant.callAction(action);
|
|
@@ -173909,7 +173943,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173909
173943
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
173910
173944
|
const action = this.state.config.lock(void 0, this.agent);
|
|
173911
173945
|
const hasPinProvided = !!request.pinCode;
|
|
173912
|
-
|
|
173946
|
+
logger184.debug(
|
|
173913
173947
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
173914
173948
|
);
|
|
173915
173949
|
if (request.pinCode) {
|
|
@@ -173923,12 +173957,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173923
173957
|
const unlatchConfig = this.state.config.unlatch;
|
|
173924
173958
|
const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
|
|
173925
173959
|
const hasPinProvided = !!request.pinCode;
|
|
173926
|
-
|
|
173960
|
+
logger184.debug(
|
|
173927
173961
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
|
|
173928
173962
|
);
|
|
173929
173963
|
if (this.state.requirePinForRemoteOperation) {
|
|
173930
173964
|
if (!request.pinCode) {
|
|
173931
|
-
|
|
173965
|
+
logger184.info(
|
|
173932
173966
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
173933
173967
|
);
|
|
173934
173968
|
throw new StatusResponseError(
|
|
@@ -173938,12 +173972,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173938
173972
|
}
|
|
173939
173973
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
173940
173974
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
173941
|
-
|
|
173975
|
+
logger184.info(
|
|
173942
173976
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
173943
173977
|
);
|
|
173944
173978
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
173945
173979
|
}
|
|
173946
|
-
|
|
173980
|
+
logger184.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
173947
173981
|
action.data = { ...action.data, code: providedPin };
|
|
173948
173982
|
}
|
|
173949
173983
|
homeAssistant.callAction(action);
|
|
@@ -173958,12 +173992,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173958
173992
|
}
|
|
173959
173993
|
const action = unlatchConfig(void 0, this.agent);
|
|
173960
173994
|
const hasPinProvided = !!request.pinCode;
|
|
173961
|
-
|
|
173995
|
+
logger184.debug(
|
|
173962
173996
|
`unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
173963
173997
|
);
|
|
173964
173998
|
if (this.state.requirePinForRemoteOperation) {
|
|
173965
173999
|
if (!request.pinCode) {
|
|
173966
|
-
|
|
174000
|
+
logger184.info(
|
|
173967
174001
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
173968
174002
|
);
|
|
173969
174003
|
throw new StatusResponseError(
|
|
@@ -173973,12 +174007,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173973
174007
|
}
|
|
173974
174008
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
173975
174009
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
173976
|
-
|
|
174010
|
+
logger184.info(
|
|
173977
174011
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
173978
174012
|
);
|
|
173979
174013
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
173980
174014
|
}
|
|
173981
|
-
|
|
174015
|
+
logger184.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
|
|
173982
174016
|
action.data = { ...action.data, code: providedPin };
|
|
173983
174017
|
}
|
|
173984
174018
|
homeAssistant.callAction(action);
|
|
@@ -174129,7 +174163,7 @@ init_home_assistant_entity_behavior();
|
|
|
174129
174163
|
init_dist();
|
|
174130
174164
|
init_esm();
|
|
174131
174165
|
init_home_assistant_entity_behavior();
|
|
174132
|
-
var
|
|
174166
|
+
var logger185 = Logger.get("MediaPlayerKeypadInputServer");
|
|
174133
174167
|
var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
174134
174168
|
sendKey(request) {
|
|
174135
174169
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -174140,12 +174174,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
|
174140
174174
|
const features2 = attributes7.supported_features ?? 0;
|
|
174141
174175
|
const action = this.mapKeyToAction(request.keyCode, features2);
|
|
174142
174176
|
if (!action) {
|
|
174143
|
-
|
|
174177
|
+
logger185.debug(
|
|
174144
174178
|
`Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
|
|
174145
174179
|
);
|
|
174146
174180
|
return { status: KeypadInput3.Status.UnsupportedKey };
|
|
174147
174181
|
}
|
|
174148
|
-
|
|
174182
|
+
logger185.debug(
|
|
174149
174183
|
`sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
|
|
174150
174184
|
);
|
|
174151
174185
|
homeAssistant.callAction({ action });
|
|
@@ -174424,7 +174458,7 @@ init_home_assistant_entity_behavior();
|
|
|
174424
174458
|
// src/matter/behaviors/speaker-level-control-server.ts
|
|
174425
174459
|
init_esm();
|
|
174426
174460
|
init_home_assistant_entity_behavior();
|
|
174427
|
-
var
|
|
174461
|
+
var logger186 = Logger.get("SpeakerLevelControlServer");
|
|
174428
174462
|
var optimisticLevelState2 = /* @__PURE__ */ new Map();
|
|
174429
174463
|
var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
|
|
174430
174464
|
var OPTIMISTIC_TOLERANCE3 = 5;
|
|
@@ -174467,7 +174501,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
174467
174501
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
174468
174502
|
}
|
|
174469
174503
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
174470
|
-
|
|
174504
|
+
logger186.debug(
|
|
174471
174505
|
`[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
|
|
174472
174506
|
);
|
|
174473
174507
|
const optimistic = optimisticLevelState2.get(entity.entity_id);
|
|
@@ -174515,7 +174549,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
174515
174549
|
const config10 = this.state.config;
|
|
174516
174550
|
const entityId = homeAssistant.entity.entity_id;
|
|
174517
174551
|
const levelPercent = level / 254;
|
|
174518
|
-
|
|
174552
|
+
logger186.debug(
|
|
174519
174553
|
`[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
|
|
174520
174554
|
);
|
|
174521
174555
|
const current = config10.getValuePercent(
|
|
@@ -175879,7 +175913,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
|
|
|
175879
175913
|
};
|
|
175880
175914
|
|
|
175881
175915
|
// src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
|
|
175882
|
-
var
|
|
175916
|
+
var logger187 = Logger.get("TvocSensor");
|
|
175883
175917
|
function airQualityFromUgm3(value) {
|
|
175884
175918
|
if (value <= 300) return AirQuality3.AirQualityEnum.Good;
|
|
175885
175919
|
if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
|
|
@@ -175920,17 +175954,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
175920
175954
|
const attributes7 = entity.state.attributes;
|
|
175921
175955
|
const deviceClass = attributes7.device_class;
|
|
175922
175956
|
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
175923
|
-
|
|
175957
|
+
logger187.debug(
|
|
175924
175958
|
`[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
|
|
175925
175959
|
);
|
|
175926
175960
|
if (state != null && !Number.isNaN(+state)) {
|
|
175927
175961
|
const value = +state;
|
|
175928
175962
|
airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
|
|
175929
|
-
|
|
175963
|
+
logger187.debug(
|
|
175930
175964
|
`[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
|
|
175931
175965
|
);
|
|
175932
175966
|
} else {
|
|
175933
|
-
|
|
175967
|
+
logger187.warn(
|
|
175934
175968
|
`[${entity.entity_id}] TVOC state not a valid number: "${state}"`
|
|
175935
175969
|
);
|
|
175936
175970
|
}
|
|
@@ -176144,7 +176178,7 @@ init_home_assistant_entity_behavior();
|
|
|
176144
176178
|
// src/matter/behaviors/pm25-concentration-measurement-server.ts
|
|
176145
176179
|
init_esm();
|
|
176146
176180
|
init_home_assistant_entity_behavior();
|
|
176147
|
-
var
|
|
176181
|
+
var logger188 = Logger.get("Pm25ConcentrationMeasurementServer");
|
|
176148
176182
|
var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
|
|
176149
176183
|
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
176150
176184
|
);
|
|
@@ -176168,11 +176202,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
176168
176202
|
if (this.state.measurementMedium === void 0) {
|
|
176169
176203
|
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
176170
176204
|
}
|
|
176171
|
-
|
|
176205
|
+
logger188.debug(
|
|
176172
176206
|
"Pm25ConcentrationMeasurementServer: before super.initialize()"
|
|
176173
176207
|
);
|
|
176174
176208
|
await super.initialize();
|
|
176175
|
-
|
|
176209
|
+
logger188.debug(
|
|
176176
176210
|
"Pm25ConcentrationMeasurementServer: after super.initialize()"
|
|
176177
176211
|
);
|
|
176178
176212
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -176195,7 +176229,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
176195
176229
|
};
|
|
176196
176230
|
|
|
176197
176231
|
// src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
|
|
176198
|
-
var
|
|
176232
|
+
var logger189 = Logger.get("Pm25AirQualityServer");
|
|
176199
176233
|
var Pm25AirQualityServerBase = AirQualityServer.with(
|
|
176200
176234
|
AirQuality3.Feature.Fair,
|
|
176201
176235
|
AirQuality3.Feature.Moderate,
|
|
@@ -176207,9 +176241,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
|
|
|
176207
176241
|
if (this.state.airQuality === void 0) {
|
|
176208
176242
|
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
176209
176243
|
}
|
|
176210
|
-
|
|
176244
|
+
logger189.debug("Pm25AirQualityServer: before super.initialize()");
|
|
176211
176245
|
await super.initialize();
|
|
176212
|
-
|
|
176246
|
+
logger189.debug("Pm25AirQualityServer: after super.initialize()");
|
|
176213
176247
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
176214
176248
|
this.update(homeAssistant.entity);
|
|
176215
176249
|
this.reactTo(homeAssistant.onChange, this.update);
|
|
@@ -176595,7 +176629,7 @@ init_home_assistant_entity_behavior();
|
|
|
176595
176629
|
init_dist();
|
|
176596
176630
|
init_esm();
|
|
176597
176631
|
init_home_assistant_entity_behavior();
|
|
176598
|
-
var
|
|
176632
|
+
var logger190 = Logger.get("VacuumIdentifyServer");
|
|
176599
176633
|
var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
176600
176634
|
triggerEffect(effect) {
|
|
176601
176635
|
this.#locate("triggerEffect");
|
|
@@ -176612,11 +176646,11 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
176612
176646
|
const features2 = homeAssistant.entity.state.attributes.supported_features ?? 0;
|
|
176613
176647
|
const hasLocate = testBit(features2, VacuumDeviceFeature.LOCATE);
|
|
176614
176648
|
if (!hasLocate) {
|
|
176615
|
-
|
|
176649
|
+
logger190.warn(
|
|
176616
176650
|
`${source} for ${homeAssistant.entityId} \u2014 LOCATE not in supported_features (${features2}), calling vacuum.locate anyway`
|
|
176617
176651
|
);
|
|
176618
176652
|
} else {
|
|
176619
|
-
|
|
176653
|
+
logger190.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
|
|
176620
176654
|
}
|
|
176621
176655
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
176622
176656
|
}
|
|
@@ -176635,7 +176669,7 @@ init_rvc_run_mode();
|
|
|
176635
176669
|
|
|
176636
176670
|
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
176637
176671
|
init_home_assistant_entity_behavior();
|
|
176638
|
-
var
|
|
176672
|
+
var logger191 = Logger.get("RvcRunModeServer");
|
|
176639
176673
|
var ROOM_MODE_BASE = 100;
|
|
176640
176674
|
function isRoomMode(mode) {
|
|
176641
176675
|
return mode >= ROOM_MODE_BASE;
|
|
@@ -176716,7 +176750,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176716
176750
|
const s = getSession(this.endpoint);
|
|
176717
176751
|
if (s.loggedShortCircuits.has(reason)) return;
|
|
176718
176752
|
s.loggedShortCircuits.add(reason);
|
|
176719
|
-
|
|
176753
|
+
logger191.info(message);
|
|
176720
176754
|
}
|
|
176721
176755
|
/**
|
|
176722
176756
|
* Read the currentRoomEntity sensor and update currentArea + progress
|
|
@@ -176777,7 +176811,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176777
176811
|
}
|
|
176778
176812
|
}
|
|
176779
176813
|
if (matchedAreaId === null) {
|
|
176780
|
-
|
|
176814
|
+
logger191.info(
|
|
176781
176815
|
`currentRoom sensor: no match for "${roomName}" (segmentId=${segmentId}), activeAreas=[${s.activeAreas.join(", ")}], supportedAreas=[${serviceArea.state.supportedAreas.map((a) => `${a.areaId}:${a.areaInfo.locationInfo?.locationName}`).join(", ")}]`
|
|
176782
176816
|
);
|
|
176783
176817
|
return;
|
|
@@ -176787,14 +176821,14 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176787
176821
|
s.completedAreas.add(s.lastCurrentArea);
|
|
176788
176822
|
}
|
|
176789
176823
|
s.lastCurrentArea = matchedAreaId;
|
|
176790
|
-
|
|
176824
|
+
logger191.info(
|
|
176791
176825
|
`currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
|
|
176792
176826
|
);
|
|
176793
176827
|
this.trySetCurrentArea(matchedAreaId);
|
|
176794
176828
|
} catch (e) {
|
|
176795
176829
|
const msg = e instanceof Error ? e.message : String(e);
|
|
176796
176830
|
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
176797
|
-
|
|
176831
|
+
logger191.warn(`currentRoom sensor update failed: ${msg}`);
|
|
176798
176832
|
}
|
|
176799
176833
|
}
|
|
176800
176834
|
}
|
|
@@ -176809,7 +176843,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176809
176843
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
176810
176844
|
if (serviceArea.state.currentArea !== areaId) {
|
|
176811
176845
|
serviceArea.state.currentArea = areaId;
|
|
176812
|
-
|
|
176846
|
+
logger191.debug(`currentArea set to ${areaId}`);
|
|
176813
176847
|
}
|
|
176814
176848
|
this.updateProgress(serviceArea, areaId);
|
|
176815
176849
|
} catch {
|
|
@@ -177157,14 +177191,14 @@ init_esm();
|
|
|
177157
177191
|
|
|
177158
177192
|
// src/matter/behaviors/service-area-server.ts
|
|
177159
177193
|
init_esm();
|
|
177160
|
-
var
|
|
177194
|
+
var logger192 = Logger.get("ServiceAreaServer");
|
|
177161
177195
|
var ServiceAreaWithProgress = ServiceAreaBehavior.with(
|
|
177162
177196
|
ServiceArea3.Feature.ProgressReporting
|
|
177163
177197
|
);
|
|
177164
177198
|
var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
177165
177199
|
selectAreas(request) {
|
|
177166
177200
|
const { newAreas } = request;
|
|
177167
|
-
|
|
177201
|
+
logger192.info(
|
|
177168
177202
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
177169
177203
|
);
|
|
177170
177204
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -177173,7 +177207,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
177173
177207
|
(id) => !supportedAreaIds.includes(id)
|
|
177174
177208
|
);
|
|
177175
177209
|
if (invalidAreas.length > 0) {
|
|
177176
|
-
|
|
177210
|
+
logger192.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
177177
177211
|
return {
|
|
177178
177212
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
177179
177213
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -177184,7 +177218,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
177184
177218
|
areaId,
|
|
177185
177219
|
status: ServiceArea3.OperationalStatus.Pending
|
|
177186
177220
|
}));
|
|
177187
|
-
|
|
177221
|
+
logger192.info(
|
|
177188
177222
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
177189
177223
|
);
|
|
177190
177224
|
return {
|
|
@@ -177205,7 +177239,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
177205
177239
|
ServiceAreaServerBase2.State = State;
|
|
177206
177240
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
177207
177241
|
function ServiceAreaServer2(initialState) {
|
|
177208
|
-
|
|
177242
|
+
logger192.info(
|
|
177209
177243
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
177210
177244
|
);
|
|
177211
177245
|
return ServiceAreaServerBase.set({
|
|
@@ -177222,7 +177256,7 @@ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
|
|
|
177222
177256
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
|
|
177223
177257
|
selectAreas(request) {
|
|
177224
177258
|
const { newAreas } = request;
|
|
177225
|
-
|
|
177259
|
+
logger192.info(
|
|
177226
177260
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
177227
177261
|
);
|
|
177228
177262
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -177231,7 +177265,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
177231
177265
|
(id) => !supportedAreaIds.includes(id)
|
|
177232
177266
|
);
|
|
177233
177267
|
if (invalidAreas.length > 0) {
|
|
177234
|
-
|
|
177268
|
+
logger192.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
177235
177269
|
return {
|
|
177236
177270
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
177237
177271
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -177242,7 +177276,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
177242
177276
|
areaId,
|
|
177243
177277
|
status: ServiceArea3.OperationalStatus.Pending
|
|
177244
177278
|
}));
|
|
177245
|
-
|
|
177279
|
+
logger192.info(
|
|
177246
177280
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
177247
177281
|
);
|
|
177248
177282
|
return {
|
|
@@ -177263,14 +177297,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
177263
177297
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
177264
177298
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
177265
177299
|
function ServiceAreaServerWithMaps(initialState) {
|
|
177266
|
-
|
|
177300
|
+
logger192.info(
|
|
177267
177301
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
177268
177302
|
);
|
|
177269
177303
|
for (const map of initialState.supportedMaps) {
|
|
177270
177304
|
const areaCount = initialState.supportedAreas.filter(
|
|
177271
177305
|
(a) => a.mapId === map.mapId
|
|
177272
177306
|
).length;
|
|
177273
|
-
|
|
177307
|
+
logger192.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
177274
177308
|
}
|
|
177275
177309
|
return ServiceAreaServerWithMapsBase.set({
|
|
177276
177310
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -177282,7 +177316,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
177282
177316
|
}
|
|
177283
177317
|
|
|
177284
177318
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
177285
|
-
var
|
|
177319
|
+
var logger193 = Logger.get("VacuumServiceAreaServer");
|
|
177286
177320
|
function toAreaId(roomId) {
|
|
177287
177321
|
if (typeof roomId === "number") {
|
|
177288
177322
|
return roomId;
|
|
@@ -177361,13 +177395,13 @@ function createVacuumServiceAreaServer(attributes7, roomEntities, includeUnnamed
|
|
|
177361
177395
|
let rooms;
|
|
177362
177396
|
if (roomEntities && roomEntities.length > 0) {
|
|
177363
177397
|
rooms = buttonEntitiesToRooms(roomEntities, attributes7);
|
|
177364
|
-
|
|
177398
|
+
logger193.info(
|
|
177365
177399
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
177366
177400
|
);
|
|
177367
177401
|
} else {
|
|
177368
177402
|
rooms = parseVacuumRooms(attributes7, includeUnnamedRooms);
|
|
177369
177403
|
if (rooms.length > 0) {
|
|
177370
|
-
|
|
177404
|
+
logger193.info(
|
|
177371
177405
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
177372
177406
|
);
|
|
177373
177407
|
}
|
|
@@ -177421,7 +177455,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
177421
177455
|
landmarkInfo: null
|
|
177422
177456
|
}
|
|
177423
177457
|
}));
|
|
177424
|
-
|
|
177458
|
+
logger193.info(
|
|
177425
177459
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
177426
177460
|
);
|
|
177427
177461
|
return ServiceAreaServer2({
|
|
@@ -177443,7 +177477,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
177443
177477
|
landmarkInfo: null
|
|
177444
177478
|
}
|
|
177445
177479
|
}));
|
|
177446
|
-
|
|
177480
|
+
logger193.info(
|
|
177447
177481
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
|
|
177448
177482
|
);
|
|
177449
177483
|
return ServiceAreaServer2({
|
|
@@ -177454,11 +177488,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
177454
177488
|
}
|
|
177455
177489
|
|
|
177456
177490
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
177457
|
-
var
|
|
177491
|
+
var logger194 = Logger.get("VacuumRvcRunModeServer");
|
|
177458
177492
|
function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
|
|
177459
177493
|
const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
177460
177494
|
const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
|
|
177461
|
-
|
|
177495
|
+
logger194.info(
|
|
177462
177496
|
`Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
|
|
177463
177497
|
);
|
|
177464
177498
|
return {
|
|
@@ -177520,12 +177554,12 @@ function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, ser
|
|
|
177520
177554
|
const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
|
|
177521
177555
|
serviceArea.state.selectedAreas = [];
|
|
177522
177556
|
if (matched.length === 0) {
|
|
177523
|
-
|
|
177557
|
+
logger194.warn(
|
|
177524
177558
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
177525
177559
|
);
|
|
177526
177560
|
return { action: "vacuum.start" };
|
|
177527
177561
|
}
|
|
177528
|
-
|
|
177562
|
+
logger194.info(
|
|
177529
177563
|
`Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
|
|
177530
177564
|
);
|
|
177531
177565
|
for (let i = 1; i < matched.length; i++) {
|
|
@@ -177565,7 +177599,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177565
177599
|
VacuumState.paused
|
|
177566
177600
|
];
|
|
177567
177601
|
const isCleaning = cleaningStates.includes(state);
|
|
177568
|
-
|
|
177602
|
+
logger194.debug(
|
|
177569
177603
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
177570
177604
|
);
|
|
177571
177605
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -177597,7 +177631,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177597
177631
|
const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
|
|
177598
177632
|
serviceArea.state.selectedAreas = [];
|
|
177599
177633
|
if (haAreaIds.length > 0) {
|
|
177600
|
-
|
|
177634
|
+
logger194.info(
|
|
177601
177635
|
`CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
|
|
177602
177636
|
);
|
|
177603
177637
|
return {
|
|
@@ -177618,7 +177652,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177618
177652
|
}
|
|
177619
177653
|
}
|
|
177620
177654
|
if (buttonEntityIds.length > 0) {
|
|
177621
|
-
|
|
177655
|
+
logger194.info(
|
|
177622
177656
|
`Roborock: Pressing button entities for selected rooms: ${buttonEntityIds.join(", ")}`
|
|
177623
177657
|
);
|
|
177624
177658
|
serviceArea.state.selectedAreas = [];
|
|
@@ -177656,7 +177690,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177656
177690
|
}
|
|
177657
177691
|
}
|
|
177658
177692
|
if (roomIds.length > 0) {
|
|
177659
|
-
|
|
177693
|
+
logger194.info(
|
|
177660
177694
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
177661
177695
|
);
|
|
177662
177696
|
serviceArea.state.selectedAreas = [];
|
|
@@ -177664,7 +177698,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177664
177698
|
if (targetMapName) {
|
|
177665
177699
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
177666
177700
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
177667
|
-
|
|
177701
|
+
logger194.info(
|
|
177668
177702
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
177669
177703
|
);
|
|
177670
177704
|
homeAssistant.callAction({
|
|
@@ -177691,7 +177725,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177691
177725
|
}
|
|
177692
177726
|
if (isEcovacsVacuum(attributes7)) {
|
|
177693
177727
|
const roomIdStr = roomIds.join(",");
|
|
177694
|
-
|
|
177728
|
+
logger194.info(
|
|
177695
177729
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
177696
177730
|
);
|
|
177697
177731
|
return {
|
|
@@ -177706,14 +177740,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
177706
177740
|
}
|
|
177707
177741
|
};
|
|
177708
177742
|
}
|
|
177709
|
-
|
|
177743
|
+
logger194.warn(
|
|
177710
177744
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
177711
177745
|
);
|
|
177712
177746
|
}
|
|
177713
177747
|
}
|
|
177714
177748
|
} catch {
|
|
177715
177749
|
}
|
|
177716
|
-
|
|
177750
|
+
logger194.info("Starting regular cleaning (no areas selected)");
|
|
177717
177751
|
return { action: "vacuum.start" };
|
|
177718
177752
|
},
|
|
177719
177753
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -177728,7 +177762,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177728
177762
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
177729
177763
|
const entity = homeAssistant.entity;
|
|
177730
177764
|
const attributes7 = entity.state.attributes;
|
|
177731
|
-
|
|
177765
|
+
logger194.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
177732
177766
|
const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
|
|
177733
177767
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
177734
177768
|
const sorted = [...cleanAreaRooms].sort(
|
|
@@ -177737,7 +177771,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177737
177771
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
177738
177772
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
177739
177773
|
const area = sorted[areaIndex];
|
|
177740
|
-
|
|
177774
|
+
logger194.info(
|
|
177741
177775
|
`cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
|
|
177742
177776
|
);
|
|
177743
177777
|
return {
|
|
@@ -177754,7 +177788,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177754
177788
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
177755
177789
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
177756
177790
|
const area = sorted[areaIndex];
|
|
177757
|
-
|
|
177791
|
+
logger194.info(
|
|
177758
177792
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
177759
177793
|
);
|
|
177760
177794
|
return {
|
|
@@ -177775,7 +177809,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177775
177809
|
}
|
|
177776
177810
|
const rooms = parseVacuumRooms(attributes7);
|
|
177777
177811
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
177778
|
-
|
|
177812
|
+
logger194.info(
|
|
177779
177813
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
177780
177814
|
);
|
|
177781
177815
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -177785,7 +177819,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177785
177819
|
if (room.mapName) {
|
|
177786
177820
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
177787
177821
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
177788
|
-
|
|
177822
|
+
logger194.info(
|
|
177789
177823
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
177790
177824
|
);
|
|
177791
177825
|
homeAssistant.callAction({
|
|
@@ -177794,7 +177828,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177794
177828
|
data: { option: room.mapName }
|
|
177795
177829
|
});
|
|
177796
177830
|
}
|
|
177797
|
-
|
|
177831
|
+
logger194.debug(
|
|
177798
177832
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
177799
177833
|
);
|
|
177800
177834
|
return {
|
|
@@ -177805,7 +177839,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177805
177839
|
};
|
|
177806
177840
|
}
|
|
177807
177841
|
if (isRoborockVacuum(attributes7) || isXiaomiMiotVacuum(attributes7)) {
|
|
177808
|
-
|
|
177842
|
+
logger194.debug(
|
|
177809
177843
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
177810
177844
|
);
|
|
177811
177845
|
return {
|
|
@@ -177818,7 +177852,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177818
177852
|
}
|
|
177819
177853
|
if (isEcovacsVacuum(attributes7)) {
|
|
177820
177854
|
const roomIdStr = String(commandId3);
|
|
177821
|
-
|
|
177855
|
+
logger194.info(
|
|
177822
177856
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
177823
177857
|
);
|
|
177824
177858
|
return {
|
|
@@ -177833,7 +177867,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177833
177867
|
}
|
|
177834
177868
|
};
|
|
177835
177869
|
}
|
|
177836
|
-
|
|
177870
|
+
logger194.warn(
|
|
177837
177871
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
177838
177872
|
);
|
|
177839
177873
|
}
|
|
@@ -177849,20 +177883,20 @@ function createVacuumRvcRunModeServer(attributes7, includeUnnamedRooms = false,
|
|
|
177849
177883
|
includeUnnamedRooms,
|
|
177850
177884
|
customAreas
|
|
177851
177885
|
);
|
|
177852
|
-
|
|
177886
|
+
logger194.info(
|
|
177853
177887
|
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
|
|
177854
177888
|
);
|
|
177855
177889
|
if (rooms.length > 0) {
|
|
177856
|
-
|
|
177890
|
+
logger194.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
177857
177891
|
}
|
|
177858
177892
|
if (filteredCount > 0) {
|
|
177859
177893
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
177860
|
-
|
|
177894
|
+
logger194.info(
|
|
177861
177895
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
177862
177896
|
);
|
|
177863
177897
|
}
|
|
177864
177898
|
if (allRooms.length === 0) {
|
|
177865
|
-
|
|
177899
|
+
logger194.debug(
|
|
177866
177900
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes7.rooms)}, segments=${JSON.stringify(attributes7.segments)}, room_list=${attributes7.room_list}`
|
|
177867
177901
|
);
|
|
177868
177902
|
}
|
|
@@ -177896,7 +177930,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
|
|
|
177896
177930
|
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
177897
177931
|
});
|
|
177898
177932
|
}
|
|
177899
|
-
|
|
177933
|
+
logger194.info(
|
|
177900
177934
|
`Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
|
|
177901
177935
|
);
|
|
177902
177936
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
@@ -177957,7 +177991,7 @@ init_rvc_clean_mode();
|
|
|
177957
177991
|
|
|
177958
177992
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
177959
177993
|
init_home_assistant_entity_behavior();
|
|
177960
|
-
var
|
|
177994
|
+
var logger195 = Logger.get("RvcCleanModeServerBase");
|
|
177961
177995
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
177962
177996
|
// Pending mode from a recent changeToMode command.
|
|
177963
177997
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -178000,14 +178034,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
178000
178034
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
178001
178035
|
const { newMode } = request;
|
|
178002
178036
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
178003
|
-
|
|
178037
|
+
logger195.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
178004
178038
|
return {
|
|
178005
178039
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
178006
178040
|
statusText: `Unsupported mode: ${newMode}`
|
|
178007
178041
|
};
|
|
178008
178042
|
}
|
|
178009
178043
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
178010
|
-
|
|
178044
|
+
logger195.info(
|
|
178011
178045
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
178012
178046
|
);
|
|
178013
178047
|
this.pendingMode = newMode;
|
|
@@ -178015,7 +178049,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
178015
178049
|
this.state.currentMode = newMode;
|
|
178016
178050
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
178017
178051
|
if (action) {
|
|
178018
|
-
|
|
178052
|
+
logger195.info(
|
|
178019
178053
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
178020
178054
|
);
|
|
178021
178055
|
homeAssistant.callAction(action);
|
|
@@ -178048,7 +178082,7 @@ function RvcCleanModeServer2(config10, initialState) {
|
|
|
178048
178082
|
}
|
|
178049
178083
|
|
|
178050
178084
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
178051
|
-
var
|
|
178085
|
+
var logger196 = Logger.get("VacuumRvcCleanModeServer");
|
|
178052
178086
|
var MODE_VACUUM = 0;
|
|
178053
178087
|
var MODE_VACUUM_AND_MOP = 1;
|
|
178054
178088
|
var MODE_MOP = 2;
|
|
@@ -178347,7 +178381,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
178347
178381
|
if (match) return match;
|
|
178348
178382
|
}
|
|
178349
178383
|
}
|
|
178350
|
-
|
|
178384
|
+
logger196.warn(
|
|
178351
178385
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
178352
178386
|
);
|
|
178353
178387
|
return aliases[0];
|
|
@@ -178356,7 +178390,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
178356
178390
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
178357
178391
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
178358
178392
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
178359
|
-
|
|
178393
|
+
logger196.info(
|
|
178360
178394
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
178361
178395
|
);
|
|
178362
178396
|
return {
|
|
@@ -178445,7 +178479,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178445
178479
|
}
|
|
178446
178480
|
}
|
|
178447
178481
|
if (speedMode !== void 0) {
|
|
178448
|
-
|
|
178482
|
+
logger196.debug(
|
|
178449
178483
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
178450
178484
|
);
|
|
178451
178485
|
return speedMode;
|
|
@@ -178466,7 +178500,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178466
178500
|
}
|
|
178467
178501
|
}
|
|
178468
178502
|
if (mopMode !== void 0) {
|
|
178469
|
-
|
|
178503
|
+
logger196.debug(
|
|
178470
178504
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
178471
178505
|
);
|
|
178472
178506
|
return mopMode;
|
|
@@ -178484,14 +178518,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178484
178518
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
178485
178519
|
const vacuumEntityId = homeAssistant.entityId;
|
|
178486
178520
|
const mapping = homeAssistant.state.mapping;
|
|
178487
|
-
|
|
178521
|
+
logger196.info(
|
|
178488
178522
|
`setCleanMode(${mode}) for ${vacuumEntityId} \u2014 suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})}`
|
|
178489
178523
|
);
|
|
178490
178524
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
178491
178525
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
178492
178526
|
const mopName = mopIntensityList[mopIndex];
|
|
178493
178527
|
if (!mopName) {
|
|
178494
|
-
|
|
178528
|
+
logger196.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
178495
178529
|
return void 0;
|
|
178496
178530
|
}
|
|
178497
178531
|
if (hasCleanTypes) {
|
|
@@ -178504,18 +178538,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178504
178538
|
mapping.mopIntensityEntity,
|
|
178505
178539
|
agent
|
|
178506
178540
|
);
|
|
178507
|
-
|
|
178541
|
+
logger196.info(
|
|
178508
178542
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
178509
178543
|
);
|
|
178510
178544
|
let option = matchMopIntensityOption(mopName, options);
|
|
178511
178545
|
if (!option && options && mopIndex < options.length) {
|
|
178512
178546
|
option = options[mopIndex];
|
|
178513
|
-
|
|
178547
|
+
logger196.info(
|
|
178514
178548
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
178515
178549
|
);
|
|
178516
178550
|
}
|
|
178517
178551
|
if (option) {
|
|
178518
|
-
|
|
178552
|
+
logger196.info(
|
|
178519
178553
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
178520
178554
|
);
|
|
178521
178555
|
return {
|
|
@@ -178524,11 +178558,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178524
178558
|
target: mapping.mopIntensityEntity
|
|
178525
178559
|
};
|
|
178526
178560
|
}
|
|
178527
|
-
|
|
178561
|
+
logger196.warn(
|
|
178528
178562
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
178529
178563
|
);
|
|
178530
178564
|
} else {
|
|
178531
|
-
|
|
178565
|
+
logger196.warn(
|
|
178532
178566
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
178533
178567
|
);
|
|
178534
178568
|
}
|
|
@@ -178538,7 +178572,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178538
178572
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
178539
178573
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
178540
178574
|
if (!fanSpeedName) {
|
|
178541
|
-
|
|
178575
|
+
logger196.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
178542
178576
|
return void 0;
|
|
178543
178577
|
}
|
|
178544
178578
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -178551,7 +178585,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178551
178585
|
mapping.suctionLevelEntity,
|
|
178552
178586
|
agent
|
|
178553
178587
|
);
|
|
178554
|
-
|
|
178588
|
+
logger196.info(
|
|
178555
178589
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
178556
178590
|
);
|
|
178557
178591
|
let option = matchFanSpeedOption(
|
|
@@ -178561,12 +178595,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178561
178595
|
);
|
|
178562
178596
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
178563
178597
|
option = options[fanSpeedIndex];
|
|
178564
|
-
|
|
178598
|
+
logger196.info(
|
|
178565
178599
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
178566
178600
|
);
|
|
178567
178601
|
}
|
|
178568
178602
|
if (option) {
|
|
178569
|
-
|
|
178603
|
+
logger196.info(
|
|
178570
178604
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
178571
178605
|
);
|
|
178572
178606
|
return {
|
|
@@ -178575,7 +178609,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178575
178609
|
target: mapping.suctionLevelEntity
|
|
178576
178610
|
};
|
|
178577
178611
|
}
|
|
178578
|
-
|
|
178612
|
+
logger196.warn(
|
|
178579
178613
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
178580
178614
|
);
|
|
178581
178615
|
return void 0;
|
|
@@ -178585,7 +178619,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178585
178619
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
178586
178620
|
);
|
|
178587
178621
|
}
|
|
178588
|
-
|
|
178622
|
+
logger196.info(
|
|
178589
178623
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
178590
178624
|
);
|
|
178591
178625
|
return {
|
|
@@ -178595,7 +178629,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178595
178629
|
};
|
|
178596
178630
|
}
|
|
178597
178631
|
if (!hasCleanTypes) {
|
|
178598
|
-
|
|
178632
|
+
logger196.debug(
|
|
178599
178633
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
178600
178634
|
);
|
|
178601
178635
|
return void 0;
|
|
@@ -178607,7 +178641,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178607
178641
|
agent
|
|
178608
178642
|
);
|
|
178609
178643
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
178610
|
-
|
|
178644
|
+
logger196.info(
|
|
178611
178645
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
178612
178646
|
);
|
|
178613
178647
|
return {
|
|
@@ -178625,10 +178659,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
178625
178659
|
cleaningModeOptions,
|
|
178626
178660
|
customFanSpeedTags
|
|
178627
178661
|
);
|
|
178628
|
-
|
|
178662
|
+
logger196.info(
|
|
178629
178663
|
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
178630
178664
|
);
|
|
178631
|
-
|
|
178665
|
+
logger196.info(
|
|
178632
178666
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
178633
178667
|
);
|
|
178634
178668
|
const initialState = {
|
|
@@ -178706,7 +178740,7 @@ init_rvc_operational_state();
|
|
|
178706
178740
|
init_home_assistant_entity_behavior();
|
|
178707
178741
|
var OperationalState4 = RvcOperationalState3.OperationalState;
|
|
178708
178742
|
var ErrorState = RvcOperationalState3.ErrorState;
|
|
178709
|
-
var
|
|
178743
|
+
var logger197 = Logger.get("RvcOperationalStateServer");
|
|
178710
178744
|
var activeStates = /* @__PURE__ */ new Set([
|
|
178711
178745
|
OperationalState4.Running,
|
|
178712
178746
|
OperationalState4.SeekingCharger
|
|
@@ -178755,7 +178789,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
178755
178789
|
{ force: true }
|
|
178756
178790
|
);
|
|
178757
178791
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
178758
|
-
|
|
178792
|
+
logger197.info(
|
|
178759
178793
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
178760
178794
|
);
|
|
178761
178795
|
try {
|
|
@@ -178768,7 +178802,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
178768
178802
|
this.context
|
|
178769
178803
|
);
|
|
178770
178804
|
} catch (e) {
|
|
178771
|
-
|
|
178805
|
+
logger197.debug("Failed to emit operationCompletion event:", e);
|
|
178772
178806
|
}
|
|
178773
178807
|
}
|
|
178774
178808
|
}
|
|
@@ -178803,7 +178837,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
178803
178837
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
178804
178838
|
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
178805
178839
|
} else {
|
|
178806
|
-
|
|
178840
|
+
logger197.warn("GoHome command received but no goHome action configured");
|
|
178807
178841
|
}
|
|
178808
178842
|
return {
|
|
178809
178843
|
commandResponseState: {
|
|
@@ -178823,7 +178857,7 @@ function RvcOperationalStateServer2(config10) {
|
|
|
178823
178857
|
}
|
|
178824
178858
|
|
|
178825
178859
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
|
|
178826
|
-
var
|
|
178860
|
+
var logger198 = Logger.get("VacuumRvcOperationalStateServer");
|
|
178827
178861
|
function isCharging(entity) {
|
|
178828
178862
|
const attrs = entity.attributes;
|
|
178829
178863
|
if (attrs.battery_icon?.includes("charging")) return true;
|
|
@@ -178865,16 +178899,16 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
178865
178899
|
operationalState = RvcOperationalState3.OperationalState.Error;
|
|
178866
178900
|
} else {
|
|
178867
178901
|
if (state.toLowerCase().includes("clean")) {
|
|
178868
|
-
|
|
178902
|
+
logger198.info(
|
|
178869
178903
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
178870
178904
|
);
|
|
178871
178905
|
operationalState = RvcOperationalState3.OperationalState.Running;
|
|
178872
178906
|
} else {
|
|
178873
|
-
|
|
178907
|
+
logger198.info(`Unknown vacuum state "${state}", treating as Stopped`);
|
|
178874
178908
|
operationalState = RvcOperationalState3.OperationalState.Stopped;
|
|
178875
178909
|
}
|
|
178876
178910
|
}
|
|
178877
|
-
|
|
178911
|
+
logger198.debug(
|
|
178878
178912
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
|
|
178879
178913
|
);
|
|
178880
178914
|
return operationalState;
|
|
@@ -178895,7 +178929,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
178895
178929
|
});
|
|
178896
178930
|
|
|
178897
178931
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
178898
|
-
var
|
|
178932
|
+
var logger199 = Logger.get("VacuumDevice");
|
|
178899
178933
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
178900
178934
|
BasicInformationServer2,
|
|
178901
178935
|
VacuumIdentifyServer,
|
|
@@ -178909,7 +178943,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
178909
178943
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
178910
178944
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
178911
178945
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
178912
|
-
|
|
178946
|
+
logger199.info(
|
|
178913
178947
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
178914
178948
|
);
|
|
178915
178949
|
const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
|
|
@@ -178921,32 +178955,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
178921
178955
|
)
|
|
178922
178956
|
).set({ homeAssistantEntity });
|
|
178923
178957
|
if (includeOnOff) {
|
|
178924
|
-
|
|
178958
|
+
logger199.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
178925
178959
|
device = device.with(VacuumOnOffServer);
|
|
178926
178960
|
}
|
|
178927
178961
|
device = device.with(VacuumPowerSourceServer);
|
|
178928
178962
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
178929
178963
|
const rooms = parseVacuumRooms(attributes7);
|
|
178930
|
-
|
|
178964
|
+
logger199.info(
|
|
178931
178965
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
|
|
178932
178966
|
);
|
|
178933
178967
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
178934
|
-
|
|
178968
|
+
logger199.info(
|
|
178935
178969
|
`${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
|
|
178936
178970
|
);
|
|
178937
178971
|
device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
|
|
178938
178972
|
} else if (customAreas && customAreas.length > 0) {
|
|
178939
|
-
|
|
178973
|
+
logger199.info(
|
|
178940
178974
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
178941
178975
|
);
|
|
178942
178976
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
178943
178977
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
178944
|
-
|
|
178978
|
+
logger199.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
178945
178979
|
device = device.with(
|
|
178946
178980
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
178947
178981
|
);
|
|
178948
178982
|
} else {
|
|
178949
|
-
|
|
178983
|
+
logger199.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
178950
178984
|
device = device.with(createDefaultServiceAreaServer());
|
|
178951
178985
|
}
|
|
178952
178986
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -178957,7 +178991,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
178957
178991
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
178958
178992
|
);
|
|
178959
178993
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
178960
|
-
|
|
178994
|
+
logger199.info(
|
|
178961
178995
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
178962
178996
|
);
|
|
178963
178997
|
device = device.with(
|
|
@@ -178970,7 +179004,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
178970
179004
|
)
|
|
178971
179005
|
);
|
|
178972
179006
|
} else {
|
|
178973
|
-
|
|
179007
|
+
logger199.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
178974
179008
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
178975
179009
|
}
|
|
178976
179010
|
return device;
|
|
@@ -179136,7 +179170,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
179136
179170
|
);
|
|
179137
179171
|
|
|
179138
179172
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
179139
|
-
var
|
|
179173
|
+
var logger200 = Logger.get("WaterHeaterDevice");
|
|
179140
179174
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
179141
179175
|
BasicInformationServer2,
|
|
179142
179176
|
IdentifyServer2,
|
|
@@ -179152,7 +179186,7 @@ function toMatterTemp2(value) {
|
|
|
179152
179186
|
}
|
|
179153
179187
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
179154
179188
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
179155
|
-
|
|
179189
|
+
logger200.debug(
|
|
179156
179190
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes7.min_temp}, max_temp=${attributes7.max_temp}`
|
|
179157
179191
|
);
|
|
179158
179192
|
const minLimit = toMatterTemp2(attributes7.min_temp) ?? 0;
|
|
@@ -179313,7 +179347,7 @@ var matterDeviceTypeFactories = {
|
|
|
179313
179347
|
};
|
|
179314
179348
|
|
|
179315
179349
|
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
179316
|
-
var
|
|
179350
|
+
var logger201 = Logger.get("UserComposedEndpoint");
|
|
179317
179351
|
function stripBasicInformation(type) {
|
|
179318
179352
|
const behaviors = { ...type.behaviors };
|
|
179319
179353
|
delete behaviors.bridgedDeviceBasicInformation;
|
|
@@ -179369,7 +179403,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179369
179403
|
{ vacuumOnOff: registry2.isVacuumOnOffEnabled() }
|
|
179370
179404
|
);
|
|
179371
179405
|
if (!primaryType) {
|
|
179372
|
-
|
|
179406
|
+
logger201.warn(
|
|
179373
179407
|
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
179374
179408
|
);
|
|
179375
179409
|
return void 0;
|
|
@@ -179384,7 +179418,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179384
179418
|
if (!sub.entityId) continue;
|
|
179385
179419
|
const subPayload = buildEntityPayload3(registry2, sub.entityId);
|
|
179386
179420
|
if (!subPayload) {
|
|
179387
|
-
|
|
179421
|
+
logger201.warn(
|
|
179388
179422
|
`Cannot find entity state for composed sub-entity ${sub.entityId}`
|
|
179389
179423
|
);
|
|
179390
179424
|
continue;
|
|
@@ -179395,7 +179429,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179395
179429
|
};
|
|
179396
179430
|
const subType = createLegacyEndpointType(subPayload, subMapping);
|
|
179397
179431
|
if (!subType) {
|
|
179398
|
-
|
|
179432
|
+
logger201.warn(
|
|
179399
179433
|
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
179400
179434
|
);
|
|
179401
179435
|
continue;
|
|
@@ -179408,7 +179442,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179408
179442
|
mappedIds.push(sub.entityId);
|
|
179409
179443
|
}
|
|
179410
179444
|
if (parts.length < 2) {
|
|
179411
|
-
|
|
179445
|
+
logger201.warn(
|
|
179412
179446
|
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
179413
179447
|
);
|
|
179414
179448
|
return void 0;
|
|
@@ -179431,7 +179465,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179431
179465
|
const labels = parts.map(
|
|
179432
179466
|
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
179433
179467
|
).join("+");
|
|
179434
|
-
|
|
179468
|
+
logger201.info(
|
|
179435
179469
|
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
179436
179470
|
);
|
|
179437
179471
|
return endpoint;
|
|
@@ -179500,7 +179534,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179500
179534
|
};
|
|
179501
179535
|
|
|
179502
179536
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
179503
|
-
var
|
|
179537
|
+
var logger202 = Logger.get("LegacyEndpoint");
|
|
179504
179538
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
179505
179539
|
static async create(registry2, entityId, mapping, pluginDomainMappings) {
|
|
179506
179540
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -179510,25 +179544,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179510
179544
|
return;
|
|
179511
179545
|
}
|
|
179512
179546
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
179513
|
-
|
|
179547
|
+
logger202.debug(
|
|
179514
179548
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
179515
179549
|
);
|
|
179516
179550
|
return;
|
|
179517
179551
|
}
|
|
179518
179552
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
179519
|
-
|
|
179553
|
+
logger202.debug(
|
|
179520
179554
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
179521
179555
|
);
|
|
179522
179556
|
return;
|
|
179523
179557
|
}
|
|
179524
179558
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
179525
|
-
|
|
179559
|
+
logger202.debug(
|
|
179526
179560
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
179527
179561
|
);
|
|
179528
179562
|
return;
|
|
179529
179563
|
}
|
|
179530
179564
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
179531
|
-
|
|
179565
|
+
logger202.debug(
|
|
179532
179566
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
179533
179567
|
);
|
|
179534
179568
|
return;
|
|
@@ -179548,7 +179582,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179548
179582
|
humidityEntity: humidityEntityId
|
|
179549
179583
|
};
|
|
179550
179584
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
179551
|
-
|
|
179585
|
+
logger202.debug(
|
|
179552
179586
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
179553
179587
|
);
|
|
179554
179588
|
}
|
|
@@ -179567,7 +179601,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179567
179601
|
pressureEntity: pressureEntityId
|
|
179568
179602
|
};
|
|
179569
179603
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
179570
|
-
|
|
179604
|
+
logger202.debug(
|
|
179571
179605
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
179572
179606
|
);
|
|
179573
179607
|
}
|
|
@@ -179585,7 +179619,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179585
179619
|
batteryEntity: batteryEntityId
|
|
179586
179620
|
};
|
|
179587
179621
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
179588
|
-
|
|
179622
|
+
logger202.debug(
|
|
179589
179623
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
179590
179624
|
);
|
|
179591
179625
|
}
|
|
@@ -179603,7 +179637,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179603
179637
|
powerEntity: powerEntityId
|
|
179604
179638
|
};
|
|
179605
179639
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
179606
|
-
|
|
179640
|
+
logger202.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
179607
179641
|
}
|
|
179608
179642
|
}
|
|
179609
179643
|
}
|
|
@@ -179620,7 +179654,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179620
179654
|
energyEntity: energyEntityId
|
|
179621
179655
|
};
|
|
179622
179656
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
179623
|
-
|
|
179657
|
+
logger202.debug(
|
|
179624
179658
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
179625
179659
|
);
|
|
179626
179660
|
}
|
|
@@ -179636,7 +179670,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179636
179670
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179637
179671
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
179638
179672
|
};
|
|
179639
|
-
|
|
179673
|
+
logger202.info(
|
|
179640
179674
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
179641
179675
|
);
|
|
179642
179676
|
}
|
|
@@ -179646,7 +179680,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179646
179680
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179647
179681
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
179648
179682
|
};
|
|
179649
|
-
|
|
179683
|
+
logger202.info(
|
|
179650
179684
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
179651
179685
|
);
|
|
179652
179686
|
}
|
|
@@ -179656,7 +179690,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179656
179690
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179657
179691
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
179658
179692
|
};
|
|
179659
|
-
|
|
179693
|
+
logger202.info(
|
|
179660
179694
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
179661
179695
|
);
|
|
179662
179696
|
}
|
|
@@ -179666,7 +179700,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179666
179700
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179667
179701
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
179668
179702
|
};
|
|
179669
|
-
|
|
179703
|
+
logger202.info(
|
|
179670
179704
|
`Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
|
|
179671
179705
|
);
|
|
179672
179706
|
}
|
|
@@ -179681,7 +179715,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179681
179715
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179682
179716
|
cleanAreaRooms
|
|
179683
179717
|
};
|
|
179684
|
-
|
|
179718
|
+
logger202.info(
|
|
179685
179719
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
179686
179720
|
);
|
|
179687
179721
|
}
|
|
@@ -179702,7 +179736,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179702
179736
|
rooms: roomsObj
|
|
179703
179737
|
}
|
|
179704
179738
|
};
|
|
179705
|
-
|
|
179739
|
+
logger202.debug(
|
|
179706
179740
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
179707
179741
|
);
|
|
179708
179742
|
} else {
|
|
@@ -179719,7 +179753,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179719
179753
|
rooms: roomsObj
|
|
179720
179754
|
}
|
|
179721
179755
|
};
|
|
179722
|
-
|
|
179756
|
+
logger202.debug(
|
|
179723
179757
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
179724
179758
|
);
|
|
179725
179759
|
}
|
|
@@ -179740,7 +179774,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179740
179774
|
if (composed) {
|
|
179741
179775
|
return composed;
|
|
179742
179776
|
}
|
|
179743
|
-
|
|
179777
|
+
logger202.warn(
|
|
179744
179778
|
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
179745
179779
|
);
|
|
179746
179780
|
}
|
|
@@ -179841,11 +179875,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179841
179875
|
}
|
|
179842
179876
|
if (mappedChanged) {
|
|
179843
179877
|
this.pendingMappedChange = true;
|
|
179844
|
-
|
|
179878
|
+
logger202.debug(
|
|
179845
179879
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
179846
179880
|
);
|
|
179847
179881
|
}
|
|
179848
|
-
|
|
179882
|
+
logger202.debug(
|
|
179849
179883
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
179850
179884
|
);
|
|
179851
179885
|
this.lastState = state;
|
|
@@ -179898,7 +179932,7 @@ import {
|
|
|
179898
179932
|
getCollection
|
|
179899
179933
|
} from "home-assistant-js-websocket";
|
|
179900
179934
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
179901
|
-
var
|
|
179935
|
+
var logger203 = Logger.get("SubscribeEntities");
|
|
179902
179936
|
function processEvent(store, updates) {
|
|
179903
179937
|
const state = { ...store.state };
|
|
179904
179938
|
if (updates.a) {
|
|
@@ -179924,7 +179958,7 @@ function processEvent(store, updates) {
|
|
|
179924
179958
|
for (const entityId in updates.c) {
|
|
179925
179959
|
let entityState = state[entityId];
|
|
179926
179960
|
if (!entityState) {
|
|
179927
|
-
|
|
179961
|
+
logger203.warn("Received state update for unknown entity", entityId);
|
|
179928
179962
|
continue;
|
|
179929
179963
|
}
|
|
179930
179964
|
entityState = { ...entityState };
|
|
@@ -179995,7 +180029,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
|
|
|
179995
180029
|
// src/services/bridges/entity-isolation-service.ts
|
|
179996
180030
|
init_esm();
|
|
179997
180031
|
init_diagnostic_event_bus();
|
|
179998
|
-
var
|
|
180032
|
+
var logger204 = Logger.get("EntityIsolation");
|
|
179999
180033
|
var EntityIsolationServiceImpl = class {
|
|
180000
180034
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
180001
180035
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -180060,13 +180094,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
180060
180094
|
}
|
|
180061
180095
|
const parsed = this.parseEndpointPath(msg);
|
|
180062
180096
|
if (!parsed) {
|
|
180063
|
-
|
|
180097
|
+
logger204.warn("Could not parse entity from error:", msg);
|
|
180064
180098
|
return false;
|
|
180065
180099
|
}
|
|
180066
180100
|
const { bridgeId, entityName } = parsed;
|
|
180067
180101
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
180068
180102
|
if (!callback) {
|
|
180069
|
-
|
|
180103
|
+
logger204.warn(
|
|
180070
180104
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
180071
180105
|
);
|
|
180072
180106
|
return false;
|
|
@@ -180077,7 +180111,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
180077
180111
|
}
|
|
180078
180112
|
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
180079
180113
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
180080
|
-
|
|
180114
|
+
logger204.warn(
|
|
180081
180115
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
180082
180116
|
);
|
|
180083
180117
|
diagnosticEventBus.emit("entity_error", `Entity isolated: ${entityName}`, {
|
|
@@ -180089,7 +180123,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
180089
180123
|
await callback(entityName);
|
|
180090
180124
|
return true;
|
|
180091
180125
|
} catch (e) {
|
|
180092
|
-
|
|
180126
|
+
logger204.error(`Failed to isolate entity ${entityName}:`, e);
|
|
180093
180127
|
return false;
|
|
180094
180128
|
}
|
|
180095
180129
|
}
|
|
@@ -181342,11 +181376,11 @@ init_diagnostic_event_bus();
|
|
|
181342
181376
|
var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
|
|
181343
181377
|
var DEAD_SESSION_TIMEOUT_MS2 = 6e4;
|
|
181344
181378
|
var ServerModeBridge = class {
|
|
181345
|
-
constructor(
|
|
181379
|
+
constructor(logger207, dataProvider, endpointManager, server) {
|
|
181346
181380
|
this.dataProvider = dataProvider;
|
|
181347
181381
|
this.endpointManager = endpointManager;
|
|
181348
181382
|
this.server = server;
|
|
181349
|
-
this.log =
|
|
181383
|
+
this.log = logger207.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
181350
181384
|
}
|
|
181351
181385
|
dataProvider;
|
|
181352
181386
|
endpointManager;
|
|
@@ -181868,7 +181902,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
181868
181902
|
}
|
|
181869
181903
|
|
|
181870
181904
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
181871
|
-
var
|
|
181905
|
+
var logger205 = Logger.get("ServerModeVacuumEndpoint");
|
|
181872
181906
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
181873
181907
|
static async create(registry2, entityId, mapping) {
|
|
181874
181908
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -181878,7 +181912,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181878
181912
|
return void 0;
|
|
181879
181913
|
}
|
|
181880
181914
|
let effectiveMapping = mapping;
|
|
181881
|
-
|
|
181915
|
+
logger205.info(
|
|
181882
181916
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
181883
181917
|
);
|
|
181884
181918
|
if (entity.device_id) {
|
|
@@ -181893,15 +181927,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181893
181927
|
batteryEntity: batteryEntityId
|
|
181894
181928
|
};
|
|
181895
181929
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
181896
|
-
|
|
181930
|
+
logger205.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
181897
181931
|
} else {
|
|
181898
181932
|
const attrs = state.attributes;
|
|
181899
181933
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
181900
|
-
|
|
181934
|
+
logger205.info(
|
|
181901
181935
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
181902
181936
|
);
|
|
181903
181937
|
} else {
|
|
181904
|
-
|
|
181938
|
+
logger205.warn(
|
|
181905
181939
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
181906
181940
|
);
|
|
181907
181941
|
}
|
|
@@ -181916,7 +181950,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181916
181950
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181917
181951
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
181918
181952
|
};
|
|
181919
|
-
|
|
181953
|
+
logger205.info(
|
|
181920
181954
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
181921
181955
|
);
|
|
181922
181956
|
}
|
|
@@ -181926,7 +181960,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181926
181960
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181927
181961
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
181928
181962
|
};
|
|
181929
|
-
|
|
181963
|
+
logger205.info(
|
|
181930
181964
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
181931
181965
|
);
|
|
181932
181966
|
}
|
|
@@ -181936,7 +181970,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181936
181970
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181937
181971
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
181938
181972
|
};
|
|
181939
|
-
|
|
181973
|
+
logger205.info(
|
|
181940
181974
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
181941
181975
|
);
|
|
181942
181976
|
}
|
|
@@ -181946,7 +181980,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181946
181980
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181947
181981
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
181948
181982
|
};
|
|
181949
|
-
|
|
181983
|
+
logger205.info(
|
|
181950
181984
|
`${entityId}: Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity}`
|
|
181951
181985
|
);
|
|
181952
181986
|
}
|
|
@@ -181961,7 +181995,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181961
181995
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181962
181996
|
cleanAreaRooms
|
|
181963
181997
|
};
|
|
181964
|
-
|
|
181998
|
+
logger205.info(
|
|
181965
181999
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
181966
182000
|
);
|
|
181967
182001
|
}
|
|
@@ -181982,7 +182016,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181982
182016
|
rooms: roomsObj
|
|
181983
182017
|
}
|
|
181984
182018
|
};
|
|
181985
|
-
|
|
182019
|
+
logger205.info(
|
|
181986
182020
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
181987
182021
|
);
|
|
181988
182022
|
} else {
|
|
@@ -181999,14 +182033,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181999
182033
|
rooms: roomsObj
|
|
182000
182034
|
}
|
|
182001
182035
|
};
|
|
182002
|
-
|
|
182036
|
+
logger205.info(
|
|
182003
182037
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
182004
182038
|
);
|
|
182005
182039
|
}
|
|
182006
182040
|
}
|
|
182007
182041
|
}
|
|
182008
182042
|
} else {
|
|
182009
|
-
|
|
182043
|
+
logger205.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
|
|
182010
182044
|
}
|
|
182011
182045
|
const payload = {
|
|
182012
182046
|
entity_id: entityId,
|
|
@@ -182103,7 +182137,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
182103
182137
|
try {
|
|
182104
182138
|
this.keepaliveCounter++;
|
|
182105
182139
|
const counter = this.keepaliveCounter;
|
|
182106
|
-
|
|
182140
|
+
logger205.info(`Keepalive #${counter} for ${this.entityId}`);
|
|
182107
182141
|
const opState = this.stateOf(RvcOperationalStateServer);
|
|
182108
182142
|
await this.setStateOf(RvcOperationalStateServer, {
|
|
182109
182143
|
operationalState: opState.operationalState,
|
|
@@ -182118,7 +182152,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
182118
182152
|
currentMode: runMode.currentMode
|
|
182119
182153
|
});
|
|
182120
182154
|
}
|
|
182121
|
-
|
|
182155
|
+
logger205.info(`Keepalive #${counter} committed for ${this.entityId}`);
|
|
182122
182156
|
} catch (e) {
|
|
182123
182157
|
if (e instanceof TransactionDestroyedError || e instanceof DestroyedDependencyError) {
|
|
182124
182158
|
return;
|
|
@@ -182127,7 +182161,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
182127
182161
|
if (msg.includes("Endpoint storage inaccessible")) {
|
|
182128
182162
|
return;
|
|
182129
182163
|
}
|
|
182130
|
-
|
|
182164
|
+
logger205.warn(`Keepalive failed for ${this.entityId}: ${msg}`);
|
|
182131
182165
|
}
|
|
182132
182166
|
}
|
|
182133
182167
|
async updateStates(states) {
|
|
@@ -182138,11 +182172,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
182138
182172
|
}
|
|
182139
182173
|
if (mappedChanged) {
|
|
182140
182174
|
this.pendingMappedChange = true;
|
|
182141
|
-
|
|
182175
|
+
logger205.debug(
|
|
182142
182176
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
182143
182177
|
);
|
|
182144
182178
|
}
|
|
182145
|
-
|
|
182179
|
+
logger205.debug(
|
|
182146
182180
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
182147
182181
|
);
|
|
182148
182182
|
this.lastState = state;
|
|
@@ -182333,7 +182367,7 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
182333
182367
|
await this.serverNode.addDevice(endpoint2);
|
|
182334
182368
|
this.deviceEndpoint = endpoint2;
|
|
182335
182369
|
this.mappingFingerprint = currentFp;
|
|
182336
|
-
this.updateServerNodeIdentity(entityId, mapping);
|
|
182370
|
+
await this.updateServerNodeIdentity(entityId, mapping);
|
|
182337
182371
|
this.log.info(
|
|
182338
182372
|
`Server mode: Added vacuum ${entityId} as standalone device`
|
|
182339
182373
|
);
|
|
@@ -182354,7 +182388,7 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
182354
182388
|
await this.serverNode.addDevice(endpoint);
|
|
182355
182389
|
this.deviceEndpoint = endpoint;
|
|
182356
182390
|
this.mappingFingerprint = currentFp;
|
|
182357
|
-
this.updateServerNodeIdentity(entityId, mapping);
|
|
182391
|
+
await this.updateServerNodeIdentity(entityId, mapping);
|
|
182358
182392
|
this.log.info(`Server mode: Added device ${entityId}`);
|
|
182359
182393
|
} catch (e) {
|
|
182360
182394
|
const reason = e instanceof Error ? e.message : String(e);
|
|
@@ -182375,11 +182409,11 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
182375
182409
|
}
|
|
182376
182410
|
}
|
|
182377
182411
|
}
|
|
182378
|
-
updateServerNodeIdentity(entityId, mapping) {
|
|
182412
|
+
async updateServerNodeIdentity(entityId, mapping) {
|
|
182379
182413
|
const device = this.registry.deviceOf(entityId);
|
|
182380
182414
|
const state = this.registry.initialState(entityId);
|
|
182381
182415
|
const friendlyName = state?.attributes?.friendly_name;
|
|
182382
|
-
this.serverNode.updateDeviceIdentity(
|
|
182416
|
+
await this.serverNode.updateDeviceIdentity(
|
|
182383
182417
|
entityId,
|
|
182384
182418
|
device,
|
|
182385
182419
|
mapping,
|
|
@@ -182578,10 +182612,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
182578
182612
|
// src/core/ioc/app-environment.ts
|
|
182579
182613
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
182580
182614
|
constructor(rootEnv, options) {
|
|
182581
|
-
const
|
|
182615
|
+
const logger207 = rootEnv.get(LoggerService);
|
|
182582
182616
|
super({
|
|
182583
182617
|
id: "App",
|
|
182584
|
-
log:
|
|
182618
|
+
log: logger207.get("AppContainer"),
|
|
182585
182619
|
parent: rootEnv
|
|
182586
182620
|
});
|
|
182587
182621
|
this.options = options;
|
|
@@ -182595,8 +182629,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
182595
182629
|
}
|
|
182596
182630
|
construction;
|
|
182597
182631
|
async init() {
|
|
182598
|
-
const
|
|
182599
|
-
this.set(LoggerService,
|
|
182632
|
+
const logger207 = this.get(LoggerService);
|
|
182633
|
+
this.set(LoggerService, logger207);
|
|
182600
182634
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
182601
182635
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
182602
182636
|
this.set(
|
|
@@ -182613,7 +182647,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
182613
182647
|
);
|
|
182614
182648
|
this.set(
|
|
182615
182649
|
HomeAssistantClient,
|
|
182616
|
-
new HomeAssistantClient(
|
|
182650
|
+
new HomeAssistantClient(logger207, this.options.homeAssistant)
|
|
182617
182651
|
);
|
|
182618
182652
|
this.set(
|
|
182619
182653
|
HomeAssistantConfig,
|
|
@@ -182621,7 +182655,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
182621
182655
|
);
|
|
182622
182656
|
this.set(
|
|
182623
182657
|
HomeAssistantActions,
|
|
182624
|
-
new HomeAssistantActions(
|
|
182658
|
+
new HomeAssistantActions(logger207, await this.load(HomeAssistantClient))
|
|
182625
182659
|
);
|
|
182626
182660
|
this.set(
|
|
182627
182661
|
HomeAssistantRegistry,
|
|
@@ -182657,7 +182691,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
182657
182691
|
this.set(
|
|
182658
182692
|
WebApi,
|
|
182659
182693
|
new WebApi(
|
|
182660
|
-
|
|
182694
|
+
logger207,
|
|
182661
182695
|
await this.load(BridgeService),
|
|
182662
182696
|
await this.load(HomeAssistantClient),
|
|
182663
182697
|
await this.load(HomeAssistantRegistry),
|
|
@@ -182683,7 +182717,7 @@ init_nodejs();
|
|
|
182683
182717
|
init_level_control();
|
|
182684
182718
|
|
|
182685
182719
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
182686
|
-
var
|
|
182720
|
+
var logger206 = Logger.get("PatchLevelControlTlv");
|
|
182687
182721
|
function patchLevelControlTlv() {
|
|
182688
182722
|
let patched = 0;
|
|
182689
182723
|
const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
|
|
@@ -182697,11 +182731,11 @@ function patchLevelControlTlv() {
|
|
|
182697
182731
|
patched++;
|
|
182698
182732
|
}
|
|
182699
182733
|
if (patched > 0) {
|
|
182700
|
-
|
|
182734
|
+
logger206.info(
|
|
182701
182735
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
182702
182736
|
);
|
|
182703
182737
|
} else {
|
|
182704
|
-
|
|
182738
|
+
logger206.warn(
|
|
182705
182739
|
"Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
|
|
182706
182740
|
);
|
|
182707
182741
|
}
|