@riddix/hamh 2.1.0-alpha.713 → 2.1.0-alpha.715
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
|
@@ -1758,8 +1758,8 @@ var init_Cancelable = __esm({
|
|
|
1758
1758
|
};
|
|
1759
1759
|
return result;
|
|
1760
1760
|
}
|
|
1761
|
-
static set logger(
|
|
1762
|
-
this.#logger =
|
|
1761
|
+
static set logger(logger231) {
|
|
1762
|
+
this.#logger = logger231;
|
|
1763
1763
|
}
|
|
1764
1764
|
static get logger() {
|
|
1765
1765
|
return this.#logger;
|
|
@@ -3450,13 +3450,13 @@ var init_Logger = __esm({
|
|
|
3450
3450
|
*
|
|
3451
3451
|
* @deprecated use {@link destinations}
|
|
3452
3452
|
*/
|
|
3453
|
-
static addLogger(identifier,
|
|
3453
|
+
static addLogger(identifier, logger231, options) {
|
|
3454
3454
|
if (identifier in this.destinations) {
|
|
3455
3455
|
throw new ImplementationError(`Logger "${identifier}" already exists`);
|
|
3456
3456
|
}
|
|
3457
3457
|
const dest = LogDestination({ name: identifier });
|
|
3458
3458
|
const legacy = adaptDestinationToLegacy(dest);
|
|
3459
|
-
legacy.log =
|
|
3459
|
+
legacy.log = logger231;
|
|
3460
3460
|
if (options?.defaultLogLevel !== void 0) {
|
|
3461
3461
|
legacy.defaultLogLevel = options.defaultLogLevel;
|
|
3462
3462
|
}
|
|
@@ -5644,8 +5644,8 @@ var init_Construction = __esm({
|
|
|
5644
5644
|
}
|
|
5645
5645
|
}
|
|
5646
5646
|
#unhandledError(...args) {
|
|
5647
|
-
const
|
|
5648
|
-
|
|
5647
|
+
const logger231 = Logger.get(this.#subject.constructor.name);
|
|
5648
|
+
logger231.error(...args);
|
|
5649
5649
|
}
|
|
5650
5650
|
#createErrorHandler(name) {
|
|
5651
5651
|
return (e) => {
|
|
@@ -62023,8 +62023,8 @@ var init_NodeSession = __esm({
|
|
|
62023
62023
|
return session?.type === SessionType.Unicast;
|
|
62024
62024
|
}
|
|
62025
62025
|
NodeSession2.is = is;
|
|
62026
|
-
function logNew(
|
|
62027
|
-
|
|
62026
|
+
function logNew(logger231, operation, session, messenger, fabric, peerNodeId) {
|
|
62027
|
+
logger231.info(
|
|
62028
62028
|
session.via,
|
|
62029
62029
|
`${operation} session with`,
|
|
62030
62030
|
Diagnostic.strong(PeerAddress({ fabricIndex: fabric.fabricIndex, nodeId: peerNodeId }).toString()),
|
|
@@ -110814,11 +110814,11 @@ var init_Api = __esm({
|
|
|
110814
110814
|
}
|
|
110815
110815
|
Api2.resourceFor = resourceFor;
|
|
110816
110816
|
function log(level, facility, id, ...message) {
|
|
110817
|
-
let
|
|
110818
|
-
if (!
|
|
110819
|
-
loggers.set(facility,
|
|
110817
|
+
let logger231 = loggers.get(facility);
|
|
110818
|
+
if (!logger231) {
|
|
110819
|
+
loggers.set(facility, logger231 = Logger.get(facility));
|
|
110820
110820
|
}
|
|
110821
|
-
|
|
110821
|
+
logger231[level](Diagnostic.via(id || "(anon)"), message);
|
|
110822
110822
|
}
|
|
110823
110823
|
Api2.log = log;
|
|
110824
110824
|
function logRequest(facility, id, method, target) {
|
|
@@ -124691,10 +124691,10 @@ var init_home_assistant_actions = __esm({
|
|
|
124691
124691
|
circuitBreakerResetMs: 3e4
|
|
124692
124692
|
};
|
|
124693
124693
|
HomeAssistantActions = class extends Service {
|
|
124694
|
-
constructor(
|
|
124694
|
+
constructor(logger231, client, config11) {
|
|
124695
124695
|
super("HomeAssistantActions");
|
|
124696
124696
|
this.client = client;
|
|
124697
|
-
this.log =
|
|
124697
|
+
this.log = logger231.get(this);
|
|
124698
124698
|
this.config = { ...defaultConfig, ...config11 };
|
|
124699
124699
|
this.circuitBreaker = new CircuitBreaker(
|
|
124700
124700
|
this.config.circuitBreakerThreshold,
|
|
@@ -125034,10 +125034,10 @@ var DiagnosticService = class {
|
|
|
125034
125034
|
};
|
|
125035
125035
|
|
|
125036
125036
|
// src/api/access-log.ts
|
|
125037
|
-
function accessLogger(
|
|
125037
|
+
function accessLogger(logger231) {
|
|
125038
125038
|
return (req, res, next) => {
|
|
125039
125039
|
res.on("finish", () => {
|
|
125040
|
-
|
|
125040
|
+
logger231.debug(
|
|
125041
125041
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
125042
125042
|
);
|
|
125043
125043
|
});
|
|
@@ -127626,6 +127626,39 @@ function metricsApi(bridgeService, haClient, haRegistry, startTime) {
|
|
|
127626
127626
|
// src/api/network-diagnostic-api.ts
|
|
127627
127627
|
import * as os3 from "node:os";
|
|
127628
127628
|
import express13 from "express";
|
|
127629
|
+
|
|
127630
|
+
// src/core/app/select-mdns-interface.ts
|
|
127631
|
+
var DOCKER_NAME = /^(docker\d*|hassio|veth|cni)/;
|
|
127632
|
+
function inDockerRange(ipv4) {
|
|
127633
|
+
const parts = ipv4.split(".");
|
|
127634
|
+
const second = Number(parts[1]);
|
|
127635
|
+
return parts[0] === "172" && second >= 16 && second <= 31;
|
|
127636
|
+
}
|
|
127637
|
+
function isLinkLocal(family, address) {
|
|
127638
|
+
if (family === "IPv4") return address.startsWith("169.254.");
|
|
127639
|
+
return address.toLowerCase().startsWith("fe80");
|
|
127640
|
+
}
|
|
127641
|
+
function selectMdnsInterface(raw) {
|
|
127642
|
+
const external = [];
|
|
127643
|
+
const dockerLike = [];
|
|
127644
|
+
for (const [name, addrs] of Object.entries(raw)) {
|
|
127645
|
+
if (!addrs) continue;
|
|
127646
|
+
const usable = addrs.filter((a) => !a.internal);
|
|
127647
|
+
if (usable.length === 0) continue;
|
|
127648
|
+
if (DOCKER_NAME.test(name)) dockerLike.push(name);
|
|
127649
|
+
const ipv4 = usable.filter((a) => a.family === "IPv4").map((a) => a.address);
|
|
127650
|
+
const ipv6 = usable.filter((a) => a.family === "IPv6").map((a) => a.address);
|
|
127651
|
+
const routable = usable.some((a) => !isLinkLocal(a.family, a.address));
|
|
127652
|
+
if (!routable) continue;
|
|
127653
|
+
external.push({ name, ipv4, ipv6 });
|
|
127654
|
+
}
|
|
127655
|
+
const lan = external.filter((i) => !DOCKER_NAME.test(i.name));
|
|
127656
|
+
const selected = lan.length === 1 ? lan[0].name : void 0;
|
|
127657
|
+
const suspicious = dockerLike.length > 0 || external.some((i) => i.ipv4.some(inDockerRange));
|
|
127658
|
+
return { selected, external, dockerLike, suspicious };
|
|
127659
|
+
}
|
|
127660
|
+
|
|
127661
|
+
// src/api/network-diagnostic-api.ts
|
|
127629
127662
|
function networkDiagnosticApi(mdnsInterface, mdnsIpv4) {
|
|
127630
127663
|
const router = express13.Router();
|
|
127631
127664
|
router.get("/", (_, res) => {
|
|
@@ -127759,13 +127792,17 @@ function runDiagnostics(mdnsInterface, mdnsIpv4) {
|
|
|
127759
127792
|
detail: "Some controllers (older Alexa, Google Home) may need IPv4 mDNS for discovery. Enable with --mdns-ipv4."
|
|
127760
127793
|
});
|
|
127761
127794
|
}
|
|
127762
|
-
if (
|
|
127763
|
-
|
|
127764
|
-
|
|
127765
|
-
|
|
127766
|
-
|
|
127767
|
-
|
|
127768
|
-
|
|
127795
|
+
if (!mdnsInterface) {
|
|
127796
|
+
const choice = selectMdnsInterface(os3.networkInterfaces());
|
|
127797
|
+
if (choice.suspicious || choice.external.length > 1) {
|
|
127798
|
+
const suggestion = choice.selected ? `Bind to "${choice.selected}" via mdns-network-interface.` : `Set mdns-network-interface to your LAN interface (${choice.external.map((i) => i.name).join(", ")}).`;
|
|
127799
|
+
checks.push({
|
|
127800
|
+
name: "multiple_interfaces",
|
|
127801
|
+
status: "warn",
|
|
127802
|
+
message: choice.suspicious ? "mDNS is advertising on Docker-internal or extra interfaces, which can make controllers show devices as offline" : `${choice.external.length} external interfaces detected without explicit binding`,
|
|
127803
|
+
detail: choice.suspicious ? `Matter bakes every interface address into its operational records, so controllers may pick an unreachable one. ${suggestion}` : `mDNS will broadcast on all interfaces. If controllers are on a specific VLAN, ${suggestion}`
|
|
127804
|
+
});
|
|
127805
|
+
}
|
|
127769
127806
|
}
|
|
127770
127807
|
return {
|
|
127771
127808
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -128606,8 +128643,8 @@ function systemApi(version2) {
|
|
|
128606
128643
|
}
|
|
128607
128644
|
function getNetworkInterfaces2() {
|
|
128608
128645
|
const interfaces = [];
|
|
128609
|
-
const
|
|
128610
|
-
for (const [name, ifaceList] of Object.entries(
|
|
128646
|
+
const networkInterfaces4 = os4.networkInterfaces();
|
|
128647
|
+
for (const [name, ifaceList] of Object.entries(networkInterfaces4)) {
|
|
128611
128648
|
if (!ifaceList) continue;
|
|
128612
128649
|
for (const iface of ifaceList) {
|
|
128613
128650
|
const family = String(iface.family);
|
|
@@ -128871,7 +128908,7 @@ var WebSocketApi = class {
|
|
|
128871
128908
|
|
|
128872
128909
|
// src/api/web-api.ts
|
|
128873
128910
|
var WebApi = class extends Service {
|
|
128874
|
-
constructor(
|
|
128911
|
+
constructor(logger231, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
|
|
128875
128912
|
super("WebApi");
|
|
128876
128913
|
this.bridgeService = bridgeService;
|
|
128877
128914
|
this.haClient = haClient;
|
|
@@ -128882,8 +128919,8 @@ var WebApi = class extends Service {
|
|
|
128882
128919
|
this.settingsStorage = settingsStorage;
|
|
128883
128920
|
this.backupService = backupService;
|
|
128884
128921
|
this.props = props;
|
|
128885
|
-
this.logger =
|
|
128886
|
-
this.log =
|
|
128922
|
+
this.logger = logger231;
|
|
128923
|
+
this.log = logger231.get(this);
|
|
128887
128924
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
128888
128925
|
this.startTime = Date.now();
|
|
128889
128926
|
this.wsApi = new WebSocketApi(
|
|
@@ -129283,22 +129320,41 @@ var BetterLogger = class _BetterLogger extends Logger {
|
|
|
129283
129320
|
}
|
|
129284
129321
|
};
|
|
129285
129322
|
|
|
129323
|
+
// src/core/app/mdns.ts
|
|
129324
|
+
init_esm();
|
|
129325
|
+
import * as os5 from "node:os";
|
|
129326
|
+
|
|
129286
129327
|
// ../../node_modules/.pnpm/@matter+main@0.17.0/node_modules/@matter/main/dist/esm/protocol.js
|
|
129287
129328
|
init_nodejs();
|
|
129288
129329
|
init_esm4();
|
|
129289
129330
|
|
|
129290
129331
|
// src/core/app/mdns.ts
|
|
129332
|
+
var logger168 = Logger.get("Mdns");
|
|
129291
129333
|
function mdns(env, options) {
|
|
129334
|
+
if (!options.networkInterface) {
|
|
129335
|
+
warnIfMisadvertising();
|
|
129336
|
+
}
|
|
129292
129337
|
new MdnsService(env, {
|
|
129293
129338
|
ipv4: options.ipv4,
|
|
129294
129339
|
networkInterface: options.networkInterface
|
|
129295
129340
|
});
|
|
129296
129341
|
}
|
|
129342
|
+
function warnIfMisadvertising() {
|
|
129343
|
+
const choice = selectMdnsInterface(os5.networkInterfaces());
|
|
129344
|
+
if (!choice.suspicious) {
|
|
129345
|
+
return;
|
|
129346
|
+
}
|
|
129347
|
+
const suggestion = choice.selected ? ` Likely LAN interface: ${choice.selected}.` : "";
|
|
129348
|
+
const list3 = choice.external.map((i) => `${i.name} (${i.ipv4[0] ?? i.ipv6[0] ?? "?"})`).join(", ");
|
|
129349
|
+
logger168.warn(
|
|
129350
|
+
`Matter mDNS is advertising on several interfaces including likely Docker-internal ones, so controllers may show devices as offline (#361). Set mdns-network-interface to your LAN interface.${suggestion} Interfaces: ${list3}.`
|
|
129351
|
+
);
|
|
129352
|
+
}
|
|
129297
129353
|
|
|
129298
129354
|
// src/core/app/storage.ts
|
|
129299
129355
|
init_esm7();
|
|
129300
129356
|
import fs7 from "node:fs";
|
|
129301
|
-
import
|
|
129357
|
+
import os6 from "node:os";
|
|
129302
129358
|
import path8 from "node:path";
|
|
129303
129359
|
|
|
129304
129360
|
// src/core/app/storage/custom-storage.ts
|
|
@@ -129333,7 +129389,7 @@ function storage(environment, options) {
|
|
|
129333
129389
|
storageService.defaultDriver = CustomStorage.driverId;
|
|
129334
129390
|
}
|
|
129335
129391
|
function resolveStorageLocation(storageLocation) {
|
|
129336
|
-
const homedir =
|
|
129392
|
+
const homedir = os6.homedir();
|
|
129337
129393
|
return storageLocation ? path8.resolve(storageLocation.replace(/^~\//, `${homedir}/`)) : path8.join(homedir, ".home-assistant-matter-hub");
|
|
129338
129394
|
}
|
|
129339
129395
|
|
|
@@ -129353,7 +129409,7 @@ function configureDefaultEnvironment(options) {
|
|
|
129353
129409
|
// src/core/app/options.ts
|
|
129354
129410
|
init_esm7();
|
|
129355
129411
|
import { createRequire } from "node:module";
|
|
129356
|
-
import
|
|
129412
|
+
import os7 from "node:os";
|
|
129357
129413
|
import path9 from "node:path";
|
|
129358
129414
|
function resolveAppVersion() {
|
|
129359
129415
|
try {
|
|
@@ -129422,7 +129478,7 @@ var Options = class {
|
|
|
129422
129478
|
}
|
|
129423
129479
|
resolveStorageLocation() {
|
|
129424
129480
|
const storageLocation = notEmpty(this.startOptions.storageLocation);
|
|
129425
|
-
const homedir =
|
|
129481
|
+
const homedir = os7.homedir();
|
|
129426
129482
|
return storageLocation ? path9.resolve(storageLocation.replace(/^~\//, `${homedir}/`)) : path9.join(homedir, ".home-assistant-matter-hub");
|
|
129427
129483
|
}
|
|
129428
129484
|
get bridgeService() {
|
|
@@ -129930,10 +129986,10 @@ function isTransientConnectError(reason) {
|
|
|
129930
129986
|
return msg.includes("socket hang up") || msg.includes("tls") || msg.includes("TLS");
|
|
129931
129987
|
}
|
|
129932
129988
|
var HomeAssistantClient = class extends Service {
|
|
129933
|
-
constructor(
|
|
129989
|
+
constructor(logger231, options) {
|
|
129934
129990
|
super("HomeAssistantClient");
|
|
129935
129991
|
this.options = options;
|
|
129936
|
-
this.log =
|
|
129992
|
+
this.log = logger231.get(this);
|
|
129937
129993
|
}
|
|
129938
129994
|
options;
|
|
129939
129995
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
@@ -130052,7 +130108,7 @@ import { getStates } from "home-assistant-js-websocket";
|
|
|
130052
130108
|
import { fromPairs, keyBy, keys, uniq, values } from "lodash-es";
|
|
130053
130109
|
|
|
130054
130110
|
// src/utils/log-memory.ts
|
|
130055
|
-
import
|
|
130111
|
+
import os8 from "node:os";
|
|
130056
130112
|
import v82 from "node:v8";
|
|
130057
130113
|
var HEAP_PRESSURE_THRESHOLD = 0.85;
|
|
130058
130114
|
var LOW_MEMORY_THRESHOLD_MB = 512;
|
|
@@ -130070,8 +130126,8 @@ function isHeapUnderPressure() {
|
|
|
130070
130126
|
return stats.used_heap_size / stats.heap_size_limit > HEAP_PRESSURE_THRESHOLD;
|
|
130071
130127
|
}
|
|
130072
130128
|
function logStartupMemoryGuard(log) {
|
|
130073
|
-
const totalMB = Math.round(
|
|
130074
|
-
const freeMB = Math.round(
|
|
130129
|
+
const totalMB = Math.round(os8.totalmem() / 1024 / 1024);
|
|
130130
|
+
const freeMB = Math.round(os8.freemem() / 1024 / 1024);
|
|
130075
130131
|
const heapLimitMB = Math.round(
|
|
130076
130132
|
v82.getHeapStatistics().heap_size_limit / 1024 / 1024
|
|
130077
130133
|
);
|
|
@@ -130120,7 +130176,7 @@ async function getAreaRegistry(connection, timeoutMs) {
|
|
|
130120
130176
|
}
|
|
130121
130177
|
|
|
130122
130178
|
// src/services/home-assistant/home-assistant-registry.ts
|
|
130123
|
-
var
|
|
130179
|
+
var logger169 = Logger.get("HomeAssistantRegistry");
|
|
130124
130180
|
var HomeAssistantRegistry = class extends Service {
|
|
130125
130181
|
constructor(client, options) {
|
|
130126
130182
|
super("HomeAssistantRegistry");
|
|
@@ -130155,7 +130211,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
130155
130211
|
try {
|
|
130156
130212
|
await this.reload();
|
|
130157
130213
|
} catch (e) {
|
|
130158
|
-
|
|
130214
|
+
logger169.warn(
|
|
130159
130215
|
"Initial registry fetch failed, starting empty and relying on auto-refresh:",
|
|
130160
130216
|
e
|
|
130161
130217
|
);
|
|
@@ -130169,7 +130225,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
130169
130225
|
let refreshing = false;
|
|
130170
130226
|
this.autoRefresh = setInterval(async () => {
|
|
130171
130227
|
if (refreshing) {
|
|
130172
|
-
|
|
130228
|
+
logger169.debug("Skipping registry refresh, previous tick still running");
|
|
130173
130229
|
return;
|
|
130174
130230
|
}
|
|
130175
130231
|
refreshing = true;
|
|
@@ -130179,7 +130235,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
130179
130235
|
await onRefresh();
|
|
130180
130236
|
}
|
|
130181
130237
|
} catch (e) {
|
|
130182
|
-
|
|
130238
|
+
logger169.warn("Failed to refresh registry, will retry next interval:", e);
|
|
130183
130239
|
} finally {
|
|
130184
130240
|
refreshing = false;
|
|
130185
130241
|
}
|
|
@@ -130197,7 +130253,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
130197
130253
|
baseDelayMs: 2e3,
|
|
130198
130254
|
maxDelayMs: 3e4,
|
|
130199
130255
|
onRetry: (attempt, error, delayMs) => {
|
|
130200
|
-
|
|
130256
|
+
logger169.warn(
|
|
130201
130257
|
`Registry fetch failed (attempt ${attempt}), retrying in ${delayMs}ms:`,
|
|
130202
130258
|
error
|
|
130203
130259
|
);
|
|
@@ -130210,7 +130266,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
130210
130266
|
return await this.runRegistryQueries();
|
|
130211
130267
|
} catch (e) {
|
|
130212
130268
|
if (!isConnectionLost(e)) throw e;
|
|
130213
|
-
|
|
130269
|
+
logger169.debug("Registry fetch hit connection drop, waiting for reconnect");
|
|
130214
130270
|
await this.waitForConnection(6e4);
|
|
130215
130271
|
return await this.runRegistryQueries();
|
|
130216
130272
|
}
|
|
@@ -130218,7 +130274,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
130218
130274
|
async waitForConnection(timeoutMs) {
|
|
130219
130275
|
const connection = this.client.connection;
|
|
130220
130276
|
if (connection.connected) return;
|
|
130221
|
-
|
|
130277
|
+
logger169.debug("Connection not ready, waiting for reconnect...");
|
|
130222
130278
|
await new Promise((resolve11) => {
|
|
130223
130279
|
const timeout = setTimeout(() => {
|
|
130224
130280
|
connection.removeEventListener("ready", onReady);
|
|
@@ -130275,7 +130331,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
130275
130331
|
const fingerprint = hash2.digest("hex");
|
|
130276
130332
|
this._states = keyBy(statesList, "entity_id");
|
|
130277
130333
|
if (fingerprint === this.lastRegistryFingerprint) {
|
|
130278
|
-
|
|
130334
|
+
logger169.debug("Registry unchanged, skipping full refresh");
|
|
130279
130335
|
return false;
|
|
130280
130336
|
}
|
|
130281
130337
|
this.lastRegistryFingerprint = fingerprint;
|
|
@@ -130296,10 +130352,10 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
130296
130352
|
const missingDevices = fromPairs(missingDeviceIds.map((d) => [d, { id: d }]));
|
|
130297
130353
|
this._devices = { ...missingDevices, ...realDevices };
|
|
130298
130354
|
this._entities = allEntities;
|
|
130299
|
-
|
|
130355
|
+
logger169.debug(
|
|
130300
130356
|
`Loaded HA registry: ${keys(allEntities).length} entities, ${keys(realDevices).length} devices, ${keys(this._states).length} states`
|
|
130301
130357
|
);
|
|
130302
|
-
logMemoryUsage(
|
|
130358
|
+
logMemoryUsage(logger169, "after HA registry load");
|
|
130303
130359
|
this._labels = labels;
|
|
130304
130360
|
this._areas = new Map(areas.map((a) => [a.area_id, a.name]));
|
|
130305
130361
|
return true;
|
|
@@ -131094,7 +131150,7 @@ var __privateIn3 = (member, obj) => Object(obj) !== obj ? __typeError47('Cannot
|
|
|
131094
131150
|
var __privateGet3 = (obj, member, getter) => (__accessCheck3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
131095
131151
|
var __privateSet3 = (obj, member, value, setter) => (__accessCheck3(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
131096
131152
|
var __privateMethod3 = (obj, member, method) => (__accessCheck3(obj, member, "access private method"), method);
|
|
131097
|
-
var
|
|
131153
|
+
var logger170 = Logger.get("ScenesManagementServer");
|
|
131098
131154
|
var UNDEFINED_SCENE_ID = 255;
|
|
131099
131155
|
function constraintErrorWithSceneId(groupId22, sceneId) {
|
|
131100
131156
|
const response = { status: Status2.ConstraintError, groupId: groupId22, sceneId };
|
|
@@ -131221,11 +131277,11 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131221
131277
|
return { status: Status2.ResourceExhausted, groupId: groupId22, sceneId };
|
|
131222
131278
|
}
|
|
131223
131279
|
this.state.sceneTable.push(sceneData);
|
|
131224
|
-
|
|
131280
|
+
logger170.debug(`Added scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
|
|
131225
131281
|
this.#updateFabricSceneInfoCountsForFabric(fabricIndex);
|
|
131226
131282
|
} else {
|
|
131227
131283
|
this.state.sceneTable[existingSceneIndex] = sceneData;
|
|
131228
|
-
|
|
131284
|
+
logger170.debug(`Updated scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
|
|
131229
131285
|
}
|
|
131230
131286
|
return { status: Status2.Success, groupId: groupId22, sceneId };
|
|
131231
131287
|
}
|
|
@@ -131528,20 +131584,20 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131528
131584
|
}
|
|
131529
131585
|
}
|
|
131530
131586
|
if (fieldCount !== 2) {
|
|
131531
|
-
|
|
131587
|
+
logger170.warn(
|
|
131532
131588
|
`AttributeValuePair has invalid number (${fieldCount}) of fields (${serialize(attributeValuePair)})`
|
|
131533
131589
|
);
|
|
131534
131590
|
return void 0;
|
|
131535
131591
|
}
|
|
131536
131592
|
const value = attributeValuePair[mappedType];
|
|
131537
131593
|
if (value === void 0) {
|
|
131538
|
-
|
|
131594
|
+
logger170.warn(
|
|
131539
131595
|
`AttributeValuePair missing value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
|
|
131540
131596
|
);
|
|
131541
131597
|
return void 0;
|
|
131542
131598
|
}
|
|
131543
131599
|
if (typeof value !== "number" && typeof value !== "bigint") {
|
|
131544
|
-
|
|
131600
|
+
logger170.warn(
|
|
131545
131601
|
`AttributeValuePair has invalid non-numeric value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
|
|
131546
131602
|
// Should never happen
|
|
131547
131603
|
);
|
|
@@ -131639,7 +131695,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131639
131695
|
} else if (schema6.schema.baseTypeMin < 0 && schema6.schema.min > schema6.schema.baseTypeMin) {
|
|
131640
131696
|
return { attributeId, [mappedType]: schema6.schema.baseTypeMin };
|
|
131641
131697
|
} else {
|
|
131642
|
-
|
|
131698
|
+
logger170.warn(
|
|
131643
131699
|
`Cannot determine out-of-bounds value for attribute schema, returning min value of datatype schema`
|
|
131644
131700
|
);
|
|
131645
131701
|
}
|
|
@@ -131660,7 +131716,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131660
131716
|
}
|
|
131661
131717
|
}
|
|
131662
131718
|
});
|
|
131663
|
-
|
|
131719
|
+
logger170.debug(`Collected scene attribute values on Endpoint ${this.endpoint.id}: ${serialize(sceneValues)}`);
|
|
131664
131720
|
return sceneValues;
|
|
131665
131721
|
}
|
|
131666
131722
|
/**
|
|
@@ -131699,7 +131755,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131699
131755
|
}
|
|
131700
131756
|
const attrType = attribute.primitiveBase?.name;
|
|
131701
131757
|
if (attrType === void 0 || DataTypeToSceneAttributeDataMap[attrType] === void 0) {
|
|
131702
|
-
|
|
131758
|
+
logger170.warn(
|
|
131703
131759
|
`Scene Attribute ${attribute.name} on Cluster ${clusterName} has unsupported datatype ${attrType} for scene management on Endpoint ${this.endpoint.id}`
|
|
131704
131760
|
);
|
|
131705
131761
|
continue;
|
|
@@ -131714,7 +131770,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131714
131770
|
});
|
|
131715
131771
|
}
|
|
131716
131772
|
if (sceneClusterDetails) {
|
|
131717
|
-
|
|
131773
|
+
logger170.info(
|
|
131718
131774
|
`Registered ${sceneClusterDetails.attributes.size} scene attributes for Cluster ${clusterName} on Endpoint ${this.endpoint.id}`
|
|
131719
131775
|
);
|
|
131720
131776
|
this.internal.endpointSceneableBehaviors.add(sceneClusterDetails);
|
|
@@ -131722,7 +131778,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131722
131778
|
}
|
|
131723
131779
|
/** Apply scene attribute values in the various clusters on the endpoint. */
|
|
131724
131780
|
#applySceneAttributeValues(sceneValues, transitionTime = null) {
|
|
131725
|
-
|
|
131781
|
+
logger170.debug(`Recalling scene on Endpoint ${this.endpoint.id} with values: ${serialize(sceneValues)}`);
|
|
131726
131782
|
const agent = this.endpoint.agentFor(this.context);
|
|
131727
131783
|
const promises = [];
|
|
131728
131784
|
for (const [clusterName, clusterAttributes] of Object.entries(sceneValues)) {
|
|
@@ -131733,7 +131789,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131733
131789
|
promises.push(result);
|
|
131734
131790
|
}
|
|
131735
131791
|
} else {
|
|
131736
|
-
|
|
131792
|
+
logger170.warn(
|
|
131737
131793
|
`No scenes implementation found for cluster ${clusterName} on Endpoint ${this.endpoint.id} during scene recall. Values are ignored`
|
|
131738
131794
|
);
|
|
131739
131795
|
}
|
|
@@ -131741,7 +131797,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
131741
131797
|
if (promises.length) {
|
|
131742
131798
|
return Promise.all(promises).then(
|
|
131743
131799
|
() => void 0,
|
|
131744
|
-
(error) =>
|
|
131800
|
+
(error) => logger170.warn(`Error applying scene attribute values on Endpoint ${this.endpoint.id}:`, error)
|
|
131745
131801
|
);
|
|
131746
131802
|
}
|
|
131747
131803
|
}
|
|
@@ -131934,7 +131990,7 @@ var GroupsBehaviorConstructor = ClusterBehavior.for(Groups4);
|
|
|
131934
131990
|
var GroupsBehavior = GroupsBehaviorConstructor;
|
|
131935
131991
|
|
|
131936
131992
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/groups/GroupsServer.js
|
|
131937
|
-
var
|
|
131993
|
+
var logger171 = Logger.get("GroupsServer");
|
|
131938
131994
|
var { commands: commands3 } = Groups4.schema;
|
|
131939
131995
|
var addGroup = commands3.require("AddGroup");
|
|
131940
131996
|
var addGroupIfIdentifying = commands3.require("AddGroupIfIdentifying");
|
|
@@ -132001,7 +132057,7 @@ var GroupsServer = class extends GroupsBase {
|
|
|
132001
132057
|
(fabric2, gkm) => gkm.addEndpointForGroup(fabric2, groupId3, endpointNumber, groupName)
|
|
132002
132058
|
);
|
|
132003
132059
|
} catch (error) {
|
|
132004
|
-
|
|
132060
|
+
logger171.error(error);
|
|
132005
132061
|
StatusResponseError.accept(error);
|
|
132006
132062
|
return { status: error.code, groupId: groupId3 };
|
|
132007
132063
|
}
|
|
@@ -132645,7 +132701,7 @@ var SwitchBehavior = SwitchBehaviorConstructor;
|
|
|
132645
132701
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/switch/SwitchServer.js
|
|
132646
132702
|
var DEFAULT_MULTIPRESS_DELAY = Millis(300);
|
|
132647
132703
|
var DEFAULT_LONG_PRESS_DELAY = Seconds(2);
|
|
132648
|
-
var
|
|
132704
|
+
var logger172 = Logger.get("SwitchServer");
|
|
132649
132705
|
var SwitchServerBase = SwitchBehavior.with(
|
|
132650
132706
|
Switch3.Feature.LatchingSwitch,
|
|
132651
132707
|
Switch3.Feature.MomentarySwitch,
|
|
@@ -132698,7 +132754,7 @@ var SwitchBaseServer = class extends SwitchServerBase {
|
|
|
132698
132754
|
this.internal.currentIsLongPress = false;
|
|
132699
132755
|
this.internal.multiPressTimer?.stop();
|
|
132700
132756
|
this.internal.longPressTimer?.stop();
|
|
132701
|
-
|
|
132757
|
+
logger172.info("State of Switch got reset");
|
|
132702
132758
|
}
|
|
132703
132759
|
// TODO remove when Validator logic can assess that with 1.3 introduction
|
|
132704
132760
|
#assertPositionInRange(position) {
|
|
@@ -133346,11 +133402,11 @@ var OccupancySensingBehaviorConstructor = ClusterBehavior.for(OccupancySensing3)
|
|
|
133346
133402
|
var OccupancySensingBehavior = OccupancySensingBehaviorConstructor;
|
|
133347
133403
|
|
|
133348
133404
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/occupancy-sensing/OccupancySensingServer.js
|
|
133349
|
-
var
|
|
133405
|
+
var logger173 = Logger.get("OccupancySensingServer");
|
|
133350
133406
|
var OccupancySensingServer = class extends OccupancySensingBehavior {
|
|
133351
133407
|
initialize() {
|
|
133352
133408
|
if (!Object.values(this.features).some((feature) => feature)) {
|
|
133353
|
-
|
|
133409
|
+
logger173.error(
|
|
133354
133410
|
`OccupancySensingServer: Since revision 5 of the cluster features need to be set based on the detector type. Currently no features are enabled.`
|
|
133355
133411
|
);
|
|
133356
133412
|
} else if (!Object.values(this.state.occupancySensorTypeBitmap).some((feature) => feature) || this.state.occupancySensorType === void 0) {
|
|
@@ -133377,7 +133433,7 @@ var OccupancySensingServer = class extends OccupancySensingBehavior {
|
|
|
133377
133433
|
} else if (this.state.occupancySensorTypeBitmap.physicalContact) {
|
|
133378
133434
|
this.state.occupancySensorType = OccupancySensing3.OccupancySensorType.PhysicalContact;
|
|
133379
133435
|
}
|
|
133380
|
-
|
|
133436
|
+
logger173.debug(
|
|
133381
133437
|
"Sync occupancySensorType to",
|
|
133382
133438
|
OccupancySensing3.OccupancySensorType[this.state.occupancySensorType],
|
|
133383
133439
|
"and occupancySensorTypeBitmap to",
|
|
@@ -135975,7 +136031,7 @@ function miredsToXy(mireds) {
|
|
|
135975
136031
|
}
|
|
135976
136032
|
|
|
135977
136033
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/color-control/ColorControlServer.js
|
|
135978
|
-
var
|
|
136034
|
+
var logger174 = Logger.get("ColorControlServer");
|
|
135979
136035
|
var ColorControlBase = ColorControlBehavior.with(
|
|
135980
136036
|
ColorControl3.Feature.HueSaturation,
|
|
135981
136037
|
ColorControl3.Feature.EnhancedHue,
|
|
@@ -137156,7 +137212,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137156
137212
|
switch (oldMode) {
|
|
137157
137213
|
case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
|
|
137158
137214
|
if (this.state.currentHue === void 0 || this.state.currentSaturation === void 0) {
|
|
137159
|
-
|
|
137215
|
+
logger174.warn("Could not convert from hue/saturation because one of them is undefined");
|
|
137160
137216
|
break;
|
|
137161
137217
|
}
|
|
137162
137218
|
switch (newMode) {
|
|
@@ -137168,7 +137224,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137168
137224
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
137169
137225
|
const mireds = hsvToMireds(this.hue, this.saturation);
|
|
137170
137226
|
if (mireds === void 0) {
|
|
137171
|
-
|
|
137227
|
+
logger174.warn(
|
|
137172
137228
|
`Could not convert hue/saturation (${this.hue}/${this.saturation}) to color temperature`
|
|
137173
137229
|
);
|
|
137174
137230
|
} else {
|
|
@@ -137179,7 +137235,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137179
137235
|
break;
|
|
137180
137236
|
case ColorControl3.ColorMode.CurrentXAndCurrentY:
|
|
137181
137237
|
if (this.state.currentX === void 0 || this.state.currentY === void 0) {
|
|
137182
|
-
|
|
137238
|
+
logger174.warn("Could not convert from xy because one of them is undefined");
|
|
137183
137239
|
break;
|
|
137184
137240
|
}
|
|
137185
137241
|
switch (newMode) {
|
|
@@ -137191,7 +137247,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137191
137247
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
137192
137248
|
const mireds = xyToMireds(this.x, this.y);
|
|
137193
137249
|
if (mireds === void 0) {
|
|
137194
|
-
|
|
137250
|
+
logger174.warn(`Could not convert xy ${this.x / this.y} to color temperature`);
|
|
137195
137251
|
} else {
|
|
137196
137252
|
this.mireds = mireds;
|
|
137197
137253
|
}
|
|
@@ -137200,14 +137256,14 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137200
137256
|
break;
|
|
137201
137257
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
137202
137258
|
if (this.state.colorTemperatureMireds === void 0) {
|
|
137203
|
-
|
|
137259
|
+
logger174.warn("Could not convert from color temperature because it is undefined");
|
|
137204
137260
|
break;
|
|
137205
137261
|
}
|
|
137206
137262
|
switch (newMode) {
|
|
137207
137263
|
case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
|
|
137208
137264
|
const hsvResult = miredsToHsv(this.mireds);
|
|
137209
137265
|
if (hsvResult === void 0) {
|
|
137210
|
-
|
|
137266
|
+
logger174.warn(`Could not convert color temperature ${this.mireds} to hue/saturation`);
|
|
137211
137267
|
} else {
|
|
137212
137268
|
const [hue, saturation] = hsvResult;
|
|
137213
137269
|
this.hue = hue;
|
|
@@ -137217,7 +137273,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137217
137273
|
case ColorControl3.ColorMode.CurrentXAndCurrentY:
|
|
137218
137274
|
const xyResult = miredsToXy(this.mireds);
|
|
137219
137275
|
if (xyResult === void 0) {
|
|
137220
|
-
|
|
137276
|
+
logger174.warn("Could not convert color temperature to xy");
|
|
137221
137277
|
} else {
|
|
137222
137278
|
const [x, y] = xyResult;
|
|
137223
137279
|
this.x = x;
|
|
@@ -137266,7 +137322,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137266
137322
|
);
|
|
137267
137323
|
newColorTemp = tempPhysMax - tempDelta;
|
|
137268
137324
|
}
|
|
137269
|
-
|
|
137325
|
+
logger174.debug(`Synced color temperature with level: ${level}, new color temperature: ${newColorTemp}`);
|
|
137270
137326
|
return this.moveToColorTemperatureLogic(newColorTemp, 0);
|
|
137271
137327
|
}
|
|
137272
137328
|
#assertRate(mode, rate) {
|
|
@@ -137470,7 +137526,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137470
137526
|
targetEnhancedColorMode = values4.enhancedColorMode;
|
|
137471
137527
|
}
|
|
137472
137528
|
if (!this.#supportsColorMode(targetEnhancedColorMode)) {
|
|
137473
|
-
|
|
137529
|
+
logger174.info(
|
|
137474
137530
|
`Can not apply scene with unsupported color mode: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
|
|
137475
137531
|
);
|
|
137476
137532
|
}
|
|
@@ -137512,7 +137568,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
137512
137568
|
}
|
|
137513
137569
|
break;
|
|
137514
137570
|
default:
|
|
137515
|
-
|
|
137571
|
+
logger174.info(
|
|
137516
137572
|
`No supported color mode found to apply scene: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
|
|
137517
137573
|
);
|
|
137518
137574
|
break;
|
|
@@ -137606,7 +137662,7 @@ var LevelControlBehaviorConstructor = ClusterBehavior.for(LevelControl3);
|
|
|
137606
137662
|
var LevelControlBehavior = LevelControlBehaviorConstructor;
|
|
137607
137663
|
|
|
137608
137664
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/level-control/LevelControlServer.js
|
|
137609
|
-
var
|
|
137665
|
+
var logger175 = Logger.get("LevelControlServer");
|
|
137610
137666
|
var LevelControlBase = LevelControlBehavior.with(LevelControl3.Feature.OnOff, LevelControl3.Feature.Lighting);
|
|
137611
137667
|
var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlBase {
|
|
137612
137668
|
/** Returns the minimum level, including feature specific fallback value handling. */
|
|
@@ -137699,17 +137755,17 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
|
|
|
137699
137755
|
*/
|
|
137700
137756
|
initializeLighting() {
|
|
137701
137757
|
if (this.state.currentLevel === 0) {
|
|
137702
|
-
|
|
137758
|
+
logger175.warn(
|
|
137703
137759
|
`The currentLevel value of ${this.state.currentLevel} is invalid according to Matter specification. The value must not be 0.`
|
|
137704
137760
|
);
|
|
137705
137761
|
}
|
|
137706
137762
|
if (this.minLevel !== 1) {
|
|
137707
|
-
|
|
137763
|
+
logger175.warn(
|
|
137708
137764
|
`The minLevel value of ${this.minLevel} is invalid according to Matter specification. The value should be 1.`
|
|
137709
137765
|
);
|
|
137710
137766
|
}
|
|
137711
137767
|
if (this.maxLevel !== 254) {
|
|
137712
|
-
|
|
137768
|
+
logger175.warn(
|
|
137713
137769
|
`The maxLevel value of ${this.maxLevel} is invalid according to Matter specification. The value should be 254.`
|
|
137714
137770
|
);
|
|
137715
137771
|
}
|
|
@@ -138020,7 +138076,7 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
|
|
|
138020
138076
|
if (!onOff || this.state.onLevel === null) {
|
|
138021
138077
|
return;
|
|
138022
138078
|
}
|
|
138023
|
-
|
|
138079
|
+
logger175.debug(`OnOff changed to ON, setting level to onLevel value of ${this.state.onLevel}`);
|
|
138024
138080
|
this.state.currentLevel = this.state.onLevel;
|
|
138025
138081
|
}
|
|
138026
138082
|
#calculateEffectiveOptions(optionsMask, optionsOverride) {
|
|
@@ -141075,7 +141131,7 @@ var ModeSelectBehaviorConstructor = ClusterBehavior.for(ModeSelect3);
|
|
|
141075
141131
|
var ModeSelectBehavior = ModeSelectBehaviorConstructor;
|
|
141076
141132
|
|
|
141077
141133
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/mode-select/ModeSelectServer.js
|
|
141078
|
-
var
|
|
141134
|
+
var logger176 = Logger.get("ModeSelectServer");
|
|
141079
141135
|
var ModeSelectBase = ModeSelectBehavior.with(ModeSelect3.Feature.OnOff);
|
|
141080
141136
|
var ModeSelectBaseServer = class extends ModeSelectBase {
|
|
141081
141137
|
initialize() {
|
|
@@ -141092,7 +141148,7 @@ var ModeSelectBaseServer = class extends ModeSelectBase {
|
|
|
141092
141148
|
}
|
|
141093
141149
|
this.reactTo(onOffServer.events.onOff$Changed, this.#handleOnOffDependency);
|
|
141094
141150
|
} else {
|
|
141095
|
-
|
|
141151
|
+
logger176.warn("OnOffServer not found on endpoint, but OnMode is set.");
|
|
141096
141152
|
}
|
|
141097
141153
|
}
|
|
141098
141154
|
if (!currentModeOverridden && this.state.startUpMode !== void 0 && this.state.startUpMode !== null && this.#getBootReason() !== GeneralDiagnostics3.BootReason.SoftwareUpdateCompleted) {
|
|
@@ -142290,7 +142346,7 @@ init_esm3();
|
|
|
142290
142346
|
|
|
142291
142347
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteState.js
|
|
142292
142348
|
init_esm();
|
|
142293
|
-
var
|
|
142349
|
+
var logger177 = Logger.get("AtomicWriteState");
|
|
142294
142350
|
var MAXIMUM_ALLOWED_TIMEOUT = Seconds(9);
|
|
142295
142351
|
var AtomicWriteState = class {
|
|
142296
142352
|
peerAddress;
|
|
@@ -142325,19 +142381,19 @@ var AtomicWriteState = class {
|
|
|
142325
142381
|
});
|
|
142326
142382
|
}
|
|
142327
142383
|
start() {
|
|
142328
|
-
|
|
142384
|
+
logger177.debug(
|
|
142329
142385
|
`Starting atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
|
|
142330
142386
|
);
|
|
142331
142387
|
this.#timer.start();
|
|
142332
142388
|
}
|
|
142333
142389
|
#timeoutTriggered() {
|
|
142334
|
-
|
|
142390
|
+
logger177.debug(
|
|
142335
142391
|
`Atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id} timed out`
|
|
142336
142392
|
);
|
|
142337
142393
|
this.close();
|
|
142338
142394
|
}
|
|
142339
142395
|
close() {
|
|
142340
|
-
|
|
142396
|
+
logger177.debug(
|
|
142341
142397
|
`Closing atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
|
|
142342
142398
|
);
|
|
142343
142399
|
if (this.#timer.isRunning) {
|
|
@@ -142348,7 +142404,7 @@ var AtomicWriteState = class {
|
|
|
142348
142404
|
};
|
|
142349
142405
|
|
|
142350
142406
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteHandler.js
|
|
142351
|
-
var
|
|
142407
|
+
var logger178 = Logger.get("AtomicWriteHandler");
|
|
142352
142408
|
var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
142353
142409
|
#observers = new ObserverGroup();
|
|
142354
142410
|
#pendingWrites = new BasicSet();
|
|
@@ -142416,7 +142472,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
142416
142472
|
);
|
|
142417
142473
|
this.#pendingWrites.add(state);
|
|
142418
142474
|
state.closed.on(() => void this.#pendingWrites.delete(state));
|
|
142419
|
-
|
|
142475
|
+
logger178.debug("Added atomic write state:", state);
|
|
142420
142476
|
return state;
|
|
142421
142477
|
}
|
|
142422
142478
|
if (existingState === void 0) {
|
|
@@ -142483,10 +142539,10 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
142483
142539
|
writeAttribute(context, endpoint, cluster2, attribute, value) {
|
|
142484
142540
|
const state = this.#assertPendingWriteForAttributeAndPeer(context, endpoint, cluster2, attribute);
|
|
142485
142541
|
const attributeName = state.attributeNames.get(attribute);
|
|
142486
|
-
|
|
142542
|
+
logger178.debug(`Writing pending value for attribute ${attributeName}, ${attribute} in atomic write`, value);
|
|
142487
142543
|
endpoint.eventsOf(cluster2.id)[`${attributeName}$AtomicChanging`]?.emit(value, state.pendingAttributeValues[attribute] !== void 0 ? state.pendingAttributeValues[attribute] : state.initialValues[attribute], context);
|
|
142488
142544
|
state.pendingAttributeValues[attribute] = value;
|
|
142489
|
-
|
|
142545
|
+
logger178.debug("Atomic write state after current write:", state);
|
|
142490
142546
|
}
|
|
142491
142547
|
/**
|
|
142492
142548
|
* Implements the commit logic for an atomic write.
|
|
@@ -142505,7 +142561,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
142505
142561
|
await context.transaction?.commit();
|
|
142506
142562
|
} catch (error) {
|
|
142507
142563
|
await context.transaction?.rollback();
|
|
142508
|
-
|
|
142564
|
+
logger178.info(`Failed to write attribute ${attr} during atomic write commit: ${error}`);
|
|
142509
142565
|
statusCode = StatusResponseError.of(error)?.code ?? Status2.Failure;
|
|
142510
142566
|
commandStatusCode = commandStatusCode === Status2.Failure ? Status2.Failure : commandStatusCode === Status2.ConstraintError ? Status2.ConstraintError : Status2.Failure;
|
|
142511
142567
|
}
|
|
@@ -142541,7 +142597,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
142541
142597
|
const fabricIndex = fabric.fabricIndex;
|
|
142542
142598
|
for (const writeState of Array.from(this.#pendingWrites)) {
|
|
142543
142599
|
if (writeState.peerAddress.fabricIndex === fabricIndex) {
|
|
142544
|
-
|
|
142600
|
+
logger178.debug(
|
|
142545
142601
|
`Closing atomic write state for peer ${writeState.peerAddress.toString()} on endpoint ${writeState.endpoint.id} due to fabric removal`
|
|
142546
142602
|
);
|
|
142547
142603
|
writeState.close();
|
|
@@ -142582,7 +142638,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
142582
142638
|
if (!PeerAddress.is(attrWriteState.peerAddress, peerAddress)) {
|
|
142583
142639
|
return void 0;
|
|
142584
142640
|
}
|
|
142585
|
-
|
|
142641
|
+
logger178.debug(
|
|
142586
142642
|
`Found pending value for attribute ${attribute} for peer ${peerAddress.nodeId}`,
|
|
142587
142643
|
serialize(attrWriteState.pendingAttributeValues[attribute])
|
|
142588
142644
|
);
|
|
@@ -142623,7 +142679,7 @@ var ThermostatBehaviorConstructor = ClusterBehavior.for(Thermostat3);
|
|
|
142623
142679
|
var ThermostatBehavior = ThermostatBehaviorConstructor;
|
|
142624
142680
|
|
|
142625
142681
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/thermostat/ThermostatServer.js
|
|
142626
|
-
var
|
|
142682
|
+
var logger179 = Logger.get("ThermostatServer");
|
|
142627
142683
|
var ThermostatBehaviorLogicBase = ThermostatBehavior.with(
|
|
142628
142684
|
Thermostat3.Feature.Heating,
|
|
142629
142685
|
Thermostat3.Feature.Cooling,
|
|
@@ -142652,7 +142708,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
142652
142708
|
throw new ImplementationError("Setback feature is deprecated and not allowed to be enabled");
|
|
142653
142709
|
}
|
|
142654
142710
|
if (this.features.matterScheduleConfiguration) {
|
|
142655
|
-
|
|
142711
|
+
logger179.warn("MatterScheduleConfiguration feature is not yet implemented. Please do not activate it");
|
|
142656
142712
|
}
|
|
142657
142713
|
if (!this.features.presets && !this.features.matterScheduleConfiguration) {
|
|
142658
142714
|
this.atomicRequest = Behavior.unimplemented;
|
|
@@ -142773,7 +142829,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
142773
142829
|
throw new StatusResponse.InvalidCommandError("Requested PresetHandle not found");
|
|
142774
142830
|
}
|
|
142775
142831
|
}
|
|
142776
|
-
|
|
142832
|
+
logger179.info(`Setting active preset handle to`, presetHandle);
|
|
142777
142833
|
this.state.activePresetHandle = presetHandle;
|
|
142778
142834
|
return preset;
|
|
142779
142835
|
}
|
|
@@ -142843,7 +142899,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
142843
142899
|
}
|
|
142844
142900
|
if (this.state.setpointHoldExpiryTimestamp === void 0) {
|
|
142845
142901
|
} else {
|
|
142846
|
-
|
|
142902
|
+
logger179.warn(
|
|
142847
142903
|
"Handling for setpointHoldExpiryTimestamp is not yet implemented. To use this attribute you need to install the needed logic yourself"
|
|
142848
142904
|
);
|
|
142849
142905
|
}
|
|
@@ -142916,7 +142972,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
142916
142972
|
"RemoteSensing cannot be set to LocalTemperature when LocalTemperatureNotExposed feature is enabled"
|
|
142917
142973
|
);
|
|
142918
142974
|
}
|
|
142919
|
-
|
|
142975
|
+
logger179.debug("LocalTemperatureNotExposed feature is enabled, ignoring local temperature measurement");
|
|
142920
142976
|
this.state.localTemperature = null;
|
|
142921
142977
|
}
|
|
142922
142978
|
let localTemperature = null;
|
|
@@ -142925,11 +142981,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
142925
142981
|
const endpoints = this.env.get(ServerNode).endpoints;
|
|
142926
142982
|
const endpoint = endpoints.has(localTempEndpoint) ? endpoints.for(localTempEndpoint) : void 0;
|
|
142927
142983
|
if (endpoint !== void 0 && endpoint.behaviors.has(TemperatureMeasurementServer)) {
|
|
142928
|
-
|
|
142984
|
+
logger179.debug(
|
|
142929
142985
|
`Using existing TemperatureMeasurement cluster on endpoint #${localTempEndpoint} for local temperature measurement`
|
|
142930
142986
|
);
|
|
142931
142987
|
if (this.state.externalMeasuredIndoorTemperature !== void 0) {
|
|
142932
|
-
|
|
142988
|
+
logger179.warn(
|
|
142933
142989
|
"Both local TemperatureMeasurement cluster and externalMeasuredIndoorTemperature state are set, using local cluster"
|
|
142934
142990
|
);
|
|
142935
142991
|
}
|
|
@@ -142939,19 +142995,19 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
142939
142995
|
);
|
|
142940
142996
|
localTemperature = endpoint.stateOf(TemperatureMeasurementServer).measuredValue;
|
|
142941
142997
|
} else {
|
|
142942
|
-
|
|
142998
|
+
logger179.warn(
|
|
142943
142999
|
`No TemperatureMeasurement cluster found on endpoint #${localTempEndpoint}, falling back to externalMeasuredIndoorTemperature state if set`
|
|
142944
143000
|
);
|
|
142945
143001
|
}
|
|
142946
143002
|
} else {
|
|
142947
143003
|
if (this.state.externalMeasuredIndoorTemperature === void 0) {
|
|
142948
143004
|
if (this.state.localTemperatureCalibration !== void 0) {
|
|
142949
|
-
|
|
143005
|
+
logger179.warn(
|
|
142950
143006
|
"No local TemperatureMeasurement cluster available, externalMeasuredIndoorTemperature state not set but localTemperatureCalibration is used: Ensure to correctly consider the calibration when updating the localTemperature value"
|
|
142951
143007
|
);
|
|
142952
143008
|
}
|
|
142953
143009
|
} else {
|
|
142954
|
-
|
|
143010
|
+
logger179.info("Using measured temperature via externalMeasuredIndoorTemperature state");
|
|
142955
143011
|
localTemperature = this.state.externalMeasuredIndoorTemperature ?? null;
|
|
142956
143012
|
}
|
|
142957
143013
|
this.reactTo(this.events.externalMeasuredIndoorTemperature$Changed, this.#handleMeasuredTemperatureChange);
|
|
@@ -142991,28 +143047,28 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
142991
143047
|
const endpoints = this.env.get(ServerNode).endpoints;
|
|
142992
143048
|
const endpoint = endpoints.has(localOccupancyEndpoint) ? endpoints.for(localOccupancyEndpoint) : void 0;
|
|
142993
143049
|
if (endpoint !== void 0 && endpoint.behaviors.has(OccupancySensingServer)) {
|
|
142994
|
-
|
|
143050
|
+
logger179.debug(
|
|
142995
143051
|
`Using existing OccupancySensing cluster on endpoint ${localOccupancyEndpoint} for local occupancy sensing`
|
|
142996
143052
|
);
|
|
142997
143053
|
if (this.state.externallyMeasuredOccupancy !== void 0) {
|
|
142998
|
-
|
|
143054
|
+
logger179.warn(
|
|
142999
143055
|
"Both local OccupancySensing cluster and externallyMeasuredOccupancy state are set, using local cluster"
|
|
143000
143056
|
);
|
|
143001
143057
|
}
|
|
143002
143058
|
this.reactTo(endpoint.eventsOf(OccupancySensingServer).occupancy$Changed, this.#handleOccupancyChange);
|
|
143003
143059
|
currentOccupancy = !!endpoint.stateOf(OccupancySensingServer).occupancy.occupied;
|
|
143004
143060
|
} else {
|
|
143005
|
-
|
|
143061
|
+
logger179.warn(
|
|
143006
143062
|
`No OccupancySensing cluster found on endpoint ${localOccupancyEndpoint}, falling back to externallyMeasuredOccupancy state if set`
|
|
143007
143063
|
);
|
|
143008
143064
|
}
|
|
143009
143065
|
} else {
|
|
143010
143066
|
if (this.state.externallyMeasuredOccupancy === void 0) {
|
|
143011
|
-
|
|
143067
|
+
logger179.warn(
|
|
143012
143068
|
"No local OccupancySensing cluster available and externallyMeasuredOccupancy state not set"
|
|
143013
143069
|
);
|
|
143014
143070
|
} else {
|
|
143015
|
-
|
|
143071
|
+
logger179.info("Using occupancy via externallyMeasuredOccupancy state");
|
|
143016
143072
|
currentOccupancy = this.state.externallyMeasuredOccupancy;
|
|
143017
143073
|
}
|
|
143018
143074
|
this.reactTo(this.events.externallyMeasuredOccupancy$Changed, this.#handleExternalOccupancyChange);
|
|
@@ -143279,7 +143335,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
143279
143335
|
max = this.state[`max${scope}`] ?? defaults.absMax,
|
|
143280
143336
|
absMax = this.state[`absMax${scope}`] ?? defaults.absMax
|
|
143281
143337
|
} = details;
|
|
143282
|
-
|
|
143338
|
+
logger179.debug(
|
|
143283
143339
|
`Validating user setpoint limits for ${scope}: absMin=${absMin}, min=${min}, max=${max}, absMax=${absMax}`
|
|
143284
143340
|
);
|
|
143285
143341
|
if (absMin > min) {
|
|
@@ -143326,7 +143382,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
143326
143382
|
const limitMax = scope === "Heat" ? this.heatSetpointMaximum : this.coolSetpointMaximum;
|
|
143327
143383
|
const result = cropValueRange(setpoint, limitMin, limitMax);
|
|
143328
143384
|
if (result !== setpoint) {
|
|
143329
|
-
|
|
143385
|
+
logger179.debug(
|
|
143330
143386
|
`${scope} setpoint (${setpoint}) is out of limits [${limitMin}, ${limitMax}], clamping to ${result}`
|
|
143331
143387
|
);
|
|
143332
143388
|
}
|
|
@@ -143363,7 +143419,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
143363
143419
|
const otherLimit = otherType === "Heating" ? this.heatSetpointMinimum : this.coolSetpointMaximum;
|
|
143364
143420
|
if (otherType === "Cooling") {
|
|
143365
143421
|
const minValidSetpoint = value + deadband;
|
|
143366
|
-
|
|
143422
|
+
logger179.debug(
|
|
143367
143423
|
`Ensuring deadband for ${type}${otherType}Setpoint, min valid setpoint is ${minValidSetpoint}`
|
|
143368
143424
|
);
|
|
143369
143425
|
if (otherSetpoint >= minValidSetpoint) {
|
|
@@ -143374,11 +143430,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
143374
143430
|
`Cannot adjust cooling setpoint to maintain deadband, would exceed max cooling setpoint (${otherLimit})`
|
|
143375
143431
|
);
|
|
143376
143432
|
}
|
|
143377
|
-
|
|
143433
|
+
logger179.debug(`Adjusting ${type}${otherType}Setpoint to ${minValidSetpoint} to maintain deadband`);
|
|
143378
143434
|
this.state[`${type}${otherType}Setpoint`] = minValidSetpoint;
|
|
143379
143435
|
} else {
|
|
143380
143436
|
const maxValidSetpoint = value - deadband;
|
|
143381
|
-
|
|
143437
|
+
logger179.debug(
|
|
143382
143438
|
`Ensuring deadband for ${type}${otherType}Setpoint, max valid setpoint is ${maxValidSetpoint}`
|
|
143383
143439
|
);
|
|
143384
143440
|
if (otherSetpoint <= maxValidSetpoint) {
|
|
@@ -143389,7 +143445,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
143389
143445
|
`Cannot adjust heating setpoint to maintain deadband, would exceed min heating setpoint (${otherLimit})`
|
|
143390
143446
|
);
|
|
143391
143447
|
}
|
|
143392
|
-
|
|
143448
|
+
logger179.debug(`Adjusting ${type}${otherType}Setpoint to ${maxValidSetpoint} to maintain deadband`);
|
|
143393
143449
|
this.state[`${type}${otherType}Setpoint`] = maxValidSetpoint;
|
|
143394
143450
|
}
|
|
143395
143451
|
}
|
|
@@ -143657,7 +143713,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
143657
143713
|
*/
|
|
143658
143714
|
#handlePersistedPresetsChanged(newPresets, oldPresets) {
|
|
143659
143715
|
if (oldPresets === void 0) {
|
|
143660
|
-
|
|
143716
|
+
logger179.debug(
|
|
143661
143717
|
"Old presets is undefined, skipping some checks. This should only happen on setup of the behavior."
|
|
143662
143718
|
);
|
|
143663
143719
|
}
|
|
@@ -143666,7 +143722,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
143666
143722
|
const newPresetHandles = /* @__PURE__ */ new Set();
|
|
143667
143723
|
for (const preset of newPresets) {
|
|
143668
143724
|
if (preset.presetHandle === null) {
|
|
143669
|
-
|
|
143725
|
+
logger179.error("Preset is missing presetHandle, generating a new one");
|
|
143670
143726
|
preset.presetHandle = entropy.randomBytes(16);
|
|
143671
143727
|
changed = true;
|
|
143672
143728
|
}
|
|
@@ -143715,7 +143771,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
143715
143771
|
throw new StatusResponse.InvalidInStateError(`ActivePresetHandle references non-existing presetHandle`);
|
|
143716
143772
|
}
|
|
143717
143773
|
if (changed) {
|
|
143718
|
-
|
|
143774
|
+
logger179.error("PresetHandles or BuiltIn flags were updated, updating persistedPresets");
|
|
143719
143775
|
this.state.persistedPresets = newPresets;
|
|
143720
143776
|
}
|
|
143721
143777
|
}
|
|
@@ -144775,7 +144831,7 @@ var WindowCoveringBehaviorConstructor = ClusterBehavior.for(WindowCovering3);
|
|
|
144775
144831
|
var WindowCoveringBehavior = WindowCoveringBehaviorConstructor;
|
|
144776
144832
|
|
|
144777
144833
|
// ../../node_modules/.pnpm/@matter+node@0.17.0/node_modules/@matter/node/dist/esm/behaviors/window-covering/WindowCoveringServer.js
|
|
144778
|
-
var
|
|
144834
|
+
var logger180 = Logger.get("WindowCoveringServer");
|
|
144779
144835
|
var WindowCoveringBase = WindowCoveringBehavior.with(
|
|
144780
144836
|
WindowCovering3.Feature.Lift,
|
|
144781
144837
|
WindowCovering3.Feature.Tilt,
|
|
@@ -144860,7 +144916,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
144860
144916
|
this.state.configStatus = configStatus;
|
|
144861
144917
|
});
|
|
144862
144918
|
}
|
|
144863
|
-
|
|
144919
|
+
logger180.debug(
|
|
144864
144920
|
`Mode changed to ${Diagnostic.json(mode)} and config status to ${Diagnostic.json(configStatus)} and internal calibration mode to ${this.internal.calibrationMode}`
|
|
144865
144921
|
);
|
|
144866
144922
|
}
|
|
@@ -144868,7 +144924,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
144868
144924
|
#handleOperationalStatusChanging(operationalStatus) {
|
|
144869
144925
|
const globalStatus = operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped ? operationalStatus.lift : operationalStatus.tilt;
|
|
144870
144926
|
operationalStatus.global = globalStatus;
|
|
144871
|
-
|
|
144927
|
+
logger180.debug(
|
|
144872
144928
|
`Operational status changed to ${Diagnostic.json(operationalStatus)} with new global status ${globalStatus}`
|
|
144873
144929
|
);
|
|
144874
144930
|
this.state.operationalStatus = operationalStatus;
|
|
@@ -144897,10 +144953,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
144897
144953
|
this.state.currentPositionLiftPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
|
|
144898
144954
|
if (this.state.operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionLiftPercent100ths) {
|
|
144899
144955
|
this.state.operationalStatus.lift = WindowCovering3.MovementStatus.Stopped;
|
|
144900
|
-
|
|
144956
|
+
logger180.debug("Lift movement stopped, target value reached");
|
|
144901
144957
|
}
|
|
144902
144958
|
}
|
|
144903
|
-
|
|
144959
|
+
logger180.debug(
|
|
144904
144960
|
`Syncing lift position ${this.state.currentPositionLiftPercent100ths === null ? null : (this.state.currentPositionLiftPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionLiftPercentage}%`
|
|
144905
144961
|
);
|
|
144906
144962
|
}
|
|
@@ -144910,10 +144966,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
144910
144966
|
this.state.currentPositionTiltPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
|
|
144911
144967
|
if (this.state.operationalStatus.tilt !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionTiltPercent100ths) {
|
|
144912
144968
|
this.state.operationalStatus.tilt = WindowCovering3.MovementStatus.Stopped;
|
|
144913
|
-
|
|
144969
|
+
logger180.debug("Tilt movement stopped, target value reached");
|
|
144914
144970
|
}
|
|
144915
144971
|
}
|
|
144916
|
-
|
|
144972
|
+
logger180.debug(
|
|
144917
144973
|
`Syncing tilt position ${this.state.currentPositionTiltPercent100ths === null ? null : (this.state.currentPositionTiltPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionTiltPercentage}%`
|
|
144918
144974
|
);
|
|
144919
144975
|
}
|
|
@@ -145001,7 +145057,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
145001
145057
|
}
|
|
145002
145058
|
const directionInfo = direction === 2 ? ` in direction by position` : ` in direction ${direction === 1 ? "Close" : "Open"}`;
|
|
145003
145059
|
const targetInfo = targetPercent100ths === void 0 ? "" : ` to target position ${(targetPercent100ths / 100).toFixed(2)}`;
|
|
145004
|
-
|
|
145060
|
+
logger180.debug(
|
|
145005
145061
|
`Moving the device ${type === 0 ? "Lift" : "Tilt"}${directionInfo} (reversed=${reversed})${targetInfo}`
|
|
145006
145062
|
);
|
|
145007
145063
|
}
|
|
@@ -145023,7 +145079,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
145023
145079
|
);
|
|
145024
145080
|
}
|
|
145025
145081
|
if (type === 0 && this.state.configStatus.liftMovementReversed) {
|
|
145026
|
-
|
|
145082
|
+
logger180.debug("Lift movement is reversed");
|
|
145027
145083
|
}
|
|
145028
145084
|
switch (type) {
|
|
145029
145085
|
case 0:
|
|
@@ -145269,7 +145325,7 @@ function trimToLength(value, maxLength, suffix) {
|
|
|
145269
145325
|
}
|
|
145270
145326
|
|
|
145271
145327
|
// src/matter/endpoints/server-mode-server-node.ts
|
|
145272
|
-
var
|
|
145328
|
+
var logger181 = Logger.get("ServerModeServerNode");
|
|
145273
145329
|
var ServerModeServerNode = class extends ServerNode {
|
|
145274
145330
|
deviceEndpoint;
|
|
145275
145331
|
featureFlags;
|
|
@@ -145355,7 +145411,7 @@ var ServerModeServerNode = class extends ServerNode {
|
|
|
145355
145411
|
await this.set({ basicInformation });
|
|
145356
145412
|
} catch (e) {
|
|
145357
145413
|
const msg = e instanceof Error ? e.message : String(e);
|
|
145358
|
-
|
|
145414
|
+
logger181.warn(
|
|
145359
145415
|
`Failed to apply server-mode identity for ${entityId}: ${msg}`
|
|
145360
145416
|
);
|
|
145361
145417
|
}
|
|
@@ -145366,7 +145422,7 @@ var ServerModeServerNode = class extends ServerNode {
|
|
|
145366
145422
|
await this.set({ productDescription: { deviceType } });
|
|
145367
145423
|
} catch (e) {
|
|
145368
145424
|
const msg = e instanceof Error ? e.message : String(e);
|
|
145369
|
-
|
|
145425
|
+
logger181.warn(`Failed to set server-mode device type: ${msg}`);
|
|
145370
145426
|
}
|
|
145371
145427
|
}
|
|
145372
145428
|
async factoryReset() {
|
|
@@ -145453,7 +145509,7 @@ init_basic_information2();
|
|
|
145453
145509
|
init_descriptor2();
|
|
145454
145510
|
init_aggregator();
|
|
145455
145511
|
init_esm();
|
|
145456
|
-
var
|
|
145512
|
+
var logger182 = Logger.get("BridgedDeviceBasicInformationServer");
|
|
145457
145513
|
var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInformationBehavior {
|
|
145458
145514
|
async initialize() {
|
|
145459
145515
|
if (this.endpoint.lifecycle.isInstalled) {
|
|
@@ -145467,7 +145523,7 @@ var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInform
|
|
|
145467
145523
|
if (uniqueId === void 0) {
|
|
145468
145524
|
this.state.uniqueId = BasicInformationServer.createUniqueId();
|
|
145469
145525
|
}
|
|
145470
|
-
validateBasicInfoAttributes(this.state,
|
|
145526
|
+
validateBasicInfoAttributes(this.state, logger182);
|
|
145471
145527
|
}
|
|
145472
145528
|
static schema = BasicInformationServer.enableUniqueIdPersistence(
|
|
145473
145529
|
BridgedDeviceBasicInformationBehavior.schema
|
|
@@ -146170,7 +146226,7 @@ var IdentifyServer2 = class extends IdentifyServer {
|
|
|
146170
146226
|
// src/matter/endpoints/validate-endpoint-type.ts
|
|
146171
146227
|
init_esm();
|
|
146172
146228
|
init_esm7();
|
|
146173
|
-
var
|
|
146229
|
+
var logger183 = Logger.get("EndpointValidation");
|
|
146174
146230
|
function toCamelCase(name) {
|
|
146175
146231
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
146176
146232
|
}
|
|
@@ -146200,12 +146256,12 @@ function validateEndpointType(endpointType, entityId) {
|
|
|
146200
146256
|
}
|
|
146201
146257
|
const prefix = entityId ? `[${entityId}] ` : "";
|
|
146202
146258
|
if (missingMandatory.length > 0) {
|
|
146203
|
-
|
|
146259
|
+
logger183.warn(
|
|
146204
146260
|
`${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): missing mandatory clusters: ${missingMandatory.join(", ")}`
|
|
146205
146261
|
);
|
|
146206
146262
|
}
|
|
146207
146263
|
if (availableOptional.length > 0) {
|
|
146208
|
-
|
|
146264
|
+
logger183.debug(
|
|
146209
146265
|
`${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): optional clusters not used: ${availableOptional.join(", ")}`
|
|
146210
146266
|
);
|
|
146211
146267
|
}
|
|
@@ -146318,7 +146374,7 @@ var BridgeDataProvider = class extends Service {
|
|
|
146318
146374
|
|
|
146319
146375
|
// src/utils/apply-patch-state.ts
|
|
146320
146376
|
init_esm();
|
|
146321
|
-
var
|
|
146377
|
+
var logger184 = Logger.get("ApplyPatchState");
|
|
146322
146378
|
function applyPatchState(state, patch, options) {
|
|
146323
146379
|
return applyPatch(state, patch, options?.force);
|
|
146324
146380
|
}
|
|
@@ -146345,23 +146401,23 @@ function applyPatch(state, patch, force = false) {
|
|
|
146345
146401
|
if (errorMessage.includes(
|
|
146346
146402
|
"Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
|
|
146347
146403
|
)) {
|
|
146348
|
-
|
|
146404
|
+
logger184.debug(
|
|
146349
146405
|
`Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
|
|
146350
146406
|
);
|
|
146351
146407
|
return actualPatch;
|
|
146352
146408
|
}
|
|
146353
146409
|
if (errorMessage.includes("synchronous-transaction-conflict")) {
|
|
146354
|
-
|
|
146410
|
+
logger184.warn(
|
|
146355
146411
|
`Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
|
|
146356
146412
|
);
|
|
146357
146413
|
return actualPatch;
|
|
146358
146414
|
}
|
|
146359
146415
|
failedKeys.push(key);
|
|
146360
|
-
|
|
146416
|
+
logger184.warn(`Failed to set property '${key}': ${errorMessage}`);
|
|
146361
146417
|
}
|
|
146362
146418
|
}
|
|
146363
146419
|
if (failedKeys.length > 0) {
|
|
146364
|
-
|
|
146420
|
+
logger184.warn(
|
|
146365
146421
|
`${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
|
|
146366
146422
|
);
|
|
146367
146423
|
}
|
|
@@ -146431,7 +146487,7 @@ function truncate(maxLength, value) {
|
|
|
146431
146487
|
}
|
|
146432
146488
|
|
|
146433
146489
|
// src/plugins/plugin-device-factory.ts
|
|
146434
|
-
var
|
|
146490
|
+
var logger185 = Logger.get("PluginDeviceFactory");
|
|
146435
146491
|
var deviceTypeMap = {
|
|
146436
146492
|
on_off_light: () => OnOffLightDevice.with(
|
|
146437
146493
|
IdentifyServer2,
|
|
@@ -146537,7 +146593,7 @@ var deviceTypeMap = {
|
|
|
146537
146593
|
function createPluginEndpointType(deviceType) {
|
|
146538
146594
|
const factory = deviceTypeMap[deviceType];
|
|
146539
146595
|
if (!factory) {
|
|
146540
|
-
|
|
146596
|
+
logger185.warn(`Unsupported plugin device type: "${deviceType}"`);
|
|
146541
146597
|
return void 0;
|
|
146542
146598
|
}
|
|
146543
146599
|
const endpoint = factory();
|
|
@@ -146552,7 +146608,7 @@ function getSupportedPluginDeviceTypes() {
|
|
|
146552
146608
|
init_esm();
|
|
146553
146609
|
import * as fs9 from "node:fs";
|
|
146554
146610
|
import * as path11 from "node:path";
|
|
146555
|
-
var
|
|
146611
|
+
var logger186 = Logger.get("PluginStorage");
|
|
146556
146612
|
var SAVE_DEBOUNCE_MS = 500;
|
|
146557
146613
|
var FilePluginStorage = class {
|
|
146558
146614
|
data = {};
|
|
@@ -146588,7 +146644,7 @@ var FilePluginStorage = class {
|
|
|
146588
146644
|
this.data = JSON.parse(raw);
|
|
146589
146645
|
}
|
|
146590
146646
|
} catch (e) {
|
|
146591
|
-
|
|
146647
|
+
logger186.warn(`Failed to load plugin storage from ${this.filePath}:`, e);
|
|
146592
146648
|
this.data = {};
|
|
146593
146649
|
}
|
|
146594
146650
|
}
|
|
@@ -146610,7 +146666,7 @@ var FilePluginStorage = class {
|
|
|
146610
146666
|
fs9.writeFileSync(this.filePath, JSON.stringify(this.data, null, 2));
|
|
146611
146667
|
this.dirty = false;
|
|
146612
146668
|
} catch (e) {
|
|
146613
|
-
|
|
146669
|
+
logger186.warn(`Failed to save plugin storage to ${this.filePath}:`, e);
|
|
146614
146670
|
}
|
|
146615
146671
|
}
|
|
146616
146672
|
flush() {
|
|
@@ -146620,7 +146676,7 @@ var FilePluginStorage = class {
|
|
|
146620
146676
|
|
|
146621
146677
|
// src/plugins/safe-plugin-runner.ts
|
|
146622
146678
|
init_esm();
|
|
146623
|
-
var
|
|
146679
|
+
var logger187 = Logger.get("SafePluginRunner");
|
|
146624
146680
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
146625
146681
|
var CIRCUIT_BREAKER_THRESHOLD = 3;
|
|
146626
146682
|
var SafePluginRunner = class {
|
|
@@ -146653,7 +146709,7 @@ var SafePluginRunner = class {
|
|
|
146653
146709
|
async run(pluginName, operation, fn, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
146654
146710
|
const state = this.getState(pluginName);
|
|
146655
146711
|
if (state.disabled) {
|
|
146656
|
-
|
|
146712
|
+
logger187.debug(
|
|
146657
146713
|
`Plugin "${pluginName}" is disabled (circuit breaker open), skipping ${operation}`
|
|
146658
146714
|
);
|
|
146659
146715
|
return void 0;
|
|
@@ -146671,13 +146727,13 @@ var SafePluginRunner = class {
|
|
|
146671
146727
|
timeout.clear();
|
|
146672
146728
|
state.failures++;
|
|
146673
146729
|
state.lastError = error instanceof Error ? error.message : String(error);
|
|
146674
|
-
|
|
146730
|
+
logger187.error(
|
|
146675
146731
|
`Plugin "${pluginName}" failed during ${operation} (failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
|
|
146676
146732
|
);
|
|
146677
146733
|
if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
|
|
146678
146734
|
state.disabled = true;
|
|
146679
146735
|
state.disabledAt = Date.now();
|
|
146680
|
-
|
|
146736
|
+
logger187.error(
|
|
146681
146737
|
`Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures. Last error: ${state.lastError}`
|
|
146682
146738
|
);
|
|
146683
146739
|
}
|
|
@@ -146699,13 +146755,13 @@ var SafePluginRunner = class {
|
|
|
146699
146755
|
} catch (error) {
|
|
146700
146756
|
state.failures++;
|
|
146701
146757
|
state.lastError = error instanceof Error ? error.message : String(error);
|
|
146702
|
-
|
|
146758
|
+
logger187.error(
|
|
146703
146759
|
`Plugin "${pluginName}" failed during ${operation} (sync, failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
|
|
146704
146760
|
);
|
|
146705
146761
|
if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
|
|
146706
146762
|
state.disabled = true;
|
|
146707
146763
|
state.disabledAt = Date.now();
|
|
146708
|
-
|
|
146764
|
+
logger187.error(
|
|
146709
146765
|
`Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures.`
|
|
146710
146766
|
);
|
|
146711
146767
|
}
|
|
@@ -146731,7 +146787,7 @@ var SafePluginRunner = class {
|
|
|
146731
146787
|
};
|
|
146732
146788
|
|
|
146733
146789
|
// src/plugins/plugin-manager.ts
|
|
146734
|
-
var
|
|
146790
|
+
var logger188 = Logger.get("PluginManager");
|
|
146735
146791
|
var PLUGIN_API_VERSION = 1;
|
|
146736
146792
|
var MAX_PLUGIN_DEVICE_ID_LENGTH = 100;
|
|
146737
146793
|
function validatePluginDevice(device) {
|
|
@@ -146814,7 +146870,7 @@ var PluginManager = class {
|
|
|
146814
146870
|
throw new Error(`Plugin at ${packagePath} package.json missing "main"`);
|
|
146815
146871
|
}
|
|
146816
146872
|
if (manifest.hamhPluginApiVersion != null && manifest.hamhPluginApiVersion !== PLUGIN_API_VERSION) {
|
|
146817
|
-
|
|
146873
|
+
logger188.warn(
|
|
146818
146874
|
`Plugin "${manifest.name}" declares API version ${manifest.hamhPluginApiVersion}, current is ${PLUGIN_API_VERSION}. It may not work correctly.`
|
|
146819
146875
|
);
|
|
146820
146876
|
}
|
|
@@ -146845,7 +146901,7 @@ var PluginManager = class {
|
|
|
146845
146901
|
};
|
|
146846
146902
|
await this.register(plugin, metadata);
|
|
146847
146903
|
} catch (e) {
|
|
146848
|
-
|
|
146904
|
+
logger188.error(`Failed to load external plugin from ${packagePath}:`, e);
|
|
146849
146905
|
throw e;
|
|
146850
146906
|
}
|
|
146851
146907
|
}
|
|
@@ -146922,7 +146978,7 @@ var PluginManager = class {
|
|
|
146922
146978
|
devices,
|
|
146923
146979
|
started: false
|
|
146924
146980
|
});
|
|
146925
|
-
|
|
146981
|
+
logger188.info(
|
|
146926
146982
|
`Registered plugin: ${plugin.name} v${plugin.version} (${metadata.source})`
|
|
146927
146983
|
);
|
|
146928
146984
|
}
|
|
@@ -146933,13 +146989,13 @@ var PluginManager = class {
|
|
|
146933
146989
|
for (const [name, instance] of this.instances) {
|
|
146934
146990
|
if (!instance.metadata.enabled) continue;
|
|
146935
146991
|
if (this.runner.isDisabled(name)) {
|
|
146936
|
-
|
|
146992
|
+
logger188.warn(
|
|
146937
146993
|
`Plugin "${name}" is disabled (circuit breaker), skipping start`
|
|
146938
146994
|
);
|
|
146939
146995
|
instance.metadata.enabled = false;
|
|
146940
146996
|
continue;
|
|
146941
146997
|
}
|
|
146942
|
-
|
|
146998
|
+
logger188.info(`Starting plugin: ${name}`);
|
|
146943
146999
|
await this.runner.run(
|
|
146944
147000
|
name,
|
|
146945
147001
|
"onStart",
|
|
@@ -146987,7 +147043,7 @@ var PluginManager = class {
|
|
|
146987
147043
|
storage2.flush();
|
|
146988
147044
|
}
|
|
146989
147045
|
instance.started = false;
|
|
146990
|
-
|
|
147046
|
+
logger188.info(`Plugin "${name}" shut down`);
|
|
146991
147047
|
}
|
|
146992
147048
|
this.instances.clear();
|
|
146993
147049
|
}
|
|
@@ -147424,10 +147480,10 @@ function seedExistingSessionStarts(startedAt, sessions, now = Date.now()) {
|
|
|
147424
147480
|
var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
147425
147481
|
var DEAD_SESSION_TIMEOUT_MS = 6e4;
|
|
147426
147482
|
var Bridge = class {
|
|
147427
|
-
constructor(env,
|
|
147483
|
+
constructor(env, logger231, dataProvider, endpointManager) {
|
|
147428
147484
|
this.dataProvider = dataProvider;
|
|
147429
147485
|
this.endpointManager = endpointManager;
|
|
147430
|
-
this.log =
|
|
147486
|
+
this.log = logger231.get(`Bridge / ${dataProvider.id}`);
|
|
147431
147487
|
this.server = new BridgeServerNode(
|
|
147432
147488
|
env,
|
|
147433
147489
|
this.dataProvider,
|
|
@@ -148444,7 +148500,7 @@ init_wi_fi_network_diagnostics();
|
|
|
148444
148500
|
|
|
148445
148501
|
// src/matter/behaviors/electrical-energy-measurement-server.ts
|
|
148446
148502
|
init_home_assistant_entity_behavior();
|
|
148447
|
-
var
|
|
148503
|
+
var logger189 = Logger.get("ElectricalEnergyMeasurementServer");
|
|
148448
148504
|
var FeaturedBase = ElectricalEnergyMeasurementServer.with("CumulativeEnergy", "ImportedEnergy");
|
|
148449
148505
|
var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
|
|
148450
148506
|
async initialize() {
|
|
@@ -148453,7 +148509,7 @@ var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
|
|
|
148453
148509
|
const entityId = homeAssistant.entityId;
|
|
148454
148510
|
const energyEntity = homeAssistant.state.mapping?.energyEntity;
|
|
148455
148511
|
if (energyEntity) {
|
|
148456
|
-
|
|
148512
|
+
logger189.debug(
|
|
148457
148513
|
`[${entityId}] ElectricalEnergyMeasurement using mapped energy entity: ${energyEntity}`
|
|
148458
148514
|
);
|
|
148459
148515
|
}
|
|
@@ -148509,7 +148565,7 @@ var HaElectricalEnergyMeasurementServer = ElectricalEnergyMeasurementServerBase.
|
|
|
148509
148565
|
// src/matter/behaviors/electrical-power-measurement-server.ts
|
|
148510
148566
|
init_esm();
|
|
148511
148567
|
init_home_assistant_entity_behavior();
|
|
148512
|
-
var
|
|
148568
|
+
var logger190 = Logger.get("ElectricalPowerMeasurementServer");
|
|
148513
148569
|
var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurementServer {
|
|
148514
148570
|
async initialize() {
|
|
148515
148571
|
await super.initialize();
|
|
@@ -148517,7 +148573,7 @@ var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurem
|
|
|
148517
148573
|
const entityId = homeAssistant.entityId;
|
|
148518
148574
|
const powerEntity = homeAssistant.state.mapping?.powerEntity;
|
|
148519
148575
|
if (powerEntity) {
|
|
148520
|
-
|
|
148576
|
+
logger190.debug(
|
|
148521
148577
|
`[${entityId}] ElectricalPowerMeasurement using mapped power entity: ${powerEntity}`
|
|
148522
148578
|
);
|
|
148523
148579
|
}
|
|
@@ -148569,7 +148625,7 @@ init_home_assistant_entity_behavior();
|
|
|
148569
148625
|
// src/matter/behaviors/humidity-measurement-server.ts
|
|
148570
148626
|
init_esm();
|
|
148571
148627
|
init_home_assistant_entity_behavior();
|
|
148572
|
-
var
|
|
148628
|
+
var logger191 = Logger.get("HumidityMeasurementServer");
|
|
148573
148629
|
var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementServer {
|
|
148574
148630
|
async initialize() {
|
|
148575
148631
|
await super.initialize();
|
|
@@ -148582,7 +148638,7 @@ var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementSer
|
|
|
148582
148638
|
return;
|
|
148583
148639
|
}
|
|
148584
148640
|
const humidity = this.getHumidity(this.state.config, entity.state);
|
|
148585
|
-
|
|
148641
|
+
logger191.debug(
|
|
148586
148642
|
`Humidity ${entity.state.entity_id} raw=${entity.state.state} measuredValue=${humidity}`
|
|
148587
148643
|
);
|
|
148588
148644
|
applyPatchState(this.state, {
|
|
@@ -148612,7 +148668,7 @@ function HumidityMeasurementServer(config11) {
|
|
|
148612
148668
|
// src/matter/behaviors/power-source-server.ts
|
|
148613
148669
|
init_esm();
|
|
148614
148670
|
init_home_assistant_entity_behavior();
|
|
148615
|
-
var
|
|
148671
|
+
var logger192 = Logger.get("PowerSourceServer");
|
|
148616
148672
|
var FeaturedBase2 = PowerSourceServer.with("Battery", "Rechargeable");
|
|
148617
148673
|
var PowerSourceServerBase = class extends FeaturedBase2 {
|
|
148618
148674
|
async initialize() {
|
|
@@ -148624,17 +148680,17 @@ var PowerSourceServerBase = class extends FeaturedBase2 {
|
|
|
148624
148680
|
applyPatchState(this.state, {
|
|
148625
148681
|
endpointList: [endpointNumber]
|
|
148626
148682
|
});
|
|
148627
|
-
|
|
148683
|
+
logger192.debug(
|
|
148628
148684
|
`[${entityId}] PowerSource initialized with endpointList=[${endpointNumber}]`
|
|
148629
148685
|
);
|
|
148630
148686
|
} else {
|
|
148631
|
-
|
|
148687
|
+
logger192.warn(
|
|
148632
148688
|
`[${entityId}] PowerSource endpoint number is null during initialize - endpointList will be empty!`
|
|
148633
148689
|
);
|
|
148634
148690
|
}
|
|
148635
148691
|
const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
|
|
148636
148692
|
if (batteryEntity) {
|
|
148637
|
-
|
|
148693
|
+
logger192.debug(
|
|
148638
148694
|
`[${entityId}] PowerSource using mapped battery entity: ${batteryEntity}`
|
|
148639
148695
|
);
|
|
148640
148696
|
}
|
|
@@ -149046,7 +149102,7 @@ function notifyLightTurnedOn(entityId) {
|
|
|
149046
149102
|
sweepLastTurnOn(now);
|
|
149047
149103
|
lastTurnOnTimestamps.set(entityId, now);
|
|
149048
149104
|
}
|
|
149049
|
-
var
|
|
149105
|
+
var logger193 = Logger.get("LevelControlServer");
|
|
149050
149106
|
var FeaturedBase4 = LevelControlServer.with("OnOff", "Lighting");
|
|
149051
149107
|
var LevelControlServerBase = class extends FeaturedBase4 {
|
|
149052
149108
|
pendingTransitionTime;
|
|
@@ -149064,7 +149120,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
149064
149120
|
try {
|
|
149065
149121
|
await super.initialize();
|
|
149066
149122
|
} catch (error) {
|
|
149067
|
-
|
|
149123
|
+
logger193.error("super.initialize() failed:", error);
|
|
149068
149124
|
throw error;
|
|
149069
149125
|
}
|
|
149070
149126
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -149141,7 +149197,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
149141
149197
|
const lastTurnOn = lastTurnOnTimestamps.get(entityId);
|
|
149142
149198
|
const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
|
|
149143
149199
|
if (level >= this.maxLevel && timeSinceTurnOn < 200) {
|
|
149144
|
-
|
|
149200
|
+
logger193.debug(
|
|
149145
149201
|
`[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
|
|
149146
149202
|
);
|
|
149147
149203
|
return;
|
|
@@ -149187,7 +149243,7 @@ function LevelControlServer2(config11) {
|
|
|
149187
149243
|
}
|
|
149188
149244
|
|
|
149189
149245
|
// src/matter/behaviors/on-off-server.ts
|
|
149190
|
-
var
|
|
149246
|
+
var logger194 = Logger.get("OnOffServer");
|
|
149191
149247
|
var optimisticOnOffState = /* @__PURE__ */ new Map();
|
|
149192
149248
|
var OPTIMISTIC_TIMEOUT_MS2 = 3e3;
|
|
149193
149249
|
function sweepOptimisticOnOff(now) {
|
|
@@ -149238,7 +149294,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
149238
149294
|
if (!action) {
|
|
149239
149295
|
return;
|
|
149240
149296
|
}
|
|
149241
|
-
|
|
149297
|
+
logger194.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
|
|
149242
149298
|
notifyLightTurnedOn(homeAssistant.entityId);
|
|
149243
149299
|
const now = Date.now();
|
|
149244
149300
|
sweepOptimisticOnOff(now);
|
|
@@ -149263,7 +149319,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
149263
149319
|
if (!action) {
|
|
149264
149320
|
return;
|
|
149265
149321
|
}
|
|
149266
|
-
|
|
149322
|
+
logger194.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
|
|
149267
149323
|
const now = Date.now();
|
|
149268
149324
|
sweepOptimisticOnOff(now);
|
|
149269
149325
|
optimisticOnOffState.set(homeAssistant.entityId, {
|
|
@@ -149297,7 +149353,7 @@ function setOptimisticOnOff(entityId, expectedOnOff) {
|
|
|
149297
149353
|
}
|
|
149298
149354
|
|
|
149299
149355
|
// src/matter/behaviors/fan-control-server.ts
|
|
149300
|
-
var
|
|
149356
|
+
var logger195 = Logger.get("FanControlServer");
|
|
149301
149357
|
var defaultStepSize = 33.33;
|
|
149302
149358
|
var minSpeedMax = 3;
|
|
149303
149359
|
var maxSpeedMax = 100;
|
|
@@ -149668,7 +149724,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
|
|
|
149668
149724
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
149669
149725
|
setOptimisticOnOff(entityId, on);
|
|
149670
149726
|
} catch (e) {
|
|
149671
|
-
|
|
149727
|
+
logger195.debug(
|
|
149672
149728
|
`syncOnOff(${on}) failed: ${e instanceof Error ? e.message : String(e)}`
|
|
149673
149729
|
);
|
|
149674
149730
|
}
|
|
@@ -149762,7 +149818,7 @@ var FanOnOffServer = OnOffServer2({
|
|
|
149762
149818
|
});
|
|
149763
149819
|
|
|
149764
149820
|
// src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
|
|
149765
|
-
var
|
|
149821
|
+
var logger196 = Logger.get("ComposedAirPurifierEndpoint");
|
|
149766
149822
|
var temperatureConfig = {
|
|
149767
149823
|
getValue(entity, agent) {
|
|
149768
149824
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
@@ -149978,7 +150034,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
149978
150034
|
config11.powerEntityId ? "+Pwr" : "",
|
|
149979
150035
|
config11.energyEntityId ? "+Nrg" : ""
|
|
149980
150036
|
].filter(Boolean).join("");
|
|
149981
|
-
|
|
150037
|
+
logger196.info(
|
|
149982
150038
|
`Created composed air purifier ${primaryEntityId}: ${clusterLabels}`
|
|
149983
150039
|
);
|
|
149984
150040
|
return endpoint;
|
|
@@ -150313,7 +150369,7 @@ init_home_assistant_entity_behavior();
|
|
|
150313
150369
|
// src/matter/behaviors/thermostat-server.ts
|
|
150314
150370
|
init_esm();
|
|
150315
150371
|
init_home_assistant_entity_behavior();
|
|
150316
|
-
var
|
|
150372
|
+
var logger197 = Logger.get("ThermostatServer");
|
|
150317
150373
|
var SystemMode = Thermostat3.SystemMode;
|
|
150318
150374
|
var RunningMode = Thermostat3.ThermostatRunningMode;
|
|
150319
150375
|
var nudgingSetpoints = /* @__PURE__ */ new Set();
|
|
@@ -150371,7 +150427,7 @@ var HeatingAndCoolingFeaturedBase = ThermostatServer.with("Heating", "Cooling").
|
|
|
150371
150427
|
);
|
|
150372
150428
|
function thermostatPreInitialize(self) {
|
|
150373
150429
|
const currentLocal = self.state.localTemperature;
|
|
150374
|
-
|
|
150430
|
+
logger197.debug(
|
|
150375
150431
|
`initialize: features - heating=${self.features.heating}, cooling=${self.features.cooling}`
|
|
150376
150432
|
);
|
|
150377
150433
|
const localValue = typeof currentLocal === "number" && !Number.isNaN(currentLocal) ? currentLocal : currentLocal === null ? null : 2100;
|
|
@@ -150394,7 +150450,7 @@ function thermostatPreInitialize(self) {
|
|
|
150394
150450
|
const coolingValue = typeof currentCooling === "number" && !Number.isNaN(currentCooling) ? currentCooling : 2400;
|
|
150395
150451
|
self.state.occupiedCoolingSetpoint = coolingValue;
|
|
150396
150452
|
}
|
|
150397
|
-
|
|
150453
|
+
logger197.debug(
|
|
150398
150454
|
`initialize: after force-set - local=${self.state.localTemperature}`
|
|
150399
150455
|
);
|
|
150400
150456
|
self.state.thermostatRunningState = runningStateAllOff;
|
|
@@ -150476,7 +150532,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
150476
150532
|
maxCoolLimit,
|
|
150477
150533
|
"cool"
|
|
150478
150534
|
);
|
|
150479
|
-
|
|
150535
|
+
logger197.debug(
|
|
150480
150536
|
`update: limits heat=[${minHeatLimit}, ${maxHeatLimit}], cool=[${minCoolLimit}, ${maxCoolLimit}], systemMode=${systemMode}, runningMode=${runningMode}`
|
|
150481
150537
|
);
|
|
150482
150538
|
let controlSequence = config11.getControlSequence(entity.state, this.agent);
|
|
@@ -150549,18 +150605,18 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
150549
150605
|
*/
|
|
150550
150606
|
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: Called via thermostatPostInitialize + prototype copy
|
|
150551
150607
|
heatingSetpointChanging(value, _oldValue, context) {
|
|
150552
|
-
|
|
150608
|
+
logger197.debug(
|
|
150553
150609
|
`heatingSetpointChanging: value=${value}, oldValue=${_oldValue}, isOffline=${transactionIsOffline(context)}`
|
|
150554
150610
|
);
|
|
150555
150611
|
if (transactionIsOffline(context)) {
|
|
150556
|
-
|
|
150612
|
+
logger197.debug(
|
|
150557
150613
|
"heatingSetpointChanging: skipping - transaction is offline"
|
|
150558
150614
|
);
|
|
150559
150615
|
return;
|
|
150560
150616
|
}
|
|
150561
150617
|
const next = Temperature.celsius(value / 100);
|
|
150562
150618
|
if (!next) {
|
|
150563
|
-
|
|
150619
|
+
logger197.debug("heatingSetpointChanging: skipping - invalid temperature");
|
|
150564
150620
|
return;
|
|
150565
150621
|
}
|
|
150566
150622
|
this.agent.asLocalActor(() => {
|
|
@@ -150571,7 +150627,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
150571
150627
|
this.agent
|
|
150572
150628
|
);
|
|
150573
150629
|
const currentMode = this.state.systemMode;
|
|
150574
|
-
|
|
150630
|
+
logger197.debug(
|
|
150575
150631
|
`heatingSetpointChanging: supportsRange=${supportsRange}, systemMode=${currentMode}, features.heating=${this.features.heating}, features.cooling=${this.features.cooling}`
|
|
150576
150632
|
);
|
|
150577
150633
|
if (!supportsRange) {
|
|
@@ -150581,12 +150637,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
150581
150637
|
const isOff = currentMode === Thermostat3.SystemMode.Off;
|
|
150582
150638
|
if (isOff && this.features.heating) {
|
|
150583
150639
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
150584
|
-
|
|
150640
|
+
logger197.debug(
|
|
150585
150641
|
`heatingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
150586
150642
|
);
|
|
150587
150643
|
return;
|
|
150588
150644
|
}
|
|
150589
|
-
|
|
150645
|
+
logger197.info(
|
|
150590
150646
|
`heatingSetpointChanging: auto-resume - switching to Heat (was Off)`
|
|
150591
150647
|
);
|
|
150592
150648
|
const modeAction = config11.setSystemMode(
|
|
@@ -150595,17 +150651,17 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
150595
150651
|
);
|
|
150596
150652
|
homeAssistant.callAction(modeAction);
|
|
150597
150653
|
} else if (!isAutoMode && !isHeatingMode) {
|
|
150598
|
-
|
|
150654
|
+
logger197.debug(
|
|
150599
150655
|
`heatingSetpointChanging: skipping - not in heating/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
|
|
150600
150656
|
);
|
|
150601
150657
|
return;
|
|
150602
150658
|
}
|
|
150603
|
-
|
|
150659
|
+
logger197.debug(
|
|
150604
150660
|
`heatingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isHeatingMode=${isHeatingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
150605
150661
|
);
|
|
150606
150662
|
}
|
|
150607
150663
|
const coolingSetpoint = this.features.cooling ? this.state.occupiedCoolingSetpoint : value;
|
|
150608
|
-
|
|
150664
|
+
logger197.debug(
|
|
150609
150665
|
`heatingSetpointChanging: calling setTemperature with heat=${next.celsius(true)}, cool=${coolingSetpoint}`
|
|
150610
150666
|
);
|
|
150611
150667
|
this.setTemperature(
|
|
@@ -150644,12 +150700,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
150644
150700
|
const isOff = currentMode === Thermostat3.SystemMode.Off;
|
|
150645
150701
|
if (isOff && !this.features.heating && this.features.cooling) {
|
|
150646
150702
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
150647
|
-
|
|
150703
|
+
logger197.debug(
|
|
150648
150704
|
`coolingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
150649
150705
|
);
|
|
150650
150706
|
return;
|
|
150651
150707
|
}
|
|
150652
|
-
|
|
150708
|
+
logger197.info(
|
|
150653
150709
|
`coolingSetpointChanging: auto-resume - switching to Cool (was Off)`
|
|
150654
150710
|
);
|
|
150655
150711
|
const modeAction = config11.setSystemMode(
|
|
@@ -150658,12 +150714,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
150658
150714
|
);
|
|
150659
150715
|
homeAssistant.callAction(modeAction);
|
|
150660
150716
|
} else if (!isAutoMode && !isCoolingMode) {
|
|
150661
|
-
|
|
150717
|
+
logger197.debug(
|
|
150662
150718
|
`coolingSetpointChanging: skipping - not in cooling/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
|
|
150663
150719
|
);
|
|
150664
150720
|
return;
|
|
150665
150721
|
}
|
|
150666
|
-
|
|
150722
|
+
logger197.debug(
|
|
150667
150723
|
`coolingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isCoolingMode=${isCoolingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
150668
150724
|
);
|
|
150669
150725
|
}
|
|
@@ -150762,7 +150818,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
150762
150818
|
const effectiveMax = max ?? 5e3;
|
|
150763
150819
|
if (value == null || Number.isNaN(value)) {
|
|
150764
150820
|
const defaultValue = type === "heat" ? 2e3 : 2400;
|
|
150765
|
-
|
|
150821
|
+
logger197.debug(
|
|
150766
150822
|
`${type} setpoint is undefined, using default: ${defaultValue}`
|
|
150767
150823
|
);
|
|
150768
150824
|
return Math.max(effectiveMin, Math.min(effectiveMax, defaultValue));
|
|
@@ -151329,7 +151385,7 @@ function ClimateDevice(homeAssistantEntity, includeBasicInformation = true) {
|
|
|
151329
151385
|
}
|
|
151330
151386
|
|
|
151331
151387
|
// src/matter/endpoints/composed/composed-climate-fan-endpoint.ts
|
|
151332
|
-
var
|
|
151388
|
+
var logger198 = Logger.get("ComposedClimateFanEndpoint");
|
|
151333
151389
|
function createEndpointId3(entityId, customName) {
|
|
151334
151390
|
const baseName = customName || entityId;
|
|
151335
151391
|
return baseName.replace(/\./g, "_").replace(/\s+/g, "_");
|
|
@@ -151367,7 +151423,7 @@ var ComposedClimateFanEndpoint = class _ComposedClimateFanEndpoint extends Endpo
|
|
|
151367
151423
|
climateSub = new Endpoint(climateType, { id: `${endpointId}_climate` });
|
|
151368
151424
|
} catch (error) {
|
|
151369
151425
|
const message = error instanceof Error ? error.message : String(error);
|
|
151370
|
-
|
|
151426
|
+
logger198.warn(
|
|
151371
151427
|
`Companion fan: climate sub build failed for ${primaryEntityId}: ${message}`
|
|
151372
151428
|
);
|
|
151373
151429
|
return void 0;
|
|
@@ -151407,7 +151463,7 @@ var ComposedClimateFanEndpoint = class _ComposedClimateFanEndpoint extends Endpo
|
|
|
151407
151463
|
endpointId,
|
|
151408
151464
|
[climateSub, fanSub]
|
|
151409
151465
|
);
|
|
151410
|
-
|
|
151466
|
+
logger198.info(`Created composed climate+fan endpoint ${primaryEntityId}`);
|
|
151411
151467
|
return endpoint;
|
|
151412
151468
|
}
|
|
151413
151469
|
constructor(type, entityId, id, parts) {
|
|
@@ -151502,7 +151558,7 @@ init_home_assistant_entity_behavior();
|
|
|
151502
151558
|
// src/matter/behaviors/pressure-measurement-server.ts
|
|
151503
151559
|
init_esm();
|
|
151504
151560
|
init_home_assistant_entity_behavior();
|
|
151505
|
-
var
|
|
151561
|
+
var logger199 = Logger.get("PressureMeasurementServer");
|
|
151506
151562
|
var MIN_PRESSURE = 300;
|
|
151507
151563
|
var MAX_PRESSURE = 1100;
|
|
151508
151564
|
var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
@@ -151530,7 +151586,7 @@ var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
|
151530
151586
|
}
|
|
151531
151587
|
const rounded = Math.round(value);
|
|
151532
151588
|
if (rounded < MIN_PRESSURE || rounded > MAX_PRESSURE) {
|
|
151533
|
-
|
|
151589
|
+
logger199.warn(
|
|
151534
151590
|
`Pressure value ${rounded} (raw: ${value}) for ${entity.entity_id} is outside valid range [${MIN_PRESSURE}-${MAX_PRESSURE}], ignoring`
|
|
151535
151591
|
);
|
|
151536
151592
|
return null;
|
|
@@ -151549,7 +151605,7 @@ function PressureMeasurementServer2(config11) {
|
|
|
151549
151605
|
}
|
|
151550
151606
|
|
|
151551
151607
|
// src/matter/endpoints/composed/composed-sensor-endpoint.ts
|
|
151552
|
-
var
|
|
151608
|
+
var logger200 = Logger.get("ComposedSensorEndpoint");
|
|
151553
151609
|
var temperatureConfig2 = {
|
|
151554
151610
|
getValue(entity, agent) {
|
|
151555
151611
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
@@ -151726,7 +151782,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
|
|
|
151726
151782
|
if (config11.pressureEntityId && pressSub) {
|
|
151727
151783
|
endpoint.subEndpoints.set(config11.pressureEntityId, pressSub);
|
|
151728
151784
|
}
|
|
151729
|
-
|
|
151785
|
+
logger200.info(
|
|
151730
151786
|
`Created composed sensor ${primaryEntityId} with ${parts.length} sub-endpoint(s): T${humSub ? "+H" : ""}${pressSub ? "+P" : ""}${config11.batteryEntityId ? "+Bat" : ""}${config11.powerEntityId ? "+Pwr" : ""}${config11.energyEntityId ? "+Nrg" : ""}`
|
|
151731
151787
|
);
|
|
151732
151788
|
return endpoint;
|
|
@@ -151862,7 +151918,7 @@ init_home_assistant_entity_behavior();
|
|
|
151862
151918
|
// src/matter/behaviors/mode-select-server.ts
|
|
151863
151919
|
init_esm();
|
|
151864
151920
|
init_home_assistant_entity_behavior();
|
|
151865
|
-
var
|
|
151921
|
+
var logger201 = Logger.get("ModeSelectServer");
|
|
151866
151922
|
function buildSupportedModes(options) {
|
|
151867
151923
|
return options.map((label, index) => ({
|
|
151868
151924
|
label: label.length > 64 ? label.substring(0, 64) : label,
|
|
@@ -151899,13 +151955,13 @@ var ModeSelectServerBase = class extends ModeSelectServer {
|
|
|
151899
151955
|
const options = config11.getOptions(homeAssistant.entity);
|
|
151900
151956
|
const { newMode } = request;
|
|
151901
151957
|
if (newMode < 0 || newMode >= options.length) {
|
|
151902
|
-
|
|
151958
|
+
logger201.warn(
|
|
151903
151959
|
`[${homeAssistant.entityId}] Invalid mode ${newMode}, options: [${options.join(", ")}]`
|
|
151904
151960
|
);
|
|
151905
151961
|
return;
|
|
151906
151962
|
}
|
|
151907
151963
|
const option = options[newMode];
|
|
151908
|
-
|
|
151964
|
+
logger201.info(
|
|
151909
151965
|
`[${homeAssistant.entityId}] changeToMode(${newMode}) -> "${option}"`
|
|
151910
151966
|
);
|
|
151911
151967
|
applyPatchState(this.state, { currentMode: newMode });
|
|
@@ -152431,7 +152487,7 @@ var WaterLeakDetectorType = WaterLeakDetectorDevice.with(
|
|
|
152431
152487
|
);
|
|
152432
152488
|
|
|
152433
152489
|
// src/matter/endpoints/legacy/binary-sensor/index.ts
|
|
152434
|
-
var
|
|
152490
|
+
var logger202 = Logger.get("BinarySensorDevice");
|
|
152435
152491
|
var deviceClasses = {
|
|
152436
152492
|
[BinarySensorDeviceClass.CarbonMonoxide]: CoAlarmType,
|
|
152437
152493
|
[BinarySensorDeviceClass.Gas]: CoAlarmType,
|
|
@@ -152483,11 +152539,11 @@ function BinarySensorDevice(homeAssistantEntity) {
|
|
|
152483
152539
|
const originalTypeName = type.name;
|
|
152484
152540
|
if (hasBattery && batteryTypes.has(type)) {
|
|
152485
152541
|
type = batteryTypes.get(type);
|
|
152486
|
-
|
|
152542
|
+
logger202.info(
|
|
152487
152543
|
`[${entityId}] Using battery variant: ${originalTypeName} -> ${type.name}, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
152488
152544
|
);
|
|
152489
152545
|
} else if (hasBattery) {
|
|
152490
|
-
|
|
152546
|
+
logger202.warn(
|
|
152491
152547
|
`[${entityId}] Has battery but no variant available for ${originalTypeName}`
|
|
152492
152548
|
);
|
|
152493
152549
|
}
|
|
@@ -152537,7 +152593,7 @@ init_home_assistant_entity_behavior();
|
|
|
152537
152593
|
init_esm();
|
|
152538
152594
|
init_home_assistant_actions();
|
|
152539
152595
|
init_home_assistant_entity_behavior();
|
|
152540
|
-
var
|
|
152596
|
+
var logger203 = Logger.get("WindowCoveringServer");
|
|
152541
152597
|
var MovementStatus = WindowCovering3.MovementStatus;
|
|
152542
152598
|
var FeaturedBase6 = WindowCoveringServer.with(
|
|
152543
152599
|
"Lift",
|
|
@@ -152652,7 +152708,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
152652
152708
|
}
|
|
152653
152709
|
return existing100ths ?? current100ths;
|
|
152654
152710
|
};
|
|
152655
|
-
|
|
152711
|
+
logger203.debug(
|
|
152656
152712
|
`Cover update for ${entity.entity_id}: state=${state.state}, lift=${currentLift}%, tilt=${currentTilt}%, movement=${MovementStatus[movementStatus]}`
|
|
152657
152713
|
);
|
|
152658
152714
|
const overrideType = config11.getCoverType?.(state, this.agent);
|
|
@@ -152695,9 +152751,9 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
152695
152751
|
);
|
|
152696
152752
|
if (Object.keys(appliedPatch).length > 0) {
|
|
152697
152753
|
const hasOperationalChange = "operationalStatus" in appliedPatch;
|
|
152698
|
-
const log = hasOperationalChange ?
|
|
152754
|
+
const log = hasOperationalChange ? logger203.info : logger203.debug;
|
|
152699
152755
|
log.call(
|
|
152700
|
-
|
|
152756
|
+
logger203,
|
|
152701
152757
|
`Cover ${entity.entity_id} state changed: ${JSON.stringify(appliedPatch)}`
|
|
152702
152758
|
);
|
|
152703
152759
|
}
|
|
@@ -152705,7 +152761,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
152705
152761
|
async handleMovement(type, _, direction, targetPercent100ths) {
|
|
152706
152762
|
const currentLift = this.state.currentPositionLiftPercent100ths ?? 0;
|
|
152707
152763
|
const currentTilt = this.state.currentPositionTiltPercent100ths ?? 0;
|
|
152708
|
-
|
|
152764
|
+
logger203.info(
|
|
152709
152765
|
`handleMovement: type=${MovementType[type]}, direction=${MovementDirection[direction]}, target=${targetPercent100ths}, currentLift=${currentLift}, currentTilt=${currentTilt}`
|
|
152710
152766
|
);
|
|
152711
152767
|
if (type === MovementType.Lift) {
|
|
@@ -152724,7 +152780,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
152724
152780
|
}
|
|
152725
152781
|
} else if (type === MovementType.Tilt) {
|
|
152726
152782
|
if (targetPercent100ths == null && this.lastLiftMovementDirection === direction && Date.now() - this.lastLiftMovementMs < 50) {
|
|
152727
|
-
|
|
152783
|
+
logger203.info(
|
|
152728
152784
|
`Skipping tilt ${MovementDirection[direction]}, lift already moving in same direction`
|
|
152729
152785
|
);
|
|
152730
152786
|
return;
|
|
@@ -152749,13 +152805,13 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
152749
152805
|
handleLiftOpen() {
|
|
152750
152806
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
152751
152807
|
const action = this.state.config.openCoverLift(void 0, this.agent);
|
|
152752
|
-
|
|
152808
|
+
logger203.info(`handleLiftOpen: calling action=${action.action}`);
|
|
152753
152809
|
homeAssistant.callAction(action);
|
|
152754
152810
|
}
|
|
152755
152811
|
handleLiftClose() {
|
|
152756
152812
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
152757
152813
|
const action = this.state.config.closeCoverLift(void 0, this.agent);
|
|
152758
|
-
|
|
152814
|
+
logger203.info(`handleLiftClose: calling action=${action.action}`);
|
|
152759
152815
|
homeAssistant.callAction(action);
|
|
152760
152816
|
}
|
|
152761
152817
|
handleGoToLiftPosition(targetPercent100ths) {
|
|
@@ -152777,7 +152833,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
152777
152833
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
152778
152834
|
const overrideMs = this.resolveDebounceOverride(homeAssistant);
|
|
152779
152835
|
const debounceMs = overrideMs != null ? overrideMs : isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
152780
|
-
|
|
152836
|
+
logger203.debug(
|
|
152781
152837
|
`Lift command: target=${targetPosition}%, debounce=${debounceMs}ms (${overrideMs != null ? "override" : isFirstInSequence ? "initial" : "subsequent"})`
|
|
152782
152838
|
);
|
|
152783
152839
|
if (this.liftDebounceTimer) {
|
|
@@ -152827,7 +152883,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
152827
152883
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
152828
152884
|
const overrideMs = this.resolveDebounceOverride(homeAssistant);
|
|
152829
152885
|
const debounceMs = overrideMs != null ? overrideMs : isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
152830
|
-
|
|
152886
|
+
logger203.debug(
|
|
152831
152887
|
`Tilt command: target=${targetPosition}%, debounce=${debounceMs}ms (${overrideMs != null ? "override" : isFirstInSequence ? "initial" : "subsequent"})`
|
|
152832
152888
|
);
|
|
152833
152889
|
if (this.tiltDebounceTimer) {
|
|
@@ -152879,7 +152935,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
|
|
|
152879
152935
|
}
|
|
152880
152936
|
|
|
152881
152937
|
// src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
|
|
152882
|
-
var
|
|
152938
|
+
var logger204 = Logger.get("CoverWindowCoveringServer");
|
|
152883
152939
|
var attributes6 = (entity) => entity.attributes;
|
|
152884
152940
|
var DEVICE_CLASS_TO_MATTER_TYPE = {
|
|
152885
152941
|
curtain: {
|
|
@@ -152951,7 +153007,7 @@ var adjustPositionForReading2 = (position, agent) => {
|
|
|
152951
153007
|
const { featureFlags } = agent.env.get(BridgeDataProvider);
|
|
152952
153008
|
const matterSem = usesMatterSemantics(agent);
|
|
152953
153009
|
const result = adjustPositionForReading(position, featureFlags, matterSem);
|
|
152954
|
-
|
|
153010
|
+
logger204.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
|
|
152955
153011
|
return result;
|
|
152956
153012
|
};
|
|
152957
153013
|
var adjustPositionForWriting2 = (position, agent) => {
|
|
@@ -153075,14 +153131,14 @@ var config6 = {
|
|
|
153075
153131
|
var CoverWindowCoveringServer = WindowCoveringServer2(config6);
|
|
153076
153132
|
|
|
153077
153133
|
// src/matter/endpoints/legacy/cover/index.ts
|
|
153078
|
-
var
|
|
153134
|
+
var logger205 = Logger.get("CoverDevice");
|
|
153079
153135
|
var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
|
|
153080
153136
|
const features3 = /* @__PURE__ */ new Set();
|
|
153081
153137
|
if (testBit(supportedFeatures, CoverSupportedFeatures.support_open)) {
|
|
153082
153138
|
features3.add("Lift");
|
|
153083
153139
|
features3.add("PositionAwareLift");
|
|
153084
153140
|
} else {
|
|
153085
|
-
|
|
153141
|
+
logger205.warn(
|
|
153086
153142
|
`[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
|
|
153087
153143
|
);
|
|
153088
153144
|
features3.add("Lift");
|
|
@@ -153097,7 +153153,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
|
|
|
153097
153153
|
features3.add("PositionAwareTilt");
|
|
153098
153154
|
}
|
|
153099
153155
|
}
|
|
153100
|
-
|
|
153156
|
+
logger205.info(
|
|
153101
153157
|
`[${entityId}] Creating WindowCovering with features: [${[...features3].join(", ")}], supported_features=${supportedFeatures}`
|
|
153102
153158
|
);
|
|
153103
153159
|
const baseBehaviors = [
|
|
@@ -153121,11 +153177,11 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
153121
153177
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
153122
153178
|
const hasBattery = hasBatteryAttr || hasBatteryEntity;
|
|
153123
153179
|
if (hasBattery) {
|
|
153124
|
-
|
|
153180
|
+
logger205.info(
|
|
153125
153181
|
`[${entityId}] Creating cover with PowerSource cluster, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
153126
153182
|
);
|
|
153127
153183
|
} else {
|
|
153128
|
-
|
|
153184
|
+
logger205.debug(
|
|
153129
153185
|
`[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
|
|
153130
153186
|
);
|
|
153131
153187
|
}
|
|
@@ -153240,7 +153296,7 @@ function DishwasherEndpoint(homeAssistantEntity) {
|
|
|
153240
153296
|
// src/matter/behaviors/generic-switch-server.ts
|
|
153241
153297
|
init_esm();
|
|
153242
153298
|
init_home_assistant_entity_behavior();
|
|
153243
|
-
var
|
|
153299
|
+
var logger206 = Logger.get("GenericSwitchServer");
|
|
153244
153300
|
var SimpleBase = SwitchServer.with(
|
|
153245
153301
|
"MomentarySwitch",
|
|
153246
153302
|
"MomentarySwitchRelease",
|
|
@@ -153282,7 +153338,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
|
|
|
153282
153338
|
await super.initialize();
|
|
153283
153339
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
153284
153340
|
const entityId = homeAssistant.entityId;
|
|
153285
|
-
|
|
153341
|
+
logger206.debug(`[${entityId}] GenericSwitch initialized (simple)`);
|
|
153286
153342
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
153287
153343
|
}
|
|
153288
153344
|
handleEventChange() {
|
|
@@ -153293,7 +153349,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
|
|
|
153293
153349
|
const eventType = attrs.event_type;
|
|
153294
153350
|
if (!eventType) return;
|
|
153295
153351
|
const entityId = homeAssistant.entityId;
|
|
153296
|
-
|
|
153352
|
+
logger206.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
153297
153353
|
this.triggerPress(eventType);
|
|
153298
153354
|
}
|
|
153299
153355
|
triggerPress(eventType) {
|
|
@@ -153339,7 +153395,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
|
|
|
153339
153395
|
await super.initialize();
|
|
153340
153396
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
153341
153397
|
const entityId = homeAssistant.entityId;
|
|
153342
|
-
|
|
153398
|
+
logger206.debug(`[${entityId}] GenericSwitch initialized (multi)`);
|
|
153343
153399
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
153344
153400
|
}
|
|
153345
153401
|
handleEventChange() {
|
|
@@ -153350,7 +153406,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
|
|
|
153350
153406
|
const eventType = attrs.event_type;
|
|
153351
153407
|
if (!eventType) return;
|
|
153352
153408
|
const entityId = homeAssistant.entityId;
|
|
153353
|
-
|
|
153409
|
+
logger206.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
153354
153410
|
this.triggerPress(eventType);
|
|
153355
153411
|
}
|
|
153356
153412
|
triggerPress(eventType) {
|
|
@@ -153686,7 +153742,7 @@ init_nodejs();
|
|
|
153686
153742
|
|
|
153687
153743
|
// src/matter/behaviors/color-control-server.ts
|
|
153688
153744
|
init_home_assistant_entity_behavior();
|
|
153689
|
-
var
|
|
153745
|
+
var logger207 = Logger.get("ColorControlServer");
|
|
153690
153746
|
var optimisticColorState = /* @__PURE__ */ new Map();
|
|
153691
153747
|
var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
|
|
153692
153748
|
var OPTIMISTIC_TOLERANCE2 = 5;
|
|
@@ -153725,7 +153781,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
153725
153781
|
if (this.state.startUpColorTemperatureMireds == null) {
|
|
153726
153782
|
this.state.startUpColorTemperatureMireds = defaultMireds;
|
|
153727
153783
|
}
|
|
153728
|
-
|
|
153784
|
+
logger207.debug(
|
|
153729
153785
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
153730
153786
|
);
|
|
153731
153787
|
}
|
|
@@ -154217,7 +154273,7 @@ init_home_assistant_entity_behavior();
|
|
|
154217
154273
|
// src/matter/behaviors/lock-server.ts
|
|
154218
154274
|
init_esm();
|
|
154219
154275
|
init_home_assistant_entity_behavior();
|
|
154220
|
-
var
|
|
154276
|
+
var logger208 = Logger.get("LockServer");
|
|
154221
154277
|
var SUPPORTED_SLOT = 1;
|
|
154222
154278
|
function normalizeSupportedIndex(index) {
|
|
154223
154279
|
if (index === 0 || index === SUPPORTED_SLOT) {
|
|
@@ -154482,7 +154538,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
154482
154538
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154483
154539
|
const action = this.state.config.lock(void 0, this.agent);
|
|
154484
154540
|
const hasPinProvided = !!request.pinCode;
|
|
154485
|
-
|
|
154541
|
+
logger208.debug(
|
|
154486
154542
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
154487
154543
|
);
|
|
154488
154544
|
if (request.pinCode) {
|
|
@@ -154495,12 +154551,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
154495
154551
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154496
154552
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
154497
154553
|
const hasPinProvided = !!request.pinCode;
|
|
154498
|
-
|
|
154554
|
+
logger208.debug(
|
|
154499
154555
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
154500
154556
|
);
|
|
154501
154557
|
if (this.state.requirePinForRemoteOperation) {
|
|
154502
154558
|
if (!request.pinCode) {
|
|
154503
|
-
|
|
154559
|
+
logger208.info(
|
|
154504
154560
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
154505
154561
|
);
|
|
154506
154562
|
throw new StatusResponseError(
|
|
@@ -154510,12 +154566,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
154510
154566
|
}
|
|
154511
154567
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
154512
154568
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
154513
|
-
|
|
154569
|
+
logger208.info(
|
|
154514
154570
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
154515
154571
|
);
|
|
154516
154572
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
154517
154573
|
}
|
|
154518
|
-
|
|
154574
|
+
logger208.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
154519
154575
|
action.data = { ...action.data, code: providedPin };
|
|
154520
154576
|
}
|
|
154521
154577
|
homeAssistant.callAction(action);
|
|
@@ -154645,7 +154701,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
154645
154701
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154646
154702
|
const action = this.state.config.lock(void 0, this.agent);
|
|
154647
154703
|
const hasPinProvided = !!request.pinCode;
|
|
154648
|
-
|
|
154704
|
+
logger208.debug(
|
|
154649
154705
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
154650
154706
|
);
|
|
154651
154707
|
if (request.pinCode) {
|
|
@@ -154659,12 +154715,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
154659
154715
|
const unlatchConfig = this.state.config.unlatch;
|
|
154660
154716
|
const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
|
|
154661
154717
|
const hasPinProvided = !!request.pinCode;
|
|
154662
|
-
|
|
154718
|
+
logger208.debug(
|
|
154663
154719
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
|
|
154664
154720
|
);
|
|
154665
154721
|
if (this.state.requirePinForRemoteOperation) {
|
|
154666
154722
|
if (!request.pinCode) {
|
|
154667
|
-
|
|
154723
|
+
logger208.info(
|
|
154668
154724
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
154669
154725
|
);
|
|
154670
154726
|
throw new StatusResponseError(
|
|
@@ -154674,12 +154730,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
154674
154730
|
}
|
|
154675
154731
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
154676
154732
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
154677
|
-
|
|
154733
|
+
logger208.info(
|
|
154678
154734
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
154679
154735
|
);
|
|
154680
154736
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
154681
154737
|
}
|
|
154682
|
-
|
|
154738
|
+
logger208.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
154683
154739
|
action.data = { ...action.data, code: providedPin };
|
|
154684
154740
|
}
|
|
154685
154741
|
homeAssistant.callAction(action);
|
|
@@ -154694,12 +154750,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
154694
154750
|
}
|
|
154695
154751
|
const action = unlatchConfig(void 0, this.agent);
|
|
154696
154752
|
const hasPinProvided = !!request.pinCode;
|
|
154697
|
-
|
|
154753
|
+
logger208.debug(
|
|
154698
154754
|
`unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
154699
154755
|
);
|
|
154700
154756
|
if (this.state.requirePinForRemoteOperation) {
|
|
154701
154757
|
if (!request.pinCode) {
|
|
154702
|
-
|
|
154758
|
+
logger208.info(
|
|
154703
154759
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
154704
154760
|
);
|
|
154705
154761
|
throw new StatusResponseError(
|
|
@@ -154709,12 +154765,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
154709
154765
|
}
|
|
154710
154766
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
154711
154767
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
154712
|
-
|
|
154768
|
+
logger208.info(
|
|
154713
154769
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
154714
154770
|
);
|
|
154715
154771
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
154716
154772
|
}
|
|
154717
|
-
|
|
154773
|
+
logger208.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
|
|
154718
154774
|
action.data = { ...action.data, code: providedPin };
|
|
154719
154775
|
}
|
|
154720
154776
|
homeAssistant.callAction(action);
|
|
@@ -154846,7 +154902,7 @@ init_home_assistant_entity_behavior();
|
|
|
154846
154902
|
init_dist();
|
|
154847
154903
|
init_esm();
|
|
154848
154904
|
init_home_assistant_entity_behavior();
|
|
154849
|
-
var
|
|
154905
|
+
var logger209 = Logger.get("MediaPlayerKeypadInputServer");
|
|
154850
154906
|
var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
154851
154907
|
sendKey(request) {
|
|
154852
154908
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -154857,12 +154913,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
|
154857
154913
|
const features3 = attributes8.supported_features ?? 0;
|
|
154858
154914
|
const action = this.mapKeyToAction(request.keyCode, features3);
|
|
154859
154915
|
if (!action) {
|
|
154860
|
-
|
|
154916
|
+
logger209.debug(
|
|
154861
154917
|
`Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
|
|
154862
154918
|
);
|
|
154863
154919
|
return { status: KeypadInput3.Status.UnsupportedKey };
|
|
154864
154920
|
}
|
|
154865
|
-
|
|
154921
|
+
logger209.debug(
|
|
154866
154922
|
`sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
|
|
154867
154923
|
);
|
|
154868
154924
|
homeAssistant.callAction({ action });
|
|
@@ -155141,7 +155197,7 @@ init_home_assistant_entity_behavior();
|
|
|
155141
155197
|
// src/matter/behaviors/speaker-level-control-server.ts
|
|
155142
155198
|
init_esm();
|
|
155143
155199
|
init_home_assistant_entity_behavior();
|
|
155144
|
-
var
|
|
155200
|
+
var logger210 = Logger.get("SpeakerLevelControlServer");
|
|
155145
155201
|
var optimisticLevelState2 = /* @__PURE__ */ new Map();
|
|
155146
155202
|
var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
|
|
155147
155203
|
var OPTIMISTIC_TOLERANCE3 = 5;
|
|
@@ -155184,7 +155240,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
155184
155240
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
155185
155241
|
}
|
|
155186
155242
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
155187
|
-
|
|
155243
|
+
logger210.debug(
|
|
155188
155244
|
`[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
|
|
155189
155245
|
);
|
|
155190
155246
|
const optimistic = optimisticLevelState2.get(entity.entity_id);
|
|
@@ -155232,7 +155288,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
155232
155288
|
const config11 = this.state.config;
|
|
155233
155289
|
const entityId = homeAssistant.entity.entity_id;
|
|
155234
155290
|
const levelPercent = level / 254;
|
|
155235
|
-
|
|
155291
|
+
logger210.debug(
|
|
155236
155292
|
`[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
|
|
155237
155293
|
);
|
|
155238
155294
|
const current = config11.getValuePercent(
|
|
@@ -156597,7 +156653,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
|
|
|
156597
156653
|
};
|
|
156598
156654
|
|
|
156599
156655
|
// src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
|
|
156600
|
-
var
|
|
156656
|
+
var logger211 = Logger.get("TvocSensor");
|
|
156601
156657
|
function airQualityFromUgm3(value) {
|
|
156602
156658
|
if (value <= 300) return AirQuality3.AirQualityEnum.Good;
|
|
156603
156659
|
if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
|
|
@@ -156638,17 +156694,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
156638
156694
|
const attributes8 = entity.state.attributes;
|
|
156639
156695
|
const deviceClass = attributes8.device_class;
|
|
156640
156696
|
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
156641
|
-
|
|
156697
|
+
logger211.debug(
|
|
156642
156698
|
`[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
|
|
156643
156699
|
);
|
|
156644
156700
|
if (state != null && !Number.isNaN(+state)) {
|
|
156645
156701
|
const value = +state;
|
|
156646
156702
|
airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
|
|
156647
|
-
|
|
156703
|
+
logger211.debug(
|
|
156648
156704
|
`[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
|
|
156649
156705
|
);
|
|
156650
156706
|
} else {
|
|
156651
|
-
|
|
156707
|
+
logger211.warn(
|
|
156652
156708
|
`[${entity.entity_id}] TVOC state not a valid number: "${state}"`
|
|
156653
156709
|
);
|
|
156654
156710
|
}
|
|
@@ -156862,7 +156918,7 @@ init_home_assistant_entity_behavior();
|
|
|
156862
156918
|
// src/matter/behaviors/pm25-concentration-measurement-server.ts
|
|
156863
156919
|
init_esm();
|
|
156864
156920
|
init_home_assistant_entity_behavior();
|
|
156865
|
-
var
|
|
156921
|
+
var logger212 = Logger.get("Pm25ConcentrationMeasurementServer");
|
|
156866
156922
|
var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
|
|
156867
156923
|
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
156868
156924
|
);
|
|
@@ -156886,11 +156942,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
156886
156942
|
if (this.state.measurementMedium === void 0) {
|
|
156887
156943
|
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
156888
156944
|
}
|
|
156889
|
-
|
|
156945
|
+
logger212.debug(
|
|
156890
156946
|
"Pm25ConcentrationMeasurementServer: before super.initialize()"
|
|
156891
156947
|
);
|
|
156892
156948
|
await super.initialize();
|
|
156893
|
-
|
|
156949
|
+
logger212.debug(
|
|
156894
156950
|
"Pm25ConcentrationMeasurementServer: after super.initialize()"
|
|
156895
156951
|
);
|
|
156896
156952
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -156913,7 +156969,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
156913
156969
|
};
|
|
156914
156970
|
|
|
156915
156971
|
// src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
|
|
156916
|
-
var
|
|
156972
|
+
var logger213 = Logger.get("Pm25AirQualityServer");
|
|
156917
156973
|
var Pm25AirQualityServerBase = AirQualityServer.with(
|
|
156918
156974
|
AirQuality3.Feature.Fair,
|
|
156919
156975
|
AirQuality3.Feature.Moderate,
|
|
@@ -156925,9 +156981,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
|
|
|
156925
156981
|
if (this.state.airQuality === void 0) {
|
|
156926
156982
|
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
156927
156983
|
}
|
|
156928
|
-
|
|
156984
|
+
logger213.debug("Pm25AirQualityServer: before super.initialize()");
|
|
156929
156985
|
await super.initialize();
|
|
156930
|
-
|
|
156986
|
+
logger213.debug("Pm25AirQualityServer: after super.initialize()");
|
|
156931
156987
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
156932
156988
|
this.update(homeAssistant.entity);
|
|
156933
156989
|
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
@@ -157316,7 +157372,7 @@ init_home_assistant_entity_behavior();
|
|
|
157316
157372
|
init_dist();
|
|
157317
157373
|
init_esm();
|
|
157318
157374
|
init_home_assistant_entity_behavior();
|
|
157319
|
-
var
|
|
157375
|
+
var logger214 = Logger.get("VacuumIdentifyServer");
|
|
157320
157376
|
var IDENTIFY_BUTTON_SUFFIXES = ["_identify", "_locate", "_find_me"];
|
|
157321
157377
|
var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
157322
157378
|
triggerEffect(effect) {
|
|
@@ -157333,19 +157389,19 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
157333
157389
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
157334
157390
|
const features3 = homeAssistant.entity.state.attributes.supported_features ?? 0;
|
|
157335
157391
|
if (testBit(features3, VacuumDeviceFeature.LOCATE)) {
|
|
157336
|
-
|
|
157392
|
+
logger214.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
|
|
157337
157393
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
157338
157394
|
return;
|
|
157339
157395
|
}
|
|
157340
157396
|
const sibling = this.#findIdentifyButton(homeAssistant);
|
|
157341
157397
|
if (sibling) {
|
|
157342
|
-
|
|
157398
|
+
logger214.info(
|
|
157343
157399
|
`${source} \u2192 button.press ${sibling} for ${homeAssistant.entityId}`
|
|
157344
157400
|
);
|
|
157345
157401
|
homeAssistant.callAction({ action: "button.press", target: sibling });
|
|
157346
157402
|
return;
|
|
157347
157403
|
}
|
|
157348
|
-
|
|
157404
|
+
logger214.warn(
|
|
157349
157405
|
`${source} for ${homeAssistant.entityId}, LOCATE not in supported_features (${features3}), trying vacuum.locate anyway`
|
|
157350
157406
|
);
|
|
157351
157407
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
@@ -157379,7 +157435,7 @@ init_nodejs();
|
|
|
157379
157435
|
|
|
157380
157436
|
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
157381
157437
|
init_home_assistant_entity_behavior();
|
|
157382
|
-
var
|
|
157438
|
+
var logger215 = Logger.get("RvcRunModeServer");
|
|
157383
157439
|
var ROOM_MODE_BASE = 100;
|
|
157384
157440
|
function isRoomMode(mode) {
|
|
157385
157441
|
return mode >= ROOM_MODE_BASE;
|
|
@@ -157499,7 +157555,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157499
157555
|
const s = getSession(this.endpoint);
|
|
157500
157556
|
if (s.loggedShortCircuits.has(reason)) return;
|
|
157501
157557
|
s.loggedShortCircuits.add(reason);
|
|
157502
|
-
|
|
157558
|
+
logger215.info(message);
|
|
157503
157559
|
}
|
|
157504
157560
|
/**
|
|
157505
157561
|
* Read the currentRoomEntity sensor and update currentArea + progress
|
|
@@ -157556,7 +157612,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157556
157612
|
}
|
|
157557
157613
|
}
|
|
157558
157614
|
if (matchedAreaId === null) {
|
|
157559
|
-
|
|
157615
|
+
logger215.info(
|
|
157560
157616
|
`currentRoom sensor: no match for "${roomName}" (segmentId=${segmentId}), activeAreas=[${s.activeAreas.join(", ")}], supportedAreas=[${serviceArea.state.supportedAreas.map((a) => `${a.areaId}:${a.areaInfo.locationInfo?.locationName}`).join(", ")}]`
|
|
157561
157617
|
);
|
|
157562
157618
|
return;
|
|
@@ -157566,14 +157622,14 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157566
157622
|
s.completedAreas.add(s.lastCurrentArea);
|
|
157567
157623
|
}
|
|
157568
157624
|
s.lastCurrentArea = matchedAreaId;
|
|
157569
|
-
|
|
157625
|
+
logger215.info(
|
|
157570
157626
|
`currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
|
|
157571
157627
|
);
|
|
157572
157628
|
this.trySetCurrentArea(matchedAreaId);
|
|
157573
157629
|
} catch (e) {
|
|
157574
157630
|
const msg = e instanceof Error ? e.message : String(e);
|
|
157575
157631
|
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
157576
|
-
|
|
157632
|
+
logger215.warn(`currentRoom sensor update failed: ${msg}`);
|
|
157577
157633
|
}
|
|
157578
157634
|
}
|
|
157579
157635
|
}
|
|
@@ -157588,7 +157644,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157588
157644
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
157589
157645
|
if (serviceArea.state.currentArea !== areaId) {
|
|
157590
157646
|
serviceArea.state.currentArea = areaId;
|
|
157591
|
-
|
|
157647
|
+
logger215.debug(`currentArea set to ${areaId}`);
|
|
157592
157648
|
}
|
|
157593
157649
|
this.updateProgress(serviceArea, areaId);
|
|
157594
157650
|
} catch {
|
|
@@ -157941,14 +157997,14 @@ init_esm();
|
|
|
157941
157997
|
|
|
157942
157998
|
// src/matter/behaviors/service-area-server.ts
|
|
157943
157999
|
init_esm();
|
|
157944
|
-
var
|
|
158000
|
+
var logger216 = Logger.get("ServiceAreaServer");
|
|
157945
158001
|
var ServiceAreaWithProgress = ServiceAreaBehavior.with(
|
|
157946
158002
|
ServiceArea3.Feature.ProgressReporting
|
|
157947
158003
|
);
|
|
157948
158004
|
var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
157949
158005
|
selectAreas(request) {
|
|
157950
158006
|
const { newAreas } = request;
|
|
157951
|
-
|
|
158007
|
+
logger216.info(
|
|
157952
158008
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
157953
158009
|
);
|
|
157954
158010
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -157957,7 +158013,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
157957
158013
|
(id) => !supportedAreaIds.includes(id)
|
|
157958
158014
|
);
|
|
157959
158015
|
if (invalidAreas.length > 0) {
|
|
157960
|
-
|
|
158016
|
+
logger216.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
157961
158017
|
return {
|
|
157962
158018
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
157963
158019
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -157968,7 +158024,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
157968
158024
|
areaId,
|
|
157969
158025
|
status: ServiceArea3.OperationalStatus.Pending
|
|
157970
158026
|
}));
|
|
157971
|
-
|
|
158027
|
+
logger216.info(
|
|
157972
158028
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
157973
158029
|
);
|
|
157974
158030
|
return {
|
|
@@ -157989,7 +158045,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
157989
158045
|
ServiceAreaServerBase2.State = State;
|
|
157990
158046
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
157991
158047
|
function ServiceAreaServer2(initialState) {
|
|
157992
|
-
|
|
158048
|
+
logger216.info(
|
|
157993
158049
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
157994
158050
|
);
|
|
157995
158051
|
return ServiceAreaServerBase.set({
|
|
@@ -158006,7 +158062,7 @@ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
|
|
|
158006
158062
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
|
|
158007
158063
|
selectAreas(request) {
|
|
158008
158064
|
const { newAreas } = request;
|
|
158009
|
-
|
|
158065
|
+
logger216.info(
|
|
158010
158066
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
158011
158067
|
);
|
|
158012
158068
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -158015,7 +158071,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158015
158071
|
(id) => !supportedAreaIds.includes(id)
|
|
158016
158072
|
);
|
|
158017
158073
|
if (invalidAreas.length > 0) {
|
|
158018
|
-
|
|
158074
|
+
logger216.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
158019
158075
|
return {
|
|
158020
158076
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
158021
158077
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -158026,7 +158082,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158026
158082
|
areaId,
|
|
158027
158083
|
status: ServiceArea3.OperationalStatus.Pending
|
|
158028
158084
|
}));
|
|
158029
|
-
|
|
158085
|
+
logger216.info(
|
|
158030
158086
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
158031
158087
|
);
|
|
158032
158088
|
return {
|
|
@@ -158047,14 +158103,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158047
158103
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
158048
158104
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
158049
158105
|
function ServiceAreaServerWithMaps(initialState) {
|
|
158050
|
-
|
|
158106
|
+
logger216.info(
|
|
158051
158107
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
158052
158108
|
);
|
|
158053
158109
|
for (const map of initialState.supportedMaps) {
|
|
158054
158110
|
const areaCount = initialState.supportedAreas.filter(
|
|
158055
158111
|
(a) => a.mapId === map.mapId
|
|
158056
158112
|
).length;
|
|
158057
|
-
|
|
158113
|
+
logger216.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
158058
158114
|
}
|
|
158059
158115
|
return ServiceAreaServerWithMapsBase.set({
|
|
158060
158116
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -158066,7 +158122,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
158066
158122
|
}
|
|
158067
158123
|
|
|
158068
158124
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
158069
|
-
var
|
|
158125
|
+
var logger217 = Logger.get("VacuumServiceAreaServer");
|
|
158070
158126
|
function toAreaId(roomId) {
|
|
158071
158127
|
if (typeof roomId === "number") {
|
|
158072
158128
|
return roomId;
|
|
@@ -158145,13 +158201,13 @@ function createVacuumServiceAreaServer(attributes8, roomEntities, includeUnnamed
|
|
|
158145
158201
|
let rooms;
|
|
158146
158202
|
if (roomEntities && roomEntities.length > 0) {
|
|
158147
158203
|
rooms = buttonEntitiesToRooms(roomEntities, attributes8);
|
|
158148
|
-
|
|
158204
|
+
logger217.info(
|
|
158149
158205
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
158150
158206
|
);
|
|
158151
158207
|
} else {
|
|
158152
158208
|
rooms = parseVacuumRooms(attributes8, includeUnnamedRooms);
|
|
158153
158209
|
if (rooms.length > 0) {
|
|
158154
|
-
|
|
158210
|
+
logger217.info(
|
|
158155
158211
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
158156
158212
|
);
|
|
158157
158213
|
}
|
|
@@ -158205,7 +158261,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
158205
158261
|
landmarkInfo: null
|
|
158206
158262
|
}
|
|
158207
158263
|
}));
|
|
158208
|
-
|
|
158264
|
+
logger217.info(
|
|
158209
158265
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
158210
158266
|
);
|
|
158211
158267
|
return ServiceAreaServer2({
|
|
@@ -158227,7 +158283,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
158227
158283
|
landmarkInfo: null
|
|
158228
158284
|
}
|
|
158229
158285
|
}));
|
|
158230
|
-
|
|
158286
|
+
logger217.info(
|
|
158231
158287
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
|
|
158232
158288
|
);
|
|
158233
158289
|
return ServiceAreaServer2({
|
|
@@ -158238,11 +158294,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
158238
158294
|
}
|
|
158239
158295
|
|
|
158240
158296
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
158241
|
-
var
|
|
158297
|
+
var logger218 = Logger.get("VacuumRvcRunModeServer");
|
|
158242
158298
|
function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
|
|
158243
158299
|
const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
158244
158300
|
const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
|
|
158245
|
-
|
|
158301
|
+
logger218.info(
|
|
158246
158302
|
`Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
|
|
158247
158303
|
);
|
|
158248
158304
|
return {
|
|
@@ -158326,14 +158382,14 @@ function mergeBatchData(areas) {
|
|
|
158326
158382
|
function handleCustomServiceAreas(selectedAreas, customAreas, session) {
|
|
158327
158383
|
const matched = selectedAreas.map((areaId) => ({ areaId, area: customAreas[areaId - 1] })).filter((m) => !!m.area);
|
|
158328
158384
|
if (matched.length === 0) {
|
|
158329
|
-
|
|
158385
|
+
logger218.warn(
|
|
158330
158386
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
158331
158387
|
);
|
|
158332
158388
|
return { action: "vacuum.start" };
|
|
158333
158389
|
}
|
|
158334
158390
|
const batchArea = matched.find(({ area }) => area.batchDispatch === true);
|
|
158335
158391
|
if (batchArea) {
|
|
158336
|
-
|
|
158392
|
+
logger218.info(
|
|
158337
158393
|
`Custom service areas (batch): single call for ${matched.length} room(s): ${matched.map(({ area }) => area.name).join(", ")}`
|
|
158338
158394
|
);
|
|
158339
158395
|
session.pendingDispatches = [];
|
|
@@ -158354,7 +158410,7 @@ function handleCustomServiceAreas(selectedAreas, customAreas, session) {
|
|
|
158354
158410
|
}
|
|
158355
158411
|
};
|
|
158356
158412
|
}
|
|
158357
|
-
|
|
158413
|
+
logger218.info(
|
|
158358
158414
|
`Custom service areas: ${matched.length} room(s) queued: ${matched.map(({ area }) => `${area.service} (${area.name})`).join(", ")}`
|
|
158359
158415
|
);
|
|
158360
158416
|
session.pendingDispatches = matched.slice(1).map(({ areaId, area }) => ({
|
|
@@ -158390,7 +158446,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158390
158446
|
VacuumState.paused
|
|
158391
158447
|
];
|
|
158392
158448
|
const isCleaning = cleaningStates.includes(state);
|
|
158393
|
-
|
|
158449
|
+
logger218.debug(
|
|
158394
158450
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
158395
158451
|
);
|
|
158396
158452
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -158422,7 +158478,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158422
158478
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
158423
158479
|
const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
|
|
158424
158480
|
if (haAreaIds.length > 0) {
|
|
158425
|
-
|
|
158481
|
+
logger218.info(
|
|
158426
158482
|
`CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
|
|
158427
158483
|
);
|
|
158428
158484
|
return {
|
|
@@ -158441,7 +158497,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158441
158497
|
}
|
|
158442
158498
|
}
|
|
158443
158499
|
if (matched.length > 0) {
|
|
158444
|
-
|
|
158500
|
+
logger218.info(
|
|
158445
158501
|
`Roborock: ${matched.length} room button(s) queued: ${matched.map((m) => m.entityId).join(", ")}`
|
|
158446
158502
|
);
|
|
158447
158503
|
session.pendingDispatches = matched.slice(1).map(({ areaId, entityId }) => ({
|
|
@@ -158475,14 +158531,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
158475
158531
|
}
|
|
158476
158532
|
}
|
|
158477
158533
|
if (roomIds.length > 0) {
|
|
158478
|
-
|
|
158534
|
+
logger218.info(
|
|
158479
158535
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
158480
158536
|
);
|
|
158481
158537
|
if (isDreameVacuum(attributes8)) {
|
|
158482
158538
|
if (targetMapName) {
|
|
158483
158539
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
158484
158540
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
158485
|
-
|
|
158541
|
+
logger218.info(
|
|
158486
158542
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
158487
158543
|
);
|
|
158488
158544
|
homeAssistant.callAction({
|
|
@@ -158509,7 +158565,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158509
158565
|
}
|
|
158510
158566
|
if (isEcovacsVacuum(attributes8)) {
|
|
158511
158567
|
const roomIdStr = roomIds.join(",");
|
|
158512
|
-
|
|
158568
|
+
logger218.info(
|
|
158513
158569
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
158514
158570
|
);
|
|
158515
158571
|
return {
|
|
@@ -158524,14 +158580,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
158524
158580
|
}
|
|
158525
158581
|
};
|
|
158526
158582
|
}
|
|
158527
|
-
|
|
158583
|
+
logger218.warn(
|
|
158528
158584
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
158529
158585
|
);
|
|
158530
158586
|
}
|
|
158531
158587
|
}
|
|
158532
158588
|
} catch {
|
|
158533
158589
|
}
|
|
158534
|
-
|
|
158590
|
+
logger218.info("Starting regular cleaning (no areas selected)");
|
|
158535
158591
|
return { action: "vacuum.start" };
|
|
158536
158592
|
},
|
|
158537
158593
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -158546,7 +158602,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158546
158602
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
158547
158603
|
const entity = homeAssistant.entity;
|
|
158548
158604
|
const attributes8 = entity.state.attributes;
|
|
158549
|
-
|
|
158605
|
+
logger218.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
158550
158606
|
const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
|
|
158551
158607
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
158552
158608
|
const sorted = [...cleanAreaRooms].sort(
|
|
@@ -158555,7 +158611,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158555
158611
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
158556
158612
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
158557
158613
|
const area = sorted[areaIndex];
|
|
158558
|
-
|
|
158614
|
+
logger218.info(
|
|
158559
158615
|
`cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
|
|
158560
158616
|
);
|
|
158561
158617
|
return {
|
|
@@ -158572,7 +158628,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158572
158628
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
158573
158629
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
158574
158630
|
const area = sorted[areaIndex];
|
|
158575
|
-
|
|
158631
|
+
logger218.info(
|
|
158576
158632
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
158577
158633
|
);
|
|
158578
158634
|
return {
|
|
@@ -158593,7 +158649,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158593
158649
|
}
|
|
158594
158650
|
const rooms = parseVacuumRooms(attributes8);
|
|
158595
158651
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
158596
|
-
|
|
158652
|
+
logger218.info(
|
|
158597
158653
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
158598
158654
|
);
|
|
158599
158655
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -158603,7 +158659,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158603
158659
|
if (room.mapName) {
|
|
158604
158660
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
158605
158661
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
158606
|
-
|
|
158662
|
+
logger218.info(
|
|
158607
158663
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
158608
158664
|
);
|
|
158609
158665
|
homeAssistant.callAction({
|
|
@@ -158612,7 +158668,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158612
158668
|
data: { option: room.mapName }
|
|
158613
158669
|
});
|
|
158614
158670
|
}
|
|
158615
|
-
|
|
158671
|
+
logger218.debug(
|
|
158616
158672
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
158617
158673
|
);
|
|
158618
158674
|
return {
|
|
@@ -158623,7 +158679,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158623
158679
|
};
|
|
158624
158680
|
}
|
|
158625
158681
|
if (isRoborockVacuum(attributes8) || isXiaomiMiotVacuum(attributes8)) {
|
|
158626
|
-
|
|
158682
|
+
logger218.debug(
|
|
158627
158683
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
158628
158684
|
);
|
|
158629
158685
|
return {
|
|
@@ -158636,7 +158692,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158636
158692
|
}
|
|
158637
158693
|
if (isEcovacsVacuum(attributes8)) {
|
|
158638
158694
|
const roomIdStr = String(commandId3);
|
|
158639
|
-
|
|
158695
|
+
logger218.info(
|
|
158640
158696
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
158641
158697
|
);
|
|
158642
158698
|
return {
|
|
@@ -158651,7 +158707,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
158651
158707
|
}
|
|
158652
158708
|
};
|
|
158653
158709
|
}
|
|
158654
|
-
|
|
158710
|
+
logger218.warn(
|
|
158655
158711
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
158656
158712
|
);
|
|
158657
158713
|
}
|
|
@@ -158667,20 +158723,20 @@ function createVacuumRvcRunModeServer(attributes8, includeUnnamedRooms = false,
|
|
|
158667
158723
|
includeUnnamedRooms,
|
|
158668
158724
|
customAreas
|
|
158669
158725
|
);
|
|
158670
|
-
|
|
158726
|
+
logger218.info(
|
|
158671
158727
|
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
|
|
158672
158728
|
);
|
|
158673
158729
|
if (rooms.length > 0) {
|
|
158674
|
-
|
|
158730
|
+
logger218.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
158675
158731
|
}
|
|
158676
158732
|
if (filteredCount > 0) {
|
|
158677
158733
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
158678
|
-
|
|
158734
|
+
logger218.info(
|
|
158679
158735
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
158680
158736
|
);
|
|
158681
158737
|
}
|
|
158682
158738
|
if (allRooms.length === 0) {
|
|
158683
|
-
|
|
158739
|
+
logger218.debug(
|
|
158684
158740
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes8.rooms)}, segments=${JSON.stringify(attributes8.segments)}, room_list=${attributes8.room_list}`
|
|
158685
158741
|
);
|
|
158686
158742
|
}
|
|
@@ -158714,7 +158770,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
|
|
|
158714
158770
|
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
158715
158771
|
});
|
|
158716
158772
|
}
|
|
158717
|
-
|
|
158773
|
+
logger218.info(
|
|
158718
158774
|
`Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
|
|
158719
158775
|
);
|
|
158720
158776
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
@@ -158774,7 +158830,7 @@ init_nodejs();
|
|
|
158774
158830
|
|
|
158775
158831
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
158776
158832
|
init_home_assistant_entity_behavior();
|
|
158777
|
-
var
|
|
158833
|
+
var logger219 = Logger.get("RvcCleanModeServerBase");
|
|
158778
158834
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
158779
158835
|
// Pending mode from a recent changeToMode command.
|
|
158780
158836
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -158821,14 +158877,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
158821
158877
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
158822
158878
|
const { newMode } = request;
|
|
158823
158879
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
158824
|
-
|
|
158880
|
+
logger219.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
158825
158881
|
return {
|
|
158826
158882
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
158827
158883
|
statusText: `Unsupported mode: ${newMode}`
|
|
158828
158884
|
};
|
|
158829
158885
|
}
|
|
158830
158886
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
158831
|
-
|
|
158887
|
+
logger219.info(
|
|
158832
158888
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
158833
158889
|
);
|
|
158834
158890
|
this.pendingMode = newMode;
|
|
@@ -158836,7 +158892,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
158836
158892
|
this.state.currentMode = newMode;
|
|
158837
158893
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
158838
158894
|
if (action) {
|
|
158839
|
-
|
|
158895
|
+
logger219.info(
|
|
158840
158896
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
158841
158897
|
);
|
|
158842
158898
|
homeAssistant.callAction(action);
|
|
@@ -158869,7 +158925,7 @@ function RvcCleanModeServer2(config11, initialState) {
|
|
|
158869
158925
|
}
|
|
158870
158926
|
|
|
158871
158927
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
158872
|
-
var
|
|
158928
|
+
var logger220 = Logger.get("VacuumRvcCleanModeServer");
|
|
158873
158929
|
var MODE_VACUUM = 0;
|
|
158874
158930
|
var MODE_VACUUM_AND_MOP = 1;
|
|
158875
158931
|
var MODE_MOP = 2;
|
|
@@ -159139,7 +159195,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
159139
159195
|
const match = availableOptions.find((o) => classifyCleanOption(o) === type);
|
|
159140
159196
|
if (match) return match;
|
|
159141
159197
|
}
|
|
159142
|
-
|
|
159198
|
+
logger220.warn(
|
|
159143
159199
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
159144
159200
|
);
|
|
159145
159201
|
return availableOptions[0];
|
|
@@ -159148,7 +159204,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
159148
159204
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
159149
159205
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
159150
159206
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
159151
|
-
|
|
159207
|
+
logger220.info(
|
|
159152
159208
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
159153
159209
|
);
|
|
159154
159210
|
return {
|
|
@@ -159237,7 +159293,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159237
159293
|
}
|
|
159238
159294
|
}
|
|
159239
159295
|
if (speedMode !== void 0) {
|
|
159240
|
-
|
|
159296
|
+
logger220.debug(
|
|
159241
159297
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
159242
159298
|
);
|
|
159243
159299
|
return speedMode;
|
|
@@ -159258,7 +159314,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159258
159314
|
}
|
|
159259
159315
|
}
|
|
159260
159316
|
if (mopMode !== void 0) {
|
|
159261
|
-
|
|
159317
|
+
logger220.debug(
|
|
159262
159318
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
159263
159319
|
);
|
|
159264
159320
|
return mopMode;
|
|
@@ -159276,14 +159332,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159276
159332
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
159277
159333
|
const vacuumEntityId = homeAssistant.entityId;
|
|
159278
159334
|
const mapping = homeAssistant.state.mapping;
|
|
159279
|
-
|
|
159335
|
+
logger220.info(
|
|
159280
159336
|
`setCleanMode(${mode}) for ${vacuumEntityId}, suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})}`
|
|
159281
159337
|
);
|
|
159282
159338
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
159283
159339
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
159284
159340
|
const mopName = mopIntensityList[mopIndex];
|
|
159285
159341
|
if (!mopName) {
|
|
159286
|
-
|
|
159342
|
+
logger220.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
159287
159343
|
return void 0;
|
|
159288
159344
|
}
|
|
159289
159345
|
if (hasCleanTypes) {
|
|
@@ -159296,18 +159352,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159296
159352
|
mapping.mopIntensityEntity,
|
|
159297
159353
|
agent
|
|
159298
159354
|
);
|
|
159299
|
-
|
|
159355
|
+
logger220.info(
|
|
159300
159356
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
159301
159357
|
);
|
|
159302
159358
|
let option = matchMopIntensityOption(mopName, options);
|
|
159303
159359
|
if (!option && options && mopIndex < options.length) {
|
|
159304
159360
|
option = options[mopIndex];
|
|
159305
|
-
|
|
159361
|
+
logger220.info(
|
|
159306
159362
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
159307
159363
|
);
|
|
159308
159364
|
}
|
|
159309
159365
|
if (option) {
|
|
159310
|
-
|
|
159366
|
+
logger220.info(
|
|
159311
159367
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
159312
159368
|
);
|
|
159313
159369
|
return {
|
|
@@ -159316,11 +159372,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159316
159372
|
target: mapping.mopIntensityEntity
|
|
159317
159373
|
};
|
|
159318
159374
|
}
|
|
159319
|
-
|
|
159375
|
+
logger220.warn(
|
|
159320
159376
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
159321
159377
|
);
|
|
159322
159378
|
} else {
|
|
159323
|
-
|
|
159379
|
+
logger220.warn(
|
|
159324
159380
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
159325
159381
|
);
|
|
159326
159382
|
}
|
|
@@ -159330,7 +159386,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159330
159386
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
159331
159387
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
159332
159388
|
if (!fanSpeedName) {
|
|
159333
|
-
|
|
159389
|
+
logger220.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
159334
159390
|
return void 0;
|
|
159335
159391
|
}
|
|
159336
159392
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -159343,7 +159399,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159343
159399
|
mapping.suctionLevelEntity,
|
|
159344
159400
|
agent
|
|
159345
159401
|
);
|
|
159346
|
-
|
|
159402
|
+
logger220.info(
|
|
159347
159403
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
159348
159404
|
);
|
|
159349
159405
|
let option = matchFanSpeedOption(
|
|
@@ -159353,12 +159409,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159353
159409
|
);
|
|
159354
159410
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
159355
159411
|
option = options[fanSpeedIndex];
|
|
159356
|
-
|
|
159412
|
+
logger220.info(
|
|
159357
159413
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
159358
159414
|
);
|
|
159359
159415
|
}
|
|
159360
159416
|
if (option) {
|
|
159361
|
-
|
|
159417
|
+
logger220.info(
|
|
159362
159418
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
159363
159419
|
);
|
|
159364
159420
|
return {
|
|
@@ -159367,7 +159423,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159367
159423
|
target: mapping.suctionLevelEntity
|
|
159368
159424
|
};
|
|
159369
159425
|
}
|
|
159370
|
-
|
|
159426
|
+
logger220.warn(
|
|
159371
159427
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
159372
159428
|
);
|
|
159373
159429
|
return void 0;
|
|
@@ -159377,7 +159433,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159377
159433
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
159378
159434
|
);
|
|
159379
159435
|
}
|
|
159380
|
-
|
|
159436
|
+
logger220.info(
|
|
159381
159437
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
159382
159438
|
);
|
|
159383
159439
|
return {
|
|
@@ -159387,7 +159443,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159387
159443
|
};
|
|
159388
159444
|
}
|
|
159389
159445
|
if (!hasCleanTypes) {
|
|
159390
|
-
|
|
159446
|
+
logger220.debug(
|
|
159391
159447
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
159392
159448
|
);
|
|
159393
159449
|
return void 0;
|
|
@@ -159399,7 +159455,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
159399
159455
|
agent
|
|
159400
159456
|
);
|
|
159401
159457
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
159402
|
-
|
|
159458
|
+
logger220.info(
|
|
159403
159459
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
159404
159460
|
);
|
|
159405
159461
|
return {
|
|
@@ -159417,10 +159473,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
159417
159473
|
cleaningModeOptions,
|
|
159418
159474
|
customFanSpeedTags
|
|
159419
159475
|
);
|
|
159420
|
-
|
|
159476
|
+
logger220.info(
|
|
159421
159477
|
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
159422
159478
|
);
|
|
159423
|
-
|
|
159479
|
+
logger220.info(
|
|
159424
159480
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
159425
159481
|
);
|
|
159426
159482
|
const initialState = {
|
|
@@ -159497,7 +159553,7 @@ init_nodejs();
|
|
|
159497
159553
|
init_home_assistant_entity_behavior();
|
|
159498
159554
|
var OperationalState4 = RvcOperationalState4.OperationalState;
|
|
159499
159555
|
var ErrorState = RvcOperationalState4.ErrorState;
|
|
159500
|
-
var
|
|
159556
|
+
var logger221 = Logger.get("RvcOperationalStateServer");
|
|
159501
159557
|
var activeStates = /* @__PURE__ */ new Set([
|
|
159502
159558
|
OperationalState4.Running,
|
|
159503
159559
|
OperationalState4.SeekingCharger
|
|
@@ -159549,7 +159605,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
159549
159605
|
{ force: true }
|
|
159550
159606
|
);
|
|
159551
159607
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
159552
|
-
|
|
159608
|
+
logger221.info(
|
|
159553
159609
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
159554
159610
|
);
|
|
159555
159611
|
try {
|
|
@@ -159562,7 +159618,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
159562
159618
|
this.context
|
|
159563
159619
|
);
|
|
159564
159620
|
} catch (e) {
|
|
159565
|
-
|
|
159621
|
+
logger221.debug("Failed to emit operationCompletion event:", e);
|
|
159566
159622
|
}
|
|
159567
159623
|
}
|
|
159568
159624
|
}
|
|
@@ -159597,7 +159653,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
159597
159653
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
159598
159654
|
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
159599
159655
|
} else {
|
|
159600
|
-
|
|
159656
|
+
logger221.warn("GoHome command received but no goHome action configured");
|
|
159601
159657
|
}
|
|
159602
159658
|
return {
|
|
159603
159659
|
commandResponseState: {
|
|
@@ -159617,7 +159673,7 @@ function RvcOperationalStateServer2(config11) {
|
|
|
159617
159673
|
}
|
|
159618
159674
|
|
|
159619
159675
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
|
|
159620
|
-
var
|
|
159676
|
+
var logger222 = Logger.get("VacuumRvcOperationalStateServer");
|
|
159621
159677
|
function isCharging(entity) {
|
|
159622
159678
|
const attrs = entity.attributes;
|
|
159623
159679
|
if (attrs.is_charging === true || attrs.charging === true) return true;
|
|
@@ -159662,16 +159718,16 @@ function mapVacuumOperationalState(entity) {
|
|
|
159662
159718
|
operationalState = RvcOperationalState4.OperationalState.Error;
|
|
159663
159719
|
} else {
|
|
159664
159720
|
if (state.toLowerCase().includes("clean")) {
|
|
159665
|
-
|
|
159721
|
+
logger222.info(
|
|
159666
159722
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
159667
159723
|
);
|
|
159668
159724
|
operationalState = RvcOperationalState4.OperationalState.Running;
|
|
159669
159725
|
} else {
|
|
159670
|
-
|
|
159726
|
+
logger222.info(`Unknown vacuum state "${state}", treating as Stopped`);
|
|
159671
159727
|
operationalState = RvcOperationalState4.OperationalState.Stopped;
|
|
159672
159728
|
}
|
|
159673
159729
|
}
|
|
159674
|
-
|
|
159730
|
+
logger222.debug(
|
|
159675
159731
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState4.OperationalState[operationalState]}`
|
|
159676
159732
|
);
|
|
159677
159733
|
return operationalState;
|
|
@@ -159696,7 +159752,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
159696
159752
|
});
|
|
159697
159753
|
|
|
159698
159754
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
159699
|
-
var
|
|
159755
|
+
var logger223 = Logger.get("VacuumDevice");
|
|
159700
159756
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
159701
159757
|
BasicInformationServer2,
|
|
159702
159758
|
VacuumIdentifyServer,
|
|
@@ -159710,7 +159766,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
159710
159766
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
159711
159767
|
const attributes8 = homeAssistantEntity.entity.state.attributes;
|
|
159712
159768
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
159713
|
-
|
|
159769
|
+
logger223.info(
|
|
159714
159770
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
159715
159771
|
);
|
|
159716
159772
|
const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
|
|
@@ -159722,32 +159778,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
159722
159778
|
)
|
|
159723
159779
|
).set({ homeAssistantEntity });
|
|
159724
159780
|
if (includeOnOff) {
|
|
159725
|
-
|
|
159781
|
+
logger223.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
159726
159782
|
device = device.with(VacuumOnOffServer);
|
|
159727
159783
|
}
|
|
159728
159784
|
device = device.with(VacuumPowerSourceServer);
|
|
159729
159785
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
159730
159786
|
const rooms = parseVacuumRooms(attributes8);
|
|
159731
|
-
|
|
159787
|
+
logger223.info(
|
|
159732
159788
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
|
|
159733
159789
|
);
|
|
159734
159790
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
159735
|
-
|
|
159791
|
+
logger223.info(
|
|
159736
159792
|
`${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
|
|
159737
159793
|
);
|
|
159738
159794
|
device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
|
|
159739
159795
|
} else if (customAreas && customAreas.length > 0) {
|
|
159740
|
-
|
|
159796
|
+
logger223.info(
|
|
159741
159797
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
159742
159798
|
);
|
|
159743
159799
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
159744
159800
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
159745
|
-
|
|
159801
|
+
logger223.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
159746
159802
|
device = device.with(
|
|
159747
159803
|
createVacuumServiceAreaServer(attributes8, roomEntities)
|
|
159748
159804
|
);
|
|
159749
159805
|
} else {
|
|
159750
|
-
|
|
159806
|
+
logger223.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
159751
159807
|
device = device.with(createDefaultServiceAreaServer());
|
|
159752
159808
|
}
|
|
159753
159809
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -159758,7 +159814,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
159758
159814
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
159759
159815
|
);
|
|
159760
159816
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
159761
|
-
|
|
159817
|
+
logger223.info(
|
|
159762
159818
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
159763
159819
|
);
|
|
159764
159820
|
device = device.with(
|
|
@@ -159771,7 +159827,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
159771
159827
|
)
|
|
159772
159828
|
);
|
|
159773
159829
|
} else {
|
|
159774
|
-
|
|
159830
|
+
logger223.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
159775
159831
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
159776
159832
|
}
|
|
159777
159833
|
return device;
|
|
@@ -159937,7 +159993,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
159937
159993
|
);
|
|
159938
159994
|
|
|
159939
159995
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
159940
|
-
var
|
|
159996
|
+
var logger224 = Logger.get("WaterHeaterDevice");
|
|
159941
159997
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
159942
159998
|
BasicInformationServer2,
|
|
159943
159999
|
IdentifyServer2,
|
|
@@ -159953,7 +160009,7 @@ function toMatterTemp2(value) {
|
|
|
159953
160009
|
}
|
|
159954
160010
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
159955
160011
|
const attributes8 = homeAssistantEntity.entity.state.attributes;
|
|
159956
|
-
|
|
160012
|
+
logger224.debug(
|
|
159957
160013
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes8.min_temp}, max_temp=${attributes8.max_temp}`
|
|
159958
160014
|
);
|
|
159959
160015
|
const minLimit = toMatterTemp2(attributes8.min_temp) ?? 0;
|
|
@@ -160163,7 +160219,7 @@ var matterDeviceTypeFactories = {
|
|
|
160163
160219
|
};
|
|
160164
160220
|
|
|
160165
160221
|
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
160166
|
-
var
|
|
160222
|
+
var logger225 = Logger.get("UserComposedEndpoint");
|
|
160167
160223
|
function stripBasicInformation(type) {
|
|
160168
160224
|
const behaviors = { ...type.behaviors };
|
|
160169
160225
|
delete behaviors.bridgedDeviceBasicInformation;
|
|
@@ -160219,7 +160275,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
160219
160275
|
{ vacuumOnOff: registry2.isVacuumOnOffEnabled() }
|
|
160220
160276
|
);
|
|
160221
160277
|
if (!primaryType) {
|
|
160222
|
-
|
|
160278
|
+
logger225.warn(
|
|
160223
160279
|
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
160224
160280
|
);
|
|
160225
160281
|
return void 0;
|
|
@@ -160234,7 +160290,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
160234
160290
|
if (!sub.entityId) continue;
|
|
160235
160291
|
const subPayload = buildEntityPayload4(registry2, sub.entityId);
|
|
160236
160292
|
if (!subPayload) {
|
|
160237
|
-
|
|
160293
|
+
logger225.warn(
|
|
160238
160294
|
`Cannot find entity state for composed sub-entity ${sub.entityId}`
|
|
160239
160295
|
);
|
|
160240
160296
|
continue;
|
|
@@ -160245,7 +160301,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
160245
160301
|
};
|
|
160246
160302
|
const subType = createLegacyEndpointType(subPayload, subMapping);
|
|
160247
160303
|
if (!subType) {
|
|
160248
|
-
|
|
160304
|
+
logger225.warn(
|
|
160249
160305
|
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
160250
160306
|
);
|
|
160251
160307
|
continue;
|
|
@@ -160258,7 +160314,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
160258
160314
|
mappedIds.push(sub.entityId);
|
|
160259
160315
|
}
|
|
160260
160316
|
if (parts.length < 2) {
|
|
160261
|
-
|
|
160317
|
+
logger225.warn(
|
|
160262
160318
|
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
160263
160319
|
);
|
|
160264
160320
|
return void 0;
|
|
@@ -160281,7 +160337,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
160281
160337
|
const labels = parts.map(
|
|
160282
160338
|
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
160283
160339
|
).join("+");
|
|
160284
|
-
|
|
160340
|
+
logger225.info(
|
|
160285
160341
|
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
160286
160342
|
);
|
|
160287
160343
|
return endpoint;
|
|
@@ -160369,7 +160425,7 @@ function asStandaloneEndpointType(type) {
|
|
|
160369
160425
|
}
|
|
160370
160426
|
|
|
160371
160427
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
160372
|
-
var
|
|
160428
|
+
var logger226 = Logger.get("LegacyEndpoint");
|
|
160373
160429
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
160374
160430
|
static async create(registry2, entityId, mapping, pluginDomainMappings, standalone = false) {
|
|
160375
160431
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -160379,25 +160435,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160379
160435
|
return;
|
|
160380
160436
|
}
|
|
160381
160437
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
160382
|
-
|
|
160438
|
+
logger226.debug(
|
|
160383
160439
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
160384
160440
|
);
|
|
160385
160441
|
return;
|
|
160386
160442
|
}
|
|
160387
160443
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
160388
|
-
|
|
160444
|
+
logger226.debug(
|
|
160389
160445
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
160390
160446
|
);
|
|
160391
160447
|
return;
|
|
160392
160448
|
}
|
|
160393
160449
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
160394
|
-
|
|
160450
|
+
logger226.debug(
|
|
160395
160451
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
160396
160452
|
);
|
|
160397
160453
|
return;
|
|
160398
160454
|
}
|
|
160399
160455
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
160400
|
-
|
|
160456
|
+
logger226.debug(
|
|
160401
160457
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
160402
160458
|
);
|
|
160403
160459
|
return;
|
|
@@ -160417,7 +160473,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160417
160473
|
humidityEntity: humidityEntityId
|
|
160418
160474
|
};
|
|
160419
160475
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
160420
|
-
|
|
160476
|
+
logger226.debug(
|
|
160421
160477
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
160422
160478
|
);
|
|
160423
160479
|
}
|
|
@@ -160436,7 +160492,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160436
160492
|
pressureEntity: pressureEntityId
|
|
160437
160493
|
};
|
|
160438
160494
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
160439
|
-
|
|
160495
|
+
logger226.debug(
|
|
160440
160496
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
160441
160497
|
);
|
|
160442
160498
|
}
|
|
@@ -160454,7 +160510,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160454
160510
|
batteryEntity: batteryEntityId
|
|
160455
160511
|
};
|
|
160456
160512
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
160457
|
-
|
|
160513
|
+
logger226.debug(
|
|
160458
160514
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
160459
160515
|
);
|
|
160460
160516
|
}
|
|
@@ -160472,7 +160528,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160472
160528
|
powerEntity: powerEntityId
|
|
160473
160529
|
};
|
|
160474
160530
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
160475
|
-
|
|
160531
|
+
logger226.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
160476
160532
|
}
|
|
160477
160533
|
}
|
|
160478
160534
|
}
|
|
@@ -160489,7 +160545,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160489
160545
|
energyEntity: energyEntityId
|
|
160490
160546
|
};
|
|
160491
160547
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
160492
|
-
|
|
160548
|
+
logger226.debug(
|
|
160493
160549
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
160494
160550
|
);
|
|
160495
160551
|
}
|
|
@@ -160505,7 +160561,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160505
160561
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
160506
160562
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
160507
160563
|
};
|
|
160508
|
-
|
|
160564
|
+
logger226.info(
|
|
160509
160565
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
160510
160566
|
);
|
|
160511
160567
|
}
|
|
@@ -160515,7 +160571,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160515
160571
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
160516
160572
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
160517
160573
|
};
|
|
160518
|
-
|
|
160574
|
+
logger226.info(
|
|
160519
160575
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
160520
160576
|
);
|
|
160521
160577
|
}
|
|
@@ -160525,7 +160581,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160525
160581
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
160526
160582
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
160527
160583
|
};
|
|
160528
|
-
|
|
160584
|
+
logger226.info(
|
|
160529
160585
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
160530
160586
|
);
|
|
160531
160587
|
}
|
|
@@ -160535,7 +160591,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160535
160591
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
160536
160592
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
160537
160593
|
};
|
|
160538
|
-
|
|
160594
|
+
logger226.info(
|
|
160539
160595
|
`Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
|
|
160540
160596
|
);
|
|
160541
160597
|
}
|
|
@@ -160550,7 +160606,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160550
160606
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
160551
160607
|
cleanAreaRooms
|
|
160552
160608
|
};
|
|
160553
|
-
|
|
160609
|
+
logger226.info(
|
|
160554
160610
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
160555
160611
|
);
|
|
160556
160612
|
}
|
|
@@ -160571,7 +160627,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160571
160627
|
rooms: roomsObj
|
|
160572
160628
|
}
|
|
160573
160629
|
};
|
|
160574
|
-
|
|
160630
|
+
logger226.debug(
|
|
160575
160631
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
160576
160632
|
);
|
|
160577
160633
|
} else {
|
|
@@ -160588,7 +160644,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160588
160644
|
rooms: roomsObj
|
|
160589
160645
|
}
|
|
160590
160646
|
};
|
|
160591
|
-
|
|
160647
|
+
logger226.debug(
|
|
160592
160648
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
160593
160649
|
);
|
|
160594
160650
|
}
|
|
@@ -160609,7 +160665,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160609
160665
|
if (composed) {
|
|
160610
160666
|
return composed;
|
|
160611
160667
|
}
|
|
160612
|
-
|
|
160668
|
+
logger226.warn(
|
|
160613
160669
|
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
160614
160670
|
);
|
|
160615
160671
|
}
|
|
@@ -160668,7 +160724,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160668
160724
|
if (composed) {
|
|
160669
160725
|
return composed;
|
|
160670
160726
|
}
|
|
160671
|
-
|
|
160727
|
+
logger226.warn(
|
|
160672
160728
|
`Companion fan creation failed for ${entityId}, falling back to standalone`
|
|
160673
160729
|
);
|
|
160674
160730
|
}
|
|
@@ -160735,11 +160791,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
160735
160791
|
}
|
|
160736
160792
|
if (mappedChanged) {
|
|
160737
160793
|
this.pendingMappedChange = true;
|
|
160738
|
-
|
|
160794
|
+
logger226.debug(
|
|
160739
160795
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
160740
160796
|
);
|
|
160741
160797
|
}
|
|
160742
|
-
|
|
160798
|
+
logger226.debug(
|
|
160743
160799
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
160744
160800
|
);
|
|
160745
160801
|
this.lastState = state;
|
|
@@ -160792,7 +160848,7 @@ import {
|
|
|
160792
160848
|
getCollection
|
|
160793
160849
|
} from "home-assistant-js-websocket";
|
|
160794
160850
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
160795
|
-
var
|
|
160851
|
+
var logger227 = Logger.get("SubscribeEntities");
|
|
160796
160852
|
function processEvent(store, updates) {
|
|
160797
160853
|
const state = { ...store.state };
|
|
160798
160854
|
if (updates.a) {
|
|
@@ -160818,7 +160874,7 @@ function processEvent(store, updates) {
|
|
|
160818
160874
|
for (const entityId in updates.c) {
|
|
160819
160875
|
let entityState = state[entityId];
|
|
160820
160876
|
if (!entityState) {
|
|
160821
|
-
|
|
160877
|
+
logger227.warn("Received state update for unknown entity", entityId);
|
|
160822
160878
|
continue;
|
|
160823
160879
|
}
|
|
160824
160880
|
entityState = { ...entityState };
|
|
@@ -160907,7 +160963,7 @@ var subscribeEntities = (conn, onChange, entityIds) => {
|
|
|
160907
160963
|
// src/services/bridges/entity-isolation-service.ts
|
|
160908
160964
|
init_esm();
|
|
160909
160965
|
init_diagnostic_event_bus();
|
|
160910
|
-
var
|
|
160966
|
+
var logger228 = Logger.get("EntityIsolation");
|
|
160911
160967
|
var EntityIsolationServiceImpl = class {
|
|
160912
160968
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
160913
160969
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -160972,13 +161028,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
160972
161028
|
}
|
|
160973
161029
|
const parsed = this.parseEndpointPath(msg);
|
|
160974
161030
|
if (!parsed) {
|
|
160975
|
-
|
|
161031
|
+
logger228.warn("Could not parse entity from error:", msg);
|
|
160976
161032
|
return false;
|
|
160977
161033
|
}
|
|
160978
161034
|
const { bridgeId, entityName } = parsed;
|
|
160979
161035
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
160980
161036
|
if (!callback) {
|
|
160981
|
-
|
|
161037
|
+
logger228.warn(
|
|
160982
161038
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
160983
161039
|
);
|
|
160984
161040
|
return false;
|
|
@@ -160989,7 +161045,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
160989
161045
|
}
|
|
160990
161046
|
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
160991
161047
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
160992
|
-
|
|
161048
|
+
logger228.warn(
|
|
160993
161049
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
160994
161050
|
);
|
|
160995
161051
|
diagnosticEventBus.emit("entity_error", `Entity isolated: ${entityName}`, {
|
|
@@ -161001,7 +161057,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
161001
161057
|
await callback(entityName);
|
|
161002
161058
|
return true;
|
|
161003
161059
|
} catch (e) {
|
|
161004
|
-
|
|
161060
|
+
logger228.error(`Failed to isolate entity ${entityName}:`, e);
|
|
161005
161061
|
return false;
|
|
161006
161062
|
}
|
|
161007
161063
|
}
|
|
@@ -162329,11 +162385,11 @@ function makeWarmStartState(state, now = (/* @__PURE__ */ new Date()).toISOStrin
|
|
|
162329
162385
|
return { ...state, last_updated: now };
|
|
162330
162386
|
}
|
|
162331
162387
|
var ServerModeBridge = class {
|
|
162332
|
-
constructor(
|
|
162388
|
+
constructor(logger231, dataProvider, endpointManager, server) {
|
|
162333
162389
|
this.dataProvider = dataProvider;
|
|
162334
162390
|
this.endpointManager = endpointManager;
|
|
162335
162391
|
this.server = server;
|
|
162336
|
-
this.log =
|
|
162392
|
+
this.log = logger231.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
162337
162393
|
}
|
|
162338
162394
|
dataProvider;
|
|
162339
162395
|
endpointManager;
|
|
@@ -162947,7 +163003,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
162947
163003
|
}
|
|
162948
163004
|
|
|
162949
163005
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
162950
|
-
var
|
|
163006
|
+
var logger229 = Logger.get("ServerModeVacuumEndpoint");
|
|
162951
163007
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
162952
163008
|
static async create(registry2, entityId, mapping) {
|
|
162953
163009
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -162957,7 +163013,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
162957
163013
|
return void 0;
|
|
162958
163014
|
}
|
|
162959
163015
|
let effectiveMapping = mapping;
|
|
162960
|
-
|
|
163016
|
+
logger229.info(
|
|
162961
163017
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
162962
163018
|
);
|
|
162963
163019
|
if (entity.device_id) {
|
|
@@ -162972,15 +163028,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
162972
163028
|
batteryEntity: batteryEntityId
|
|
162973
163029
|
};
|
|
162974
163030
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
162975
|
-
|
|
163031
|
+
logger229.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
162976
163032
|
} else {
|
|
162977
163033
|
const attrs = state.attributes;
|
|
162978
163034
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
162979
|
-
|
|
163035
|
+
logger229.info(
|
|
162980
163036
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
162981
163037
|
);
|
|
162982
163038
|
} else {
|
|
162983
|
-
|
|
163039
|
+
logger229.warn(
|
|
162984
163040
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
162985
163041
|
);
|
|
162986
163042
|
}
|
|
@@ -162995,7 +163051,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
162995
163051
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
162996
163052
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
162997
163053
|
};
|
|
162998
|
-
|
|
163054
|
+
logger229.info(
|
|
162999
163055
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
163000
163056
|
);
|
|
163001
163057
|
}
|
|
@@ -163005,7 +163061,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163005
163061
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163006
163062
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
163007
163063
|
};
|
|
163008
|
-
|
|
163064
|
+
logger229.info(
|
|
163009
163065
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
163010
163066
|
);
|
|
163011
163067
|
}
|
|
@@ -163015,7 +163071,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163015
163071
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163016
163072
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
163017
163073
|
};
|
|
163018
|
-
|
|
163074
|
+
logger229.info(
|
|
163019
163075
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
163020
163076
|
);
|
|
163021
163077
|
}
|
|
@@ -163025,7 +163081,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163025
163081
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163026
163082
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
163027
163083
|
};
|
|
163028
|
-
|
|
163084
|
+
logger229.info(
|
|
163029
163085
|
`${entityId}: Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity}`
|
|
163030
163086
|
);
|
|
163031
163087
|
}
|
|
@@ -163040,7 +163096,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163040
163096
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163041
163097
|
cleanAreaRooms
|
|
163042
163098
|
};
|
|
163043
|
-
|
|
163099
|
+
logger229.info(
|
|
163044
163100
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
163045
163101
|
);
|
|
163046
163102
|
}
|
|
@@ -163061,7 +163117,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163061
163117
|
rooms: roomsObj
|
|
163062
163118
|
}
|
|
163063
163119
|
};
|
|
163064
|
-
|
|
163120
|
+
logger229.info(
|
|
163065
163121
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
163066
163122
|
);
|
|
163067
163123
|
} else {
|
|
@@ -163078,14 +163134,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163078
163134
|
rooms: roomsObj
|
|
163079
163135
|
}
|
|
163080
163136
|
};
|
|
163081
|
-
|
|
163137
|
+
logger229.info(
|
|
163082
163138
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
163083
163139
|
);
|
|
163084
163140
|
}
|
|
163085
163141
|
}
|
|
163086
163142
|
}
|
|
163087
163143
|
} else {
|
|
163088
|
-
|
|
163144
|
+
logger229.warn(`${entityId}: No device_id, cannot auto-assign battery`);
|
|
163089
163145
|
}
|
|
163090
163146
|
const payload = {
|
|
163091
163147
|
entity_id: entityId,
|
|
@@ -163188,7 +163244,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163188
163244
|
try {
|
|
163189
163245
|
this.keepaliveCounter++;
|
|
163190
163246
|
const counter = this.keepaliveCounter;
|
|
163191
|
-
|
|
163247
|
+
logger229.info(`Keepalive #${counter} for ${this.entityId}`);
|
|
163192
163248
|
const opState = this.stateOf(RvcOperationalStateServer);
|
|
163193
163249
|
await this.setStateOf(RvcOperationalStateServer, {
|
|
163194
163250
|
operationalState: opState.operationalState,
|
|
@@ -163196,7 +163252,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163196
163252
|
opState.operationalError.errorStateId
|
|
163197
163253
|
)
|
|
163198
163254
|
});
|
|
163199
|
-
|
|
163255
|
+
logger229.info(`Keepalive #${counter} committed for ${this.entityId}`);
|
|
163200
163256
|
} catch (e) {
|
|
163201
163257
|
if (e instanceof TransactionDestroyedError || e instanceof DestroyedDependencyError) {
|
|
163202
163258
|
return;
|
|
@@ -163205,7 +163261,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163205
163261
|
if (msg.includes("Endpoint storage inaccessible")) {
|
|
163206
163262
|
return;
|
|
163207
163263
|
}
|
|
163208
|
-
|
|
163264
|
+
logger229.warn(`Keepalive failed for ${this.entityId}: ${msg}`);
|
|
163209
163265
|
}
|
|
163210
163266
|
}
|
|
163211
163267
|
async updateStates(states) {
|
|
@@ -163216,11 +163272,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163216
163272
|
}
|
|
163217
163273
|
if (mappedChanged) {
|
|
163218
163274
|
this.pendingMappedChange = true;
|
|
163219
|
-
|
|
163275
|
+
logger229.debug(
|
|
163220
163276
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
163221
163277
|
);
|
|
163222
163278
|
}
|
|
163223
|
-
|
|
163279
|
+
logger229.debug(
|
|
163224
163280
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
163225
163281
|
);
|
|
163226
163282
|
this.lastState = state;
|
|
@@ -163662,10 +163718,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
163662
163718
|
// src/core/ioc/app-environment.ts
|
|
163663
163719
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
163664
163720
|
constructor(rootEnv, options) {
|
|
163665
|
-
const
|
|
163721
|
+
const logger231 = rootEnv.get(LoggerService);
|
|
163666
163722
|
super({
|
|
163667
163723
|
id: "App",
|
|
163668
|
-
log:
|
|
163724
|
+
log: logger231.get("AppContainer"),
|
|
163669
163725
|
parent: rootEnv
|
|
163670
163726
|
});
|
|
163671
163727
|
this.options = options;
|
|
@@ -163679,8 +163735,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
163679
163735
|
}
|
|
163680
163736
|
construction;
|
|
163681
163737
|
async init() {
|
|
163682
|
-
const
|
|
163683
|
-
this.set(LoggerService,
|
|
163738
|
+
const logger231 = this.get(LoggerService);
|
|
163739
|
+
this.set(LoggerService, logger231);
|
|
163684
163740
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
163685
163741
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
163686
163742
|
this.set(
|
|
@@ -163697,7 +163753,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
163697
163753
|
);
|
|
163698
163754
|
this.set(
|
|
163699
163755
|
HomeAssistantClient,
|
|
163700
|
-
new HomeAssistantClient(
|
|
163756
|
+
new HomeAssistantClient(logger231, this.options.homeAssistant)
|
|
163701
163757
|
);
|
|
163702
163758
|
this.set(
|
|
163703
163759
|
HomeAssistantConfig,
|
|
@@ -163705,7 +163761,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
163705
163761
|
);
|
|
163706
163762
|
this.set(
|
|
163707
163763
|
HomeAssistantActions,
|
|
163708
|
-
new HomeAssistantActions(
|
|
163764
|
+
new HomeAssistantActions(logger231, await this.load(HomeAssistantClient))
|
|
163709
163765
|
);
|
|
163710
163766
|
this.set(
|
|
163711
163767
|
HomeAssistantRegistry,
|
|
@@ -163741,7 +163797,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
163741
163797
|
this.set(
|
|
163742
163798
|
WebApi,
|
|
163743
163799
|
new WebApi(
|
|
163744
|
-
|
|
163800
|
+
logger231,
|
|
163745
163801
|
await this.load(BridgeService),
|
|
163746
163802
|
await this.load(HomeAssistantClient),
|
|
163747
163803
|
await this.load(HomeAssistantRegistry),
|
|
@@ -163766,7 +163822,7 @@ init_esm();
|
|
|
163766
163822
|
init_nodejs();
|
|
163767
163823
|
|
|
163768
163824
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
163769
|
-
var
|
|
163825
|
+
var logger230 = Logger.get("PatchLevelControlTlv");
|
|
163770
163826
|
function patchLevelControlTlv() {
|
|
163771
163827
|
let patched = 0;
|
|
163772
163828
|
const moveToLevelFields = LevelControl3.MoveToLevelRequest.fieldDefinitions;
|
|
@@ -163780,11 +163836,11 @@ function patchLevelControlTlv() {
|
|
|
163780
163836
|
patched++;
|
|
163781
163837
|
}
|
|
163782
163838
|
if (patched > 0) {
|
|
163783
|
-
|
|
163839
|
+
logger230.info(
|
|
163784
163840
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
163785
163841
|
);
|
|
163786
163842
|
} else {
|
|
163787
|
-
|
|
163843
|
+
logger230.warn(
|
|
163788
163844
|
"Failed to patch LevelControl TLV schemas, field definitions not found. Google Home brightness adjustment may not work."
|
|
163789
163845
|
);
|
|
163790
163846
|
}
|