@riddix/hamh 2.1.0-alpha.621 → 2.1.0-alpha.622
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: {
|
|
@@ -172328,7 +172352,7 @@ var adjustPositionForReading2 = (position, agent) => {
|
|
|
172328
172352
|
const { featureFlags } = agent.env.get(BridgeDataProvider);
|
|
172329
172353
|
const matterSem = usesMatterSemantics(agent);
|
|
172330
172354
|
const result = adjustPositionForReading(position, featureFlags, matterSem);
|
|
172331
|
-
|
|
172355
|
+
logger180.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
|
|
172332
172356
|
return result;
|
|
172333
172357
|
};
|
|
172334
172358
|
var adjustPositionForWriting2 = (position, agent) => {
|
|
@@ -172437,7 +172461,7 @@ var config5 = {
|
|
|
172437
172461
|
var CoverWindowCoveringServer = WindowCoveringServer2(config5);
|
|
172438
172462
|
|
|
172439
172463
|
// src/matter/endpoints/legacy/cover/index.ts
|
|
172440
|
-
var
|
|
172464
|
+
var logger181 = Logger.get("CoverDevice");
|
|
172441
172465
|
var DISCRETE_COVER_CLASSES = /* @__PURE__ */ new Set(["garage", "gate"]);
|
|
172442
172466
|
var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
|
|
172443
172467
|
const features2 = /* @__PURE__ */ new Set();
|
|
@@ -172448,7 +172472,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
|
|
|
172448
172472
|
features2.add("AbsolutePosition");
|
|
172449
172473
|
}
|
|
172450
172474
|
} else {
|
|
172451
|
-
|
|
172475
|
+
logger181.warn(
|
|
172452
172476
|
`[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
|
|
172453
172477
|
);
|
|
172454
172478
|
features2.add("Lift");
|
|
@@ -172467,7 +172491,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
|
|
|
172467
172491
|
features2.add("AbsolutePosition");
|
|
172468
172492
|
}
|
|
172469
172493
|
}
|
|
172470
|
-
|
|
172494
|
+
logger181.info(
|
|
172471
172495
|
`[${entityId}] Creating WindowCovering with features: [${[...features2].join(", ")}], supported_features=${supportedFeatures}`
|
|
172472
172496
|
);
|
|
172473
172497
|
const baseBehaviors = [
|
|
@@ -172491,18 +172515,18 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
172491
172515
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
172492
172516
|
const hasBattery = hasBatteryAttr || hasBatteryEntity;
|
|
172493
172517
|
if (hasBattery) {
|
|
172494
|
-
|
|
172518
|
+
logger181.info(
|
|
172495
172519
|
`[${entityId}] Creating cover with PowerSource cluster, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
172496
172520
|
);
|
|
172497
172521
|
} else {
|
|
172498
|
-
|
|
172522
|
+
logger181.debug(
|
|
172499
172523
|
`[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
|
|
172500
172524
|
);
|
|
172501
172525
|
}
|
|
172502
172526
|
const deviceClass = attributes7.device_class;
|
|
172503
172527
|
const isDiscrete = typeof deviceClass === "string" && DISCRETE_COVER_CLASSES.has(deviceClass.toLowerCase());
|
|
172504
172528
|
if (isDiscrete) {
|
|
172505
|
-
|
|
172529
|
+
logger181.info(
|
|
172506
172530
|
`[${entityId}] Garage/gate cover (device_class=${deviceClass}): using discrete Open/Close mode`
|
|
172507
172531
|
);
|
|
172508
172532
|
}
|
|
@@ -172619,7 +172643,7 @@ function DishwasherEndpoint(homeAssistantEntity) {
|
|
|
172619
172643
|
// src/matter/behaviors/generic-switch-server.ts
|
|
172620
172644
|
init_esm();
|
|
172621
172645
|
init_home_assistant_entity_behavior();
|
|
172622
|
-
var
|
|
172646
|
+
var logger182 = Logger.get("GenericSwitchServer");
|
|
172623
172647
|
var SimpleBase = SwitchServer.with(
|
|
172624
172648
|
"MomentarySwitch",
|
|
172625
172649
|
"MomentarySwitchRelease",
|
|
@@ -172661,7 +172685,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
|
|
|
172661
172685
|
await super.initialize();
|
|
172662
172686
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172663
172687
|
const entityId = homeAssistant.entityId;
|
|
172664
|
-
|
|
172688
|
+
logger182.debug(`[${entityId}] GenericSwitch initialized (simple)`);
|
|
172665
172689
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
172666
172690
|
}
|
|
172667
172691
|
handleEventChange() {
|
|
@@ -172672,7 +172696,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
|
|
|
172672
172696
|
const eventType = attrs.event_type;
|
|
172673
172697
|
if (!eventType) return;
|
|
172674
172698
|
const entityId = homeAssistant.entityId;
|
|
172675
|
-
|
|
172699
|
+
logger182.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
172676
172700
|
this.triggerPress(eventType);
|
|
172677
172701
|
}
|
|
172678
172702
|
triggerPress(eventType) {
|
|
@@ -172718,7 +172742,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
|
|
|
172718
172742
|
await super.initialize();
|
|
172719
172743
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172720
172744
|
const entityId = homeAssistant.entityId;
|
|
172721
|
-
|
|
172745
|
+
logger182.debug(`[${entityId}] GenericSwitch initialized (multi)`);
|
|
172722
172746
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
172723
172747
|
}
|
|
172724
172748
|
handleEventChange() {
|
|
@@ -172729,7 +172753,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
|
|
|
172729
172753
|
const eventType = attrs.event_type;
|
|
172730
172754
|
if (!eventType) return;
|
|
172731
172755
|
const entityId = homeAssistant.entityId;
|
|
172732
|
-
|
|
172756
|
+
logger182.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
172733
172757
|
this.triggerPress(eventType);
|
|
172734
172758
|
}
|
|
172735
172759
|
triggerPress(eventType) {
|
|
@@ -173065,7 +173089,7 @@ init_nodejs();
|
|
|
173065
173089
|
|
|
173066
173090
|
// src/matter/behaviors/color-control-server.ts
|
|
173067
173091
|
init_home_assistant_entity_behavior();
|
|
173068
|
-
var
|
|
173092
|
+
var logger183 = Logger.get("ColorControlServer");
|
|
173069
173093
|
var optimisticColorState = /* @__PURE__ */ new Map();
|
|
173070
173094
|
var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
|
|
173071
173095
|
var OPTIMISTIC_TOLERANCE2 = 5;
|
|
@@ -173104,7 +173128,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
173104
173128
|
if (this.state.startUpColorTemperatureMireds == null) {
|
|
173105
173129
|
this.state.startUpColorTemperatureMireds = defaultMireds;
|
|
173106
173130
|
}
|
|
173107
|
-
|
|
173131
|
+
logger183.debug(
|
|
173108
173132
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
173109
173133
|
);
|
|
173110
173134
|
}
|
|
@@ -173557,7 +173581,7 @@ init_home_assistant_entity_behavior();
|
|
|
173557
173581
|
// src/matter/behaviors/lock-server.ts
|
|
173558
173582
|
init_esm();
|
|
173559
173583
|
init_home_assistant_entity_behavior();
|
|
173560
|
-
var
|
|
173584
|
+
var logger184 = Logger.get("LockServer");
|
|
173561
173585
|
function hasStoredCredentialHelper(env, entityId) {
|
|
173562
173586
|
try {
|
|
173563
173587
|
const storage2 = env.get(LockCredentialStorage);
|
|
@@ -173715,7 +173739,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
173715
173739
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
173716
173740
|
const action = this.state.config.lock(void 0, this.agent);
|
|
173717
173741
|
const hasPinProvided = !!request.pinCode;
|
|
173718
|
-
|
|
173742
|
+
logger184.debug(
|
|
173719
173743
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
173720
173744
|
);
|
|
173721
173745
|
if (request.pinCode) {
|
|
@@ -173728,12 +173752,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
173728
173752
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
173729
173753
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
173730
173754
|
const hasPinProvided = !!request.pinCode;
|
|
173731
|
-
|
|
173755
|
+
logger184.debug(
|
|
173732
173756
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
173733
173757
|
);
|
|
173734
173758
|
if (this.state.requirePinForRemoteOperation) {
|
|
173735
173759
|
if (!request.pinCode) {
|
|
173736
|
-
|
|
173760
|
+
logger184.info(
|
|
173737
173761
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
173738
173762
|
);
|
|
173739
173763
|
throw new StatusResponseError(
|
|
@@ -173743,12 +173767,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
173743
173767
|
}
|
|
173744
173768
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
173745
173769
|
if (!this.verifyStoredPin(homeAssistant.entityId, providedPin)) {
|
|
173746
|
-
|
|
173770
|
+
logger184.info(
|
|
173747
173771
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
173748
173772
|
);
|
|
173749
173773
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
173750
173774
|
}
|
|
173751
|
-
|
|
173775
|
+
logger184.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
173752
173776
|
action.data = { ...action.data, code: providedPin };
|
|
173753
173777
|
}
|
|
173754
173778
|
homeAssistant.callAction(action);
|
|
@@ -173909,7 +173933,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173909
173933
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
173910
173934
|
const action = this.state.config.lock(void 0, this.agent);
|
|
173911
173935
|
const hasPinProvided = !!request.pinCode;
|
|
173912
|
-
|
|
173936
|
+
logger184.debug(
|
|
173913
173937
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
173914
173938
|
);
|
|
173915
173939
|
if (request.pinCode) {
|
|
@@ -173923,12 +173947,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173923
173947
|
const unlatchConfig = this.state.config.unlatch;
|
|
173924
173948
|
const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
|
|
173925
173949
|
const hasPinProvided = !!request.pinCode;
|
|
173926
|
-
|
|
173950
|
+
logger184.debug(
|
|
173927
173951
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
|
|
173928
173952
|
);
|
|
173929
173953
|
if (this.state.requirePinForRemoteOperation) {
|
|
173930
173954
|
if (!request.pinCode) {
|
|
173931
|
-
|
|
173955
|
+
logger184.info(
|
|
173932
173956
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
173933
173957
|
);
|
|
173934
173958
|
throw new StatusResponseError(
|
|
@@ -173938,12 +173962,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173938
173962
|
}
|
|
173939
173963
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
173940
173964
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
173941
|
-
|
|
173965
|
+
logger184.info(
|
|
173942
173966
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
173943
173967
|
);
|
|
173944
173968
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
173945
173969
|
}
|
|
173946
|
-
|
|
173970
|
+
logger184.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
173947
173971
|
action.data = { ...action.data, code: providedPin };
|
|
173948
173972
|
}
|
|
173949
173973
|
homeAssistant.callAction(action);
|
|
@@ -173958,12 +173982,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173958
173982
|
}
|
|
173959
173983
|
const action = unlatchConfig(void 0, this.agent);
|
|
173960
173984
|
const hasPinProvided = !!request.pinCode;
|
|
173961
|
-
|
|
173985
|
+
logger184.debug(
|
|
173962
173986
|
`unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
173963
173987
|
);
|
|
173964
173988
|
if (this.state.requirePinForRemoteOperation) {
|
|
173965
173989
|
if (!request.pinCode) {
|
|
173966
|
-
|
|
173990
|
+
logger184.info(
|
|
173967
173991
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
173968
173992
|
);
|
|
173969
173993
|
throw new StatusResponseError(
|
|
@@ -173973,12 +173997,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
173973
173997
|
}
|
|
173974
173998
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
173975
173999
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
173976
|
-
|
|
174000
|
+
logger184.info(
|
|
173977
174001
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
173978
174002
|
);
|
|
173979
174003
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
173980
174004
|
}
|
|
173981
|
-
|
|
174005
|
+
logger184.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
|
|
173982
174006
|
action.data = { ...action.data, code: providedPin };
|
|
173983
174007
|
}
|
|
173984
174008
|
homeAssistant.callAction(action);
|
|
@@ -174129,7 +174153,7 @@ init_home_assistant_entity_behavior();
|
|
|
174129
174153
|
init_dist();
|
|
174130
174154
|
init_esm();
|
|
174131
174155
|
init_home_assistant_entity_behavior();
|
|
174132
|
-
var
|
|
174156
|
+
var logger185 = Logger.get("MediaPlayerKeypadInputServer");
|
|
174133
174157
|
var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
174134
174158
|
sendKey(request) {
|
|
174135
174159
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -174140,12 +174164,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
|
174140
174164
|
const features2 = attributes7.supported_features ?? 0;
|
|
174141
174165
|
const action = this.mapKeyToAction(request.keyCode, features2);
|
|
174142
174166
|
if (!action) {
|
|
174143
|
-
|
|
174167
|
+
logger185.debug(
|
|
174144
174168
|
`Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
|
|
174145
174169
|
);
|
|
174146
174170
|
return { status: KeypadInput3.Status.UnsupportedKey };
|
|
174147
174171
|
}
|
|
174148
|
-
|
|
174172
|
+
logger185.debug(
|
|
174149
174173
|
`sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
|
|
174150
174174
|
);
|
|
174151
174175
|
homeAssistant.callAction({ action });
|
|
@@ -174424,7 +174448,7 @@ init_home_assistant_entity_behavior();
|
|
|
174424
174448
|
// src/matter/behaviors/speaker-level-control-server.ts
|
|
174425
174449
|
init_esm();
|
|
174426
174450
|
init_home_assistant_entity_behavior();
|
|
174427
|
-
var
|
|
174451
|
+
var logger186 = Logger.get("SpeakerLevelControlServer");
|
|
174428
174452
|
var optimisticLevelState2 = /* @__PURE__ */ new Map();
|
|
174429
174453
|
var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
|
|
174430
174454
|
var OPTIMISTIC_TOLERANCE3 = 5;
|
|
@@ -174467,7 +174491,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
174467
174491
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
174468
174492
|
}
|
|
174469
174493
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
174470
|
-
|
|
174494
|
+
logger186.debug(
|
|
174471
174495
|
`[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
|
|
174472
174496
|
);
|
|
174473
174497
|
const optimistic = optimisticLevelState2.get(entity.entity_id);
|
|
@@ -174515,7 +174539,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
174515
174539
|
const config10 = this.state.config;
|
|
174516
174540
|
const entityId = homeAssistant.entity.entity_id;
|
|
174517
174541
|
const levelPercent = level / 254;
|
|
174518
|
-
|
|
174542
|
+
logger186.debug(
|
|
174519
174543
|
`[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
|
|
174520
174544
|
);
|
|
174521
174545
|
const current = config10.getValuePercent(
|
|
@@ -175879,7 +175903,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
|
|
|
175879
175903
|
};
|
|
175880
175904
|
|
|
175881
175905
|
// src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
|
|
175882
|
-
var
|
|
175906
|
+
var logger187 = Logger.get("TvocSensor");
|
|
175883
175907
|
function airQualityFromUgm3(value) {
|
|
175884
175908
|
if (value <= 300) return AirQuality3.AirQualityEnum.Good;
|
|
175885
175909
|
if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
|
|
@@ -175920,17 +175944,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
175920
175944
|
const attributes7 = entity.state.attributes;
|
|
175921
175945
|
const deviceClass = attributes7.device_class;
|
|
175922
175946
|
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
175923
|
-
|
|
175947
|
+
logger187.debug(
|
|
175924
175948
|
`[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
|
|
175925
175949
|
);
|
|
175926
175950
|
if (state != null && !Number.isNaN(+state)) {
|
|
175927
175951
|
const value = +state;
|
|
175928
175952
|
airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
|
|
175929
|
-
|
|
175953
|
+
logger187.debug(
|
|
175930
175954
|
`[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
|
|
175931
175955
|
);
|
|
175932
175956
|
} else {
|
|
175933
|
-
|
|
175957
|
+
logger187.warn(
|
|
175934
175958
|
`[${entity.entity_id}] TVOC state not a valid number: "${state}"`
|
|
175935
175959
|
);
|
|
175936
175960
|
}
|
|
@@ -176144,7 +176168,7 @@ init_home_assistant_entity_behavior();
|
|
|
176144
176168
|
// src/matter/behaviors/pm25-concentration-measurement-server.ts
|
|
176145
176169
|
init_esm();
|
|
176146
176170
|
init_home_assistant_entity_behavior();
|
|
176147
|
-
var
|
|
176171
|
+
var logger188 = Logger.get("Pm25ConcentrationMeasurementServer");
|
|
176148
176172
|
var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
|
|
176149
176173
|
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
176150
176174
|
);
|
|
@@ -176168,11 +176192,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
176168
176192
|
if (this.state.measurementMedium === void 0) {
|
|
176169
176193
|
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
176170
176194
|
}
|
|
176171
|
-
|
|
176195
|
+
logger188.debug(
|
|
176172
176196
|
"Pm25ConcentrationMeasurementServer: before super.initialize()"
|
|
176173
176197
|
);
|
|
176174
176198
|
await super.initialize();
|
|
176175
|
-
|
|
176199
|
+
logger188.debug(
|
|
176176
176200
|
"Pm25ConcentrationMeasurementServer: after super.initialize()"
|
|
176177
176201
|
);
|
|
176178
176202
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -176195,7 +176219,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
176195
176219
|
};
|
|
176196
176220
|
|
|
176197
176221
|
// src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
|
|
176198
|
-
var
|
|
176222
|
+
var logger189 = Logger.get("Pm25AirQualityServer");
|
|
176199
176223
|
var Pm25AirQualityServerBase = AirQualityServer.with(
|
|
176200
176224
|
AirQuality3.Feature.Fair,
|
|
176201
176225
|
AirQuality3.Feature.Moderate,
|
|
@@ -176207,9 +176231,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
|
|
|
176207
176231
|
if (this.state.airQuality === void 0) {
|
|
176208
176232
|
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
176209
176233
|
}
|
|
176210
|
-
|
|
176234
|
+
logger189.debug("Pm25AirQualityServer: before super.initialize()");
|
|
176211
176235
|
await super.initialize();
|
|
176212
|
-
|
|
176236
|
+
logger189.debug("Pm25AirQualityServer: after super.initialize()");
|
|
176213
176237
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
176214
176238
|
this.update(homeAssistant.entity);
|
|
176215
176239
|
this.reactTo(homeAssistant.onChange, this.update);
|
|
@@ -176595,7 +176619,7 @@ init_home_assistant_entity_behavior();
|
|
|
176595
176619
|
init_dist();
|
|
176596
176620
|
init_esm();
|
|
176597
176621
|
init_home_assistant_entity_behavior();
|
|
176598
|
-
var
|
|
176622
|
+
var logger190 = Logger.get("VacuumIdentifyServer");
|
|
176599
176623
|
var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
176600
176624
|
triggerEffect(effect) {
|
|
176601
176625
|
this.#locate("triggerEffect");
|
|
@@ -176612,11 +176636,11 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
176612
176636
|
const features2 = homeAssistant.entity.state.attributes.supported_features ?? 0;
|
|
176613
176637
|
const hasLocate = testBit(features2, VacuumDeviceFeature.LOCATE);
|
|
176614
176638
|
if (!hasLocate) {
|
|
176615
|
-
|
|
176639
|
+
logger190.warn(
|
|
176616
176640
|
`${source} for ${homeAssistant.entityId} \u2014 LOCATE not in supported_features (${features2}), calling vacuum.locate anyway`
|
|
176617
176641
|
);
|
|
176618
176642
|
} else {
|
|
176619
|
-
|
|
176643
|
+
logger190.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
|
|
176620
176644
|
}
|
|
176621
176645
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
176622
176646
|
}
|
|
@@ -176635,7 +176659,7 @@ init_rvc_run_mode();
|
|
|
176635
176659
|
|
|
176636
176660
|
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
176637
176661
|
init_home_assistant_entity_behavior();
|
|
176638
|
-
var
|
|
176662
|
+
var logger191 = Logger.get("RvcRunModeServer");
|
|
176639
176663
|
var ROOM_MODE_BASE = 100;
|
|
176640
176664
|
function isRoomMode(mode) {
|
|
176641
176665
|
return mode >= ROOM_MODE_BASE;
|
|
@@ -176716,7 +176740,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176716
176740
|
const s = getSession(this.endpoint);
|
|
176717
176741
|
if (s.loggedShortCircuits.has(reason)) return;
|
|
176718
176742
|
s.loggedShortCircuits.add(reason);
|
|
176719
|
-
|
|
176743
|
+
logger191.info(message);
|
|
176720
176744
|
}
|
|
176721
176745
|
/**
|
|
176722
176746
|
* Read the currentRoomEntity sensor and update currentArea + progress
|
|
@@ -176777,7 +176801,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176777
176801
|
}
|
|
176778
176802
|
}
|
|
176779
176803
|
if (matchedAreaId === null) {
|
|
176780
|
-
|
|
176804
|
+
logger191.info(
|
|
176781
176805
|
`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
176806
|
);
|
|
176783
176807
|
return;
|
|
@@ -176787,14 +176811,14 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176787
176811
|
s.completedAreas.add(s.lastCurrentArea);
|
|
176788
176812
|
}
|
|
176789
176813
|
s.lastCurrentArea = matchedAreaId;
|
|
176790
|
-
|
|
176814
|
+
logger191.info(
|
|
176791
176815
|
`currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
|
|
176792
176816
|
);
|
|
176793
176817
|
this.trySetCurrentArea(matchedAreaId);
|
|
176794
176818
|
} catch (e) {
|
|
176795
176819
|
const msg = e instanceof Error ? e.message : String(e);
|
|
176796
176820
|
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
176797
|
-
|
|
176821
|
+
logger191.warn(`currentRoom sensor update failed: ${msg}`);
|
|
176798
176822
|
}
|
|
176799
176823
|
}
|
|
176800
176824
|
}
|
|
@@ -176809,7 +176833,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
176809
176833
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
176810
176834
|
if (serviceArea.state.currentArea !== areaId) {
|
|
176811
176835
|
serviceArea.state.currentArea = areaId;
|
|
176812
|
-
|
|
176836
|
+
logger191.debug(`currentArea set to ${areaId}`);
|
|
176813
176837
|
}
|
|
176814
176838
|
this.updateProgress(serviceArea, areaId);
|
|
176815
176839
|
} catch {
|
|
@@ -177157,14 +177181,14 @@ init_esm();
|
|
|
177157
177181
|
|
|
177158
177182
|
// src/matter/behaviors/service-area-server.ts
|
|
177159
177183
|
init_esm();
|
|
177160
|
-
var
|
|
177184
|
+
var logger192 = Logger.get("ServiceAreaServer");
|
|
177161
177185
|
var ServiceAreaWithProgress = ServiceAreaBehavior.with(
|
|
177162
177186
|
ServiceArea3.Feature.ProgressReporting
|
|
177163
177187
|
);
|
|
177164
177188
|
var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
177165
177189
|
selectAreas(request) {
|
|
177166
177190
|
const { newAreas } = request;
|
|
177167
|
-
|
|
177191
|
+
logger192.info(
|
|
177168
177192
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
177169
177193
|
);
|
|
177170
177194
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -177173,7 +177197,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
177173
177197
|
(id) => !supportedAreaIds.includes(id)
|
|
177174
177198
|
);
|
|
177175
177199
|
if (invalidAreas.length > 0) {
|
|
177176
|
-
|
|
177200
|
+
logger192.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
177177
177201
|
return {
|
|
177178
177202
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
177179
177203
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -177184,7 +177208,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
177184
177208
|
areaId,
|
|
177185
177209
|
status: ServiceArea3.OperationalStatus.Pending
|
|
177186
177210
|
}));
|
|
177187
|
-
|
|
177211
|
+
logger192.info(
|
|
177188
177212
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
177189
177213
|
);
|
|
177190
177214
|
return {
|
|
@@ -177205,7 +177229,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
177205
177229
|
ServiceAreaServerBase2.State = State;
|
|
177206
177230
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
177207
177231
|
function ServiceAreaServer2(initialState) {
|
|
177208
|
-
|
|
177232
|
+
logger192.info(
|
|
177209
177233
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
177210
177234
|
);
|
|
177211
177235
|
return ServiceAreaServerBase.set({
|
|
@@ -177222,7 +177246,7 @@ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
|
|
|
177222
177246
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
|
|
177223
177247
|
selectAreas(request) {
|
|
177224
177248
|
const { newAreas } = request;
|
|
177225
|
-
|
|
177249
|
+
logger192.info(
|
|
177226
177250
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
177227
177251
|
);
|
|
177228
177252
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -177231,7 +177255,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
177231
177255
|
(id) => !supportedAreaIds.includes(id)
|
|
177232
177256
|
);
|
|
177233
177257
|
if (invalidAreas.length > 0) {
|
|
177234
|
-
|
|
177258
|
+
logger192.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
177235
177259
|
return {
|
|
177236
177260
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
177237
177261
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -177242,7 +177266,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
177242
177266
|
areaId,
|
|
177243
177267
|
status: ServiceArea3.OperationalStatus.Pending
|
|
177244
177268
|
}));
|
|
177245
|
-
|
|
177269
|
+
logger192.info(
|
|
177246
177270
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
177247
177271
|
);
|
|
177248
177272
|
return {
|
|
@@ -177263,14 +177287,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
177263
177287
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
177264
177288
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
177265
177289
|
function ServiceAreaServerWithMaps(initialState) {
|
|
177266
|
-
|
|
177290
|
+
logger192.info(
|
|
177267
177291
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
177268
177292
|
);
|
|
177269
177293
|
for (const map of initialState.supportedMaps) {
|
|
177270
177294
|
const areaCount = initialState.supportedAreas.filter(
|
|
177271
177295
|
(a) => a.mapId === map.mapId
|
|
177272
177296
|
).length;
|
|
177273
|
-
|
|
177297
|
+
logger192.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
177274
177298
|
}
|
|
177275
177299
|
return ServiceAreaServerWithMapsBase.set({
|
|
177276
177300
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -177282,7 +177306,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
177282
177306
|
}
|
|
177283
177307
|
|
|
177284
177308
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
177285
|
-
var
|
|
177309
|
+
var logger193 = Logger.get("VacuumServiceAreaServer");
|
|
177286
177310
|
function toAreaId(roomId) {
|
|
177287
177311
|
if (typeof roomId === "number") {
|
|
177288
177312
|
return roomId;
|
|
@@ -177361,13 +177385,13 @@ function createVacuumServiceAreaServer(attributes7, roomEntities, includeUnnamed
|
|
|
177361
177385
|
let rooms;
|
|
177362
177386
|
if (roomEntities && roomEntities.length > 0) {
|
|
177363
177387
|
rooms = buttonEntitiesToRooms(roomEntities, attributes7);
|
|
177364
|
-
|
|
177388
|
+
logger193.info(
|
|
177365
177389
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
177366
177390
|
);
|
|
177367
177391
|
} else {
|
|
177368
177392
|
rooms = parseVacuumRooms(attributes7, includeUnnamedRooms);
|
|
177369
177393
|
if (rooms.length > 0) {
|
|
177370
|
-
|
|
177394
|
+
logger193.info(
|
|
177371
177395
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
177372
177396
|
);
|
|
177373
177397
|
}
|
|
@@ -177421,7 +177445,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
177421
177445
|
landmarkInfo: null
|
|
177422
177446
|
}
|
|
177423
177447
|
}));
|
|
177424
|
-
|
|
177448
|
+
logger193.info(
|
|
177425
177449
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
177426
177450
|
);
|
|
177427
177451
|
return ServiceAreaServer2({
|
|
@@ -177443,7 +177467,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
177443
177467
|
landmarkInfo: null
|
|
177444
177468
|
}
|
|
177445
177469
|
}));
|
|
177446
|
-
|
|
177470
|
+
logger193.info(
|
|
177447
177471
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
|
|
177448
177472
|
);
|
|
177449
177473
|
return ServiceAreaServer2({
|
|
@@ -177454,11 +177478,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
177454
177478
|
}
|
|
177455
177479
|
|
|
177456
177480
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
177457
|
-
var
|
|
177481
|
+
var logger194 = Logger.get("VacuumRvcRunModeServer");
|
|
177458
177482
|
function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
|
|
177459
177483
|
const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
177460
177484
|
const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
|
|
177461
|
-
|
|
177485
|
+
logger194.info(
|
|
177462
177486
|
`Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
|
|
177463
177487
|
);
|
|
177464
177488
|
return {
|
|
@@ -177520,12 +177544,12 @@ function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, ser
|
|
|
177520
177544
|
const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
|
|
177521
177545
|
serviceArea.state.selectedAreas = [];
|
|
177522
177546
|
if (matched.length === 0) {
|
|
177523
|
-
|
|
177547
|
+
logger194.warn(
|
|
177524
177548
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
177525
177549
|
);
|
|
177526
177550
|
return { action: "vacuum.start" };
|
|
177527
177551
|
}
|
|
177528
|
-
|
|
177552
|
+
logger194.info(
|
|
177529
177553
|
`Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
|
|
177530
177554
|
);
|
|
177531
177555
|
for (let i = 1; i < matched.length; i++) {
|
|
@@ -177565,7 +177589,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177565
177589
|
VacuumState.paused
|
|
177566
177590
|
];
|
|
177567
177591
|
const isCleaning = cleaningStates.includes(state);
|
|
177568
|
-
|
|
177592
|
+
logger194.debug(
|
|
177569
177593
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
177570
177594
|
);
|
|
177571
177595
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -177597,7 +177621,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177597
177621
|
const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
|
|
177598
177622
|
serviceArea.state.selectedAreas = [];
|
|
177599
177623
|
if (haAreaIds.length > 0) {
|
|
177600
|
-
|
|
177624
|
+
logger194.info(
|
|
177601
177625
|
`CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
|
|
177602
177626
|
);
|
|
177603
177627
|
return {
|
|
@@ -177618,7 +177642,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177618
177642
|
}
|
|
177619
177643
|
}
|
|
177620
177644
|
if (buttonEntityIds.length > 0) {
|
|
177621
|
-
|
|
177645
|
+
logger194.info(
|
|
177622
177646
|
`Roborock: Pressing button entities for selected rooms: ${buttonEntityIds.join(", ")}`
|
|
177623
177647
|
);
|
|
177624
177648
|
serviceArea.state.selectedAreas = [];
|
|
@@ -177656,7 +177680,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177656
177680
|
}
|
|
177657
177681
|
}
|
|
177658
177682
|
if (roomIds.length > 0) {
|
|
177659
|
-
|
|
177683
|
+
logger194.info(
|
|
177660
177684
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
177661
177685
|
);
|
|
177662
177686
|
serviceArea.state.selectedAreas = [];
|
|
@@ -177664,7 +177688,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177664
177688
|
if (targetMapName) {
|
|
177665
177689
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
177666
177690
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
177667
|
-
|
|
177691
|
+
logger194.info(
|
|
177668
177692
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
177669
177693
|
);
|
|
177670
177694
|
homeAssistant.callAction({
|
|
@@ -177691,7 +177715,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177691
177715
|
}
|
|
177692
177716
|
if (isEcovacsVacuum(attributes7)) {
|
|
177693
177717
|
const roomIdStr = roomIds.join(",");
|
|
177694
|
-
|
|
177718
|
+
logger194.info(
|
|
177695
177719
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
177696
177720
|
);
|
|
177697
177721
|
return {
|
|
@@ -177706,14 +177730,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
177706
177730
|
}
|
|
177707
177731
|
};
|
|
177708
177732
|
}
|
|
177709
|
-
|
|
177733
|
+
logger194.warn(
|
|
177710
177734
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
177711
177735
|
);
|
|
177712
177736
|
}
|
|
177713
177737
|
}
|
|
177714
177738
|
} catch {
|
|
177715
177739
|
}
|
|
177716
|
-
|
|
177740
|
+
logger194.info("Starting regular cleaning (no areas selected)");
|
|
177717
177741
|
return { action: "vacuum.start" };
|
|
177718
177742
|
},
|
|
177719
177743
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -177728,7 +177752,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177728
177752
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
177729
177753
|
const entity = homeAssistant.entity;
|
|
177730
177754
|
const attributes7 = entity.state.attributes;
|
|
177731
|
-
|
|
177755
|
+
logger194.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
177732
177756
|
const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
|
|
177733
177757
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
177734
177758
|
const sorted = [...cleanAreaRooms].sort(
|
|
@@ -177737,7 +177761,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177737
177761
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
177738
177762
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
177739
177763
|
const area = sorted[areaIndex];
|
|
177740
|
-
|
|
177764
|
+
logger194.info(
|
|
177741
177765
|
`cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
|
|
177742
177766
|
);
|
|
177743
177767
|
return {
|
|
@@ -177754,7 +177778,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177754
177778
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
177755
177779
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
177756
177780
|
const area = sorted[areaIndex];
|
|
177757
|
-
|
|
177781
|
+
logger194.info(
|
|
177758
177782
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
177759
177783
|
);
|
|
177760
177784
|
return {
|
|
@@ -177775,7 +177799,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177775
177799
|
}
|
|
177776
177800
|
const rooms = parseVacuumRooms(attributes7);
|
|
177777
177801
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
177778
|
-
|
|
177802
|
+
logger194.info(
|
|
177779
177803
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
177780
177804
|
);
|
|
177781
177805
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -177785,7 +177809,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177785
177809
|
if (room.mapName) {
|
|
177786
177810
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
177787
177811
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
177788
|
-
|
|
177812
|
+
logger194.info(
|
|
177789
177813
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
177790
177814
|
);
|
|
177791
177815
|
homeAssistant.callAction({
|
|
@@ -177794,7 +177818,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177794
177818
|
data: { option: room.mapName }
|
|
177795
177819
|
});
|
|
177796
177820
|
}
|
|
177797
|
-
|
|
177821
|
+
logger194.debug(
|
|
177798
177822
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
177799
177823
|
);
|
|
177800
177824
|
return {
|
|
@@ -177805,7 +177829,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177805
177829
|
};
|
|
177806
177830
|
}
|
|
177807
177831
|
if (isRoborockVacuum(attributes7) || isXiaomiMiotVacuum(attributes7)) {
|
|
177808
|
-
|
|
177832
|
+
logger194.debug(
|
|
177809
177833
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
177810
177834
|
);
|
|
177811
177835
|
return {
|
|
@@ -177818,7 +177842,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177818
177842
|
}
|
|
177819
177843
|
if (isEcovacsVacuum(attributes7)) {
|
|
177820
177844
|
const roomIdStr = String(commandId3);
|
|
177821
|
-
|
|
177845
|
+
logger194.info(
|
|
177822
177846
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
177823
177847
|
);
|
|
177824
177848
|
return {
|
|
@@ -177833,7 +177857,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
177833
177857
|
}
|
|
177834
177858
|
};
|
|
177835
177859
|
}
|
|
177836
|
-
|
|
177860
|
+
logger194.warn(
|
|
177837
177861
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
177838
177862
|
);
|
|
177839
177863
|
}
|
|
@@ -177849,20 +177873,20 @@ function createVacuumRvcRunModeServer(attributes7, includeUnnamedRooms = false,
|
|
|
177849
177873
|
includeUnnamedRooms,
|
|
177850
177874
|
customAreas
|
|
177851
177875
|
);
|
|
177852
|
-
|
|
177876
|
+
logger194.info(
|
|
177853
177877
|
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
|
|
177854
177878
|
);
|
|
177855
177879
|
if (rooms.length > 0) {
|
|
177856
|
-
|
|
177880
|
+
logger194.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
177857
177881
|
}
|
|
177858
177882
|
if (filteredCount > 0) {
|
|
177859
177883
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
177860
|
-
|
|
177884
|
+
logger194.info(
|
|
177861
177885
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
177862
177886
|
);
|
|
177863
177887
|
}
|
|
177864
177888
|
if (allRooms.length === 0) {
|
|
177865
|
-
|
|
177889
|
+
logger194.debug(
|
|
177866
177890
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes7.rooms)}, segments=${JSON.stringify(attributes7.segments)}, room_list=${attributes7.room_list}`
|
|
177867
177891
|
);
|
|
177868
177892
|
}
|
|
@@ -177896,7 +177920,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
|
|
|
177896
177920
|
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
177897
177921
|
});
|
|
177898
177922
|
}
|
|
177899
|
-
|
|
177923
|
+
logger194.info(
|
|
177900
177924
|
`Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
|
|
177901
177925
|
);
|
|
177902
177926
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
@@ -177957,7 +177981,7 @@ init_rvc_clean_mode();
|
|
|
177957
177981
|
|
|
177958
177982
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
177959
177983
|
init_home_assistant_entity_behavior();
|
|
177960
|
-
var
|
|
177984
|
+
var logger195 = Logger.get("RvcCleanModeServerBase");
|
|
177961
177985
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
177962
177986
|
// Pending mode from a recent changeToMode command.
|
|
177963
177987
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -178000,14 +178024,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
178000
178024
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
178001
178025
|
const { newMode } = request;
|
|
178002
178026
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
178003
|
-
|
|
178027
|
+
logger195.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
178004
178028
|
return {
|
|
178005
178029
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
178006
178030
|
statusText: `Unsupported mode: ${newMode}`
|
|
178007
178031
|
};
|
|
178008
178032
|
}
|
|
178009
178033
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
178010
|
-
|
|
178034
|
+
logger195.info(
|
|
178011
178035
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
178012
178036
|
);
|
|
178013
178037
|
this.pendingMode = newMode;
|
|
@@ -178015,7 +178039,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
178015
178039
|
this.state.currentMode = newMode;
|
|
178016
178040
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
178017
178041
|
if (action) {
|
|
178018
|
-
|
|
178042
|
+
logger195.info(
|
|
178019
178043
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
178020
178044
|
);
|
|
178021
178045
|
homeAssistant.callAction(action);
|
|
@@ -178048,7 +178072,7 @@ function RvcCleanModeServer2(config10, initialState) {
|
|
|
178048
178072
|
}
|
|
178049
178073
|
|
|
178050
178074
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
178051
|
-
var
|
|
178075
|
+
var logger196 = Logger.get("VacuumRvcCleanModeServer");
|
|
178052
178076
|
var MODE_VACUUM = 0;
|
|
178053
178077
|
var MODE_VACUUM_AND_MOP = 1;
|
|
178054
178078
|
var MODE_MOP = 2;
|
|
@@ -178347,7 +178371,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
178347
178371
|
if (match) return match;
|
|
178348
178372
|
}
|
|
178349
178373
|
}
|
|
178350
|
-
|
|
178374
|
+
logger196.warn(
|
|
178351
178375
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
178352
178376
|
);
|
|
178353
178377
|
return aliases[0];
|
|
@@ -178356,7 +178380,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
178356
178380
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
178357
178381
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
178358
178382
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
178359
|
-
|
|
178383
|
+
logger196.info(
|
|
178360
178384
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
178361
178385
|
);
|
|
178362
178386
|
return {
|
|
@@ -178445,7 +178469,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178445
178469
|
}
|
|
178446
178470
|
}
|
|
178447
178471
|
if (speedMode !== void 0) {
|
|
178448
|
-
|
|
178472
|
+
logger196.debug(
|
|
178449
178473
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
178450
178474
|
);
|
|
178451
178475
|
return speedMode;
|
|
@@ -178466,7 +178490,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178466
178490
|
}
|
|
178467
178491
|
}
|
|
178468
178492
|
if (mopMode !== void 0) {
|
|
178469
|
-
|
|
178493
|
+
logger196.debug(
|
|
178470
178494
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
178471
178495
|
);
|
|
178472
178496
|
return mopMode;
|
|
@@ -178484,14 +178508,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178484
178508
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
178485
178509
|
const vacuumEntityId = homeAssistant.entityId;
|
|
178486
178510
|
const mapping = homeAssistant.state.mapping;
|
|
178487
|
-
|
|
178511
|
+
logger196.info(
|
|
178488
178512
|
`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
178513
|
);
|
|
178490
178514
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
178491
178515
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
178492
178516
|
const mopName = mopIntensityList[mopIndex];
|
|
178493
178517
|
if (!mopName) {
|
|
178494
|
-
|
|
178518
|
+
logger196.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
178495
178519
|
return void 0;
|
|
178496
178520
|
}
|
|
178497
178521
|
if (hasCleanTypes) {
|
|
@@ -178504,18 +178528,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178504
178528
|
mapping.mopIntensityEntity,
|
|
178505
178529
|
agent
|
|
178506
178530
|
);
|
|
178507
|
-
|
|
178531
|
+
logger196.info(
|
|
178508
178532
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
178509
178533
|
);
|
|
178510
178534
|
let option = matchMopIntensityOption(mopName, options);
|
|
178511
178535
|
if (!option && options && mopIndex < options.length) {
|
|
178512
178536
|
option = options[mopIndex];
|
|
178513
|
-
|
|
178537
|
+
logger196.info(
|
|
178514
178538
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
178515
178539
|
);
|
|
178516
178540
|
}
|
|
178517
178541
|
if (option) {
|
|
178518
|
-
|
|
178542
|
+
logger196.info(
|
|
178519
178543
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
178520
178544
|
);
|
|
178521
178545
|
return {
|
|
@@ -178524,11 +178548,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178524
178548
|
target: mapping.mopIntensityEntity
|
|
178525
178549
|
};
|
|
178526
178550
|
}
|
|
178527
|
-
|
|
178551
|
+
logger196.warn(
|
|
178528
178552
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
178529
178553
|
);
|
|
178530
178554
|
} else {
|
|
178531
|
-
|
|
178555
|
+
logger196.warn(
|
|
178532
178556
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
178533
178557
|
);
|
|
178534
178558
|
}
|
|
@@ -178538,7 +178562,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178538
178562
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
178539
178563
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
178540
178564
|
if (!fanSpeedName) {
|
|
178541
|
-
|
|
178565
|
+
logger196.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
178542
178566
|
return void 0;
|
|
178543
178567
|
}
|
|
178544
178568
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -178551,7 +178575,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178551
178575
|
mapping.suctionLevelEntity,
|
|
178552
178576
|
agent
|
|
178553
178577
|
);
|
|
178554
|
-
|
|
178578
|
+
logger196.info(
|
|
178555
178579
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
178556
178580
|
);
|
|
178557
178581
|
let option = matchFanSpeedOption(
|
|
@@ -178561,12 +178585,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178561
178585
|
);
|
|
178562
178586
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
178563
178587
|
option = options[fanSpeedIndex];
|
|
178564
|
-
|
|
178588
|
+
logger196.info(
|
|
178565
178589
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
178566
178590
|
);
|
|
178567
178591
|
}
|
|
178568
178592
|
if (option) {
|
|
178569
|
-
|
|
178593
|
+
logger196.info(
|
|
178570
178594
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
178571
178595
|
);
|
|
178572
178596
|
return {
|
|
@@ -178575,7 +178599,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178575
178599
|
target: mapping.suctionLevelEntity
|
|
178576
178600
|
};
|
|
178577
178601
|
}
|
|
178578
|
-
|
|
178602
|
+
logger196.warn(
|
|
178579
178603
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
178580
178604
|
);
|
|
178581
178605
|
return void 0;
|
|
@@ -178585,7 +178609,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178585
178609
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
178586
178610
|
);
|
|
178587
178611
|
}
|
|
178588
|
-
|
|
178612
|
+
logger196.info(
|
|
178589
178613
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
178590
178614
|
);
|
|
178591
178615
|
return {
|
|
@@ -178595,7 +178619,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178595
178619
|
};
|
|
178596
178620
|
}
|
|
178597
178621
|
if (!hasCleanTypes) {
|
|
178598
|
-
|
|
178622
|
+
logger196.debug(
|
|
178599
178623
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
178600
178624
|
);
|
|
178601
178625
|
return void 0;
|
|
@@ -178607,7 +178631,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
178607
178631
|
agent
|
|
178608
178632
|
);
|
|
178609
178633
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
178610
|
-
|
|
178634
|
+
logger196.info(
|
|
178611
178635
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
178612
178636
|
);
|
|
178613
178637
|
return {
|
|
@@ -178625,10 +178649,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
178625
178649
|
cleaningModeOptions,
|
|
178626
178650
|
customFanSpeedTags
|
|
178627
178651
|
);
|
|
178628
|
-
|
|
178652
|
+
logger196.info(
|
|
178629
178653
|
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
178630
178654
|
);
|
|
178631
|
-
|
|
178655
|
+
logger196.info(
|
|
178632
178656
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
178633
178657
|
);
|
|
178634
178658
|
const initialState = {
|
|
@@ -178706,7 +178730,7 @@ init_rvc_operational_state();
|
|
|
178706
178730
|
init_home_assistant_entity_behavior();
|
|
178707
178731
|
var OperationalState4 = RvcOperationalState3.OperationalState;
|
|
178708
178732
|
var ErrorState = RvcOperationalState3.ErrorState;
|
|
178709
|
-
var
|
|
178733
|
+
var logger197 = Logger.get("RvcOperationalStateServer");
|
|
178710
178734
|
var activeStates = /* @__PURE__ */ new Set([
|
|
178711
178735
|
OperationalState4.Running,
|
|
178712
178736
|
OperationalState4.SeekingCharger
|
|
@@ -178755,7 +178779,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
178755
178779
|
{ force: true }
|
|
178756
178780
|
);
|
|
178757
178781
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
178758
|
-
|
|
178782
|
+
logger197.info(
|
|
178759
178783
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
178760
178784
|
);
|
|
178761
178785
|
try {
|
|
@@ -178768,7 +178792,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
178768
178792
|
this.context
|
|
178769
178793
|
);
|
|
178770
178794
|
} catch (e) {
|
|
178771
|
-
|
|
178795
|
+
logger197.debug("Failed to emit operationCompletion event:", e);
|
|
178772
178796
|
}
|
|
178773
178797
|
}
|
|
178774
178798
|
}
|
|
@@ -178803,7 +178827,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
178803
178827
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
178804
178828
|
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
178805
178829
|
} else {
|
|
178806
|
-
|
|
178830
|
+
logger197.warn("GoHome command received but no goHome action configured");
|
|
178807
178831
|
}
|
|
178808
178832
|
return {
|
|
178809
178833
|
commandResponseState: {
|
|
@@ -178823,7 +178847,7 @@ function RvcOperationalStateServer2(config10) {
|
|
|
178823
178847
|
}
|
|
178824
178848
|
|
|
178825
178849
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
|
|
178826
|
-
var
|
|
178850
|
+
var logger198 = Logger.get("VacuumRvcOperationalStateServer");
|
|
178827
178851
|
function isCharging(entity) {
|
|
178828
178852
|
const attrs = entity.attributes;
|
|
178829
178853
|
if (attrs.battery_icon?.includes("charging")) return true;
|
|
@@ -178865,16 +178889,16 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
178865
178889
|
operationalState = RvcOperationalState3.OperationalState.Error;
|
|
178866
178890
|
} else {
|
|
178867
178891
|
if (state.toLowerCase().includes("clean")) {
|
|
178868
|
-
|
|
178892
|
+
logger198.info(
|
|
178869
178893
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
178870
178894
|
);
|
|
178871
178895
|
operationalState = RvcOperationalState3.OperationalState.Running;
|
|
178872
178896
|
} else {
|
|
178873
|
-
|
|
178897
|
+
logger198.info(`Unknown vacuum state "${state}", treating as Stopped`);
|
|
178874
178898
|
operationalState = RvcOperationalState3.OperationalState.Stopped;
|
|
178875
178899
|
}
|
|
178876
178900
|
}
|
|
178877
|
-
|
|
178901
|
+
logger198.debug(
|
|
178878
178902
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
|
|
178879
178903
|
);
|
|
178880
178904
|
return operationalState;
|
|
@@ -178895,7 +178919,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
178895
178919
|
});
|
|
178896
178920
|
|
|
178897
178921
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
178898
|
-
var
|
|
178922
|
+
var logger199 = Logger.get("VacuumDevice");
|
|
178899
178923
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
178900
178924
|
BasicInformationServer2,
|
|
178901
178925
|
VacuumIdentifyServer,
|
|
@@ -178909,7 +178933,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
178909
178933
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
178910
178934
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
178911
178935
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
178912
|
-
|
|
178936
|
+
logger199.info(
|
|
178913
178937
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
178914
178938
|
);
|
|
178915
178939
|
const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
|
|
@@ -178921,32 +178945,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
178921
178945
|
)
|
|
178922
178946
|
).set({ homeAssistantEntity });
|
|
178923
178947
|
if (includeOnOff) {
|
|
178924
|
-
|
|
178948
|
+
logger199.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
178925
178949
|
device = device.with(VacuumOnOffServer);
|
|
178926
178950
|
}
|
|
178927
178951
|
device = device.with(VacuumPowerSourceServer);
|
|
178928
178952
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
178929
178953
|
const rooms = parseVacuumRooms(attributes7);
|
|
178930
|
-
|
|
178954
|
+
logger199.info(
|
|
178931
178955
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
|
|
178932
178956
|
);
|
|
178933
178957
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
178934
|
-
|
|
178958
|
+
logger199.info(
|
|
178935
178959
|
`${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
|
|
178936
178960
|
);
|
|
178937
178961
|
device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
|
|
178938
178962
|
} else if (customAreas && customAreas.length > 0) {
|
|
178939
|
-
|
|
178963
|
+
logger199.info(
|
|
178940
178964
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
178941
178965
|
);
|
|
178942
178966
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
178943
178967
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
178944
|
-
|
|
178968
|
+
logger199.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
178945
178969
|
device = device.with(
|
|
178946
178970
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
178947
178971
|
);
|
|
178948
178972
|
} else {
|
|
178949
|
-
|
|
178973
|
+
logger199.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
178950
178974
|
device = device.with(createDefaultServiceAreaServer());
|
|
178951
178975
|
}
|
|
178952
178976
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -178957,7 +178981,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
178957
178981
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
178958
178982
|
);
|
|
178959
178983
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
178960
|
-
|
|
178984
|
+
logger199.info(
|
|
178961
178985
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
178962
178986
|
);
|
|
178963
178987
|
device = device.with(
|
|
@@ -178970,7 +178994,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
178970
178994
|
)
|
|
178971
178995
|
);
|
|
178972
178996
|
} else {
|
|
178973
|
-
|
|
178997
|
+
logger199.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
178974
178998
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
178975
178999
|
}
|
|
178976
179000
|
return device;
|
|
@@ -179136,7 +179160,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
179136
179160
|
);
|
|
179137
179161
|
|
|
179138
179162
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
179139
|
-
var
|
|
179163
|
+
var logger200 = Logger.get("WaterHeaterDevice");
|
|
179140
179164
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
179141
179165
|
BasicInformationServer2,
|
|
179142
179166
|
IdentifyServer2,
|
|
@@ -179152,7 +179176,7 @@ function toMatterTemp2(value) {
|
|
|
179152
179176
|
}
|
|
179153
179177
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
179154
179178
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
179155
|
-
|
|
179179
|
+
logger200.debug(
|
|
179156
179180
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes7.min_temp}, max_temp=${attributes7.max_temp}`
|
|
179157
179181
|
);
|
|
179158
179182
|
const minLimit = toMatterTemp2(attributes7.min_temp) ?? 0;
|
|
@@ -179313,7 +179337,7 @@ var matterDeviceTypeFactories = {
|
|
|
179313
179337
|
};
|
|
179314
179338
|
|
|
179315
179339
|
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
179316
|
-
var
|
|
179340
|
+
var logger201 = Logger.get("UserComposedEndpoint");
|
|
179317
179341
|
function stripBasicInformation(type) {
|
|
179318
179342
|
const behaviors = { ...type.behaviors };
|
|
179319
179343
|
delete behaviors.bridgedDeviceBasicInformation;
|
|
@@ -179369,7 +179393,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179369
179393
|
{ vacuumOnOff: registry2.isVacuumOnOffEnabled() }
|
|
179370
179394
|
);
|
|
179371
179395
|
if (!primaryType) {
|
|
179372
|
-
|
|
179396
|
+
logger201.warn(
|
|
179373
179397
|
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
179374
179398
|
);
|
|
179375
179399
|
return void 0;
|
|
@@ -179384,7 +179408,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179384
179408
|
if (!sub.entityId) continue;
|
|
179385
179409
|
const subPayload = buildEntityPayload3(registry2, sub.entityId);
|
|
179386
179410
|
if (!subPayload) {
|
|
179387
|
-
|
|
179411
|
+
logger201.warn(
|
|
179388
179412
|
`Cannot find entity state for composed sub-entity ${sub.entityId}`
|
|
179389
179413
|
);
|
|
179390
179414
|
continue;
|
|
@@ -179395,7 +179419,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179395
179419
|
};
|
|
179396
179420
|
const subType = createLegacyEndpointType(subPayload, subMapping);
|
|
179397
179421
|
if (!subType) {
|
|
179398
|
-
|
|
179422
|
+
logger201.warn(
|
|
179399
179423
|
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
179400
179424
|
);
|
|
179401
179425
|
continue;
|
|
@@ -179408,7 +179432,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179408
179432
|
mappedIds.push(sub.entityId);
|
|
179409
179433
|
}
|
|
179410
179434
|
if (parts.length < 2) {
|
|
179411
|
-
|
|
179435
|
+
logger201.warn(
|
|
179412
179436
|
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
179413
179437
|
);
|
|
179414
179438
|
return void 0;
|
|
@@ -179431,7 +179455,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179431
179455
|
const labels = parts.map(
|
|
179432
179456
|
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
179433
179457
|
).join("+");
|
|
179434
|
-
|
|
179458
|
+
logger201.info(
|
|
179435
179459
|
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
179436
179460
|
);
|
|
179437
179461
|
return endpoint;
|
|
@@ -179500,7 +179524,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
179500
179524
|
};
|
|
179501
179525
|
|
|
179502
179526
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
179503
|
-
var
|
|
179527
|
+
var logger202 = Logger.get("LegacyEndpoint");
|
|
179504
179528
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
179505
179529
|
static async create(registry2, entityId, mapping, pluginDomainMappings) {
|
|
179506
179530
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -179510,25 +179534,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179510
179534
|
return;
|
|
179511
179535
|
}
|
|
179512
179536
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
179513
|
-
|
|
179537
|
+
logger202.debug(
|
|
179514
179538
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
179515
179539
|
);
|
|
179516
179540
|
return;
|
|
179517
179541
|
}
|
|
179518
179542
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
179519
|
-
|
|
179543
|
+
logger202.debug(
|
|
179520
179544
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
179521
179545
|
);
|
|
179522
179546
|
return;
|
|
179523
179547
|
}
|
|
179524
179548
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
179525
|
-
|
|
179549
|
+
logger202.debug(
|
|
179526
179550
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
179527
179551
|
);
|
|
179528
179552
|
return;
|
|
179529
179553
|
}
|
|
179530
179554
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
179531
|
-
|
|
179555
|
+
logger202.debug(
|
|
179532
179556
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
179533
179557
|
);
|
|
179534
179558
|
return;
|
|
@@ -179548,7 +179572,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179548
179572
|
humidityEntity: humidityEntityId
|
|
179549
179573
|
};
|
|
179550
179574
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
179551
|
-
|
|
179575
|
+
logger202.debug(
|
|
179552
179576
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
179553
179577
|
);
|
|
179554
179578
|
}
|
|
@@ -179567,7 +179591,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179567
179591
|
pressureEntity: pressureEntityId
|
|
179568
179592
|
};
|
|
179569
179593
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
179570
|
-
|
|
179594
|
+
logger202.debug(
|
|
179571
179595
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
179572
179596
|
);
|
|
179573
179597
|
}
|
|
@@ -179585,7 +179609,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179585
179609
|
batteryEntity: batteryEntityId
|
|
179586
179610
|
};
|
|
179587
179611
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
179588
|
-
|
|
179612
|
+
logger202.debug(
|
|
179589
179613
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
179590
179614
|
);
|
|
179591
179615
|
}
|
|
@@ -179603,7 +179627,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179603
179627
|
powerEntity: powerEntityId
|
|
179604
179628
|
};
|
|
179605
179629
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
179606
|
-
|
|
179630
|
+
logger202.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
179607
179631
|
}
|
|
179608
179632
|
}
|
|
179609
179633
|
}
|
|
@@ -179620,7 +179644,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179620
179644
|
energyEntity: energyEntityId
|
|
179621
179645
|
};
|
|
179622
179646
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
179623
|
-
|
|
179647
|
+
logger202.debug(
|
|
179624
179648
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
179625
179649
|
);
|
|
179626
179650
|
}
|
|
@@ -179636,7 +179660,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179636
179660
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179637
179661
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
179638
179662
|
};
|
|
179639
|
-
|
|
179663
|
+
logger202.info(
|
|
179640
179664
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
179641
179665
|
);
|
|
179642
179666
|
}
|
|
@@ -179646,7 +179670,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179646
179670
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179647
179671
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
179648
179672
|
};
|
|
179649
|
-
|
|
179673
|
+
logger202.info(
|
|
179650
179674
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
179651
179675
|
);
|
|
179652
179676
|
}
|
|
@@ -179656,7 +179680,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179656
179680
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179657
179681
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
179658
179682
|
};
|
|
179659
|
-
|
|
179683
|
+
logger202.info(
|
|
179660
179684
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
179661
179685
|
);
|
|
179662
179686
|
}
|
|
@@ -179666,7 +179690,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179666
179690
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179667
179691
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
179668
179692
|
};
|
|
179669
|
-
|
|
179693
|
+
logger202.info(
|
|
179670
179694
|
`Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
|
|
179671
179695
|
);
|
|
179672
179696
|
}
|
|
@@ -179681,7 +179705,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179681
179705
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
179682
179706
|
cleanAreaRooms
|
|
179683
179707
|
};
|
|
179684
|
-
|
|
179708
|
+
logger202.info(
|
|
179685
179709
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
179686
179710
|
);
|
|
179687
179711
|
}
|
|
@@ -179702,7 +179726,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179702
179726
|
rooms: roomsObj
|
|
179703
179727
|
}
|
|
179704
179728
|
};
|
|
179705
|
-
|
|
179729
|
+
logger202.debug(
|
|
179706
179730
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
179707
179731
|
);
|
|
179708
179732
|
} else {
|
|
@@ -179719,7 +179743,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179719
179743
|
rooms: roomsObj
|
|
179720
179744
|
}
|
|
179721
179745
|
};
|
|
179722
|
-
|
|
179746
|
+
logger202.debug(
|
|
179723
179747
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
179724
179748
|
);
|
|
179725
179749
|
}
|
|
@@ -179740,7 +179764,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179740
179764
|
if (composed) {
|
|
179741
179765
|
return composed;
|
|
179742
179766
|
}
|
|
179743
|
-
|
|
179767
|
+
logger202.warn(
|
|
179744
179768
|
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
179745
179769
|
);
|
|
179746
179770
|
}
|
|
@@ -179841,11 +179865,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
179841
179865
|
}
|
|
179842
179866
|
if (mappedChanged) {
|
|
179843
179867
|
this.pendingMappedChange = true;
|
|
179844
|
-
|
|
179868
|
+
logger202.debug(
|
|
179845
179869
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
179846
179870
|
);
|
|
179847
179871
|
}
|
|
179848
|
-
|
|
179872
|
+
logger202.debug(
|
|
179849
179873
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
179850
179874
|
);
|
|
179851
179875
|
this.lastState = state;
|
|
@@ -179898,7 +179922,7 @@ import {
|
|
|
179898
179922
|
getCollection
|
|
179899
179923
|
} from "home-assistant-js-websocket";
|
|
179900
179924
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
179901
|
-
var
|
|
179925
|
+
var logger203 = Logger.get("SubscribeEntities");
|
|
179902
179926
|
function processEvent(store, updates) {
|
|
179903
179927
|
const state = { ...store.state };
|
|
179904
179928
|
if (updates.a) {
|
|
@@ -179924,7 +179948,7 @@ function processEvent(store, updates) {
|
|
|
179924
179948
|
for (const entityId in updates.c) {
|
|
179925
179949
|
let entityState = state[entityId];
|
|
179926
179950
|
if (!entityState) {
|
|
179927
|
-
|
|
179951
|
+
logger203.warn("Received state update for unknown entity", entityId);
|
|
179928
179952
|
continue;
|
|
179929
179953
|
}
|
|
179930
179954
|
entityState = { ...entityState };
|
|
@@ -179995,7 +180019,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
|
|
|
179995
180019
|
// src/services/bridges/entity-isolation-service.ts
|
|
179996
180020
|
init_esm();
|
|
179997
180021
|
init_diagnostic_event_bus();
|
|
179998
|
-
var
|
|
180022
|
+
var logger204 = Logger.get("EntityIsolation");
|
|
179999
180023
|
var EntityIsolationServiceImpl = class {
|
|
180000
180024
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
180001
180025
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -180060,13 +180084,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
180060
180084
|
}
|
|
180061
180085
|
const parsed = this.parseEndpointPath(msg);
|
|
180062
180086
|
if (!parsed) {
|
|
180063
|
-
|
|
180087
|
+
logger204.warn("Could not parse entity from error:", msg);
|
|
180064
180088
|
return false;
|
|
180065
180089
|
}
|
|
180066
180090
|
const { bridgeId, entityName } = parsed;
|
|
180067
180091
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
180068
180092
|
if (!callback) {
|
|
180069
|
-
|
|
180093
|
+
logger204.warn(
|
|
180070
180094
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
180071
180095
|
);
|
|
180072
180096
|
return false;
|
|
@@ -180077,7 +180101,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
180077
180101
|
}
|
|
180078
180102
|
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
180079
180103
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
180080
|
-
|
|
180104
|
+
logger204.warn(
|
|
180081
180105
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
180082
180106
|
);
|
|
180083
180107
|
diagnosticEventBus.emit("entity_error", `Entity isolated: ${entityName}`, {
|
|
@@ -180089,7 +180113,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
180089
180113
|
await callback(entityName);
|
|
180090
180114
|
return true;
|
|
180091
180115
|
} catch (e) {
|
|
180092
|
-
|
|
180116
|
+
logger204.error(`Failed to isolate entity ${entityName}:`, e);
|
|
180093
180117
|
return false;
|
|
180094
180118
|
}
|
|
180095
180119
|
}
|
|
@@ -181342,11 +181366,11 @@ init_diagnostic_event_bus();
|
|
|
181342
181366
|
var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
|
|
181343
181367
|
var DEAD_SESSION_TIMEOUT_MS2 = 6e4;
|
|
181344
181368
|
var ServerModeBridge = class {
|
|
181345
|
-
constructor(
|
|
181369
|
+
constructor(logger207, dataProvider, endpointManager, server) {
|
|
181346
181370
|
this.dataProvider = dataProvider;
|
|
181347
181371
|
this.endpointManager = endpointManager;
|
|
181348
181372
|
this.server = server;
|
|
181349
|
-
this.log =
|
|
181373
|
+
this.log = logger207.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
181350
181374
|
}
|
|
181351
181375
|
dataProvider;
|
|
181352
181376
|
endpointManager;
|
|
@@ -181868,7 +181892,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
181868
181892
|
}
|
|
181869
181893
|
|
|
181870
181894
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
181871
|
-
var
|
|
181895
|
+
var logger205 = Logger.get("ServerModeVacuumEndpoint");
|
|
181872
181896
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
181873
181897
|
static async create(registry2, entityId, mapping) {
|
|
181874
181898
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -181878,7 +181902,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181878
181902
|
return void 0;
|
|
181879
181903
|
}
|
|
181880
181904
|
let effectiveMapping = mapping;
|
|
181881
|
-
|
|
181905
|
+
logger205.info(
|
|
181882
181906
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
181883
181907
|
);
|
|
181884
181908
|
if (entity.device_id) {
|
|
@@ -181893,15 +181917,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181893
181917
|
batteryEntity: batteryEntityId
|
|
181894
181918
|
};
|
|
181895
181919
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
181896
|
-
|
|
181920
|
+
logger205.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
181897
181921
|
} else {
|
|
181898
181922
|
const attrs = state.attributes;
|
|
181899
181923
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
181900
|
-
|
|
181924
|
+
logger205.info(
|
|
181901
181925
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
181902
181926
|
);
|
|
181903
181927
|
} else {
|
|
181904
|
-
|
|
181928
|
+
logger205.warn(
|
|
181905
181929
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
181906
181930
|
);
|
|
181907
181931
|
}
|
|
@@ -181916,7 +181940,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181916
181940
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181917
181941
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
181918
181942
|
};
|
|
181919
|
-
|
|
181943
|
+
logger205.info(
|
|
181920
181944
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
181921
181945
|
);
|
|
181922
181946
|
}
|
|
@@ -181926,7 +181950,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181926
181950
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181927
181951
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
181928
181952
|
};
|
|
181929
|
-
|
|
181953
|
+
logger205.info(
|
|
181930
181954
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
181931
181955
|
);
|
|
181932
181956
|
}
|
|
@@ -181936,7 +181960,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181936
181960
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181937
181961
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
181938
181962
|
};
|
|
181939
|
-
|
|
181963
|
+
logger205.info(
|
|
181940
181964
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
181941
181965
|
);
|
|
181942
181966
|
}
|
|
@@ -181946,7 +181970,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181946
181970
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181947
181971
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
181948
181972
|
};
|
|
181949
|
-
|
|
181973
|
+
logger205.info(
|
|
181950
181974
|
`${entityId}: Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity}`
|
|
181951
181975
|
);
|
|
181952
181976
|
}
|
|
@@ -181961,7 +181985,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181961
181985
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
181962
181986
|
cleanAreaRooms
|
|
181963
181987
|
};
|
|
181964
|
-
|
|
181988
|
+
logger205.info(
|
|
181965
181989
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
181966
181990
|
);
|
|
181967
181991
|
}
|
|
@@ -181982,7 +182006,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181982
182006
|
rooms: roomsObj
|
|
181983
182007
|
}
|
|
181984
182008
|
};
|
|
181985
|
-
|
|
182009
|
+
logger205.info(
|
|
181986
182010
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
181987
182011
|
);
|
|
181988
182012
|
} else {
|
|
@@ -181999,14 +182023,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
181999
182023
|
rooms: roomsObj
|
|
182000
182024
|
}
|
|
182001
182025
|
};
|
|
182002
|
-
|
|
182026
|
+
logger205.info(
|
|
182003
182027
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
182004
182028
|
);
|
|
182005
182029
|
}
|
|
182006
182030
|
}
|
|
182007
182031
|
}
|
|
182008
182032
|
} else {
|
|
182009
|
-
|
|
182033
|
+
logger205.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
|
|
182010
182034
|
}
|
|
182011
182035
|
const payload = {
|
|
182012
182036
|
entity_id: entityId,
|
|
@@ -182103,7 +182127,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
182103
182127
|
try {
|
|
182104
182128
|
this.keepaliveCounter++;
|
|
182105
182129
|
const counter = this.keepaliveCounter;
|
|
182106
|
-
|
|
182130
|
+
logger205.info(`Keepalive #${counter} for ${this.entityId}`);
|
|
182107
182131
|
const opState = this.stateOf(RvcOperationalStateServer);
|
|
182108
182132
|
await this.setStateOf(RvcOperationalStateServer, {
|
|
182109
182133
|
operationalState: opState.operationalState,
|
|
@@ -182118,7 +182142,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
182118
182142
|
currentMode: runMode.currentMode
|
|
182119
182143
|
});
|
|
182120
182144
|
}
|
|
182121
|
-
|
|
182145
|
+
logger205.info(`Keepalive #${counter} committed for ${this.entityId}`);
|
|
182122
182146
|
} catch (e) {
|
|
182123
182147
|
if (e instanceof TransactionDestroyedError || e instanceof DestroyedDependencyError) {
|
|
182124
182148
|
return;
|
|
@@ -182127,7 +182151,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
182127
182151
|
if (msg.includes("Endpoint storage inaccessible")) {
|
|
182128
182152
|
return;
|
|
182129
182153
|
}
|
|
182130
|
-
|
|
182154
|
+
logger205.warn(`Keepalive failed for ${this.entityId}: ${msg}`);
|
|
182131
182155
|
}
|
|
182132
182156
|
}
|
|
182133
182157
|
async updateStates(states) {
|
|
@@ -182138,11 +182162,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
182138
182162
|
}
|
|
182139
182163
|
if (mappedChanged) {
|
|
182140
182164
|
this.pendingMappedChange = true;
|
|
182141
|
-
|
|
182165
|
+
logger205.debug(
|
|
182142
182166
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
182143
182167
|
);
|
|
182144
182168
|
}
|
|
182145
|
-
|
|
182169
|
+
logger205.debug(
|
|
182146
182170
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
182147
182171
|
);
|
|
182148
182172
|
this.lastState = state;
|
|
@@ -182333,7 +182357,7 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
182333
182357
|
await this.serverNode.addDevice(endpoint2);
|
|
182334
182358
|
this.deviceEndpoint = endpoint2;
|
|
182335
182359
|
this.mappingFingerprint = currentFp;
|
|
182336
|
-
this.updateServerNodeIdentity(entityId, mapping);
|
|
182360
|
+
await this.updateServerNodeIdentity(entityId, mapping);
|
|
182337
182361
|
this.log.info(
|
|
182338
182362
|
`Server mode: Added vacuum ${entityId} as standalone device`
|
|
182339
182363
|
);
|
|
@@ -182354,7 +182378,7 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
182354
182378
|
await this.serverNode.addDevice(endpoint);
|
|
182355
182379
|
this.deviceEndpoint = endpoint;
|
|
182356
182380
|
this.mappingFingerprint = currentFp;
|
|
182357
|
-
this.updateServerNodeIdentity(entityId, mapping);
|
|
182381
|
+
await this.updateServerNodeIdentity(entityId, mapping);
|
|
182358
182382
|
this.log.info(`Server mode: Added device ${entityId}`);
|
|
182359
182383
|
} catch (e) {
|
|
182360
182384
|
const reason = e instanceof Error ? e.message : String(e);
|
|
@@ -182375,11 +182399,11 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
182375
182399
|
}
|
|
182376
182400
|
}
|
|
182377
182401
|
}
|
|
182378
|
-
updateServerNodeIdentity(entityId, mapping) {
|
|
182402
|
+
async updateServerNodeIdentity(entityId, mapping) {
|
|
182379
182403
|
const device = this.registry.deviceOf(entityId);
|
|
182380
182404
|
const state = this.registry.initialState(entityId);
|
|
182381
182405
|
const friendlyName = state?.attributes?.friendly_name;
|
|
182382
|
-
this.serverNode.updateDeviceIdentity(
|
|
182406
|
+
await this.serverNode.updateDeviceIdentity(
|
|
182383
182407
|
entityId,
|
|
182384
182408
|
device,
|
|
182385
182409
|
mapping,
|
|
@@ -182578,10 +182602,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
182578
182602
|
// src/core/ioc/app-environment.ts
|
|
182579
182603
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
182580
182604
|
constructor(rootEnv, options) {
|
|
182581
|
-
const
|
|
182605
|
+
const logger207 = rootEnv.get(LoggerService);
|
|
182582
182606
|
super({
|
|
182583
182607
|
id: "App",
|
|
182584
|
-
log:
|
|
182608
|
+
log: logger207.get("AppContainer"),
|
|
182585
182609
|
parent: rootEnv
|
|
182586
182610
|
});
|
|
182587
182611
|
this.options = options;
|
|
@@ -182595,8 +182619,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
182595
182619
|
}
|
|
182596
182620
|
construction;
|
|
182597
182621
|
async init() {
|
|
182598
|
-
const
|
|
182599
|
-
this.set(LoggerService,
|
|
182622
|
+
const logger207 = this.get(LoggerService);
|
|
182623
|
+
this.set(LoggerService, logger207);
|
|
182600
182624
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
182601
182625
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
182602
182626
|
this.set(
|
|
@@ -182613,7 +182637,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
182613
182637
|
);
|
|
182614
182638
|
this.set(
|
|
182615
182639
|
HomeAssistantClient,
|
|
182616
|
-
new HomeAssistantClient(
|
|
182640
|
+
new HomeAssistantClient(logger207, this.options.homeAssistant)
|
|
182617
182641
|
);
|
|
182618
182642
|
this.set(
|
|
182619
182643
|
HomeAssistantConfig,
|
|
@@ -182621,7 +182645,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
182621
182645
|
);
|
|
182622
182646
|
this.set(
|
|
182623
182647
|
HomeAssistantActions,
|
|
182624
|
-
new HomeAssistantActions(
|
|
182648
|
+
new HomeAssistantActions(logger207, await this.load(HomeAssistantClient))
|
|
182625
182649
|
);
|
|
182626
182650
|
this.set(
|
|
182627
182651
|
HomeAssistantRegistry,
|
|
@@ -182657,7 +182681,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
182657
182681
|
this.set(
|
|
182658
182682
|
WebApi,
|
|
182659
182683
|
new WebApi(
|
|
182660
|
-
|
|
182684
|
+
logger207,
|
|
182661
182685
|
await this.load(BridgeService),
|
|
182662
182686
|
await this.load(HomeAssistantClient),
|
|
182663
182687
|
await this.load(HomeAssistantRegistry),
|
|
@@ -182683,7 +182707,7 @@ init_nodejs();
|
|
|
182683
182707
|
init_level_control();
|
|
182684
182708
|
|
|
182685
182709
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
182686
|
-
var
|
|
182710
|
+
var logger206 = Logger.get("PatchLevelControlTlv");
|
|
182687
182711
|
function patchLevelControlTlv() {
|
|
182688
182712
|
let patched = 0;
|
|
182689
182713
|
const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
|
|
@@ -182697,11 +182721,11 @@ function patchLevelControlTlv() {
|
|
|
182697
182721
|
patched++;
|
|
182698
182722
|
}
|
|
182699
182723
|
if (patched > 0) {
|
|
182700
|
-
|
|
182724
|
+
logger206.info(
|
|
182701
182725
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
182702
182726
|
);
|
|
182703
182727
|
} else {
|
|
182704
|
-
|
|
182728
|
+
logger206.warn(
|
|
182705
182729
|
"Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
|
|
182706
182730
|
);
|
|
182707
182731
|
}
|