@riddix/hamh 2.1.0-alpha.459 → 2.1.0-alpha.461
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(logger195) {
|
|
1747
|
+
this.#logger = logger195;
|
|
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, logger195, 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 = logger195;
|
|
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 logger195 = Logger.get(subject.constructor.name);
|
|
5542
|
+
logger195.error(...args);
|
|
5543
5543
|
}
|
|
5544
5544
|
function createErrorHandler(name) {
|
|
5545
5545
|
return (e) => {
|
|
@@ -135998,11 +135998,11 @@ var init_Api = __esm({
|
|
|
135998
135998
|
}
|
|
135999
135999
|
Api2.resourceFor = resourceFor;
|
|
136000
136000
|
function log(level, facility, id, ...message) {
|
|
136001
|
-
let
|
|
136002
|
-
if (!
|
|
136003
|
-
loggers.set(facility,
|
|
136001
|
+
let logger195 = loggers.get(facility);
|
|
136002
|
+
if (!logger195) {
|
|
136003
|
+
loggers.set(facility, logger195 = Logger.get(facility));
|
|
136004
136004
|
}
|
|
136005
|
-
|
|
136005
|
+
logger195[level](Diagnostic.via(id || "(anon)"), message);
|
|
136006
136006
|
}
|
|
136007
136007
|
Api2.log = log;
|
|
136008
136008
|
function logRequest(facility, id, method, target) {
|
|
@@ -147233,10 +147233,10 @@ var init_home_assistant_actions = __esm({
|
|
|
147233
147233
|
circuitBreakerResetMs: 3e4
|
|
147234
147234
|
};
|
|
147235
147235
|
HomeAssistantActions = class extends Service {
|
|
147236
|
-
constructor(
|
|
147236
|
+
constructor(logger195, client, config10) {
|
|
147237
147237
|
super("HomeAssistantActions");
|
|
147238
147238
|
this.client = client;
|
|
147239
|
-
this.log =
|
|
147239
|
+
this.log = logger195.get(this);
|
|
147240
147240
|
this.config = { ...defaultConfig, ...config10 };
|
|
147241
147241
|
this.circuitBreaker = new CircuitBreaker(
|
|
147242
147242
|
this.config.circuitBreakerThreshold,
|
|
@@ -147468,6 +147468,9 @@ import basicAuth from "express-basic-auth";
|
|
|
147468
147468
|
import AccessControl5 from "express-ip-access-control";
|
|
147469
147469
|
import nocache from "nocache";
|
|
147470
147470
|
|
|
147471
|
+
// src/services/diagnostics/diagnostic-service.ts
|
|
147472
|
+
init_esm();
|
|
147473
|
+
|
|
147471
147474
|
// src/services/diagnostics/diagnostic-event-bus.ts
|
|
147472
147475
|
var MAX_EVENTS = 500;
|
|
147473
147476
|
var eventCounter = 0;
|
|
@@ -147510,12 +147513,60 @@ var DiagnosticEventBusImpl = class {
|
|
|
147510
147513
|
var diagnosticEventBus = new DiagnosticEventBusImpl();
|
|
147511
147514
|
|
|
147512
147515
|
// src/services/diagnostics/diagnostic-service.ts
|
|
147516
|
+
var logger141 = Logger.get("DiagnosticService");
|
|
147517
|
+
var ignoredStateKeys = /* @__PURE__ */ new Set([
|
|
147518
|
+
"homeAssistantEntity",
|
|
147519
|
+
"bridgedDeviceBasicInformation",
|
|
147520
|
+
"identify"
|
|
147521
|
+
]);
|
|
147513
147522
|
var DiagnosticService = class {
|
|
147514
147523
|
constructor(bridgeService) {
|
|
147515
147524
|
this.bridgeService = bridgeService;
|
|
147516
147525
|
this.startTime = Date.now();
|
|
147517
147526
|
}
|
|
147518
147527
|
startTime;
|
|
147528
|
+
collectEntities(aggregator) {
|
|
147529
|
+
const entities = [];
|
|
147530
|
+
try {
|
|
147531
|
+
for (const part of aggregator.parts) {
|
|
147532
|
+
const state = part.state;
|
|
147533
|
+
const ha = state.homeAssistantEntity;
|
|
147534
|
+
if (!ha?.entity?.entity_id) continue;
|
|
147535
|
+
const entityId = ha.entity.entity_id;
|
|
147536
|
+
const haState = ha.entity.state?.state ?? null;
|
|
147537
|
+
const available = haState !== "unavailable" && haState !== "unknown";
|
|
147538
|
+
const matterClusters = Object.keys(state).filter(
|
|
147539
|
+
(k) => !ignoredStateKeys.has(k)
|
|
147540
|
+
);
|
|
147541
|
+
const autoMappings = [];
|
|
147542
|
+
const mapping = ha.mapping;
|
|
147543
|
+
if (mapping) {
|
|
147544
|
+
if (typeof mapping.batteryEntity === "string")
|
|
147545
|
+
autoMappings.push(`Battery: ${mapping.batteryEntity}`);
|
|
147546
|
+
if (typeof mapping.humidityEntity === "string")
|
|
147547
|
+
autoMappings.push(`Humidity: ${mapping.humidityEntity}`);
|
|
147548
|
+
if (typeof mapping.pressureEntity === "string")
|
|
147549
|
+
autoMappings.push(`Pressure: ${mapping.pressureEntity}`);
|
|
147550
|
+
if (typeof mapping.powerEntity === "string")
|
|
147551
|
+
autoMappings.push(`Power: ${mapping.powerEntity}`);
|
|
147552
|
+
if (typeof mapping.energyEntity === "string")
|
|
147553
|
+
autoMappings.push(`Energy: ${mapping.energyEntity}`);
|
|
147554
|
+
}
|
|
147555
|
+
entities.push({
|
|
147556
|
+
entityId,
|
|
147557
|
+
domain: entityId.split(".")[0],
|
|
147558
|
+
haState,
|
|
147559
|
+
available,
|
|
147560
|
+
matterClusters,
|
|
147561
|
+
autoMappings,
|
|
147562
|
+
lastUpdate: Date.now()
|
|
147563
|
+
});
|
|
147564
|
+
}
|
|
147565
|
+
} catch (e) {
|
|
147566
|
+
logger141.warn("Failed to collect entity diagnostics:", e);
|
|
147567
|
+
}
|
|
147568
|
+
return entities;
|
|
147569
|
+
}
|
|
147519
147570
|
getSnapshot() {
|
|
147520
147571
|
const bridges = this.bridgeService.bridges.map(
|
|
147521
147572
|
(bridge) => {
|
|
@@ -147528,7 +147579,7 @@ var DiagnosticService = class {
|
|
|
147528
147579
|
}
|
|
147529
147580
|
}
|
|
147530
147581
|
}
|
|
147531
|
-
const entities =
|
|
147582
|
+
const entities = this.collectEntities(bridge.aggregator);
|
|
147532
147583
|
return {
|
|
147533
147584
|
bridgeId: data.id,
|
|
147534
147585
|
bridgeName: data.name,
|
|
@@ -147557,10 +147608,10 @@ var DiagnosticService = class {
|
|
|
147557
147608
|
};
|
|
147558
147609
|
|
|
147559
147610
|
// src/api/access-log.ts
|
|
147560
|
-
function accessLogger(
|
|
147611
|
+
function accessLogger(logger195) {
|
|
147561
147612
|
return (req, res, next) => {
|
|
147562
147613
|
res.on("finish", () => {
|
|
147563
|
-
|
|
147614
|
+
logger195.debug(
|
|
147564
147615
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
147565
147616
|
);
|
|
147566
147617
|
});
|
|
@@ -148542,6 +148593,9 @@ function healthApi(bridgeService, haClient, version, startTime) {
|
|
|
148542
148593
|
fabricCount: fabrics.length,
|
|
148543
148594
|
fabrics: fabrics.map((f) => ({
|
|
148544
148595
|
fabricIndex: f.fabricIndex,
|
|
148596
|
+
fabricId: f.fabricId,
|
|
148597
|
+
nodeId: f.nodeId,
|
|
148598
|
+
rootNodeId: f.rootNodeId,
|
|
148545
148599
|
label: f.label,
|
|
148546
148600
|
rootVendorId: f.rootVendorId
|
|
148547
148601
|
})),
|
|
@@ -149900,7 +149954,7 @@ import { promisify } from "node:util";
|
|
|
149900
149954
|
import v8 from "node:v8";
|
|
149901
149955
|
import express13 from "express";
|
|
149902
149956
|
var execAsync = promisify(exec);
|
|
149903
|
-
var
|
|
149957
|
+
var logger142 = Logger.get("SystemApi");
|
|
149904
149958
|
function detectEnvironment2() {
|
|
149905
149959
|
if (process.env.SUPERVISOR_TOKEN || process.env.HASSIO_TOKEN) {
|
|
149906
149960
|
return "Home Assistant Add-on";
|
|
@@ -149945,7 +149999,7 @@ function systemApi(version) {
|
|
|
149945
149999
|
environment: detectEnvironment2()
|
|
149946
150000
|
});
|
|
149947
150001
|
} catch (error) {
|
|
149948
|
-
|
|
150002
|
+
logger142.error("Failed to check for updates:", error);
|
|
149949
150003
|
res.status(500).json({ error: "Failed to check for updates" });
|
|
149950
150004
|
}
|
|
149951
150005
|
});
|
|
@@ -149994,7 +150048,7 @@ function systemApi(version) {
|
|
|
149994
150048
|
};
|
|
149995
150049
|
res.json(systemInfo);
|
|
149996
150050
|
} catch (error) {
|
|
149997
|
-
|
|
150051
|
+
logger142.error("Failed to get system info:", error);
|
|
149998
150052
|
res.status(500).json({ error: "Failed to get system info" });
|
|
149999
150053
|
}
|
|
150000
150054
|
});
|
|
@@ -150037,7 +150091,7 @@ async function getStorageInfo() {
|
|
|
150037
150091
|
return await getUnixStorageInfo(pathToCheck);
|
|
150038
150092
|
}
|
|
150039
150093
|
} catch (error) {
|
|
150040
|
-
|
|
150094
|
+
logger142.error("Failed to get storage info:", error);
|
|
150041
150095
|
return { total: 0, used: 0, free: 0 };
|
|
150042
150096
|
}
|
|
150043
150097
|
}
|
|
@@ -150264,7 +150318,7 @@ var WebSocketApi = class {
|
|
|
150264
150318
|
|
|
150265
150319
|
// src/api/web-api.ts
|
|
150266
150320
|
var WebApi = class extends Service {
|
|
150267
|
-
constructor(
|
|
150321
|
+
constructor(logger195, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, props) {
|
|
150268
150322
|
super("WebApi");
|
|
150269
150323
|
this.bridgeService = bridgeService;
|
|
150270
150324
|
this.haClient = haClient;
|
|
@@ -150274,8 +150328,8 @@ var WebApi = class extends Service {
|
|
|
150274
150328
|
this.lockCredentialStorage = lockCredentialStorage;
|
|
150275
150329
|
this.settingsStorage = settingsStorage;
|
|
150276
150330
|
this.props = props;
|
|
150277
|
-
this.logger =
|
|
150278
|
-
this.log =
|
|
150331
|
+
this.logger = logger195;
|
|
150332
|
+
this.log = logger195.get(this);
|
|
150279
150333
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
150280
150334
|
this.startTime = Date.now();
|
|
150281
150335
|
this.wsApi = new WebSocketApi(
|
|
@@ -150708,12 +150762,12 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
150708
150762
|
|
|
150709
150763
|
// src/core/app/storage.ts
|
|
150710
150764
|
function storage(environment, options) {
|
|
150711
|
-
const
|
|
150765
|
+
const logger195 = environment.get(LoggerService).get("CustomStorage");
|
|
150712
150766
|
const location2 = resolveStorageLocation(options.location);
|
|
150713
150767
|
fs6.mkdirSync(location2, { recursive: true });
|
|
150714
150768
|
const storageService = environment.get(StorageService);
|
|
150715
150769
|
storageService.location = location2;
|
|
150716
|
-
storageService.factory = (ns) => new CustomStorage(
|
|
150770
|
+
storageService.factory = (ns) => new CustomStorage(logger195, path6.resolve(location2, ns));
|
|
150717
150771
|
}
|
|
150718
150772
|
function resolveStorageLocation(storageLocation) {
|
|
150719
150773
|
const homedir = os3.homedir();
|
|
@@ -151067,10 +151121,10 @@ import {
|
|
|
151067
151121
|
getConfig
|
|
151068
151122
|
} from "home-assistant-js-websocket";
|
|
151069
151123
|
var HomeAssistantClient = class extends Service {
|
|
151070
|
-
constructor(
|
|
151124
|
+
constructor(logger195, options) {
|
|
151071
151125
|
super("HomeAssistantClient");
|
|
151072
151126
|
this.options = options;
|
|
151073
|
-
this.log =
|
|
151127
|
+
this.log = logger195.get(this);
|
|
151074
151128
|
}
|
|
151075
151129
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
151076
151130
|
_connection;
|
|
@@ -151216,7 +151270,7 @@ async function getAreaRegistry(connection) {
|
|
|
151216
151270
|
}
|
|
151217
151271
|
|
|
151218
151272
|
// src/services/home-assistant/home-assistant-registry.ts
|
|
151219
|
-
var
|
|
151273
|
+
var logger143 = Logger.get("HomeAssistantRegistry");
|
|
151220
151274
|
var HomeAssistantRegistry = class extends Service {
|
|
151221
151275
|
constructor(client, options) {
|
|
151222
151276
|
super("HomeAssistantRegistry");
|
|
@@ -151260,7 +151314,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
151260
151314
|
onRefresh();
|
|
151261
151315
|
}
|
|
151262
151316
|
} catch (e) {
|
|
151263
|
-
|
|
151317
|
+
logger143.warn("Failed to refresh registry, will retry next interval:", e);
|
|
151264
151318
|
}
|
|
151265
151319
|
}, this.options.refreshInterval * 1e3);
|
|
151266
151320
|
}
|
|
@@ -151276,7 +151330,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
151276
151330
|
baseDelayMs: 2e3,
|
|
151277
151331
|
maxDelayMs: 15e3,
|
|
151278
151332
|
onRetry: (attempt, error, delayMs) => {
|
|
151279
|
-
|
|
151333
|
+
logger143.warn(
|
|
151280
151334
|
`Registry fetch failed (attempt ${attempt}), retrying in ${delayMs}ms:`,
|
|
151281
151335
|
error
|
|
151282
151336
|
);
|
|
@@ -151316,7 +151370,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
151316
151370
|
const fingerprint = hash2.digest("hex");
|
|
151317
151371
|
this._states = keyBy(statesList, "entity_id");
|
|
151318
151372
|
if (fingerprint === this.lastRegistryFingerprint) {
|
|
151319
|
-
|
|
151373
|
+
logger143.debug("Registry unchanged, skipping full refresh");
|
|
151320
151374
|
return false;
|
|
151321
151375
|
}
|
|
151322
151376
|
this.lastRegistryFingerprint = fingerprint;
|
|
@@ -151337,10 +151391,10 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
151337
151391
|
const missingDevices = fromPairs(missingDeviceIds.map((d) => [d, { id: d }]));
|
|
151338
151392
|
this._devices = { ...missingDevices, ...realDevices };
|
|
151339
151393
|
this._entities = allEntities;
|
|
151340
|
-
|
|
151394
|
+
logger143.debug(
|
|
151341
151395
|
`Loaded HA registry: ${keys(allEntities).length} entities, ${keys(realDevices).length} devices, ${keys(this._states).length} states`
|
|
151342
151396
|
);
|
|
151343
|
-
logMemoryUsage(
|
|
151397
|
+
logMemoryUsage(logger143, "after HA registry load");
|
|
151344
151398
|
this._labels = labels;
|
|
151345
151399
|
this._areas = new Map(areas.map((a) => [a.area_id, a.name]));
|
|
151346
151400
|
return true;
|
|
@@ -151916,7 +151970,7 @@ var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError40('Cannot
|
|
|
151916
151970
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
151917
151971
|
var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
151918
151972
|
var __privateMethod2 = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
|
|
151919
|
-
var
|
|
151973
|
+
var logger144 = Logger.get("ScenesManagementServer");
|
|
151920
151974
|
var UNDEFINED_SCENE_ID = 255;
|
|
151921
151975
|
var GLOBAL_SCENE_ID = 0;
|
|
151922
151976
|
var UNDEFINED_GROUP = GroupId(0);
|
|
@@ -152075,11 +152129,11 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152075
152129
|
return { status: Status2.ResourceExhausted, groupId: groupId22, sceneId };
|
|
152076
152130
|
}
|
|
152077
152131
|
this.state.sceneTable.push(sceneData);
|
|
152078
|
-
|
|
152132
|
+
logger144.debug(`Added scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
|
|
152079
152133
|
this.#updateFabricSceneInfoCountsForFabric(fabricIndex);
|
|
152080
152134
|
} else {
|
|
152081
152135
|
this.state.sceneTable[existingSceneIndex] = sceneData;
|
|
152082
|
-
|
|
152136
|
+
logger144.debug(`Updated scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
|
|
152083
152137
|
}
|
|
152084
152138
|
return { status: Status2.Success, groupId: groupId22, sceneId };
|
|
152085
152139
|
}
|
|
@@ -152382,20 +152436,20 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152382
152436
|
}
|
|
152383
152437
|
}
|
|
152384
152438
|
if (fieldCount !== 2) {
|
|
152385
|
-
|
|
152439
|
+
logger144.warn(
|
|
152386
152440
|
`AttributeValuePair has invalid number (${fieldCount}) of fields (${serialize(attributeValuePair)})`
|
|
152387
152441
|
);
|
|
152388
152442
|
return void 0;
|
|
152389
152443
|
}
|
|
152390
152444
|
const value = attributeValuePair[mappedType];
|
|
152391
152445
|
if (value === void 0) {
|
|
152392
|
-
|
|
152446
|
+
logger144.warn(
|
|
152393
152447
|
`AttributeValuePair missing value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
|
|
152394
152448
|
);
|
|
152395
152449
|
return void 0;
|
|
152396
152450
|
}
|
|
152397
152451
|
if (typeof value !== "number" && typeof value !== "bigint") {
|
|
152398
|
-
|
|
152452
|
+
logger144.warn(
|
|
152399
152453
|
`AttributeValuePair has invalid non-numeric value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
|
|
152400
152454
|
// Should never happen
|
|
152401
152455
|
);
|
|
@@ -152493,7 +152547,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152493
152547
|
} else if (schema6.schema.baseTypeMin < 0 && schema6.schema.min > schema6.schema.baseTypeMin) {
|
|
152494
152548
|
return { attributeId, [mappedType]: schema6.schema.baseTypeMin };
|
|
152495
152549
|
} else {
|
|
152496
|
-
|
|
152550
|
+
logger144.warn(
|
|
152497
152551
|
`Cannot determine out-of-bounds value for attribute schema, returning min value of datatype schema`
|
|
152498
152552
|
);
|
|
152499
152553
|
}
|
|
@@ -152514,7 +152568,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152514
152568
|
}
|
|
152515
152569
|
}
|
|
152516
152570
|
});
|
|
152517
|
-
|
|
152571
|
+
logger144.debug(`Collected scene attribute values on Endpoint ${this.endpoint.id}: ${serialize(sceneValues)}`);
|
|
152518
152572
|
return sceneValues;
|
|
152519
152573
|
}
|
|
152520
152574
|
/**
|
|
@@ -152553,7 +152607,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152553
152607
|
}
|
|
152554
152608
|
const attrType = attribute2.primitiveBase?.name;
|
|
152555
152609
|
if (attrType === void 0 || DataTypeToSceneAttributeDataMap[attrType] === void 0) {
|
|
152556
|
-
|
|
152610
|
+
logger144.warn(
|
|
152557
152611
|
`Scene Attribute ${attribute2.name} on Cluster ${clusterName} has unsupported datatype ${attrType} for scene management on Endpoint ${this.endpoint.id}`
|
|
152558
152612
|
);
|
|
152559
152613
|
continue;
|
|
@@ -152568,7 +152622,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152568
152622
|
});
|
|
152569
152623
|
}
|
|
152570
152624
|
if (sceneClusterDetails) {
|
|
152571
|
-
|
|
152625
|
+
logger144.info(
|
|
152572
152626
|
`Registered ${sceneClusterDetails.attributes.size} scene attributes for Cluster ${clusterName} on Endpoint ${this.endpoint.id}`
|
|
152573
152627
|
);
|
|
152574
152628
|
this.internal.endpointSceneableBehaviors.add(sceneClusterDetails);
|
|
@@ -152576,7 +152630,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152576
152630
|
}
|
|
152577
152631
|
/** Apply scene attribute values in the various clusters on the endpoint. */
|
|
152578
152632
|
#applySceneAttributeValues(sceneValues, transitionTime = null) {
|
|
152579
|
-
|
|
152633
|
+
logger144.debug(`Recalling scene on Endpoint ${this.endpoint.id} with values: ${serialize(sceneValues)}`);
|
|
152580
152634
|
const agent = this.endpoint.agentFor(this.context);
|
|
152581
152635
|
const promises = [];
|
|
152582
152636
|
for (const [clusterName, clusterAttributes] of Object.entries(sceneValues)) {
|
|
@@ -152587,7 +152641,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152587
152641
|
promises.push(result);
|
|
152588
152642
|
}
|
|
152589
152643
|
} else {
|
|
152590
|
-
|
|
152644
|
+
logger144.warn(
|
|
152591
152645
|
`No scenes implementation found for cluster ${clusterName} on Endpoint ${this.endpoint.id} during scene recall. Values are ignored`
|
|
152592
152646
|
);
|
|
152593
152647
|
}
|
|
@@ -152595,7 +152649,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152595
152649
|
if (promises.length) {
|
|
152596
152650
|
return Promise.all(promises).then(
|
|
152597
152651
|
() => void 0,
|
|
152598
|
-
(error) =>
|
|
152652
|
+
(error) => logger144.warn(`Error applying scene attribute values on Endpoint ${this.endpoint.id}:`, error)
|
|
152599
152653
|
);
|
|
152600
152654
|
}
|
|
152601
152655
|
}
|
|
@@ -152786,7 +152840,7 @@ var GroupsBehaviorConstructor = ClusterBehavior.withInterface().for(Groups3.Clus
|
|
|
152786
152840
|
var GroupsBehavior = GroupsBehaviorConstructor;
|
|
152787
152841
|
|
|
152788
152842
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/groups/GroupsServer.js
|
|
152789
|
-
var
|
|
152843
|
+
var logger145 = Logger.get("GroupsServer");
|
|
152790
152844
|
Groups3.Cluster.commands = {
|
|
152791
152845
|
...Groups3.Cluster.commands,
|
|
152792
152846
|
addGroup: Command(
|
|
@@ -152850,7 +152904,7 @@ var GroupsServer = class extends GroupsBase {
|
|
|
152850
152904
|
(fabric2, gkm) => gkm.addEndpointForGroup(fabric2, groupId3, endpointNumber, groupName)
|
|
152851
152905
|
);
|
|
152852
152906
|
} catch (error) {
|
|
152853
|
-
|
|
152907
|
+
logger145.error(error);
|
|
152854
152908
|
StatusResponseError.accept(error);
|
|
152855
152909
|
return { status: error.code, groupId: groupId3 };
|
|
152856
152910
|
}
|
|
@@ -155890,7 +155944,7 @@ function miredsToXy(mireds) {
|
|
|
155890
155944
|
}
|
|
155891
155945
|
|
|
155892
155946
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/color-control/ColorControlServer.js
|
|
155893
|
-
var
|
|
155947
|
+
var logger146 = Logger.get("ColorControlServer");
|
|
155894
155948
|
var ColorControlBase = ColorControlBehavior.with(
|
|
155895
155949
|
ColorControl3.Feature.HueSaturation,
|
|
155896
155950
|
ColorControl3.Feature.EnhancedHue,
|
|
@@ -157071,7 +157125,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157071
157125
|
switch (oldMode) {
|
|
157072
157126
|
case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
|
|
157073
157127
|
if (this.state.currentHue === void 0 || this.state.currentSaturation === void 0) {
|
|
157074
|
-
|
|
157128
|
+
logger146.warn("Could not convert from hue/saturation because one of them is undefined");
|
|
157075
157129
|
break;
|
|
157076
157130
|
}
|
|
157077
157131
|
switch (newMode) {
|
|
@@ -157083,7 +157137,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157083
157137
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
157084
157138
|
const mireds = hsvToMireds(this.hue, this.saturation);
|
|
157085
157139
|
if (mireds === void 0) {
|
|
157086
|
-
|
|
157140
|
+
logger146.warn(
|
|
157087
157141
|
`Could not convert hue/saturation (${this.hue}/${this.saturation}) to color temperature`
|
|
157088
157142
|
);
|
|
157089
157143
|
} else {
|
|
@@ -157094,7 +157148,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157094
157148
|
break;
|
|
157095
157149
|
case ColorControl3.ColorMode.CurrentXAndCurrentY:
|
|
157096
157150
|
if (this.state.currentX === void 0 || this.state.currentY === void 0) {
|
|
157097
|
-
|
|
157151
|
+
logger146.warn("Could not convert from xy because one of them is undefined");
|
|
157098
157152
|
break;
|
|
157099
157153
|
}
|
|
157100
157154
|
switch (newMode) {
|
|
@@ -157106,7 +157160,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157106
157160
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
157107
157161
|
const mireds = xyToMireds(this.x, this.y);
|
|
157108
157162
|
if (mireds === void 0) {
|
|
157109
|
-
|
|
157163
|
+
logger146.warn(`Could not convert xy ${this.x / this.y} to color temperature`);
|
|
157110
157164
|
} else {
|
|
157111
157165
|
this.mireds = mireds;
|
|
157112
157166
|
}
|
|
@@ -157115,14 +157169,14 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157115
157169
|
break;
|
|
157116
157170
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
157117
157171
|
if (this.state.colorTemperatureMireds === void 0) {
|
|
157118
|
-
|
|
157172
|
+
logger146.warn("Could not convert from color temperature because it is undefined");
|
|
157119
157173
|
break;
|
|
157120
157174
|
}
|
|
157121
157175
|
switch (newMode) {
|
|
157122
157176
|
case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
|
|
157123
157177
|
const hsvResult = miredsToHsv(this.mireds);
|
|
157124
157178
|
if (hsvResult === void 0) {
|
|
157125
|
-
|
|
157179
|
+
logger146.warn(`Could not convert color temperature ${this.mireds} to hue/saturation`);
|
|
157126
157180
|
} else {
|
|
157127
157181
|
const [hue, saturation] = hsvResult;
|
|
157128
157182
|
this.hue = hue;
|
|
@@ -157132,7 +157186,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157132
157186
|
case ColorControl3.ColorMode.CurrentXAndCurrentY:
|
|
157133
157187
|
const xyResult = miredsToXy(this.mireds);
|
|
157134
157188
|
if (xyResult === void 0) {
|
|
157135
|
-
|
|
157189
|
+
logger146.warn("Could not convert color temperature to xy");
|
|
157136
157190
|
} else {
|
|
157137
157191
|
const [x, y] = xyResult;
|
|
157138
157192
|
this.x = x;
|
|
@@ -157181,7 +157235,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157181
157235
|
);
|
|
157182
157236
|
newColorTemp = tempPhysMax - tempDelta;
|
|
157183
157237
|
}
|
|
157184
|
-
|
|
157238
|
+
logger146.debug(`Synced color temperature with level: ${level}, new color temperature: ${newColorTemp}`);
|
|
157185
157239
|
return this.moveToColorTemperatureLogic(newColorTemp, 0);
|
|
157186
157240
|
}
|
|
157187
157241
|
#assertRate(mode, rate) {
|
|
@@ -157385,7 +157439,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157385
157439
|
targetEnhancedColorMode = values4.enhancedColorMode;
|
|
157386
157440
|
}
|
|
157387
157441
|
if (!this.#supportsColorMode(targetEnhancedColorMode)) {
|
|
157388
|
-
|
|
157442
|
+
logger146.info(
|
|
157389
157443
|
`Can not apply scene with unsupported color mode: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
|
|
157390
157444
|
);
|
|
157391
157445
|
}
|
|
@@ -157427,7 +157481,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157427
157481
|
}
|
|
157428
157482
|
break;
|
|
157429
157483
|
default:
|
|
157430
|
-
|
|
157484
|
+
logger146.info(
|
|
157431
157485
|
`No supported color mode found to apply scene: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
|
|
157432
157486
|
);
|
|
157433
157487
|
break;
|
|
@@ -157520,7 +157574,7 @@ init_esm();
|
|
|
157520
157574
|
init_ServerNode();
|
|
157521
157575
|
init_esm4();
|
|
157522
157576
|
init_esm3();
|
|
157523
|
-
var
|
|
157577
|
+
var logger147 = Logger.get("LevelControlServer");
|
|
157524
157578
|
var LevelControlBase = LevelControlBehavior.with(LevelControl3.Feature.OnOff, LevelControl3.Feature.Lighting);
|
|
157525
157579
|
var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlBase {
|
|
157526
157580
|
/** Returns the minimum level, including feature specific fallback value handling. */
|
|
@@ -157607,17 +157661,17 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
|
|
|
157607
157661
|
*/
|
|
157608
157662
|
initializeLighting() {
|
|
157609
157663
|
if (this.state.currentLevel === 0) {
|
|
157610
|
-
|
|
157664
|
+
logger147.warn(
|
|
157611
157665
|
`The currentLevel value of ${this.state.currentLevel} is invalid according to Matter specification. The value must not be 0.`
|
|
157612
157666
|
);
|
|
157613
157667
|
}
|
|
157614
157668
|
if (this.minLevel !== 1) {
|
|
157615
|
-
|
|
157669
|
+
logger147.warn(
|
|
157616
157670
|
`The minLevel value of ${this.minLevel} is invalid according to Matter specification. The value should be 1.`
|
|
157617
157671
|
);
|
|
157618
157672
|
}
|
|
157619
157673
|
if (this.maxLevel !== 254) {
|
|
157620
|
-
|
|
157674
|
+
logger147.warn(
|
|
157621
157675
|
`The maxLevel value of ${this.maxLevel} is invalid according to Matter specification. The value should be 254.`
|
|
157622
157676
|
);
|
|
157623
157677
|
}
|
|
@@ -157928,7 +157982,7 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
|
|
|
157928
157982
|
if (!onOff || this.state.onLevel === null) {
|
|
157929
157983
|
return;
|
|
157930
157984
|
}
|
|
157931
|
-
|
|
157985
|
+
logger147.debug(`OnOff changed to ON, setting level to onLevel value of ${this.state.onLevel}`);
|
|
157932
157986
|
this.state.currentLevel = this.state.onLevel;
|
|
157933
157987
|
}
|
|
157934
157988
|
#calculateEffectiveOptions(optionsMask, optionsOverride) {
|
|
@@ -158963,7 +159017,7 @@ var SwitchBehavior = SwitchBehaviorConstructor;
|
|
|
158963
159017
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/switch/SwitchServer.js
|
|
158964
159018
|
var DEFAULT_MULTIPRESS_DELAY = Millis(300);
|
|
158965
159019
|
var DEFAULT_LONG_PRESS_DELAY = Seconds(2);
|
|
158966
|
-
var
|
|
159020
|
+
var logger148 = Logger.get("SwitchServer");
|
|
158967
159021
|
var SwitchServerBase = SwitchBehavior.for(Switch3.Complete).with(
|
|
158968
159022
|
Switch3.Feature.LatchingSwitch,
|
|
158969
159023
|
Switch3.Feature.MomentarySwitch,
|
|
@@ -159017,7 +159071,7 @@ var SwitchBaseServer = class extends SwitchServerBase {
|
|
|
159017
159071
|
this.internal.currentIsLongPress = false;
|
|
159018
159072
|
this.internal.multiPressTimer?.stop();
|
|
159019
159073
|
this.internal.longPressTimer?.stop();
|
|
159020
|
-
|
|
159074
|
+
logger148.info("State of Switch got reset");
|
|
159021
159075
|
}
|
|
159022
159076
|
// TODO remove when Validator logic can assess that with 1.3 introduction
|
|
159023
159077
|
#assertPositionInRange(position) {
|
|
@@ -159544,7 +159598,7 @@ var ModeSelectBehaviorConstructor = ClusterBehavior.withInterface().for(ModeSele
|
|
|
159544
159598
|
var ModeSelectBehavior = ModeSelectBehaviorConstructor;
|
|
159545
159599
|
|
|
159546
159600
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/mode-select/ModeSelectServer.js
|
|
159547
|
-
var
|
|
159601
|
+
var logger149 = Logger.get("ModeSelectServer");
|
|
159548
159602
|
var ModeSelectBase = ModeSelectBehavior.with(ModeSelect3.Feature.OnOff);
|
|
159549
159603
|
var ModeSelectBaseServer = class extends ModeSelectBase {
|
|
159550
159604
|
initialize() {
|
|
@@ -159561,7 +159615,7 @@ var ModeSelectBaseServer = class extends ModeSelectBase {
|
|
|
159561
159615
|
}
|
|
159562
159616
|
this.reactTo(onOffServer.events.onOff$Changed, this.#handleOnOffDependency);
|
|
159563
159617
|
} else {
|
|
159564
|
-
|
|
159618
|
+
logger149.warn("OnOffServer not found on endpoint, but OnMode is set.");
|
|
159565
159619
|
}
|
|
159566
159620
|
}
|
|
159567
159621
|
if (!currentModeOverridden && this.state.startUpMode !== void 0 && this.state.startUpMode !== null && this.#getBootReason() !== GeneralDiagnostics3.BootReason.SoftwareUpdateCompleted) {
|
|
@@ -159782,7 +159836,7 @@ init_IdentifyServer();
|
|
|
159782
159836
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/occupancy-sensing/OccupancySensingServer.js
|
|
159783
159837
|
init_occupancy_sensing();
|
|
159784
159838
|
init_esm();
|
|
159785
|
-
var
|
|
159839
|
+
var logger150 = Logger.get("OccupancySensingServer");
|
|
159786
159840
|
var holdTimeDependencies = [
|
|
159787
159841
|
"holdTimeLimits",
|
|
159788
159842
|
"pirOccupiedToUnoccupiedDelay",
|
|
@@ -159798,7 +159852,7 @@ var holdTimeDependencies = [
|
|
|
159798
159852
|
var OccupancySensingServer = class extends OccupancySensingBehavior {
|
|
159799
159853
|
initialize() {
|
|
159800
159854
|
if (!Object.values(this.features).some((feature) => feature)) {
|
|
159801
|
-
|
|
159855
|
+
logger150.error(
|
|
159802
159856
|
`OccupancySensingServer: Since revision 5 of the cluster features need to be set based on the detector type. Currently no features are enabled.`
|
|
159803
159857
|
);
|
|
159804
159858
|
} else if (!Object.values(this.state.occupancySensorTypeBitmap).some((feature) => feature) || this.state.occupancySensorType === void 0) {
|
|
@@ -159825,7 +159879,7 @@ var OccupancySensingServer = class extends OccupancySensingBehavior {
|
|
|
159825
159879
|
} else if (this.state.occupancySensorTypeBitmap.physicalContact) {
|
|
159826
159880
|
this.state.occupancySensorType = OccupancySensing3.OccupancySensorType.PhysicalContact;
|
|
159827
159881
|
}
|
|
159828
|
-
|
|
159882
|
+
logger150.debug(
|
|
159829
159883
|
"Sync occupancySensorType to",
|
|
159830
159884
|
OccupancySensing3.OccupancySensorType[this.state.occupancySensorType],
|
|
159831
159885
|
"and occupancySensorTypeBitmap to",
|
|
@@ -160201,6 +160255,7 @@ var RainSensorDeviceDefinition = MutableEndpoint({
|
|
|
160201
160255
|
)
|
|
160202
160256
|
});
|
|
160203
160257
|
Object.freeze(RainSensorDeviceDefinition);
|
|
160258
|
+
var RainSensorDevice = RainSensorDeviceDefinition;
|
|
160204
160259
|
|
|
160205
160260
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/devices/refrigerator.js
|
|
160206
160261
|
init_IdentifyServer();
|
|
@@ -160789,7 +160844,7 @@ init_esm3();
|
|
|
160789
160844
|
|
|
160790
160845
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteState.js
|
|
160791
160846
|
init_esm();
|
|
160792
|
-
var
|
|
160847
|
+
var logger151 = Logger.get("AtomicWriteState");
|
|
160793
160848
|
var MAXIMUM_ALLOWED_TIMEOUT = Seconds(9);
|
|
160794
160849
|
var AtomicWriteState = class {
|
|
160795
160850
|
peerAddress;
|
|
@@ -160824,19 +160879,19 @@ var AtomicWriteState = class {
|
|
|
160824
160879
|
});
|
|
160825
160880
|
}
|
|
160826
160881
|
start() {
|
|
160827
|
-
|
|
160882
|
+
logger151.debug(
|
|
160828
160883
|
`Starting atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
|
|
160829
160884
|
);
|
|
160830
160885
|
this.#timer.start();
|
|
160831
160886
|
}
|
|
160832
160887
|
#timeoutTriggered() {
|
|
160833
|
-
|
|
160888
|
+
logger151.debug(
|
|
160834
160889
|
`Atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id} timed out`
|
|
160835
160890
|
);
|
|
160836
160891
|
this.close();
|
|
160837
160892
|
}
|
|
160838
160893
|
close() {
|
|
160839
|
-
|
|
160894
|
+
logger151.debug(
|
|
160840
160895
|
`Closing atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
|
|
160841
160896
|
);
|
|
160842
160897
|
if (this.#timer.isRunning) {
|
|
@@ -160847,7 +160902,7 @@ var AtomicWriteState = class {
|
|
|
160847
160902
|
};
|
|
160848
160903
|
|
|
160849
160904
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteHandler.js
|
|
160850
|
-
var
|
|
160905
|
+
var logger152 = Logger.get("AtomicWriteHandler");
|
|
160851
160906
|
var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
160852
160907
|
#observers = new ObserverGroup();
|
|
160853
160908
|
#pendingWrites = new BasicSet();
|
|
@@ -160917,7 +160972,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
160917
160972
|
);
|
|
160918
160973
|
this.#pendingWrites.add(state);
|
|
160919
160974
|
state.closed.on(() => void this.#pendingWrites.delete(state));
|
|
160920
|
-
|
|
160975
|
+
logger152.debug("Added atomic write state:", state);
|
|
160921
160976
|
return state;
|
|
160922
160977
|
}
|
|
160923
160978
|
if (existingState === void 0) {
|
|
@@ -160984,10 +161039,10 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
160984
161039
|
writeAttribute(context, endpoint, cluster2, attribute2, value) {
|
|
160985
161040
|
const state = this.#assertPendingWriteForAttributeAndPeer(context, endpoint, cluster2, attribute2);
|
|
160986
161041
|
const attributeName = state.attributeNames.get(attribute2);
|
|
160987
|
-
|
|
161042
|
+
logger152.debug(`Writing pending value for attribute ${attributeName}, ${attribute2} in atomic write`, value);
|
|
160988
161043
|
endpoint.eventsOf(cluster2.id)[`${attributeName}$AtomicChanging`]?.emit(value, state.pendingAttributeValues[attribute2] !== void 0 ? state.pendingAttributeValues[attribute2] : state.initialValues[attribute2], context);
|
|
160989
161044
|
state.pendingAttributeValues[attribute2] = value;
|
|
160990
|
-
|
|
161045
|
+
logger152.debug("Atomic write state after current write:", state);
|
|
160991
161046
|
}
|
|
160992
161047
|
/**
|
|
160993
161048
|
* Implements the commit logic for an atomic write.
|
|
@@ -161006,7 +161061,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
161006
161061
|
await context.transaction?.commit();
|
|
161007
161062
|
} catch (error) {
|
|
161008
161063
|
await context.transaction?.rollback();
|
|
161009
|
-
|
|
161064
|
+
logger152.info(`Failed to write attribute ${attr} during atomic write commit: ${error}`);
|
|
161010
161065
|
statusCode = error instanceof StatusResponseError ? error.code : Status2.Failure;
|
|
161011
161066
|
commandStatusCode = commandStatusCode === Status2.Failure ? Status2.Failure : commandStatusCode === Status2.ConstraintError ? Status2.ConstraintError : Status2.Failure;
|
|
161012
161067
|
}
|
|
@@ -161042,7 +161097,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
161042
161097
|
const fabricIndex = fabric.fabricIndex;
|
|
161043
161098
|
for (const writeState of Array.from(this.#pendingWrites)) {
|
|
161044
161099
|
if (writeState.peerAddress.fabricIndex === fabricIndex) {
|
|
161045
|
-
|
|
161100
|
+
logger152.debug(
|
|
161046
161101
|
`Closing atomic write state for peer ${writeState.peerAddress.toString()} on endpoint ${writeState.endpoint.id} due to fabric removal`
|
|
161047
161102
|
);
|
|
161048
161103
|
writeState.close();
|
|
@@ -161083,7 +161138,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
161083
161138
|
if (!PeerAddress.is(attrWriteState.peerAddress, peerAddress)) {
|
|
161084
161139
|
return void 0;
|
|
161085
161140
|
}
|
|
161086
|
-
|
|
161141
|
+
logger152.debug(
|
|
161087
161142
|
`Found pending value for attribute ${attribute2} for peer ${peerAddress.nodeId}`,
|
|
161088
161143
|
serialize(attrWriteState.pendingAttributeValues[attribute2])
|
|
161089
161144
|
);
|
|
@@ -161119,7 +161174,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
161119
161174
|
};
|
|
161120
161175
|
|
|
161121
161176
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/thermostat/ThermostatServer.js
|
|
161122
|
-
var
|
|
161177
|
+
var logger153 = Logger.get("ThermostatServer");
|
|
161123
161178
|
var ThermostatBehaviorLogicBase = ThermostatBehavior.with(
|
|
161124
161179
|
Thermostat3.Feature.Heating,
|
|
161125
161180
|
Thermostat3.Feature.Cooling,
|
|
@@ -161148,7 +161203,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161148
161203
|
throw new ImplementationError("Setback feature is deprecated and not allowed to be enabled");
|
|
161149
161204
|
}
|
|
161150
161205
|
if (this.features.matterScheduleConfiguration) {
|
|
161151
|
-
|
|
161206
|
+
logger153.warn("MatterScheduleConfiguration feature is not yet implemented. Please do not activate it");
|
|
161152
161207
|
}
|
|
161153
161208
|
const options = this.endpoint.behaviors.optionsFor(_ThermostatBaseServer);
|
|
161154
161209
|
if (this.features.presets && this.state.persistedPresets === void 0) {
|
|
@@ -161266,7 +161321,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161266
161321
|
throw new StatusResponse.InvalidCommandError("Requested PresetHandle not found");
|
|
161267
161322
|
}
|
|
161268
161323
|
}
|
|
161269
|
-
|
|
161324
|
+
logger153.info(`Setting active preset handle to`, presetHandle);
|
|
161270
161325
|
this.state.activePresetHandle = presetHandle;
|
|
161271
161326
|
return preset;
|
|
161272
161327
|
}
|
|
@@ -161336,7 +161391,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161336
161391
|
}
|
|
161337
161392
|
if (this.state.setpointHoldExpiryTimestamp === void 0) {
|
|
161338
161393
|
} else {
|
|
161339
|
-
|
|
161394
|
+
logger153.warn(
|
|
161340
161395
|
"Handling for setpointHoldExpiryTimestamp is not yet implemented. To use this attribute you need to install the needed logic yourself"
|
|
161341
161396
|
);
|
|
161342
161397
|
}
|
|
@@ -161409,7 +161464,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161409
161464
|
"RemoteSensing cannot be set to LocalTemperature when LocalTemperatureNotExposed feature is enabled"
|
|
161410
161465
|
);
|
|
161411
161466
|
}
|
|
161412
|
-
|
|
161467
|
+
logger153.debug("LocalTemperatureNotExposed feature is enabled, ignoring local temperature measurement");
|
|
161413
161468
|
this.state.localTemperature = null;
|
|
161414
161469
|
}
|
|
161415
161470
|
let localTemperature = null;
|
|
@@ -161418,11 +161473,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161418
161473
|
const endpoints = this.env.get(ServerNode).endpoints;
|
|
161419
161474
|
const endpoint = endpoints.has(localTempEndpoint) ? endpoints.for(localTempEndpoint) : void 0;
|
|
161420
161475
|
if (endpoint !== void 0 && endpoint.behaviors.has(TemperatureMeasurementServer)) {
|
|
161421
|
-
|
|
161476
|
+
logger153.debug(
|
|
161422
161477
|
`Using existing TemperatureMeasurement cluster on endpoint #${localTempEndpoint} for local temperature measurement`
|
|
161423
161478
|
);
|
|
161424
161479
|
if (this.state.externalMeasuredIndoorTemperature !== void 0) {
|
|
161425
|
-
|
|
161480
|
+
logger153.warn(
|
|
161426
161481
|
"Both local TemperatureMeasurement cluster and externalMeasuredIndoorTemperature state are set, using local cluster"
|
|
161427
161482
|
);
|
|
161428
161483
|
}
|
|
@@ -161432,19 +161487,19 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161432
161487
|
);
|
|
161433
161488
|
localTemperature = endpoint.stateOf(TemperatureMeasurementServer).measuredValue;
|
|
161434
161489
|
} else {
|
|
161435
|
-
|
|
161490
|
+
logger153.warn(
|
|
161436
161491
|
`No TemperatureMeasurement cluster found on endpoint #${localTempEndpoint}, falling back to externalMeasuredIndoorTemperature state if set`
|
|
161437
161492
|
);
|
|
161438
161493
|
}
|
|
161439
161494
|
} else {
|
|
161440
161495
|
if (this.state.externalMeasuredIndoorTemperature === void 0) {
|
|
161441
161496
|
if (this.state.localTemperatureCalibration !== void 0) {
|
|
161442
|
-
|
|
161497
|
+
logger153.warn(
|
|
161443
161498
|
"No local TemperatureMeasurement cluster available, externalMeasuredIndoorTemperature state not set but localTemperatureCalibration is used: Ensure to correctly consider the calibration when updating the localTemperature value"
|
|
161444
161499
|
);
|
|
161445
161500
|
}
|
|
161446
161501
|
} else {
|
|
161447
|
-
|
|
161502
|
+
logger153.info("Using measured temperature via externalMeasuredIndoorTemperature state");
|
|
161448
161503
|
localTemperature = this.state.externalMeasuredIndoorTemperature ?? null;
|
|
161449
161504
|
}
|
|
161450
161505
|
this.reactTo(this.events.externalMeasuredIndoorTemperature$Changed, this.#handleMeasuredTemperatureChange);
|
|
@@ -161484,28 +161539,28 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161484
161539
|
const endpoints = this.env.get(ServerNode).endpoints;
|
|
161485
161540
|
const endpoint = endpoints.has(localOccupancyEndpoint) ? endpoints.for(localOccupancyEndpoint) : void 0;
|
|
161486
161541
|
if (endpoint !== void 0 && endpoint.behaviors.has(OccupancySensingServer)) {
|
|
161487
|
-
|
|
161542
|
+
logger153.debug(
|
|
161488
161543
|
`Using existing OccupancySensing cluster on endpoint ${localOccupancyEndpoint} for local occupancy sensing`
|
|
161489
161544
|
);
|
|
161490
161545
|
if (this.state.externallyMeasuredOccupancy !== void 0) {
|
|
161491
|
-
|
|
161546
|
+
logger153.warn(
|
|
161492
161547
|
"Both local OccupancySensing cluster and externallyMeasuredOccupancy state are set, using local cluster"
|
|
161493
161548
|
);
|
|
161494
161549
|
}
|
|
161495
161550
|
this.reactTo(endpoint.eventsOf(OccupancySensingServer).occupancy$Changed, this.#handleOccupancyChange);
|
|
161496
161551
|
currentOccupancy = !!endpoint.stateOf(OccupancySensingServer).occupancy.occupied;
|
|
161497
161552
|
} else {
|
|
161498
|
-
|
|
161553
|
+
logger153.warn(
|
|
161499
161554
|
`No OccupancySensing cluster found on endpoint ${localOccupancyEndpoint}, falling back to externallyMeasuredOccupancy state if set`
|
|
161500
161555
|
);
|
|
161501
161556
|
}
|
|
161502
161557
|
} else {
|
|
161503
161558
|
if (this.state.externallyMeasuredOccupancy === void 0) {
|
|
161504
|
-
|
|
161559
|
+
logger153.warn(
|
|
161505
161560
|
"No local OccupancySensing cluster available and externallyMeasuredOccupancy state not set"
|
|
161506
161561
|
);
|
|
161507
161562
|
} else {
|
|
161508
|
-
|
|
161563
|
+
logger153.info("Using occupancy via externallyMeasuredOccupancy state");
|
|
161509
161564
|
currentOccupancy = this.state.externallyMeasuredOccupancy;
|
|
161510
161565
|
}
|
|
161511
161566
|
this.reactTo(this.events.externallyMeasuredOccupancy$Changed, this.#handleExternalOccupancyChange);
|
|
@@ -161772,7 +161827,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161772
161827
|
max = this.state[`max${scope}`] ?? defaults.absMax,
|
|
161773
161828
|
absMax = this.state[`absMax${scope}`] ?? defaults.absMax
|
|
161774
161829
|
} = details;
|
|
161775
|
-
|
|
161830
|
+
logger153.debug(
|
|
161776
161831
|
`Validating user setpoint limits for ${scope}: absMin=${absMin}, min=${min}, max=${max}, absMax=${absMax}`
|
|
161777
161832
|
);
|
|
161778
161833
|
if (absMin > min) {
|
|
@@ -161819,7 +161874,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161819
161874
|
const limitMax = scope === "Heat" ? this.heatSetpointMaximum : this.coolSetpointMaximum;
|
|
161820
161875
|
const result = cropValueRange(setpoint, limitMin, limitMax);
|
|
161821
161876
|
if (result !== setpoint) {
|
|
161822
|
-
|
|
161877
|
+
logger153.debug(
|
|
161823
161878
|
`${scope} setpoint (${setpoint}) is out of limits [${limitMin}, ${limitMax}], clamping to ${result}`
|
|
161824
161879
|
);
|
|
161825
161880
|
}
|
|
@@ -161856,7 +161911,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161856
161911
|
const otherLimit = otherType === "Heating" ? this.heatSetpointMinimum : this.coolSetpointMaximum;
|
|
161857
161912
|
if (otherType === "Cooling") {
|
|
161858
161913
|
const minValidSetpoint = value + deadband;
|
|
161859
|
-
|
|
161914
|
+
logger153.debug(
|
|
161860
161915
|
`Ensuring deadband for ${type}${otherType}Setpoint, min valid setpoint is ${minValidSetpoint}`
|
|
161861
161916
|
);
|
|
161862
161917
|
if (otherSetpoint >= minValidSetpoint) {
|
|
@@ -161867,11 +161922,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161867
161922
|
`Cannot adjust cooling setpoint to maintain deadband, would exceed max cooling setpoint (${otherLimit})`
|
|
161868
161923
|
);
|
|
161869
161924
|
}
|
|
161870
|
-
|
|
161925
|
+
logger153.debug(`Adjusting ${type}${otherType}Setpoint to ${minValidSetpoint} to maintain deadband`);
|
|
161871
161926
|
this.state[`${type}${otherType}Setpoint`] = minValidSetpoint;
|
|
161872
161927
|
} else {
|
|
161873
161928
|
const maxValidSetpoint = value - deadband;
|
|
161874
|
-
|
|
161929
|
+
logger153.debug(
|
|
161875
161930
|
`Ensuring deadband for ${type}${otherType}Setpoint, max valid setpoint is ${maxValidSetpoint}`
|
|
161876
161931
|
);
|
|
161877
161932
|
if (otherSetpoint <= maxValidSetpoint) {
|
|
@@ -161882,7 +161937,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161882
161937
|
`Cannot adjust heating setpoint to maintain deadband, would exceed min heating setpoint (${otherLimit})`
|
|
161883
161938
|
);
|
|
161884
161939
|
}
|
|
161885
|
-
|
|
161940
|
+
logger153.debug(`Adjusting ${type}${otherType}Setpoint to ${maxValidSetpoint} to maintain deadband`);
|
|
161886
161941
|
this.state[`${type}${otherType}Setpoint`] = maxValidSetpoint;
|
|
161887
161942
|
}
|
|
161888
161943
|
}
|
|
@@ -162150,7 +162205,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
162150
162205
|
*/
|
|
162151
162206
|
#handlePersistedPresetsChanged(newPresets, oldPresets) {
|
|
162152
162207
|
if (oldPresets === void 0) {
|
|
162153
|
-
|
|
162208
|
+
logger153.debug(
|
|
162154
162209
|
"Old presets is undefined, skipping some checks. This should only happen on setup of the behavior."
|
|
162155
162210
|
);
|
|
162156
162211
|
}
|
|
@@ -162159,7 +162214,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
162159
162214
|
const newPresetHandles = /* @__PURE__ */ new Set();
|
|
162160
162215
|
for (const preset of newPresets) {
|
|
162161
162216
|
if (preset.presetHandle === null) {
|
|
162162
|
-
|
|
162217
|
+
logger153.error("Preset is missing presetHandle, generating a new one");
|
|
162163
162218
|
preset.presetHandle = entropy.randomBytes(16);
|
|
162164
162219
|
changed = true;
|
|
162165
162220
|
}
|
|
@@ -162208,7 +162263,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
162208
162263
|
throw new StatusResponse.InvalidInStateError(`ActivePresetHandle references non-existing presetHandle`);
|
|
162209
162264
|
}
|
|
162210
162265
|
if (changed) {
|
|
162211
|
-
|
|
162266
|
+
logger153.error("PresetHandles or BuiltIn flags were updated, updating persistedPresets");
|
|
162212
162267
|
this.state.persistedPresets = deepCopy(newPresets);
|
|
162213
162268
|
}
|
|
162214
162269
|
}
|
|
@@ -163111,7 +163166,7 @@ init_IdentifyServer();
|
|
|
163111
163166
|
init_window_covering();
|
|
163112
163167
|
init_esm();
|
|
163113
163168
|
init_esm3();
|
|
163114
|
-
var
|
|
163169
|
+
var logger154 = Logger.get("WindowCoveringServer");
|
|
163115
163170
|
var WindowCoveringBase = WindowCoveringBehavior.with(
|
|
163116
163171
|
WindowCovering3.Feature.Lift,
|
|
163117
163172
|
WindowCovering3.Feature.Tilt,
|
|
@@ -163196,7 +163251,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
163196
163251
|
this.state.configStatus = configStatus;
|
|
163197
163252
|
});
|
|
163198
163253
|
}
|
|
163199
|
-
|
|
163254
|
+
logger154.debug(
|
|
163200
163255
|
`Mode changed to ${Diagnostic.json(mode)} and config status to ${Diagnostic.json(configStatus)} and internal calibration mode to ${this.internal.calibrationMode}`
|
|
163201
163256
|
);
|
|
163202
163257
|
}
|
|
@@ -163204,7 +163259,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
163204
163259
|
#handleOperationalStatusChanging(operationalStatus) {
|
|
163205
163260
|
const globalStatus = operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped ? operationalStatus.lift : operationalStatus.tilt;
|
|
163206
163261
|
operationalStatus.global = globalStatus;
|
|
163207
|
-
|
|
163262
|
+
logger154.debug(
|
|
163208
163263
|
`Operational status changed to ${Diagnostic.json(operationalStatus)} with new global status ${globalStatus}`
|
|
163209
163264
|
);
|
|
163210
163265
|
this.state.operationalStatus = operationalStatus;
|
|
@@ -163233,10 +163288,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
163233
163288
|
this.state.currentPositionLiftPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
|
|
163234
163289
|
if (this.state.operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionLiftPercent100ths) {
|
|
163235
163290
|
this.state.operationalStatus.lift = WindowCovering3.MovementStatus.Stopped;
|
|
163236
|
-
|
|
163291
|
+
logger154.debug("Lift movement stopped, target value reached");
|
|
163237
163292
|
}
|
|
163238
163293
|
}
|
|
163239
|
-
|
|
163294
|
+
logger154.debug(
|
|
163240
163295
|
`Syncing lift position ${this.state.currentPositionLiftPercent100ths === null ? null : (this.state.currentPositionLiftPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionLiftPercentage}%`
|
|
163241
163296
|
);
|
|
163242
163297
|
}
|
|
@@ -163246,10 +163301,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
163246
163301
|
this.state.currentPositionTiltPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
|
|
163247
163302
|
if (this.state.operationalStatus.tilt !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionTiltPercent100ths) {
|
|
163248
163303
|
this.state.operationalStatus.tilt = WindowCovering3.MovementStatus.Stopped;
|
|
163249
|
-
|
|
163304
|
+
logger154.debug("Tilt movement stopped, target value reached");
|
|
163250
163305
|
}
|
|
163251
163306
|
}
|
|
163252
|
-
|
|
163307
|
+
logger154.debug(
|
|
163253
163308
|
`Syncing tilt position ${this.state.currentPositionTiltPercent100ths === null ? null : (this.state.currentPositionTiltPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionTiltPercentage}%`
|
|
163254
163309
|
);
|
|
163255
163310
|
}
|
|
@@ -163337,7 +163392,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
163337
163392
|
}
|
|
163338
163393
|
const directionInfo = direction === 2 ? ` in direction by position` : ` in direction ${direction === 1 ? "Close" : "Open"}`;
|
|
163339
163394
|
const targetInfo = targetPercent100ths === void 0 ? "" : ` to target position ${(targetPercent100ths / 100).toFixed(2)}`;
|
|
163340
|
-
|
|
163395
|
+
logger154.debug(
|
|
163341
163396
|
`Moving the device ${type === 0 ? "Lift" : "Tilt"}${directionInfo} (reversed=${reversed})${targetInfo}`
|
|
163342
163397
|
);
|
|
163343
163398
|
}
|
|
@@ -163359,7 +163414,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
163359
163414
|
);
|
|
163360
163415
|
}
|
|
163361
163416
|
if (type === 0 && this.state.configStatus.liftMovementReversed) {
|
|
163362
|
-
|
|
163417
|
+
logger154.debug("Lift movement is reversed");
|
|
163363
163418
|
}
|
|
163364
163419
|
switch (type) {
|
|
163365
163420
|
case 0:
|
|
@@ -163721,7 +163776,7 @@ var BridgedDeviceBasicInformationBehaviorConstructor = ClusterBehavior.withInter
|
|
|
163721
163776
|
var BridgedDeviceBasicInformationBehavior = BridgedDeviceBasicInformationBehaviorConstructor;
|
|
163722
163777
|
|
|
163723
163778
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/bridged-device-basic-information/BridgedDeviceBasicInformationServer.js
|
|
163724
|
-
var
|
|
163779
|
+
var logger155 = Logger.get("BridgedDeviceBasicInformationServer");
|
|
163725
163780
|
var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInformationBehavior {
|
|
163726
163781
|
async initialize() {
|
|
163727
163782
|
if (this.endpoint.lifecycle.isInstalled) {
|
|
@@ -163736,7 +163791,7 @@ var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInform
|
|
|
163736
163791
|
this.state.uniqueId = BasicInformationServer.createUniqueId();
|
|
163737
163792
|
}
|
|
163738
163793
|
if (serialNumber !== void 0 && uniqueId === this.state.serialNumber) {
|
|
163739
|
-
|
|
163794
|
+
logger155.warn("uniqueId and serialNumber shall not be the same.");
|
|
163740
163795
|
}
|
|
163741
163796
|
}
|
|
163742
163797
|
static schema = BasicInformationServer.enableUniqueIdPersistence(
|
|
@@ -164319,10 +164374,10 @@ function ensureCommissioningConfig(server) {
|
|
|
164319
164374
|
// src/services/bridges/bridge.ts
|
|
164320
164375
|
var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
164321
164376
|
var Bridge = class {
|
|
164322
|
-
constructor(env,
|
|
164377
|
+
constructor(env, logger195, dataProvider, endpointManager) {
|
|
164323
164378
|
this.dataProvider = dataProvider;
|
|
164324
164379
|
this.endpointManager = endpointManager;
|
|
164325
|
-
this.log =
|
|
164380
|
+
this.log = logger195.get(`Bridge / ${dataProvider.id}`);
|
|
164326
164381
|
this.server = new BridgeServerNode(
|
|
164327
164382
|
env,
|
|
164328
164383
|
this.dataProvider,
|
|
@@ -165566,7 +165621,7 @@ import crypto5 from "node:crypto";
|
|
|
165566
165621
|
|
|
165567
165622
|
// src/utils/apply-patch-state.ts
|
|
165568
165623
|
init_esm();
|
|
165569
|
-
var
|
|
165624
|
+
var logger156 = Logger.get("ApplyPatchState");
|
|
165570
165625
|
function applyPatchState(state, patch, options) {
|
|
165571
165626
|
return applyPatch(state, patch, options?.force);
|
|
165572
165627
|
}
|
|
@@ -165593,23 +165648,23 @@ function applyPatch(state, patch, force = false) {
|
|
|
165593
165648
|
if (errorMessage.includes(
|
|
165594
165649
|
"Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
|
|
165595
165650
|
)) {
|
|
165596
|
-
|
|
165651
|
+
logger156.debug(
|
|
165597
165652
|
`Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
|
|
165598
165653
|
);
|
|
165599
165654
|
return actualPatch;
|
|
165600
165655
|
}
|
|
165601
165656
|
if (errorMessage.includes("synchronous-transaction-conflict")) {
|
|
165602
|
-
|
|
165657
|
+
logger156.warn(
|
|
165603
165658
|
`Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
|
|
165604
165659
|
);
|
|
165605
165660
|
return actualPatch;
|
|
165606
165661
|
}
|
|
165607
165662
|
failedKeys.push(key);
|
|
165608
|
-
|
|
165663
|
+
logger156.warn(`Failed to set property '${key}': ${errorMessage}`);
|
|
165609
165664
|
}
|
|
165610
165665
|
}
|
|
165611
165666
|
if (failedKeys.length > 0) {
|
|
165612
|
-
|
|
165667
|
+
logger156.warn(
|
|
165613
165668
|
`${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
|
|
165614
165669
|
);
|
|
165615
165670
|
}
|
|
@@ -165684,7 +165739,7 @@ init_home_assistant_entity_behavior();
|
|
|
165684
165739
|
// src/matter/behaviors/humidity-measurement-server.ts
|
|
165685
165740
|
init_esm();
|
|
165686
165741
|
init_home_assistant_entity_behavior();
|
|
165687
|
-
var
|
|
165742
|
+
var logger157 = Logger.get("HumidityMeasurementServer");
|
|
165688
165743
|
var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementServer {
|
|
165689
165744
|
async initialize() {
|
|
165690
165745
|
await super.initialize();
|
|
@@ -165697,7 +165752,7 @@ var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementSer
|
|
|
165697
165752
|
return;
|
|
165698
165753
|
}
|
|
165699
165754
|
const humidity = this.getHumidity(this.state.config, entity.state);
|
|
165700
|
-
|
|
165755
|
+
logger157.debug(
|
|
165701
165756
|
`Humidity ${entity.state.entity_id} raw=${entity.state.state} measuredValue=${humidity}`
|
|
165702
165757
|
);
|
|
165703
165758
|
applyPatchState(this.state, {
|
|
@@ -165737,7 +165792,7 @@ init_clusters();
|
|
|
165737
165792
|
|
|
165738
165793
|
// src/matter/behaviors/power-source-server.ts
|
|
165739
165794
|
init_home_assistant_entity_behavior();
|
|
165740
|
-
var
|
|
165795
|
+
var logger158 = Logger.get("PowerSourceServer");
|
|
165741
165796
|
var FeaturedBase = PowerSourceServer.with("Battery", "Rechargeable");
|
|
165742
165797
|
var PowerSourceServerBase = class extends FeaturedBase {
|
|
165743
165798
|
async initialize() {
|
|
@@ -165749,17 +165804,17 @@ var PowerSourceServerBase = class extends FeaturedBase {
|
|
|
165749
165804
|
applyPatchState(this.state, {
|
|
165750
165805
|
endpointList: [endpointNumber]
|
|
165751
165806
|
});
|
|
165752
|
-
|
|
165807
|
+
logger158.debug(
|
|
165753
165808
|
`[${entityId}] PowerSource initialized with endpointList=[${endpointNumber}]`
|
|
165754
165809
|
);
|
|
165755
165810
|
} else {
|
|
165756
|
-
|
|
165811
|
+
logger158.warn(
|
|
165757
165812
|
`[${entityId}] PowerSource endpoint number is null during initialize - endpointList will be empty!`
|
|
165758
165813
|
);
|
|
165759
165814
|
}
|
|
165760
165815
|
const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
|
|
165761
165816
|
if (batteryEntity) {
|
|
165762
|
-
|
|
165817
|
+
logger158.debug(
|
|
165763
165818
|
`[${entityId}] PowerSource using mapped battery entity: ${batteryEntity}`
|
|
165764
165819
|
);
|
|
165765
165820
|
}
|
|
@@ -166063,7 +166118,7 @@ var OPTIMISTIC_TOLERANCE = 5;
|
|
|
166063
166118
|
function notifyLightTurnedOn(entityId) {
|
|
166064
166119
|
lastTurnOnTimestamps.set(entityId, Date.now());
|
|
166065
166120
|
}
|
|
166066
|
-
var
|
|
166121
|
+
var logger159 = Logger.get("LevelControlServer");
|
|
166067
166122
|
var FeaturedBase3 = LevelControlServer.with("OnOff", "Lighting");
|
|
166068
166123
|
var LevelControlServerBase = class extends FeaturedBase3 {
|
|
166069
166124
|
pendingTransitionTime;
|
|
@@ -166078,12 +166133,12 @@ var LevelControlServerBase = class extends FeaturedBase3 {
|
|
|
166078
166133
|
this.state.maxLevel = 254;
|
|
166079
166134
|
}
|
|
166080
166135
|
this.state.onLevel = null;
|
|
166081
|
-
|
|
166136
|
+
logger159.debug(`initialize: calling super.initialize()`);
|
|
166082
166137
|
try {
|
|
166083
166138
|
await super.initialize();
|
|
166084
|
-
|
|
166139
|
+
logger159.debug(`initialize: super.initialize() completed successfully`);
|
|
166085
166140
|
} catch (error) {
|
|
166086
|
-
|
|
166141
|
+
logger159.error(`initialize: super.initialize() FAILED:`, error);
|
|
166087
166142
|
throw error;
|
|
166088
166143
|
}
|
|
166089
166144
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -166159,7 +166214,7 @@ var LevelControlServerBase = class extends FeaturedBase3 {
|
|
|
166159
166214
|
const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
|
|
166160
166215
|
const isMaxBrightness = level >= this.maxLevel;
|
|
166161
166216
|
if (isMaxBrightness && timeSinceTurnOn < 200) {
|
|
166162
|
-
|
|
166217
|
+
logger159.debug(
|
|
166163
166218
|
`[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
|
|
166164
166219
|
);
|
|
166165
166220
|
return;
|
|
@@ -166202,7 +166257,7 @@ function LevelControlServer2(config10) {
|
|
|
166202
166257
|
}
|
|
166203
166258
|
|
|
166204
166259
|
// src/matter/behaviors/on-off-server.ts
|
|
166205
|
-
var
|
|
166260
|
+
var logger160 = Logger.get("OnOffServer");
|
|
166206
166261
|
var optimisticOnOffState = /* @__PURE__ */ new Map();
|
|
166207
166262
|
var OPTIMISTIC_TIMEOUT_MS2 = 3e3;
|
|
166208
166263
|
var OnOffServerBase = class extends OnOffServer {
|
|
@@ -166240,7 +166295,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
166240
166295
|
const action = turnOn?.(void 0, this.agent) ?? {
|
|
166241
166296
|
action: "homeassistant.turn_on"
|
|
166242
166297
|
};
|
|
166243
|
-
|
|
166298
|
+
logger160.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
|
|
166244
166299
|
notifyLightTurnedOn(homeAssistant.entityId);
|
|
166245
166300
|
applyPatchState(this.state, { onOff: true });
|
|
166246
166301
|
optimisticOnOffState.set(homeAssistant.entityId, {
|
|
@@ -166262,7 +166317,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
166262
166317
|
const action = turnOff?.(void 0, this.agent) ?? {
|
|
166263
166318
|
action: "homeassistant.turn_off"
|
|
166264
166319
|
};
|
|
166265
|
-
|
|
166320
|
+
logger160.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
|
|
166266
166321
|
applyPatchState(this.state, { onOff: false });
|
|
166267
166322
|
optimisticOnOffState.set(homeAssistant.entityId, {
|
|
166268
166323
|
expectedOnOff: false,
|
|
@@ -166693,7 +166748,7 @@ var FanOnOffServer = OnOffServer2({
|
|
|
166693
166748
|
});
|
|
166694
166749
|
|
|
166695
166750
|
// src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
|
|
166696
|
-
var
|
|
166751
|
+
var logger161 = Logger.get("ComposedAirPurifierEndpoint");
|
|
166697
166752
|
function createTemperatureConfig(temperatureEntityId) {
|
|
166698
166753
|
return {
|
|
166699
166754
|
getValue(_entity, agent) {
|
|
@@ -166851,7 +166906,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
166851
166906
|
config10.humidityEntityId ? "+Hum" : "",
|
|
166852
166907
|
config10.batteryEntityId ? "+Bat" : ""
|
|
166853
166908
|
].filter(Boolean).join("");
|
|
166854
|
-
|
|
166909
|
+
logger161.info(`Created air purifier ${primaryEntityId}: ${clusterLabels}`);
|
|
166855
166910
|
return endpoint;
|
|
166856
166911
|
}
|
|
166857
166912
|
constructor(type, entityId, id, trackedEntityIds, mappedEntityIds) {
|
|
@@ -166947,7 +167002,7 @@ init_home_assistant_entity_behavior();
|
|
|
166947
167002
|
// src/matter/behaviors/pressure-measurement-server.ts
|
|
166948
167003
|
init_esm();
|
|
166949
167004
|
init_home_assistant_entity_behavior();
|
|
166950
|
-
var
|
|
167005
|
+
var logger162 = Logger.get("PressureMeasurementServer");
|
|
166951
167006
|
var MIN_PRESSURE = 300;
|
|
166952
167007
|
var MAX_PRESSURE = 1100;
|
|
166953
167008
|
var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
@@ -166975,7 +167030,7 @@ var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
|
166975
167030
|
}
|
|
166976
167031
|
const rounded = Math.round(value);
|
|
166977
167032
|
if (rounded < MIN_PRESSURE || rounded > MAX_PRESSURE) {
|
|
166978
|
-
|
|
167033
|
+
logger162.warn(
|
|
166979
167034
|
`Pressure value ${rounded} (raw: ${value}) for ${entity.entity_id} is outside valid range [${MIN_PRESSURE}-${MAX_PRESSURE}], ignoring`
|
|
166980
167035
|
);
|
|
166981
167036
|
return null;
|
|
@@ -166994,7 +167049,7 @@ function PressureMeasurementServer2(config10) {
|
|
|
166994
167049
|
}
|
|
166995
167050
|
|
|
166996
167051
|
// src/matter/endpoints/composed/composed-sensor-endpoint.ts
|
|
166997
|
-
var
|
|
167052
|
+
var logger163 = Logger.get("ComposedSensorEndpoint");
|
|
166998
167053
|
var temperatureConfig = {
|
|
166999
167054
|
getValue(entity, agent) {
|
|
167000
167055
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
@@ -167158,7 +167213,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
|
|
|
167158
167213
|
if (config10.pressureEntityId && pressSub) {
|
|
167159
167214
|
endpoint.subEndpoints.set(config10.pressureEntityId, pressSub);
|
|
167160
167215
|
}
|
|
167161
|
-
|
|
167216
|
+
logger163.info(
|
|
167162
167217
|
`Created composed sensor ${primaryEntityId} with ${parts.length} sub-endpoint(s): T${humSub ? "+H" : ""}${pressSub ? "+P" : ""}${config10.batteryEntityId ? "+Bat" : ""}`
|
|
167163
167218
|
);
|
|
167164
167219
|
return endpoint;
|
|
@@ -167285,7 +167340,7 @@ init_home_assistant_entity_behavior();
|
|
|
167285
167340
|
// src/matter/behaviors/mode-select-server.ts
|
|
167286
167341
|
init_esm();
|
|
167287
167342
|
init_home_assistant_entity_behavior();
|
|
167288
|
-
var
|
|
167343
|
+
var logger164 = Logger.get("ModeSelectServer");
|
|
167289
167344
|
var ModeSelectServerBase = class extends ModeSelectServer {
|
|
167290
167345
|
async initialize() {
|
|
167291
167346
|
await super.initialize();
|
|
@@ -167314,13 +167369,13 @@ var ModeSelectServerBase = class extends ModeSelectServer {
|
|
|
167314
167369
|
const options = config10.getOptions(homeAssistant.entity);
|
|
167315
167370
|
const { newMode } = request;
|
|
167316
167371
|
if (newMode < 0 || newMode >= options.length) {
|
|
167317
|
-
|
|
167372
|
+
logger164.warn(
|
|
167318
167373
|
`[${homeAssistant.entityId}] Invalid mode ${newMode}, options: [${options.join(", ")}]`
|
|
167319
167374
|
);
|
|
167320
167375
|
return;
|
|
167321
167376
|
}
|
|
167322
167377
|
const option = options[newMode];
|
|
167323
|
-
|
|
167378
|
+
logger164.info(
|
|
167324
167379
|
`[${homeAssistant.entityId}] changeToMode(${newMode}) -> "${option}"`
|
|
167325
167380
|
);
|
|
167326
167381
|
applyPatchState(this.state, { currentMode: newMode });
|
|
@@ -167765,7 +167820,7 @@ var WaterLeakDetectorType = WaterLeakDetectorDevice.with(
|
|
|
167765
167820
|
);
|
|
167766
167821
|
|
|
167767
167822
|
// src/matter/endpoints/legacy/binary-sensor/index.ts
|
|
167768
|
-
var
|
|
167823
|
+
var logger165 = Logger.get("BinarySensorDevice");
|
|
167769
167824
|
var deviceClasses = {
|
|
167770
167825
|
[BinarySensorDeviceClass.CarbonMonoxide]: CoAlarmType,
|
|
167771
167826
|
[BinarySensorDeviceClass.Gas]: CoAlarmType,
|
|
@@ -167815,17 +167870,26 @@ function BinarySensorDevice(homeAssistantEntity) {
|
|
|
167815
167870
|
const originalTypeName = type.name;
|
|
167816
167871
|
if (hasBattery && batteryTypes.has(type)) {
|
|
167817
167872
|
type = batteryTypes.get(type);
|
|
167818
|
-
|
|
167873
|
+
logger165.info(
|
|
167819
167874
|
`[${entityId}] Using battery variant: ${originalTypeName} -> ${type.name}, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
167820
167875
|
);
|
|
167821
167876
|
} else if (hasBattery) {
|
|
167822
|
-
|
|
167877
|
+
logger165.warn(
|
|
167823
167878
|
`[${entityId}] Has battery but no variant available for ${originalTypeName}`
|
|
167824
167879
|
);
|
|
167825
167880
|
}
|
|
167826
167881
|
return type.set({ homeAssistantEntity });
|
|
167827
167882
|
}
|
|
167828
167883
|
|
|
167884
|
+
// src/matter/endpoints/legacy/binary-sensor/rain-sensor.ts
|
|
167885
|
+
init_home_assistant_entity_behavior();
|
|
167886
|
+
var RainSensorType = RainSensorDevice.with(
|
|
167887
|
+
BasicInformationServer2,
|
|
167888
|
+
IdentifyServer2,
|
|
167889
|
+
HomeAssistantEntityBehavior,
|
|
167890
|
+
BooleanStateServer2()
|
|
167891
|
+
);
|
|
167892
|
+
|
|
167829
167893
|
// src/matter/endpoints/legacy/button/index.ts
|
|
167830
167894
|
init_home_assistant_entity_behavior();
|
|
167831
167895
|
var ButtonOnOffServerBase = class extends OnOffServer.with("Lighting") {
|
|
@@ -167966,7 +168030,7 @@ init_home_assistant_entity_behavior();
|
|
|
167966
168030
|
// src/matter/behaviors/thermostat-server.ts
|
|
167967
168031
|
init_esm();
|
|
167968
168032
|
init_home_assistant_entity_behavior();
|
|
167969
|
-
var
|
|
168033
|
+
var logger166 = Logger.get("ThermostatServer");
|
|
167970
168034
|
var SystemMode = Thermostat3.SystemMode;
|
|
167971
168035
|
var RunningMode = Thermostat3.ThermostatRunningMode;
|
|
167972
168036
|
var nudgingSetpoints = /* @__PURE__ */ new Set();
|
|
@@ -168024,7 +168088,7 @@ var HeatingAndCoolingFeaturedBase = ThermostatServer.with("Heating", "Cooling").
|
|
|
168024
168088
|
);
|
|
168025
168089
|
function thermostatPreInitialize(self) {
|
|
168026
168090
|
const currentLocal = self.state.localTemperature;
|
|
168027
|
-
|
|
168091
|
+
logger166.debug(
|
|
168028
168092
|
`initialize: features - heating=${self.features.heating}, cooling=${self.features.cooling}`
|
|
168029
168093
|
);
|
|
168030
168094
|
const localValue = typeof currentLocal === "number" && !Number.isNaN(currentLocal) ? currentLocal : currentLocal === null ? null : 2100;
|
|
@@ -168047,7 +168111,7 @@ function thermostatPreInitialize(self) {
|
|
|
168047
168111
|
const coolingValue = typeof currentCooling === "number" && !Number.isNaN(currentCooling) ? currentCooling : 2400;
|
|
168048
168112
|
self.state.occupiedCoolingSetpoint = coolingValue;
|
|
168049
168113
|
}
|
|
168050
|
-
|
|
168114
|
+
logger166.debug(
|
|
168051
168115
|
`initialize: after force-set - local=${self.state.localTemperature}`
|
|
168052
168116
|
);
|
|
168053
168117
|
self.state.thermostatRunningState = runningStateAllOff;
|
|
@@ -168129,7 +168193,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168129
168193
|
maxCoolLimit,
|
|
168130
168194
|
"cool"
|
|
168131
168195
|
);
|
|
168132
|
-
|
|
168196
|
+
logger166.debug(
|
|
168133
168197
|
`update: limits heat=[${minHeatLimit}, ${maxHeatLimit}], cool=[${minCoolLimit}, ${maxCoolLimit}], systemMode=${systemMode}, runningMode=${runningMode}`
|
|
168134
168198
|
);
|
|
168135
168199
|
const controlSequence = config10.getControlSequence(entity.state, this.agent);
|
|
@@ -168201,18 +168265,18 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168201
168265
|
*/
|
|
168202
168266
|
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: Called via thermostatPostInitialize + prototype copy
|
|
168203
168267
|
heatingSetpointChanging(value, _oldValue, context) {
|
|
168204
|
-
|
|
168268
|
+
logger166.debug(
|
|
168205
168269
|
`heatingSetpointChanging: value=${value}, oldValue=${_oldValue}, isOffline=${transactionIsOffline(context)}`
|
|
168206
168270
|
);
|
|
168207
168271
|
if (transactionIsOffline(context)) {
|
|
168208
|
-
|
|
168272
|
+
logger166.debug(
|
|
168209
168273
|
"heatingSetpointChanging: skipping - transaction is offline"
|
|
168210
168274
|
);
|
|
168211
168275
|
return;
|
|
168212
168276
|
}
|
|
168213
168277
|
const next = Temperature.celsius(value / 100);
|
|
168214
168278
|
if (!next) {
|
|
168215
|
-
|
|
168279
|
+
logger166.debug("heatingSetpointChanging: skipping - invalid temperature");
|
|
168216
168280
|
return;
|
|
168217
168281
|
}
|
|
168218
168282
|
this.agent.asLocalActor(() => {
|
|
@@ -168223,7 +168287,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168223
168287
|
this.agent
|
|
168224
168288
|
);
|
|
168225
168289
|
const currentMode = this.state.systemMode;
|
|
168226
|
-
|
|
168290
|
+
logger166.debug(
|
|
168227
168291
|
`heatingSetpointChanging: supportsRange=${supportsRange}, systemMode=${currentMode}, features.heating=${this.features.heating}, features.cooling=${this.features.cooling}`
|
|
168228
168292
|
);
|
|
168229
168293
|
if (!supportsRange) {
|
|
@@ -168233,12 +168297,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168233
168297
|
const isOff = currentMode === Thermostat3.SystemMode.Off;
|
|
168234
168298
|
if (isOff && this.features.heating) {
|
|
168235
168299
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
168236
|
-
|
|
168300
|
+
logger166.debug(
|
|
168237
168301
|
`heatingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
168238
168302
|
);
|
|
168239
168303
|
return;
|
|
168240
168304
|
}
|
|
168241
|
-
|
|
168305
|
+
logger166.info(
|
|
168242
168306
|
`heatingSetpointChanging: auto-resume - switching to Heat (was Off)`
|
|
168243
168307
|
);
|
|
168244
168308
|
const modeAction = config10.setSystemMode(
|
|
@@ -168247,17 +168311,17 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168247
168311
|
);
|
|
168248
168312
|
homeAssistant.callAction(modeAction);
|
|
168249
168313
|
} else if (!isAutoMode && !isHeatingMode) {
|
|
168250
|
-
|
|
168314
|
+
logger166.debug(
|
|
168251
168315
|
`heatingSetpointChanging: skipping - not in heating/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
|
|
168252
168316
|
);
|
|
168253
168317
|
return;
|
|
168254
168318
|
}
|
|
168255
|
-
|
|
168319
|
+
logger166.debug(
|
|
168256
168320
|
`heatingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isHeatingMode=${isHeatingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
168257
168321
|
);
|
|
168258
168322
|
}
|
|
168259
168323
|
const coolingSetpoint = this.features.cooling ? this.state.occupiedCoolingSetpoint : value;
|
|
168260
|
-
|
|
168324
|
+
logger166.debug(
|
|
168261
168325
|
`heatingSetpointChanging: calling setTemperature with heat=${next.celsius(true)}, cool=${coolingSetpoint}`
|
|
168262
168326
|
);
|
|
168263
168327
|
this.setTemperature(
|
|
@@ -168296,12 +168360,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168296
168360
|
const isOff = currentMode === Thermostat3.SystemMode.Off;
|
|
168297
168361
|
if (isOff && !this.features.heating && this.features.cooling) {
|
|
168298
168362
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
168299
|
-
|
|
168363
|
+
logger166.debug(
|
|
168300
168364
|
`coolingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
168301
168365
|
);
|
|
168302
168366
|
return;
|
|
168303
168367
|
}
|
|
168304
|
-
|
|
168368
|
+
logger166.info(
|
|
168305
168369
|
`coolingSetpointChanging: auto-resume - switching to Cool (was Off)`
|
|
168306
168370
|
);
|
|
168307
168371
|
const modeAction = config10.setSystemMode(
|
|
@@ -168310,12 +168374,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168310
168374
|
);
|
|
168311
168375
|
homeAssistant.callAction(modeAction);
|
|
168312
168376
|
} else if (!isAutoMode && !isCoolingMode) {
|
|
168313
|
-
|
|
168377
|
+
logger166.debug(
|
|
168314
168378
|
`coolingSetpointChanging: skipping - not in cooling/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
|
|
168315
168379
|
);
|
|
168316
168380
|
return;
|
|
168317
168381
|
}
|
|
168318
|
-
|
|
168382
|
+
logger166.debug(
|
|
168319
168383
|
`coolingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isCoolingMode=${isCoolingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
168320
168384
|
);
|
|
168321
168385
|
}
|
|
@@ -168392,7 +168456,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168392
168456
|
const effectiveMax = max ?? 5e3;
|
|
168393
168457
|
if (value == null || Number.isNaN(value)) {
|
|
168394
168458
|
const defaultValue = type === "heat" ? 2e3 : 2400;
|
|
168395
|
-
|
|
168459
|
+
logger166.debug(
|
|
168396
168460
|
`${type} setpoint is undefined, using default: ${defaultValue}`
|
|
168397
168461
|
);
|
|
168398
168462
|
return Math.max(effectiveMin, Math.min(effectiveMax, defaultValue));
|
|
@@ -168856,7 +168920,7 @@ init_home_assistant_entity_behavior();
|
|
|
168856
168920
|
init_esm();
|
|
168857
168921
|
init_home_assistant_actions();
|
|
168858
168922
|
init_home_assistant_entity_behavior();
|
|
168859
|
-
var
|
|
168923
|
+
var logger167 = Logger.get("WindowCoveringServer");
|
|
168860
168924
|
var MovementStatus = WindowCovering3.MovementStatus;
|
|
168861
168925
|
var FeaturedBase5 = WindowCoveringServer.with(
|
|
168862
168926
|
"Lift",
|
|
@@ -168940,7 +169004,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168940
169004
|
);
|
|
168941
169005
|
const currentTilt100ths = currentTilt != null ? currentTilt * 100 : null;
|
|
168942
169006
|
const isStopped = movementStatus === MovementStatus.Stopped;
|
|
168943
|
-
|
|
169007
|
+
logger167.debug(
|
|
168944
169008
|
`Cover update for ${entity.entity_id}: state=${state.state}, lift=${currentLift}%, tilt=${currentTilt}%, movement=${MovementStatus[movementStatus]}`
|
|
168945
169009
|
);
|
|
168946
169010
|
const appliedPatch = applyPatchState(
|
|
@@ -168979,9 +169043,9 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168979
169043
|
);
|
|
168980
169044
|
if (Object.keys(appliedPatch).length > 0) {
|
|
168981
169045
|
const hasOperationalChange = "operationalStatus" in appliedPatch;
|
|
168982
|
-
const log = hasOperationalChange ?
|
|
169046
|
+
const log = hasOperationalChange ? logger167.info : logger167.debug;
|
|
168983
169047
|
log.call(
|
|
168984
|
-
|
|
169048
|
+
logger167,
|
|
168985
169049
|
`Cover ${entity.entity_id} state changed: ${JSON.stringify(appliedPatch)}`
|
|
168986
169050
|
);
|
|
168987
169051
|
}
|
|
@@ -168989,7 +169053,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168989
169053
|
async handleMovement(type, _, direction, targetPercent100ths) {
|
|
168990
169054
|
const currentLift = this.state.currentPositionLiftPercent100ths ?? 0;
|
|
168991
169055
|
const currentTilt = this.state.currentPositionTiltPercent100ths ?? 0;
|
|
168992
|
-
|
|
169056
|
+
logger167.info(
|
|
168993
169057
|
`handleMovement: type=${MovementType[type]}, direction=${MovementDirection[direction]}, target=${targetPercent100ths}, currentLift=${currentLift}, currentTilt=${currentTilt}, absolutePosition=${this.features.absolutePosition}`
|
|
168994
169058
|
);
|
|
168995
169059
|
if (type === MovementType.Lift) {
|
|
@@ -169025,13 +169089,13 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
169025
169089
|
handleLiftOpen() {
|
|
169026
169090
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
169027
169091
|
const action = this.state.config.openCoverLift(void 0, this.agent);
|
|
169028
|
-
|
|
169092
|
+
logger167.info(`handleLiftOpen: calling action=${action.action}`);
|
|
169029
169093
|
homeAssistant.callAction(action);
|
|
169030
169094
|
}
|
|
169031
169095
|
handleLiftClose() {
|
|
169032
169096
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
169033
169097
|
const action = this.state.config.closeCoverLift(void 0, this.agent);
|
|
169034
|
-
|
|
169098
|
+
logger167.info(`handleLiftClose: calling action=${action.action}`);
|
|
169035
169099
|
homeAssistant.callAction(action);
|
|
169036
169100
|
}
|
|
169037
169101
|
handleGoToLiftPosition(targetPercent100ths) {
|
|
@@ -169052,7 +169116,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
169052
169116
|
this.lastLiftCommandTime = now;
|
|
169053
169117
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
169054
169118
|
const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
169055
|
-
|
|
169119
|
+
logger167.debug(
|
|
169056
169120
|
`Lift command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
|
|
169057
169121
|
);
|
|
169058
169122
|
if (this.liftDebounceTimer) {
|
|
@@ -169101,7 +169165,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
169101
169165
|
this.lastTiltCommandTime = now;
|
|
169102
169166
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
169103
169167
|
const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
169104
|
-
|
|
169168
|
+
logger167.debug(
|
|
169105
169169
|
`Tilt command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
|
|
169106
169170
|
);
|
|
169107
169171
|
if (this.tiltDebounceTimer) {
|
|
@@ -169160,7 +169224,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
|
|
|
169160
169224
|
}
|
|
169161
169225
|
|
|
169162
169226
|
// src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
|
|
169163
|
-
var
|
|
169227
|
+
var logger168 = Logger.get("CoverWindowCoveringServer");
|
|
169164
169228
|
var attributes5 = (entity) => entity.attributes;
|
|
169165
169229
|
var MATTER_SEMANTIC_PLATFORMS = [
|
|
169166
169230
|
// Currently empty - no known platforms use Matter semantics by default
|
|
@@ -169178,7 +169242,7 @@ var adjustPositionForReading2 = (position, agent) => {
|
|
|
169178
169242
|
const { featureFlags } = agent.env.get(BridgeDataProvider);
|
|
169179
169243
|
const matterSem = usesMatterSemantics(agent);
|
|
169180
169244
|
const result = adjustPositionForReading(position, featureFlags, matterSem);
|
|
169181
|
-
|
|
169245
|
+
logger168.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
|
|
169182
169246
|
return result;
|
|
169183
169247
|
};
|
|
169184
169248
|
var adjustPositionForWriting2 = (position, agent) => {
|
|
@@ -169282,7 +169346,7 @@ var config5 = {
|
|
|
169282
169346
|
var CoverWindowCoveringServer = WindowCoveringServer2(config5);
|
|
169283
169347
|
|
|
169284
169348
|
// src/matter/endpoints/legacy/cover/index.ts
|
|
169285
|
-
var
|
|
169349
|
+
var logger169 = Logger.get("CoverDevice");
|
|
169286
169350
|
var CoverPowerSourceServer = PowerSourceServer2({
|
|
169287
169351
|
getBatteryPercent: (entity, agent) => {
|
|
169288
169352
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
@@ -169309,7 +169373,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
|
|
|
169309
169373
|
features2.add("PositionAwareLift");
|
|
169310
169374
|
features2.add("AbsolutePosition");
|
|
169311
169375
|
} else {
|
|
169312
|
-
|
|
169376
|
+
logger169.warn(
|
|
169313
169377
|
`[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
|
|
169314
169378
|
);
|
|
169315
169379
|
features2.add("Lift");
|
|
@@ -169326,7 +169390,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
|
|
|
169326
169390
|
features2.add("AbsolutePosition");
|
|
169327
169391
|
}
|
|
169328
169392
|
}
|
|
169329
|
-
|
|
169393
|
+
logger169.info(
|
|
169330
169394
|
`[${entityId}] Creating WindowCovering with features: [${[...features2].join(", ")}], supported_features=${supportedFeatures}`
|
|
169331
169395
|
);
|
|
169332
169396
|
const baseBehaviors = [
|
|
@@ -169347,11 +169411,11 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
169347
169411
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
169348
169412
|
const hasBattery = hasBatteryAttr || hasBatteryEntity;
|
|
169349
169413
|
if (hasBattery) {
|
|
169350
|
-
|
|
169414
|
+
logger169.info(
|
|
169351
169415
|
`[${entityId}] Creating cover with PowerSource cluster, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
169352
169416
|
);
|
|
169353
169417
|
} else {
|
|
169354
|
-
|
|
169418
|
+
logger169.debug(
|
|
169355
169419
|
`[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
|
|
169356
169420
|
);
|
|
169357
169421
|
}
|
|
@@ -169367,7 +169431,7 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
169367
169431
|
// src/matter/behaviors/generic-switch-server.ts
|
|
169368
169432
|
init_esm();
|
|
169369
169433
|
init_home_assistant_entity_behavior();
|
|
169370
|
-
var
|
|
169434
|
+
var logger170 = Logger.get("GenericSwitchServer");
|
|
169371
169435
|
var FeaturedBase6 = SwitchServer.with(
|
|
169372
169436
|
"MomentarySwitch",
|
|
169373
169437
|
"MomentarySwitchRelease",
|
|
@@ -169378,7 +169442,7 @@ var GenericSwitchServerBase = class extends FeaturedBase6 {
|
|
|
169378
169442
|
await super.initialize();
|
|
169379
169443
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
169380
169444
|
const entityId = homeAssistant.entityId;
|
|
169381
|
-
|
|
169445
|
+
logger170.debug(`[${entityId}] GenericSwitch initialized`);
|
|
169382
169446
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
169383
169447
|
}
|
|
169384
169448
|
handleEventChange() {
|
|
@@ -169389,7 +169453,7 @@ var GenericSwitchServerBase = class extends FeaturedBase6 {
|
|
|
169389
169453
|
const eventType = attrs.event_type;
|
|
169390
169454
|
if (!eventType) return;
|
|
169391
169455
|
const entityId = homeAssistant.entityId;
|
|
169392
|
-
|
|
169456
|
+
logger170.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
169393
169457
|
this.triggerPress(eventType);
|
|
169394
169458
|
}
|
|
169395
169459
|
triggerPress(eventType) {
|
|
@@ -169703,7 +169767,7 @@ init_nodejs();
|
|
|
169703
169767
|
|
|
169704
169768
|
// src/matter/behaviors/color-control-server.ts
|
|
169705
169769
|
init_home_assistant_entity_behavior();
|
|
169706
|
-
var
|
|
169770
|
+
var logger171 = Logger.get("ColorControlServer");
|
|
169707
169771
|
var optimisticColorState = /* @__PURE__ */ new Map();
|
|
169708
169772
|
var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
|
|
169709
169773
|
var OPTIMISTIC_TOLERANCE2 = 5;
|
|
@@ -169736,7 +169800,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
169736
169800
|
if (this.state.startUpColorTemperatureMireds == null) {
|
|
169737
169801
|
this.state.startUpColorTemperatureMireds = defaultMireds;
|
|
169738
169802
|
}
|
|
169739
|
-
|
|
169803
|
+
logger171.debug(
|
|
169740
169804
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
169741
169805
|
);
|
|
169742
169806
|
}
|
|
@@ -170176,7 +170240,7 @@ init_dist();
|
|
|
170176
170240
|
// src/matter/behaviors/electrical-energy-measurement-server.ts
|
|
170177
170241
|
init_esm();
|
|
170178
170242
|
init_home_assistant_entity_behavior();
|
|
170179
|
-
var
|
|
170243
|
+
var logger172 = Logger.get("ElectricalEnergyMeasurementServer");
|
|
170180
170244
|
var FeaturedBase8 = ElectricalEnergyMeasurementServer.with("CumulativeEnergy", "ImportedEnergy");
|
|
170181
170245
|
var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase8 {
|
|
170182
170246
|
async initialize() {
|
|
@@ -170185,7 +170249,7 @@ var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase8 {
|
|
|
170185
170249
|
const entityId = homeAssistant.entityId;
|
|
170186
170250
|
const energyEntity = homeAssistant.state.mapping?.energyEntity;
|
|
170187
170251
|
if (energyEntity) {
|
|
170188
|
-
|
|
170252
|
+
logger172.debug(
|
|
170189
170253
|
`[${entityId}] ElectricalEnergyMeasurement using mapped energy entity: ${energyEntity}`
|
|
170190
170254
|
);
|
|
170191
170255
|
}
|
|
@@ -170237,7 +170301,7 @@ var HaElectricalEnergyMeasurementServer = ElectricalEnergyMeasurementServerBase.
|
|
|
170237
170301
|
// src/matter/behaviors/electrical-power-measurement-server.ts
|
|
170238
170302
|
init_esm();
|
|
170239
170303
|
init_home_assistant_entity_behavior();
|
|
170240
|
-
var
|
|
170304
|
+
var logger173 = Logger.get("ElectricalPowerMeasurementServer");
|
|
170241
170305
|
var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurementServer {
|
|
170242
170306
|
async initialize() {
|
|
170243
170307
|
await super.initialize();
|
|
@@ -170245,7 +170309,7 @@ var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurem
|
|
|
170245
170309
|
const entityId = homeAssistant.entityId;
|
|
170246
170310
|
const powerEntity = homeAssistant.state.mapping?.powerEntity;
|
|
170247
170311
|
if (powerEntity) {
|
|
170248
|
-
|
|
170312
|
+
logger173.debug(
|
|
170249
170313
|
`[${entityId}] ElectricalPowerMeasurement using mapped power entity: ${powerEntity}`
|
|
170250
170314
|
);
|
|
170251
170315
|
}
|
|
@@ -170341,7 +170405,7 @@ init_home_assistant_entity_behavior();
|
|
|
170341
170405
|
// src/matter/behaviors/lock-server.ts
|
|
170342
170406
|
init_esm();
|
|
170343
170407
|
init_home_assistant_entity_behavior();
|
|
170344
|
-
var
|
|
170408
|
+
var logger174 = Logger.get("LockServer");
|
|
170345
170409
|
function hasStoredCredentialHelper(env, entityId) {
|
|
170346
170410
|
try {
|
|
170347
170411
|
const storage2 = env.get(LockCredentialStorage);
|
|
@@ -170499,7 +170563,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
170499
170563
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
170500
170564
|
const action = this.state.config.lock(void 0, this.agent);
|
|
170501
170565
|
const hasPinProvided = !!request.pinCode;
|
|
170502
|
-
|
|
170566
|
+
logger174.debug(
|
|
170503
170567
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
170504
170568
|
);
|
|
170505
170569
|
if (request.pinCode) {
|
|
@@ -170512,12 +170576,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
170512
170576
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
170513
170577
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
170514
170578
|
const hasPinProvided = !!request.pinCode;
|
|
170515
|
-
|
|
170579
|
+
logger174.debug(
|
|
170516
170580
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
170517
170581
|
);
|
|
170518
170582
|
if (this.state.requirePinForRemoteOperation) {
|
|
170519
170583
|
if (!request.pinCode) {
|
|
170520
|
-
|
|
170584
|
+
logger174.info(
|
|
170521
170585
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
170522
170586
|
);
|
|
170523
170587
|
throw new StatusResponseError(
|
|
@@ -170527,12 +170591,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
170527
170591
|
}
|
|
170528
170592
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
170529
170593
|
if (!this.verifyStoredPin(homeAssistant.entityId, providedPin)) {
|
|
170530
|
-
|
|
170594
|
+
logger174.info(
|
|
170531
170595
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
170532
170596
|
);
|
|
170533
170597
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
170534
170598
|
}
|
|
170535
|
-
|
|
170599
|
+
logger174.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
170536
170600
|
action.data = { ...action.data, code: providedPin };
|
|
170537
170601
|
}
|
|
170538
170602
|
homeAssistant.callAction(action);
|
|
@@ -170693,7 +170757,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170693
170757
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
170694
170758
|
const action = this.state.config.lock(void 0, this.agent);
|
|
170695
170759
|
const hasPinProvided = !!request.pinCode;
|
|
170696
|
-
|
|
170760
|
+
logger174.debug(
|
|
170697
170761
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
170698
170762
|
);
|
|
170699
170763
|
if (request.pinCode) {
|
|
@@ -170707,12 +170771,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170707
170771
|
const unlatchConfig = this.state.config.unlatch;
|
|
170708
170772
|
const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
|
|
170709
170773
|
const hasPinProvided = !!request.pinCode;
|
|
170710
|
-
|
|
170774
|
+
logger174.debug(
|
|
170711
170775
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
|
|
170712
170776
|
);
|
|
170713
170777
|
if (this.state.requirePinForRemoteOperation) {
|
|
170714
170778
|
if (!request.pinCode) {
|
|
170715
|
-
|
|
170779
|
+
logger174.info(
|
|
170716
170780
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
170717
170781
|
);
|
|
170718
170782
|
throw new StatusResponseError(
|
|
@@ -170722,12 +170786,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170722
170786
|
}
|
|
170723
170787
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
170724
170788
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
170725
|
-
|
|
170789
|
+
logger174.info(
|
|
170726
170790
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
170727
170791
|
);
|
|
170728
170792
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
170729
170793
|
}
|
|
170730
|
-
|
|
170794
|
+
logger174.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
170731
170795
|
action.data = { ...action.data, code: providedPin };
|
|
170732
170796
|
}
|
|
170733
170797
|
homeAssistant.callAction(action);
|
|
@@ -170742,12 +170806,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170742
170806
|
}
|
|
170743
170807
|
const action = unlatchConfig(void 0, this.agent);
|
|
170744
170808
|
const hasPinProvided = !!request.pinCode;
|
|
170745
|
-
|
|
170809
|
+
logger174.debug(
|
|
170746
170810
|
`unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
170747
170811
|
);
|
|
170748
170812
|
if (this.state.requirePinForRemoteOperation) {
|
|
170749
170813
|
if (!request.pinCode) {
|
|
170750
|
-
|
|
170814
|
+
logger174.info(
|
|
170751
170815
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
170752
170816
|
);
|
|
170753
170817
|
throw new StatusResponseError(
|
|
@@ -170757,12 +170821,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170757
170821
|
}
|
|
170758
170822
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
170759
170823
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
170760
|
-
|
|
170824
|
+
logger174.info(
|
|
170761
170825
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
170762
170826
|
);
|
|
170763
170827
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
170764
170828
|
}
|
|
170765
|
-
|
|
170829
|
+
logger174.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
|
|
170766
170830
|
action.data = { ...action.data, code: providedPin };
|
|
170767
170831
|
}
|
|
170768
170832
|
homeAssistant.callAction(action);
|
|
@@ -170932,7 +170996,7 @@ init_home_assistant_entity_behavior();
|
|
|
170932
170996
|
init_dist();
|
|
170933
170997
|
init_esm();
|
|
170934
170998
|
init_home_assistant_entity_behavior();
|
|
170935
|
-
var
|
|
170999
|
+
var logger175 = Logger.get("MediaPlayerKeypadInputServer");
|
|
170936
171000
|
var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
170937
171001
|
sendKey(request) {
|
|
170938
171002
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -170943,12 +171007,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
|
170943
171007
|
const features2 = attributes7.supported_features ?? 0;
|
|
170944
171008
|
const action = this.mapKeyToAction(request.keyCode, features2);
|
|
170945
171009
|
if (!action) {
|
|
170946
|
-
|
|
171010
|
+
logger175.debug(
|
|
170947
171011
|
`Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
|
|
170948
171012
|
);
|
|
170949
171013
|
return { status: KeypadInput3.Status.UnsupportedKey };
|
|
170950
171014
|
}
|
|
170951
|
-
|
|
171015
|
+
logger175.debug(
|
|
170952
171016
|
`sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
|
|
170953
171017
|
);
|
|
170954
171018
|
homeAssistant.callAction({ action });
|
|
@@ -171227,7 +171291,7 @@ init_home_assistant_entity_behavior();
|
|
|
171227
171291
|
// src/matter/behaviors/speaker-level-control-server.ts
|
|
171228
171292
|
init_esm();
|
|
171229
171293
|
init_home_assistant_entity_behavior();
|
|
171230
|
-
var
|
|
171294
|
+
var logger176 = Logger.get("SpeakerLevelControlServer");
|
|
171231
171295
|
var optimisticLevelState2 = /* @__PURE__ */ new Map();
|
|
171232
171296
|
var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
|
|
171233
171297
|
var OPTIMISTIC_TOLERANCE3 = 5;
|
|
@@ -171263,7 +171327,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase9 {
|
|
|
171263
171327
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
171264
171328
|
}
|
|
171265
171329
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
171266
|
-
|
|
171330
|
+
logger176.debug(
|
|
171267
171331
|
`[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
|
|
171268
171332
|
);
|
|
171269
171333
|
const optimistic = optimisticLevelState2.get(entity.entity_id);
|
|
@@ -171311,7 +171375,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase9 {
|
|
|
171311
171375
|
const config10 = this.state.config;
|
|
171312
171376
|
const entityId = homeAssistant.entity.entity_id;
|
|
171313
171377
|
const levelPercent = level / 254;
|
|
171314
|
-
|
|
171378
|
+
logger176.debug(
|
|
171315
171379
|
`[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
|
|
171316
171380
|
);
|
|
171317
171381
|
const current = config10.getValuePercent(
|
|
@@ -172637,7 +172701,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
|
|
|
172637
172701
|
};
|
|
172638
172702
|
|
|
172639
172703
|
// src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
|
|
172640
|
-
var
|
|
172704
|
+
var logger177 = Logger.get("TvocSensor");
|
|
172641
172705
|
function airQualityFromUgm3(value) {
|
|
172642
172706
|
if (value <= 300) return AirQuality3.AirQualityEnum.Good;
|
|
172643
172707
|
if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
|
|
@@ -172675,17 +172739,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
172675
172739
|
const attributes7 = entity.state.attributes;
|
|
172676
172740
|
const deviceClass = attributes7.device_class;
|
|
172677
172741
|
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172678
|
-
|
|
172742
|
+
logger177.debug(
|
|
172679
172743
|
`[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
|
|
172680
172744
|
);
|
|
172681
172745
|
if (state != null && !Number.isNaN(+state)) {
|
|
172682
172746
|
const value = +state;
|
|
172683
172747
|
airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
|
|
172684
|
-
|
|
172748
|
+
logger177.debug(
|
|
172685
172749
|
`[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
|
|
172686
172750
|
);
|
|
172687
172751
|
} else {
|
|
172688
|
-
|
|
172752
|
+
logger177.warn(
|
|
172689
172753
|
`[${entity.entity_id}] TVOC state not a valid number: "${state}"`
|
|
172690
172754
|
);
|
|
172691
172755
|
}
|
|
@@ -172898,7 +172962,7 @@ init_home_assistant_entity_behavior();
|
|
|
172898
172962
|
// src/matter/behaviors/pm25-concentration-measurement-server.ts
|
|
172899
172963
|
init_esm();
|
|
172900
172964
|
init_home_assistant_entity_behavior();
|
|
172901
|
-
var
|
|
172965
|
+
var logger178 = Logger.get("Pm25ConcentrationMeasurementServer");
|
|
172902
172966
|
var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
|
|
172903
172967
|
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
172904
172968
|
);
|
|
@@ -172922,11 +172986,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
172922
172986
|
if (this.state.measurementMedium === void 0) {
|
|
172923
172987
|
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
172924
172988
|
}
|
|
172925
|
-
|
|
172989
|
+
logger178.debug(
|
|
172926
172990
|
"Pm25ConcentrationMeasurementServer: before super.initialize()"
|
|
172927
172991
|
);
|
|
172928
172992
|
await super.initialize();
|
|
172929
|
-
|
|
172993
|
+
logger178.debug(
|
|
172930
172994
|
"Pm25ConcentrationMeasurementServer: after super.initialize()"
|
|
172931
172995
|
);
|
|
172932
172996
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -172949,7 +173013,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
172949
173013
|
};
|
|
172950
173014
|
|
|
172951
173015
|
// src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
|
|
172952
|
-
var
|
|
173016
|
+
var logger179 = Logger.get("Pm25AirQualityServer");
|
|
172953
173017
|
var Pm25AirQualityServerBase = AirQualityServer.with(
|
|
172954
173018
|
AirQuality3.Feature.Fair,
|
|
172955
173019
|
AirQuality3.Feature.Moderate,
|
|
@@ -172961,9 +173025,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
|
|
|
172961
173025
|
if (this.state.airQuality === void 0) {
|
|
172962
173026
|
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
172963
173027
|
}
|
|
172964
|
-
|
|
173028
|
+
logger179.debug("Pm25AirQualityServer: before super.initialize()");
|
|
172965
173029
|
await super.initialize();
|
|
172966
|
-
|
|
173030
|
+
logger179.debug("Pm25AirQualityServer: after super.initialize()");
|
|
172967
173031
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
172968
173032
|
this.update(homeAssistant.entity);
|
|
172969
173033
|
this.reactTo(homeAssistant.onChange, this.update);
|
|
@@ -173318,7 +173382,7 @@ init_home_assistant_entity_behavior();
|
|
|
173318
173382
|
init_dist();
|
|
173319
173383
|
init_esm();
|
|
173320
173384
|
init_home_assistant_entity_behavior();
|
|
173321
|
-
var
|
|
173385
|
+
var logger180 = Logger.get("VacuumIdentifyServer");
|
|
173322
173386
|
var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
173323
173387
|
triggerEffect(effect) {
|
|
173324
173388
|
this.#locate("triggerEffect");
|
|
@@ -173335,11 +173399,11 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
173335
173399
|
const features2 = homeAssistant.entity.state.attributes.supported_features ?? 0;
|
|
173336
173400
|
const hasLocate = testBit(features2, VacuumDeviceFeature.LOCATE);
|
|
173337
173401
|
if (!hasLocate) {
|
|
173338
|
-
|
|
173402
|
+
logger180.warn(
|
|
173339
173403
|
`${source} for ${homeAssistant.entityId} \u2014 LOCATE not in supported_features (${features2}), calling vacuum.locate anyway`
|
|
173340
173404
|
);
|
|
173341
173405
|
} else {
|
|
173342
|
-
|
|
173406
|
+
logger180.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
|
|
173343
173407
|
}
|
|
173344
173408
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
173345
173409
|
}
|
|
@@ -173630,11 +173694,11 @@ init_esm();
|
|
|
173630
173694
|
|
|
173631
173695
|
// src/matter/behaviors/service-area-server.ts
|
|
173632
173696
|
init_esm();
|
|
173633
|
-
var
|
|
173697
|
+
var logger181 = Logger.get("ServiceAreaServer");
|
|
173634
173698
|
var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
173635
173699
|
selectAreas(request) {
|
|
173636
173700
|
const { newAreas } = request;
|
|
173637
|
-
|
|
173701
|
+
logger181.info(
|
|
173638
173702
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
173639
173703
|
);
|
|
173640
173704
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -173643,14 +173707,14 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
|
173643
173707
|
(id) => !supportedAreaIds.includes(id)
|
|
173644
173708
|
);
|
|
173645
173709
|
if (invalidAreas.length > 0) {
|
|
173646
|
-
|
|
173710
|
+
logger181.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
173647
173711
|
return {
|
|
173648
173712
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
173649
173713
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
173650
173714
|
};
|
|
173651
173715
|
}
|
|
173652
173716
|
this.state.selectedAreas = uniqueAreas;
|
|
173653
|
-
|
|
173717
|
+
logger181.info(
|
|
173654
173718
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
173655
173719
|
);
|
|
173656
173720
|
return {
|
|
@@ -173671,7 +173735,7 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
|
173671
173735
|
ServiceAreaServerBase2.State = State;
|
|
173672
173736
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
173673
173737
|
function ServiceAreaServer2(initialState) {
|
|
173674
|
-
|
|
173738
|
+
logger181.info(
|
|
173675
173739
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
173676
173740
|
);
|
|
173677
173741
|
return ServiceAreaServerBase.set({
|
|
@@ -173684,7 +173748,7 @@ var ServiceAreaWithMaps = ServiceAreaBehavior.with(ServiceArea3.Feature.Maps);
|
|
|
173684
173748
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
173685
173749
|
selectAreas(request) {
|
|
173686
173750
|
const { newAreas } = request;
|
|
173687
|
-
|
|
173751
|
+
logger181.info(
|
|
173688
173752
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
173689
173753
|
);
|
|
173690
173754
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -173693,14 +173757,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
|
173693
173757
|
(id) => !supportedAreaIds.includes(id)
|
|
173694
173758
|
);
|
|
173695
173759
|
if (invalidAreas.length > 0) {
|
|
173696
|
-
|
|
173760
|
+
logger181.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
173697
173761
|
return {
|
|
173698
173762
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
173699
173763
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
173700
173764
|
};
|
|
173701
173765
|
}
|
|
173702
173766
|
this.state.selectedAreas = uniqueAreas;
|
|
173703
|
-
|
|
173767
|
+
logger181.info(
|
|
173704
173768
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
173705
173769
|
);
|
|
173706
173770
|
return {
|
|
@@ -173721,14 +173785,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
|
173721
173785
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
173722
173786
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
173723
173787
|
function ServiceAreaServerWithMaps(initialState) {
|
|
173724
|
-
|
|
173788
|
+
logger181.info(
|
|
173725
173789
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
173726
173790
|
);
|
|
173727
173791
|
for (const map of initialState.supportedMaps) {
|
|
173728
173792
|
const areaCount = initialState.supportedAreas.filter(
|
|
173729
173793
|
(a) => a.mapId === map.mapId
|
|
173730
173794
|
).length;
|
|
173731
|
-
|
|
173795
|
+
logger181.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
173732
173796
|
}
|
|
173733
173797
|
return ServiceAreaServerWithMapsBase.set({
|
|
173734
173798
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -173739,7 +173803,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
173739
173803
|
}
|
|
173740
173804
|
|
|
173741
173805
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
173742
|
-
var
|
|
173806
|
+
var logger182 = Logger.get("VacuumServiceAreaServer");
|
|
173743
173807
|
function toAreaId(roomId) {
|
|
173744
173808
|
if (typeof roomId === "number") {
|
|
173745
173809
|
return roomId;
|
|
@@ -173818,13 +173882,13 @@ function createVacuumServiceAreaServer(attributes7, roomEntities, includeUnnamed
|
|
|
173818
173882
|
let rooms;
|
|
173819
173883
|
if (roomEntities && roomEntities.length > 0) {
|
|
173820
173884
|
rooms = buttonEntitiesToRooms(roomEntities, attributes7);
|
|
173821
|
-
|
|
173885
|
+
logger182.info(
|
|
173822
173886
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
173823
173887
|
);
|
|
173824
173888
|
} else {
|
|
173825
173889
|
rooms = parseVacuumRooms(attributes7, includeUnnamedRooms);
|
|
173826
173890
|
if (rooms.length > 0) {
|
|
173827
|
-
|
|
173891
|
+
logger182.info(
|
|
173828
173892
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
173829
173893
|
);
|
|
173830
173894
|
}
|
|
@@ -173878,7 +173942,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
173878
173942
|
landmarkInfo: null
|
|
173879
173943
|
}
|
|
173880
173944
|
}));
|
|
173881
|
-
|
|
173945
|
+
logger182.info(
|
|
173882
173946
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
173883
173947
|
);
|
|
173884
173948
|
return ServiceAreaServer2({
|
|
@@ -173889,7 +173953,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
173889
173953
|
}
|
|
173890
173954
|
|
|
173891
173955
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
173892
|
-
var
|
|
173956
|
+
var logger183 = Logger.get("VacuumRvcRunModeServer");
|
|
173893
173957
|
function buildSupportedModes2(attributes7, includeUnnamedRooms = false, customAreas) {
|
|
173894
173958
|
const modes = [
|
|
173895
173959
|
{
|
|
@@ -173935,12 +173999,12 @@ function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, ser
|
|
|
173935
173999
|
const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
|
|
173936
174000
|
serviceArea.state.selectedAreas = [];
|
|
173937
174001
|
if (matched.length === 0) {
|
|
173938
|
-
|
|
174002
|
+
logger183.warn(
|
|
173939
174003
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
173940
174004
|
);
|
|
173941
174005
|
return { action: "vacuum.start" };
|
|
173942
174006
|
}
|
|
173943
|
-
|
|
174007
|
+
logger183.info(
|
|
173944
174008
|
`Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
|
|
173945
174009
|
);
|
|
173946
174010
|
for (let i = 1; i < matched.length; i++) {
|
|
@@ -173969,7 +174033,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
173969
174033
|
VacuumState.mop_cleaning
|
|
173970
174034
|
];
|
|
173971
174035
|
const isCleaning = cleaningStates.includes(state);
|
|
173972
|
-
|
|
174036
|
+
logger183.debug(
|
|
173973
174037
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
173974
174038
|
);
|
|
173975
174039
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -174008,7 +174072,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174008
174072
|
}
|
|
174009
174073
|
}
|
|
174010
174074
|
if (buttonEntityIds.length > 0) {
|
|
174011
|
-
|
|
174075
|
+
logger183.info(
|
|
174012
174076
|
`Roborock: Pressing button entities for selected rooms: ${buttonEntityIds.join(", ")}`
|
|
174013
174077
|
);
|
|
174014
174078
|
serviceArea.state.selectedAreas = [];
|
|
@@ -174037,14 +174101,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
174037
174101
|
}
|
|
174038
174102
|
}
|
|
174039
174103
|
if (roomIds.length > 0) {
|
|
174040
|
-
|
|
174104
|
+
logger183.info(
|
|
174041
174105
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
174042
174106
|
);
|
|
174043
174107
|
serviceArea.state.selectedAreas = [];
|
|
174044
174108
|
const vacuumEntityId = homeAssistant.entityId;
|
|
174045
174109
|
if (vacuumEntityId.startsWith("vacuum.valetudo_")) {
|
|
174046
174110
|
const identifier = vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
174047
|
-
|
|
174111
|
+
logger183.info(
|
|
174048
174112
|
`Valetudo vacuum: Using mqtt.publish segment_cleanup for rooms: ${roomIds.join(", ")}`
|
|
174049
174113
|
);
|
|
174050
174114
|
return {
|
|
@@ -174064,7 +174128,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174064
174128
|
if (targetMapName) {
|
|
174065
174129
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
174066
174130
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
174067
|
-
|
|
174131
|
+
logger183.info(
|
|
174068
174132
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
174069
174133
|
);
|
|
174070
174134
|
homeAssistant.callAction({
|
|
@@ -174091,7 +174155,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174091
174155
|
}
|
|
174092
174156
|
if (isEcovacsVacuum(attributes7)) {
|
|
174093
174157
|
const roomIdStr = roomIds.join(",");
|
|
174094
|
-
|
|
174158
|
+
logger183.info(
|
|
174095
174159
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
174096
174160
|
);
|
|
174097
174161
|
return {
|
|
@@ -174106,14 +174170,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
174106
174170
|
}
|
|
174107
174171
|
};
|
|
174108
174172
|
}
|
|
174109
|
-
|
|
174173
|
+
logger183.warn(
|
|
174110
174174
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
174111
174175
|
);
|
|
174112
174176
|
}
|
|
174113
174177
|
}
|
|
174114
174178
|
} catch {
|
|
174115
174179
|
}
|
|
174116
|
-
|
|
174180
|
+
logger183.info("Starting regular cleaning (no areas selected)");
|
|
174117
174181
|
return { action: "vacuum.start" };
|
|
174118
174182
|
},
|
|
174119
174183
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -174128,7 +174192,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174128
174192
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
174129
174193
|
const entity = homeAssistant.entity;
|
|
174130
174194
|
const attributes7 = entity.state.attributes;
|
|
174131
|
-
|
|
174195
|
+
logger183.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
174132
174196
|
const customAreas = homeAssistant.state.mapping?.customServiceAreas;
|
|
174133
174197
|
if (customAreas && customAreas.length > 0) {
|
|
174134
174198
|
const sorted = [...customAreas].sort(
|
|
@@ -174137,7 +174201,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174137
174201
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
174138
174202
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
174139
174203
|
const area = sorted[areaIndex];
|
|
174140
|
-
|
|
174204
|
+
logger183.info(
|
|
174141
174205
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
174142
174206
|
);
|
|
174143
174207
|
return {
|
|
@@ -174149,7 +174213,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174149
174213
|
}
|
|
174150
174214
|
const rooms = parseVacuumRooms(attributes7);
|
|
174151
174215
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
174152
|
-
|
|
174216
|
+
logger183.info(
|
|
174153
174217
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
174154
174218
|
);
|
|
174155
174219
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -174158,7 +174222,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174158
174222
|
const vacuumEntityId = entity.entity_id;
|
|
174159
174223
|
if (vacuumEntityId.startsWith("vacuum.valetudo_")) {
|
|
174160
174224
|
const identifier = vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
174161
|
-
|
|
174225
|
+
logger183.info(
|
|
174162
174226
|
`Valetudo vacuum: Using mqtt.publish segment_cleanup for room ${room.name} (id: ${commandId3})`
|
|
174163
174227
|
);
|
|
174164
174228
|
return {
|
|
@@ -174178,7 +174242,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174178
174242
|
if (room.mapName) {
|
|
174179
174243
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
174180
174244
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
174181
|
-
|
|
174245
|
+
logger183.info(
|
|
174182
174246
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
174183
174247
|
);
|
|
174184
174248
|
homeAssistant.callAction({
|
|
@@ -174187,7 +174251,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174187
174251
|
data: { option: room.mapName }
|
|
174188
174252
|
});
|
|
174189
174253
|
}
|
|
174190
|
-
|
|
174254
|
+
logger183.debug(
|
|
174191
174255
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
174192
174256
|
);
|
|
174193
174257
|
return {
|
|
@@ -174198,7 +174262,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174198
174262
|
};
|
|
174199
174263
|
}
|
|
174200
174264
|
if (isRoborockVacuum(attributes7) || isXiaomiMiotVacuum(attributes7)) {
|
|
174201
|
-
|
|
174265
|
+
logger183.debug(
|
|
174202
174266
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
174203
174267
|
);
|
|
174204
174268
|
return {
|
|
@@ -174211,7 +174275,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174211
174275
|
}
|
|
174212
174276
|
if (isEcovacsVacuum(attributes7)) {
|
|
174213
174277
|
const roomIdStr = String(commandId3);
|
|
174214
|
-
|
|
174278
|
+
logger183.info(
|
|
174215
174279
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
174216
174280
|
);
|
|
174217
174281
|
return {
|
|
@@ -174226,7 +174290,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
174226
174290
|
}
|
|
174227
174291
|
};
|
|
174228
174292
|
}
|
|
174229
|
-
|
|
174293
|
+
logger183.warn(
|
|
174230
174294
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
174231
174295
|
);
|
|
174232
174296
|
}
|
|
@@ -174242,20 +174306,20 @@ function createVacuumRvcRunModeServer(attributes7, includeUnnamedRooms = false,
|
|
|
174242
174306
|
includeUnnamedRooms,
|
|
174243
174307
|
customAreas
|
|
174244
174308
|
);
|
|
174245
|
-
|
|
174309
|
+
logger183.info(
|
|
174246
174310
|
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
|
|
174247
174311
|
);
|
|
174248
174312
|
if (rooms.length > 0) {
|
|
174249
|
-
|
|
174313
|
+
logger183.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
174250
174314
|
}
|
|
174251
174315
|
if (filteredCount > 0) {
|
|
174252
174316
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
174253
|
-
|
|
174317
|
+
logger183.info(
|
|
174254
174318
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
174255
174319
|
);
|
|
174256
174320
|
}
|
|
174257
174321
|
if (allRooms.length === 0) {
|
|
174258
|
-
|
|
174322
|
+
logger183.debug(
|
|
174259
174323
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes7.rooms)}, segments=${JSON.stringify(attributes7.segments)}, room_list=${attributes7.room_list}`
|
|
174260
174324
|
);
|
|
174261
174325
|
}
|
|
@@ -174313,7 +174377,7 @@ init_rvc_clean_mode();
|
|
|
174313
174377
|
|
|
174314
174378
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
174315
174379
|
init_home_assistant_entity_behavior();
|
|
174316
|
-
var
|
|
174380
|
+
var logger184 = Logger.get("RvcCleanModeServerBase");
|
|
174317
174381
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
174318
174382
|
// Pending mode from a recent changeToMode command.
|
|
174319
174383
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -174356,14 +174420,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
174356
174420
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
174357
174421
|
const { newMode } = request;
|
|
174358
174422
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
174359
|
-
|
|
174423
|
+
logger184.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
174360
174424
|
return {
|
|
174361
174425
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
174362
174426
|
statusText: `Unsupported mode: ${newMode}`
|
|
174363
174427
|
};
|
|
174364
174428
|
}
|
|
174365
174429
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
174366
|
-
|
|
174430
|
+
logger184.info(
|
|
174367
174431
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
174368
174432
|
);
|
|
174369
174433
|
this.pendingMode = newMode;
|
|
@@ -174371,7 +174435,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
174371
174435
|
this.state.currentMode = newMode;
|
|
174372
174436
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
174373
174437
|
if (action) {
|
|
174374
|
-
|
|
174438
|
+
logger184.info(
|
|
174375
174439
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
174376
174440
|
);
|
|
174377
174441
|
homeAssistant.callAction(action);
|
|
@@ -174404,7 +174468,7 @@ function RvcCleanModeServer2(config10, initialState) {
|
|
|
174404
174468
|
}
|
|
174405
174469
|
|
|
174406
174470
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
174407
|
-
var
|
|
174471
|
+
var logger185 = Logger.get("VacuumRvcCleanModeServer");
|
|
174408
174472
|
var MODE_VACUUM = 0;
|
|
174409
174473
|
var MODE_VACUUM_AND_MOP = 1;
|
|
174410
174474
|
var MODE_MOP = 2;
|
|
@@ -174703,7 +174767,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
174703
174767
|
if (match) return match;
|
|
174704
174768
|
}
|
|
174705
174769
|
}
|
|
174706
|
-
|
|
174770
|
+
logger185.warn(
|
|
174707
174771
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
174708
174772
|
);
|
|
174709
174773
|
return aliases[0];
|
|
@@ -174712,7 +174776,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
174712
174776
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
174713
174777
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
174714
174778
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
174715
|
-
|
|
174779
|
+
logger185.info(
|
|
174716
174780
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
174717
174781
|
);
|
|
174718
174782
|
return {
|
|
@@ -174801,7 +174865,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174801
174865
|
}
|
|
174802
174866
|
}
|
|
174803
174867
|
if (speedMode !== void 0) {
|
|
174804
|
-
|
|
174868
|
+
logger185.debug(
|
|
174805
174869
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
174806
174870
|
);
|
|
174807
174871
|
return speedMode;
|
|
@@ -174822,7 +174886,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174822
174886
|
}
|
|
174823
174887
|
}
|
|
174824
174888
|
if (mopMode !== void 0) {
|
|
174825
|
-
|
|
174889
|
+
logger185.debug(
|
|
174826
174890
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
174827
174891
|
);
|
|
174828
174892
|
return mopMode;
|
|
@@ -174840,14 +174904,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174840
174904
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
174841
174905
|
const vacuumEntityId = homeAssistant.entityId;
|
|
174842
174906
|
const mapping = homeAssistant.state.mapping;
|
|
174843
|
-
|
|
174907
|
+
logger185.info(
|
|
174844
174908
|
`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 ?? {})}`
|
|
174845
174909
|
);
|
|
174846
174910
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
174847
174911
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
174848
174912
|
const mopName = mopIntensityList[mopIndex];
|
|
174849
174913
|
if (!mopName) {
|
|
174850
|
-
|
|
174914
|
+
logger185.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
174851
174915
|
return void 0;
|
|
174852
174916
|
}
|
|
174853
174917
|
if (hasCleanTypes) {
|
|
@@ -174860,18 +174924,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174860
174924
|
mapping.mopIntensityEntity,
|
|
174861
174925
|
agent
|
|
174862
174926
|
);
|
|
174863
|
-
|
|
174927
|
+
logger185.info(
|
|
174864
174928
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
174865
174929
|
);
|
|
174866
174930
|
let option = matchMopIntensityOption(mopName, options);
|
|
174867
174931
|
if (!option && options && mopIndex < options.length) {
|
|
174868
174932
|
option = options[mopIndex];
|
|
174869
|
-
|
|
174933
|
+
logger185.info(
|
|
174870
174934
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
174871
174935
|
);
|
|
174872
174936
|
}
|
|
174873
174937
|
if (option) {
|
|
174874
|
-
|
|
174938
|
+
logger185.info(
|
|
174875
174939
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
174876
174940
|
);
|
|
174877
174941
|
return {
|
|
@@ -174880,11 +174944,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174880
174944
|
target: mapping.mopIntensityEntity
|
|
174881
174945
|
};
|
|
174882
174946
|
}
|
|
174883
|
-
|
|
174947
|
+
logger185.warn(
|
|
174884
174948
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
174885
174949
|
);
|
|
174886
174950
|
} else {
|
|
174887
|
-
|
|
174951
|
+
logger185.warn(
|
|
174888
174952
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
174889
174953
|
);
|
|
174890
174954
|
}
|
|
@@ -174894,7 +174958,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174894
174958
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
174895
174959
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
174896
174960
|
if (!fanSpeedName) {
|
|
174897
|
-
|
|
174961
|
+
logger185.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
174898
174962
|
return void 0;
|
|
174899
174963
|
}
|
|
174900
174964
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -174907,7 +174971,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174907
174971
|
mapping.suctionLevelEntity,
|
|
174908
174972
|
agent
|
|
174909
174973
|
);
|
|
174910
|
-
|
|
174974
|
+
logger185.info(
|
|
174911
174975
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
174912
174976
|
);
|
|
174913
174977
|
let option = matchFanSpeedOption(
|
|
@@ -174917,12 +174981,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174917
174981
|
);
|
|
174918
174982
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
174919
174983
|
option = options[fanSpeedIndex];
|
|
174920
|
-
|
|
174984
|
+
logger185.info(
|
|
174921
174985
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
174922
174986
|
);
|
|
174923
174987
|
}
|
|
174924
174988
|
if (option) {
|
|
174925
|
-
|
|
174989
|
+
logger185.info(
|
|
174926
174990
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
174927
174991
|
);
|
|
174928
174992
|
return {
|
|
@@ -174931,7 +174995,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174931
174995
|
target: mapping.suctionLevelEntity
|
|
174932
174996
|
};
|
|
174933
174997
|
}
|
|
174934
|
-
|
|
174998
|
+
logger185.warn(
|
|
174935
174999
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
174936
175000
|
);
|
|
174937
175001
|
return void 0;
|
|
@@ -174941,7 +175005,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174941
175005
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
174942
175006
|
);
|
|
174943
175007
|
}
|
|
174944
|
-
|
|
175008
|
+
logger185.info(
|
|
174945
175009
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
174946
175010
|
);
|
|
174947
175011
|
return {
|
|
@@ -174951,7 +175015,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174951
175015
|
};
|
|
174952
175016
|
}
|
|
174953
175017
|
if (!hasCleanTypes) {
|
|
174954
|
-
|
|
175018
|
+
logger185.debug(
|
|
174955
175019
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
174956
175020
|
);
|
|
174957
175021
|
return void 0;
|
|
@@ -174963,7 +175027,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
174963
175027
|
agent
|
|
174964
175028
|
);
|
|
174965
175029
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
174966
|
-
|
|
175030
|
+
logger185.info(
|
|
174967
175031
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
174968
175032
|
);
|
|
174969
175033
|
return {
|
|
@@ -174981,10 +175045,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
174981
175045
|
cleaningModeOptions,
|
|
174982
175046
|
customFanSpeedTags
|
|
174983
175047
|
);
|
|
174984
|
-
|
|
175048
|
+
logger185.info(
|
|
174985
175049
|
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
174986
175050
|
);
|
|
174987
|
-
|
|
175051
|
+
logger185.info(
|
|
174988
175052
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
174989
175053
|
);
|
|
174990
175054
|
const initialState = {
|
|
@@ -175062,7 +175126,7 @@ init_rvc_operational_state();
|
|
|
175062
175126
|
init_home_assistant_entity_behavior();
|
|
175063
175127
|
var OperationalState4 = RvcOperationalState3.OperationalState;
|
|
175064
175128
|
var ErrorState = RvcOperationalState3.ErrorState;
|
|
175065
|
-
var
|
|
175129
|
+
var logger186 = Logger.get("RvcOperationalStateServer");
|
|
175066
175130
|
var activeStates = /* @__PURE__ */ new Set([
|
|
175067
175131
|
OperationalState4.Running,
|
|
175068
175132
|
OperationalState4.SeekingCharger
|
|
@@ -175104,7 +175168,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
175104
175168
|
}
|
|
175105
175169
|
});
|
|
175106
175170
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
175107
|
-
|
|
175171
|
+
logger186.info(
|
|
175108
175172
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
175109
175173
|
);
|
|
175110
175174
|
try {
|
|
@@ -175117,7 +175181,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
175117
175181
|
this.context
|
|
175118
175182
|
);
|
|
175119
175183
|
} catch (e) {
|
|
175120
|
-
|
|
175184
|
+
logger186.debug("Failed to emit operationCompletion event:", e);
|
|
175121
175185
|
}
|
|
175122
175186
|
}
|
|
175123
175187
|
}
|
|
@@ -175152,7 +175216,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
175152
175216
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
175153
175217
|
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
175154
175218
|
} else {
|
|
175155
|
-
|
|
175219
|
+
logger186.warn("GoHome command received but no goHome action configured");
|
|
175156
175220
|
}
|
|
175157
175221
|
return {
|
|
175158
175222
|
commandResponseState: {
|
|
@@ -175172,7 +175236,7 @@ function RvcOperationalStateServer2(config10) {
|
|
|
175172
175236
|
}
|
|
175173
175237
|
|
|
175174
175238
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
|
|
175175
|
-
var
|
|
175239
|
+
var logger187 = Logger.get("VacuumRvcOperationalStateServer");
|
|
175176
175240
|
function isCharging(entity) {
|
|
175177
175241
|
const attrs = entity.attributes;
|
|
175178
175242
|
if (attrs.battery_icon?.includes("charging")) return true;
|
|
@@ -175214,16 +175278,16 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
175214
175278
|
operationalState = RvcOperationalState3.OperationalState.Error;
|
|
175215
175279
|
} else {
|
|
175216
175280
|
if (state.toLowerCase().includes("clean")) {
|
|
175217
|
-
|
|
175281
|
+
logger187.info(
|
|
175218
175282
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
175219
175283
|
);
|
|
175220
175284
|
operationalState = RvcOperationalState3.OperationalState.Running;
|
|
175221
175285
|
} else {
|
|
175222
|
-
|
|
175286
|
+
logger187.info(`Unknown vacuum state "${state}", treating as Paused`);
|
|
175223
175287
|
operationalState = RvcOperationalState3.OperationalState.Paused;
|
|
175224
175288
|
}
|
|
175225
175289
|
}
|
|
175226
|
-
|
|
175290
|
+
logger187.debug(
|
|
175227
175291
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
|
|
175228
175292
|
);
|
|
175229
175293
|
return operationalState;
|
|
@@ -175244,7 +175308,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
175244
175308
|
});
|
|
175245
175309
|
|
|
175246
175310
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
175247
|
-
var
|
|
175311
|
+
var logger188 = Logger.get("VacuumDevice");
|
|
175248
175312
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
175249
175313
|
BasicInformationServer2,
|
|
175250
175314
|
VacuumIdentifyServer,
|
|
@@ -175258,7 +175322,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
175258
175322
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
175259
175323
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
175260
175324
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
175261
|
-
|
|
175325
|
+
logger188.info(
|
|
175262
175326
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
175263
175327
|
);
|
|
175264
175328
|
let device = VacuumEndpointType.with(
|
|
@@ -175269,7 +175333,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
175269
175333
|
)
|
|
175270
175334
|
).set({ homeAssistantEntity });
|
|
175271
175335
|
if (includeOnOff) {
|
|
175272
|
-
|
|
175336
|
+
logger188.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
175273
175337
|
device = device.with(VacuumOnOffServer);
|
|
175274
175338
|
}
|
|
175275
175339
|
if (!minimalClusters) {
|
|
@@ -175277,24 +175341,24 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
175277
175341
|
}
|
|
175278
175342
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
175279
175343
|
const rooms = parseVacuumRooms(attributes7);
|
|
175280
|
-
|
|
175344
|
+
logger188.info(
|
|
175281
175345
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}`
|
|
175282
175346
|
);
|
|
175283
175347
|
if (customAreas && customAreas.length > 0) {
|
|
175284
|
-
|
|
175348
|
+
logger188.info(
|
|
175285
175349
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
175286
175350
|
);
|
|
175287
175351
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
175288
175352
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
175289
|
-
|
|
175353
|
+
logger188.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
175290
175354
|
device = device.with(
|
|
175291
175355
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
175292
175356
|
);
|
|
175293
175357
|
} else if (!minimalClusters) {
|
|
175294
|
-
|
|
175358
|
+
logger188.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
175295
175359
|
device = device.with(createDefaultServiceAreaServer());
|
|
175296
175360
|
} else {
|
|
175297
|
-
|
|
175361
|
+
logger188.info(`${entityId}: Skipping ServiceArea (minimal clusters mode)`);
|
|
175298
175362
|
}
|
|
175299
175363
|
const fanSpeedList = resolveFanSpeedList(
|
|
175300
175364
|
attributes7,
|
|
@@ -175304,7 +175368,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
175304
175368
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
175305
175369
|
);
|
|
175306
175370
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
175307
|
-
|
|
175371
|
+
logger188.info(
|
|
175308
175372
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
175309
175373
|
);
|
|
175310
175374
|
device = device.with(
|
|
@@ -175317,7 +175381,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
175317
175381
|
)
|
|
175318
175382
|
);
|
|
175319
175383
|
} else {
|
|
175320
|
-
|
|
175384
|
+
logger188.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
175321
175385
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
175322
175386
|
}
|
|
175323
175387
|
return device;
|
|
@@ -175472,7 +175536,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
175472
175536
|
);
|
|
175473
175537
|
|
|
175474
175538
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
175475
|
-
var
|
|
175539
|
+
var logger189 = Logger.get("WaterHeaterDevice");
|
|
175476
175540
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
175477
175541
|
BasicInformationServer2,
|
|
175478
175542
|
IdentifyServer2,
|
|
@@ -175488,7 +175552,7 @@ function toMatterTemp2(value) {
|
|
|
175488
175552
|
}
|
|
175489
175553
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
175490
175554
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
175491
|
-
|
|
175555
|
+
logger189.debug(
|
|
175492
175556
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes7.min_temp}, max_temp=${attributes7.max_temp}`
|
|
175493
175557
|
);
|
|
175494
175558
|
const minLimit = toMatterTemp2(attributes7.min_temp) ?? 0;
|
|
@@ -175661,6 +175725,9 @@ var matterDeviceTypeFactories = {
|
|
|
175661
175725
|
mode_select: SelectDevice,
|
|
175662
175726
|
water_valve: ValveDevice,
|
|
175663
175727
|
pump: PumpEndpoint,
|
|
175728
|
+
rain_sensor: (ha) => RainSensorType.set({
|
|
175729
|
+
homeAssistantEntity: { entity: ha.entity, customName: ha.customName }
|
|
175730
|
+
}),
|
|
175664
175731
|
water_heater: WaterHeaterDevice,
|
|
175665
175732
|
generic_switch: EventDevice,
|
|
175666
175733
|
smoke_co_alarm: (ha) => SmokeAlarmType.set({
|
|
@@ -175675,7 +175742,7 @@ var matterDeviceTypeFactories = {
|
|
|
175675
175742
|
};
|
|
175676
175743
|
|
|
175677
175744
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
175678
|
-
var
|
|
175745
|
+
var logger190 = Logger.get("LegacyEndpoint");
|
|
175679
175746
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
175680
175747
|
static async create(registry2, entityId, mapping) {
|
|
175681
175748
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -175685,25 +175752,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175685
175752
|
return;
|
|
175686
175753
|
}
|
|
175687
175754
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
175688
|
-
|
|
175755
|
+
logger190.debug(
|
|
175689
175756
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
175690
175757
|
);
|
|
175691
175758
|
return;
|
|
175692
175759
|
}
|
|
175693
175760
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
175694
|
-
|
|
175761
|
+
logger190.debug(
|
|
175695
175762
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
175696
175763
|
);
|
|
175697
175764
|
return;
|
|
175698
175765
|
}
|
|
175699
175766
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
175700
|
-
|
|
175767
|
+
logger190.debug(
|
|
175701
175768
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
175702
175769
|
);
|
|
175703
175770
|
return;
|
|
175704
175771
|
}
|
|
175705
175772
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
175706
|
-
|
|
175773
|
+
logger190.debug(
|
|
175707
175774
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
175708
175775
|
);
|
|
175709
175776
|
return;
|
|
@@ -175723,7 +175790,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175723
175790
|
humidityEntity: humidityEntityId
|
|
175724
175791
|
};
|
|
175725
175792
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
175726
|
-
|
|
175793
|
+
logger190.debug(
|
|
175727
175794
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
175728
175795
|
);
|
|
175729
175796
|
}
|
|
@@ -175742,7 +175809,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175742
175809
|
pressureEntity: pressureEntityId
|
|
175743
175810
|
};
|
|
175744
175811
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
175745
|
-
|
|
175812
|
+
logger190.debug(
|
|
175746
175813
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
175747
175814
|
);
|
|
175748
175815
|
}
|
|
@@ -175759,7 +175826,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175759
175826
|
batteryEntity: batteryEntityId
|
|
175760
175827
|
};
|
|
175761
175828
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
175762
|
-
|
|
175829
|
+
logger190.debug(
|
|
175763
175830
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
175764
175831
|
);
|
|
175765
175832
|
}
|
|
@@ -175777,7 +175844,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175777
175844
|
powerEntity: powerEntityId
|
|
175778
175845
|
};
|
|
175779
175846
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
175780
|
-
|
|
175847
|
+
logger190.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
175781
175848
|
}
|
|
175782
175849
|
}
|
|
175783
175850
|
}
|
|
@@ -175794,7 +175861,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175794
175861
|
energyEntity: energyEntityId
|
|
175795
175862
|
};
|
|
175796
175863
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
175797
|
-
|
|
175864
|
+
logger190.debug(
|
|
175798
175865
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
175799
175866
|
);
|
|
175800
175867
|
}
|
|
@@ -175810,7 +175877,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175810
175877
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
175811
175878
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
175812
175879
|
};
|
|
175813
|
-
|
|
175880
|
+
logger190.debug(
|
|
175814
175881
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
175815
175882
|
);
|
|
175816
175883
|
}
|
|
@@ -175820,7 +175887,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175820
175887
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
175821
175888
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
175822
175889
|
};
|
|
175823
|
-
|
|
175890
|
+
logger190.debug(
|
|
175824
175891
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
175825
175892
|
);
|
|
175826
175893
|
}
|
|
@@ -175830,7 +175897,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175830
175897
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
175831
175898
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
175832
175899
|
};
|
|
175833
|
-
|
|
175900
|
+
logger190.debug(
|
|
175834
175901
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
175835
175902
|
);
|
|
175836
175903
|
}
|
|
@@ -175851,7 +175918,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175851
175918
|
rooms: roomsObj
|
|
175852
175919
|
}
|
|
175853
175920
|
};
|
|
175854
|
-
|
|
175921
|
+
logger190.debug(
|
|
175855
175922
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
175856
175923
|
);
|
|
175857
175924
|
} else {
|
|
@@ -175868,7 +175935,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175868
175935
|
rooms: roomsObj
|
|
175869
175936
|
}
|
|
175870
175937
|
};
|
|
175871
|
-
|
|
175938
|
+
logger190.debug(
|
|
175872
175939
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
175873
175940
|
);
|
|
175874
175941
|
}
|
|
@@ -175970,11 +176037,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
175970
176037
|
return;
|
|
175971
176038
|
}
|
|
175972
176039
|
if (mappedChanged) {
|
|
175973
|
-
|
|
176040
|
+
logger190.debug(
|
|
175974
176041
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
175975
176042
|
);
|
|
175976
176043
|
}
|
|
175977
|
-
|
|
176044
|
+
logger190.debug(
|
|
175978
176045
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
175979
176046
|
);
|
|
175980
176047
|
this.lastState = state;
|
|
@@ -176013,7 +176080,7 @@ import {
|
|
|
176013
176080
|
getCollection
|
|
176014
176081
|
} from "home-assistant-js-websocket";
|
|
176015
176082
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
176016
|
-
var
|
|
176083
|
+
var logger191 = Logger.get("SubscribeEntities");
|
|
176017
176084
|
function processEvent(store, updates) {
|
|
176018
176085
|
const state = { ...store.state };
|
|
176019
176086
|
if (updates.a) {
|
|
@@ -176039,7 +176106,7 @@ function processEvent(store, updates) {
|
|
|
176039
176106
|
for (const entityId in updates.c) {
|
|
176040
176107
|
let entityState = state[entityId];
|
|
176041
176108
|
if (!entityState) {
|
|
176042
|
-
|
|
176109
|
+
logger191.warn("Received state update for unknown entity", entityId);
|
|
176043
176110
|
continue;
|
|
176044
176111
|
}
|
|
176045
176112
|
entityState = { ...entityState };
|
|
@@ -176109,7 +176176,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
|
|
|
176109
176176
|
|
|
176110
176177
|
// src/services/bridges/entity-isolation-service.ts
|
|
176111
176178
|
init_esm();
|
|
176112
|
-
var
|
|
176179
|
+
var logger192 = Logger.get("EntityIsolation");
|
|
176113
176180
|
var EntityIsolationServiceImpl = class {
|
|
176114
176181
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
176115
176182
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -176138,24 +176205,49 @@ var EntityIsolationServiceImpl = class {
|
|
|
176138
176205
|
}
|
|
176139
176206
|
return null;
|
|
176140
176207
|
}
|
|
176208
|
+
classifyError(msg) {
|
|
176209
|
+
if (msg.includes("Invalid intervalMs")) {
|
|
176210
|
+
return "Subscription timing error (Invalid intervalMs)";
|
|
176211
|
+
}
|
|
176212
|
+
if (msg.includes("Behaviors have errors")) {
|
|
176213
|
+
return "Behavior initialization failure";
|
|
176214
|
+
}
|
|
176215
|
+
if (msg.includes("TransactionDestroyedError")) {
|
|
176216
|
+
return "Transaction destroyed during operation";
|
|
176217
|
+
}
|
|
176218
|
+
if (msg.includes("DestroyedDependencyError")) {
|
|
176219
|
+
return "Dependency destroyed during operation";
|
|
176220
|
+
}
|
|
176221
|
+
if (msg.includes("UninitializedDependencyError")) {
|
|
176222
|
+
return "Uninitialized dependency access";
|
|
176223
|
+
}
|
|
176224
|
+
if (msg.includes("Endpoint storage inaccessible")) {
|
|
176225
|
+
return "Endpoint storage inaccessible";
|
|
176226
|
+
}
|
|
176227
|
+
if (msg.includes("aggregator.")) {
|
|
176228
|
+
return "Runtime error in endpoint";
|
|
176229
|
+
}
|
|
176230
|
+
return null;
|
|
176231
|
+
}
|
|
176141
176232
|
/**
|
|
176142
176233
|
* Attempt to isolate an entity based on an error.
|
|
176143
176234
|
* Returns true if the entity was successfully identified and isolation was triggered.
|
|
176144
176235
|
*/
|
|
176145
176236
|
async isolateFromError(error) {
|
|
176146
176237
|
const msg = error instanceof Error ? error.message : String(error);
|
|
176147
|
-
|
|
176238
|
+
const classification = this.classifyError(msg);
|
|
176239
|
+
if (!classification) {
|
|
176148
176240
|
return false;
|
|
176149
176241
|
}
|
|
176150
176242
|
const parsed = this.parseEndpointPath(msg);
|
|
176151
176243
|
if (!parsed) {
|
|
176152
|
-
|
|
176244
|
+
logger192.warn("Could not parse entity from error:", msg);
|
|
176153
176245
|
return false;
|
|
176154
176246
|
}
|
|
176155
176247
|
const { bridgeId, entityName } = parsed;
|
|
176156
176248
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
176157
176249
|
if (!callback) {
|
|
176158
|
-
|
|
176250
|
+
logger192.warn(
|
|
176159
176251
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
176160
176252
|
);
|
|
176161
176253
|
return false;
|
|
@@ -176164,16 +176256,16 @@ var EntityIsolationServiceImpl = class {
|
|
|
176164
176256
|
if (this.isolatedEntities.has(key)) {
|
|
176165
176257
|
return true;
|
|
176166
176258
|
}
|
|
176167
|
-
const reason =
|
|
176259
|
+
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
176168
176260
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
176169
|
-
|
|
176261
|
+
logger192.warn(
|
|
176170
176262
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
176171
176263
|
);
|
|
176172
176264
|
try {
|
|
176173
176265
|
await callback(entityName);
|
|
176174
176266
|
return true;
|
|
176175
176267
|
} catch (e) {
|
|
176176
|
-
|
|
176268
|
+
logger192.error(`Failed to isolate entity ${entityName}:`, e);
|
|
176177
176269
|
return false;
|
|
176178
176270
|
}
|
|
176179
176271
|
}
|
|
@@ -177039,11 +177131,11 @@ var BridgeRegistry = class _BridgeRegistry {
|
|
|
177039
177131
|
init_dist();
|
|
177040
177132
|
var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
|
|
177041
177133
|
var ServerModeBridge = class {
|
|
177042
|
-
constructor(
|
|
177134
|
+
constructor(logger195, dataProvider, endpointManager, server) {
|
|
177043
177135
|
this.dataProvider = dataProvider;
|
|
177044
177136
|
this.endpointManager = endpointManager;
|
|
177045
177137
|
this.server = server;
|
|
177046
|
-
this.log =
|
|
177138
|
+
this.log = logger195.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
177047
177139
|
}
|
|
177048
177140
|
log;
|
|
177049
177141
|
status = {
|
|
@@ -177445,7 +177537,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
177445
177537
|
}
|
|
177446
177538
|
|
|
177447
177539
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
177448
|
-
var
|
|
177540
|
+
var logger193 = Logger.get("ServerModeVacuumEndpoint");
|
|
177449
177541
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
177450
177542
|
static async create(registry2, entityId, mapping) {
|
|
177451
177543
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -177455,7 +177547,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
177455
177547
|
return void 0;
|
|
177456
177548
|
}
|
|
177457
177549
|
let effectiveMapping = mapping;
|
|
177458
|
-
|
|
177550
|
+
logger193.info(
|
|
177459
177551
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
177460
177552
|
);
|
|
177461
177553
|
if (entity.device_id) {
|
|
@@ -177470,9 +177562,9 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
177470
177562
|
batteryEntity: batteryEntityId
|
|
177471
177563
|
};
|
|
177472
177564
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
177473
|
-
|
|
177565
|
+
logger193.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
177474
177566
|
} else {
|
|
177475
|
-
|
|
177567
|
+
logger193.warn(
|
|
177476
177568
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
177477
177569
|
);
|
|
177478
177570
|
}
|
|
@@ -177486,7 +177578,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
177486
177578
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
177487
177579
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
177488
177580
|
};
|
|
177489
|
-
|
|
177581
|
+
logger193.info(
|
|
177490
177582
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
177491
177583
|
);
|
|
177492
177584
|
}
|
|
@@ -177496,7 +177588,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
177496
177588
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
177497
177589
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
177498
177590
|
};
|
|
177499
|
-
|
|
177591
|
+
logger193.info(
|
|
177500
177592
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
177501
177593
|
);
|
|
177502
177594
|
}
|
|
@@ -177506,7 +177598,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
177506
177598
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
177507
177599
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
177508
177600
|
};
|
|
177509
|
-
|
|
177601
|
+
logger193.info(
|
|
177510
177602
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
177511
177603
|
);
|
|
177512
177604
|
}
|
|
@@ -177527,7 +177619,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
177527
177619
|
rooms: roomsObj
|
|
177528
177620
|
}
|
|
177529
177621
|
};
|
|
177530
|
-
|
|
177622
|
+
logger193.info(
|
|
177531
177623
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
177532
177624
|
);
|
|
177533
177625
|
} else {
|
|
@@ -177544,14 +177636,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
177544
177636
|
rooms: roomsObj
|
|
177545
177637
|
}
|
|
177546
177638
|
};
|
|
177547
|
-
|
|
177639
|
+
logger193.info(
|
|
177548
177640
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
177549
177641
|
);
|
|
177550
177642
|
}
|
|
177551
177643
|
}
|
|
177552
177644
|
}
|
|
177553
177645
|
} else {
|
|
177554
|
-
|
|
177646
|
+
logger193.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
|
|
177555
177647
|
}
|
|
177556
177648
|
const payload = {
|
|
177557
177649
|
entity_id: entityId,
|
|
@@ -177614,11 +177706,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
177614
177706
|
return;
|
|
177615
177707
|
}
|
|
177616
177708
|
if (mappedChanged) {
|
|
177617
|
-
|
|
177709
|
+
logger193.debug(
|
|
177618
177710
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
177619
177711
|
);
|
|
177620
177712
|
}
|
|
177621
|
-
|
|
177713
|
+
logger193.debug(
|
|
177622
177714
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
177623
177715
|
);
|
|
177624
177716
|
this.lastState = state;
|
|
@@ -178008,10 +178100,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
178008
178100
|
// src/core/ioc/app-environment.ts
|
|
178009
178101
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
178010
178102
|
constructor(rootEnv, options) {
|
|
178011
|
-
const
|
|
178103
|
+
const logger195 = rootEnv.get(LoggerService);
|
|
178012
178104
|
super({
|
|
178013
178105
|
id: "App",
|
|
178014
|
-
log:
|
|
178106
|
+
log: logger195.get("AppContainer"),
|
|
178015
178107
|
parent: rootEnv
|
|
178016
178108
|
});
|
|
178017
178109
|
this.options = options;
|
|
@@ -178024,8 +178116,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
178024
178116
|
}
|
|
178025
178117
|
construction;
|
|
178026
178118
|
async init() {
|
|
178027
|
-
const
|
|
178028
|
-
this.set(LoggerService,
|
|
178119
|
+
const logger195 = this.get(LoggerService);
|
|
178120
|
+
this.set(LoggerService, logger195);
|
|
178029
178121
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
178030
178122
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
178031
178123
|
this.set(
|
|
@@ -178042,7 +178134,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
178042
178134
|
);
|
|
178043
178135
|
this.set(
|
|
178044
178136
|
HomeAssistantClient,
|
|
178045
|
-
new HomeAssistantClient(
|
|
178137
|
+
new HomeAssistantClient(logger195, this.options.homeAssistant)
|
|
178046
178138
|
);
|
|
178047
178139
|
this.set(
|
|
178048
178140
|
HomeAssistantConfig,
|
|
@@ -178050,7 +178142,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
178050
178142
|
);
|
|
178051
178143
|
this.set(
|
|
178052
178144
|
HomeAssistantActions,
|
|
178053
|
-
new HomeAssistantActions(
|
|
178145
|
+
new HomeAssistantActions(logger195, await this.load(HomeAssistantClient))
|
|
178054
178146
|
);
|
|
178055
178147
|
this.set(
|
|
178056
178148
|
HomeAssistantRegistry,
|
|
@@ -178071,7 +178163,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
178071
178163
|
this.set(
|
|
178072
178164
|
WebApi,
|
|
178073
178165
|
new WebApi(
|
|
178074
|
-
|
|
178166
|
+
logger195,
|
|
178075
178167
|
await this.load(BridgeService),
|
|
178076
178168
|
await this.load(HomeAssistantClient),
|
|
178077
178169
|
await this.load(HomeAssistantRegistry),
|
|
@@ -178096,7 +178188,7 @@ init_nodejs();
|
|
|
178096
178188
|
init_level_control();
|
|
178097
178189
|
|
|
178098
178190
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
178099
|
-
var
|
|
178191
|
+
var logger194 = Logger.get("PatchLevelControlTlv");
|
|
178100
178192
|
function patchLevelControlTlv() {
|
|
178101
178193
|
let patched = 0;
|
|
178102
178194
|
const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
|
|
@@ -178110,11 +178202,11 @@ function patchLevelControlTlv() {
|
|
|
178110
178202
|
patched++;
|
|
178111
178203
|
}
|
|
178112
178204
|
if (patched > 0) {
|
|
178113
|
-
|
|
178205
|
+
logger194.info(
|
|
178114
178206
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
178115
178207
|
);
|
|
178116
178208
|
} else {
|
|
178117
|
-
|
|
178209
|
+
logger194.warn(
|
|
178118
178210
|
"Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
|
|
178119
178211
|
);
|
|
178120
178212
|
}
|
|
@@ -178139,7 +178231,7 @@ function shouldSuppressError(error) {
|
|
|
178139
178231
|
}
|
|
178140
178232
|
function isIsolatableError(error) {
|
|
178141
178233
|
const msg = error instanceof Error ? error.message : String(error);
|
|
178142
|
-
return msg.includes("Invalid intervalMs") || msg.includes("aggregator.");
|
|
178234
|
+
return msg.includes("Invalid intervalMs") || msg.includes("Behaviors have errors") || msg.includes("TransactionDestroyedError") || msg.includes("DestroyedDependencyError") || msg.includes("UninitializedDependencyError") || msg.includes("Endpoint storage inaccessible") || msg.includes("aggregator.");
|
|
178143
178235
|
}
|
|
178144
178236
|
process.on("uncaughtException", (error) => {
|
|
178145
178237
|
if (shouldSuppressError(error)) {
|
|
@@ -178199,6 +178291,23 @@ async function startHandler(startOptions, webUiDist) {
|
|
|
178199
178291
|
bridgeService.onBridgeChanged = (bridgeId) => {
|
|
178200
178292
|
webApi.websocket.broadcastBridgeUpdate(bridgeId);
|
|
178201
178293
|
};
|
|
178294
|
+
let shuttingDown = false;
|
|
178295
|
+
const gracefulShutdown = async (signal) => {
|
|
178296
|
+
if (shuttingDown) return;
|
|
178297
|
+
shuttingDown = true;
|
|
178298
|
+
console.log(`Received ${signal}, shutting down gracefully...`);
|
|
178299
|
+
try {
|
|
178300
|
+
await Promise.race([
|
|
178301
|
+
bridgeService.dispose(),
|
|
178302
|
+
new Promise((resolve4) => setTimeout(resolve4, 1e4))
|
|
178303
|
+
]);
|
|
178304
|
+
} catch (e) {
|
|
178305
|
+
console.warn("Error during graceful shutdown:", e);
|
|
178306
|
+
}
|
|
178307
|
+
process.exit(0);
|
|
178308
|
+
};
|
|
178309
|
+
process.on("SIGTERM", () => gracefulShutdown("SIGTERM"));
|
|
178310
|
+
process.on("SIGINT", () => gracefulShutdown("SIGINT"));
|
|
178202
178311
|
const initBridges = bridgeService.startAll();
|
|
178203
178312
|
const initApi = webApi.start();
|
|
178204
178313
|
const enableAutoRefresh = initBridges.then(() => registry$).then((r) => r.enableAutoRefresh(() => bridgeService.refreshAll()));
|