@riddix/hamh 2.1.0-alpha.738 → 2.1.0-alpha.739
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
|
@@ -1762,8 +1762,8 @@ var init_Cancelable = __esm({
|
|
|
1762
1762
|
};
|
|
1763
1763
|
return result;
|
|
1764
1764
|
}
|
|
1765
|
-
static set logger(
|
|
1766
|
-
this.#logger =
|
|
1765
|
+
static set logger(logger234) {
|
|
1766
|
+
this.#logger = logger234;
|
|
1767
1767
|
}
|
|
1768
1768
|
static get logger() {
|
|
1769
1769
|
return this.#logger;
|
|
@@ -3454,13 +3454,13 @@ var init_Logger = __esm({
|
|
|
3454
3454
|
*
|
|
3455
3455
|
* @deprecated use {@link destinations}
|
|
3456
3456
|
*/
|
|
3457
|
-
static addLogger(identifier,
|
|
3457
|
+
static addLogger(identifier, logger234, options) {
|
|
3458
3458
|
if (identifier in this.destinations) {
|
|
3459
3459
|
throw new ImplementationError(`Logger "${identifier}" already exists`);
|
|
3460
3460
|
}
|
|
3461
3461
|
const dest = LogDestination({ name: identifier });
|
|
3462
3462
|
const legacy = adaptDestinationToLegacy(dest);
|
|
3463
|
-
legacy.log =
|
|
3463
|
+
legacy.log = logger234;
|
|
3464
3464
|
if (options?.defaultLogLevel !== void 0) {
|
|
3465
3465
|
legacy.defaultLogLevel = options.defaultLogLevel;
|
|
3466
3466
|
}
|
|
@@ -5652,8 +5652,8 @@ var init_Construction = __esm({
|
|
|
5652
5652
|
}
|
|
5653
5653
|
}
|
|
5654
5654
|
#unhandledError(...args) {
|
|
5655
|
-
const
|
|
5656
|
-
|
|
5655
|
+
const logger234 = Logger.get(this.#subject.constructor.name);
|
|
5656
|
+
logger234.error(...args);
|
|
5657
5657
|
}
|
|
5658
5658
|
#createErrorHandler(name) {
|
|
5659
5659
|
return (e) => {
|
|
@@ -62166,8 +62166,8 @@ var init_NodeSession = __esm({
|
|
|
62166
62166
|
return session?.type === SessionType.Unicast;
|
|
62167
62167
|
}
|
|
62168
62168
|
NodeSession2.is = is;
|
|
62169
|
-
function logNew(
|
|
62170
|
-
|
|
62169
|
+
function logNew(logger234, operation, session, messenger, fabric, peerNodeId) {
|
|
62170
|
+
logger234.info(
|
|
62171
62171
|
session.via,
|
|
62172
62172
|
`${operation} session with`,
|
|
62173
62173
|
Diagnostic.strong(PeerAddress({ fabricIndex: fabric.fabricIndex, nodeId: peerNodeId }).toString()),
|
|
@@ -111400,11 +111400,11 @@ var init_Api = __esm({
|
|
|
111400
111400
|
}
|
|
111401
111401
|
Api2.resourceFor = resourceFor;
|
|
111402
111402
|
function log(level, facility, id, ...message) {
|
|
111403
|
-
let
|
|
111404
|
-
if (!
|
|
111405
|
-
loggers.set(facility,
|
|
111403
|
+
let logger234 = loggers.get(facility);
|
|
111404
|
+
if (!logger234) {
|
|
111405
|
+
loggers.set(facility, logger234 = Logger.get(facility));
|
|
111406
111406
|
}
|
|
111407
|
-
|
|
111407
|
+
logger234[level](Diagnostic.via(id || "(anon)"), message);
|
|
111408
111408
|
}
|
|
111409
111409
|
Api2.log = log;
|
|
111410
111410
|
function logRequest(facility, id, method, target) {
|
|
@@ -124190,6 +124190,26 @@ var init_humidifer = __esm({
|
|
|
124190
124190
|
}
|
|
124191
124191
|
});
|
|
124192
124192
|
|
|
124193
|
+
// ../common/dist/domains/lawn-mower.js
|
|
124194
|
+
var LawnMowerActivity, LawnMowerEntityFeature;
|
|
124195
|
+
var init_lawn_mower = __esm({
|
|
124196
|
+
"../common/dist/domains/lawn-mower.js"() {
|
|
124197
|
+
"use strict";
|
|
124198
|
+
(function(LawnMowerActivity2) {
|
|
124199
|
+
LawnMowerActivity2["error"] = "error";
|
|
124200
|
+
LawnMowerActivity2["paused"] = "paused";
|
|
124201
|
+
LawnMowerActivity2["mowing"] = "mowing";
|
|
124202
|
+
LawnMowerActivity2["docked"] = "docked";
|
|
124203
|
+
LawnMowerActivity2["returning"] = "returning";
|
|
124204
|
+
})(LawnMowerActivity || (LawnMowerActivity = {}));
|
|
124205
|
+
(function(LawnMowerEntityFeature2) {
|
|
124206
|
+
LawnMowerEntityFeature2[LawnMowerEntityFeature2["START_MOWING"] = 1] = "START_MOWING";
|
|
124207
|
+
LawnMowerEntityFeature2[LawnMowerEntityFeature2["PAUSE"] = 2] = "PAUSE";
|
|
124208
|
+
LawnMowerEntityFeature2[LawnMowerEntityFeature2["DOCK"] = 4] = "DOCK";
|
|
124209
|
+
})(LawnMowerEntityFeature || (LawnMowerEntityFeature = {}));
|
|
124210
|
+
}
|
|
124211
|
+
});
|
|
124212
|
+
|
|
124193
124213
|
// ../common/dist/domains/light.js
|
|
124194
124214
|
var LightDeviceColorMode;
|
|
124195
124215
|
var init_light = __esm({
|
|
@@ -124406,6 +124426,7 @@ var init_domains = __esm({
|
|
|
124406
124426
|
init_event2();
|
|
124407
124427
|
init_fan();
|
|
124408
124428
|
init_humidifer();
|
|
124429
|
+
init_lawn_mower();
|
|
124409
124430
|
init_light();
|
|
124410
124431
|
init_lock();
|
|
124411
124432
|
init_media_player();
|
|
@@ -124462,6 +124483,7 @@ var init_home_assistant_domain = __esm({
|
|
|
124462
124483
|
HomeAssistantDomain2["input_boolean"] = "input_boolean";
|
|
124463
124484
|
HomeAssistantDomain2["input_button"] = "input_button";
|
|
124464
124485
|
HomeAssistantDomain2["input_select"] = "input_select";
|
|
124486
|
+
HomeAssistantDomain2["lawn_mower"] = "lawn_mower";
|
|
124465
124487
|
HomeAssistantDomain2["light"] = "light";
|
|
124466
124488
|
HomeAssistantDomain2["lock"] = "lock";
|
|
124467
124489
|
HomeAssistantDomain2["media_player"] = "media_player";
|
|
@@ -125292,10 +125314,10 @@ var init_home_assistant_actions = __esm({
|
|
|
125292
125314
|
circuitBreakerResetMs: 3e4
|
|
125293
125315
|
};
|
|
125294
125316
|
HomeAssistantActions = class extends Service {
|
|
125295
|
-
constructor(
|
|
125317
|
+
constructor(logger234, client, config11) {
|
|
125296
125318
|
super("HomeAssistantActions");
|
|
125297
125319
|
this.client = client;
|
|
125298
|
-
this.log =
|
|
125320
|
+
this.log = logger234.get(this);
|
|
125299
125321
|
this.config = { ...defaultConfig, ...config11 };
|
|
125300
125322
|
this.circuitBreaker = new CircuitBreaker(
|
|
125301
125323
|
this.config.circuitBreakerThreshold,
|
|
@@ -125635,10 +125657,10 @@ var DiagnosticService = class {
|
|
|
125635
125657
|
};
|
|
125636
125658
|
|
|
125637
125659
|
// src/api/access-log.ts
|
|
125638
|
-
function accessLogger(
|
|
125660
|
+
function accessLogger(logger234) {
|
|
125639
125661
|
return (req, res, next) => {
|
|
125640
125662
|
res.on("finish", () => {
|
|
125641
|
-
|
|
125663
|
+
logger234.debug(
|
|
125642
125664
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
125643
125665
|
);
|
|
125644
125666
|
});
|
|
@@ -129518,7 +129540,7 @@ var WebSocketApi = class {
|
|
|
129518
129540
|
|
|
129519
129541
|
// src/api/web-api.ts
|
|
129520
129542
|
var WebApi = class extends Service {
|
|
129521
|
-
constructor(
|
|
129543
|
+
constructor(logger234, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
|
|
129522
129544
|
super("WebApi");
|
|
129523
129545
|
this.bridgeService = bridgeService;
|
|
129524
129546
|
this.haClient = haClient;
|
|
@@ -129529,8 +129551,8 @@ var WebApi = class extends Service {
|
|
|
129529
129551
|
this.settingsStorage = settingsStorage;
|
|
129530
129552
|
this.backupService = backupService;
|
|
129531
129553
|
this.props = props;
|
|
129532
|
-
this.logger =
|
|
129533
|
-
this.log =
|
|
129554
|
+
this.logger = logger234;
|
|
129555
|
+
this.log = logger234.get(this);
|
|
129534
129556
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
129535
129557
|
this.startTime = Date.now();
|
|
129536
129558
|
this.wsApi = new WebSocketApi(
|
|
@@ -130621,10 +130643,10 @@ function isTransientConnectError(reason) {
|
|
|
130621
130643
|
return msg.includes("socket hang up") || msg.includes("tls") || msg.includes("TLS");
|
|
130622
130644
|
}
|
|
130623
130645
|
var HomeAssistantClient = class extends Service {
|
|
130624
|
-
constructor(
|
|
130646
|
+
constructor(logger234, options) {
|
|
130625
130647
|
super("HomeAssistantClient");
|
|
130626
130648
|
this.options = options;
|
|
130627
|
-
this.log =
|
|
130649
|
+
this.log = logger234.get(this);
|
|
130628
130650
|
}
|
|
130629
130651
|
options;
|
|
130630
130652
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
@@ -139320,10 +139342,10 @@ var UnsupportedModeError = class extends ImplementationError {
|
|
|
139320
139342
|
};
|
|
139321
139343
|
var ModeUtils;
|
|
139322
139344
|
((ModeUtils2) => {
|
|
139323
|
-
function assertSupportedModes(
|
|
139345
|
+
function assertSupportedModes(supportedModes2) {
|
|
139324
139346
|
const labels = /* @__PURE__ */ new Set();
|
|
139325
139347
|
const modes = /* @__PURE__ */ new Set();
|
|
139326
|
-
for (const { mode, label } of
|
|
139348
|
+
for (const { mode, label } of supportedModes2) {
|
|
139327
139349
|
if (labels.has(label)) {
|
|
139328
139350
|
throw new ImplementationError(`Duplicate label in supportedModes: ${label}`);
|
|
139329
139351
|
}
|
|
@@ -139335,18 +139357,18 @@ var ModeUtils;
|
|
|
139335
139357
|
}
|
|
139336
139358
|
}
|
|
139337
139359
|
ModeUtils2.assertSupportedModes = assertSupportedModes;
|
|
139338
|
-
function assertMode(
|
|
139339
|
-
if (!
|
|
139360
|
+
function assertMode(supportedModes2, newMode) {
|
|
139361
|
+
if (!supportedModes2.some(({ mode }) => mode === newMode)) {
|
|
139340
139362
|
throw new UnsupportedModeError(
|
|
139341
|
-
`Can not use unsupported mode: ${newMode}. Allowed modes are ${
|
|
139363
|
+
`Can not use unsupported mode: ${newMode}. Allowed modes are ${supportedModes2.map(({ mode }) => mode).join(", ")}`
|
|
139342
139364
|
);
|
|
139343
139365
|
}
|
|
139344
139366
|
}
|
|
139345
139367
|
ModeUtils2.assertMode = assertMode;
|
|
139346
|
-
function assertModeChange(
|
|
139368
|
+
function assertModeChange(supportedModes2, currentMode, newMode) {
|
|
139347
139369
|
if (currentMode !== newMode) {
|
|
139348
139370
|
try {
|
|
139349
|
-
assertMode(
|
|
139371
|
+
assertMode(supportedModes2, newMode);
|
|
139350
139372
|
} catch (error) {
|
|
139351
139373
|
UnsupportedModeError.accept(error);
|
|
139352
139374
|
return {
|
|
@@ -148167,10 +148189,10 @@ function seedExistingSessionStarts(startedAt, sessions, now = Date.now()) {
|
|
|
148167
148189
|
var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
148168
148190
|
var DEAD_SESSION_TIMEOUT_MS = 6e4;
|
|
148169
148191
|
var Bridge = class {
|
|
148170
|
-
constructor(env,
|
|
148192
|
+
constructor(env, logger234, dataProvider, endpointManager) {
|
|
148171
148193
|
this.dataProvider = dataProvider;
|
|
148172
148194
|
this.endpointManager = endpointManager;
|
|
148173
|
-
this.log =
|
|
148195
|
+
this.log = logger234.get(`Bridge / ${dataProvider.id}`);
|
|
148174
148196
|
this.server = new BridgeServerNode(
|
|
148175
148197
|
env,
|
|
148176
148198
|
this.dataProvider,
|
|
@@ -154410,6 +154432,771 @@ function InputButtonDevice(homeAssistantEntity) {
|
|
|
154410
154432
|
return InputButtonEndpointType.set({ homeAssistantEntity });
|
|
154411
154433
|
}
|
|
154412
154434
|
|
|
154435
|
+
// src/matter/endpoints/legacy/lawn-mower/index.ts
|
|
154436
|
+
init_home_assistant_entity_behavior();
|
|
154437
|
+
|
|
154438
|
+
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-operational-state-server.ts
|
|
154439
|
+
init_dist();
|
|
154440
|
+
init_esm();
|
|
154441
|
+
init_home_assistant_entity_behavior();
|
|
154442
|
+
|
|
154443
|
+
// src/matter/behaviors/rvc-operational-state-server.ts
|
|
154444
|
+
init_esm();
|
|
154445
|
+
|
|
154446
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/behaviors/rvc-operational-state.js
|
|
154447
|
+
init_nodejs();
|
|
154448
|
+
|
|
154449
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/rvc-operational-state.js
|
|
154450
|
+
init_nodejs();
|
|
154451
|
+
|
|
154452
|
+
// src/matter/behaviors/rvc-operational-state-server.ts
|
|
154453
|
+
init_home_assistant_entity_behavior();
|
|
154454
|
+
var OperationalState4 = RvcOperationalState4.OperationalState;
|
|
154455
|
+
var ErrorState = RvcOperationalState4.ErrorState;
|
|
154456
|
+
var logger209 = Logger.get("RvcOperationalStateServer");
|
|
154457
|
+
var activeStates = /* @__PURE__ */ new Set([
|
|
154458
|
+
OperationalState4.Running,
|
|
154459
|
+
OperationalState4.SeekingCharger
|
|
154460
|
+
]);
|
|
154461
|
+
var advertisedOperationalStates = [
|
|
154462
|
+
OperationalState4.Stopped,
|
|
154463
|
+
OperationalState4.Running,
|
|
154464
|
+
OperationalState4.Paused,
|
|
154465
|
+
OperationalState4.Error,
|
|
154466
|
+
OperationalState4.SeekingCharger,
|
|
154467
|
+
OperationalState4.Charging,
|
|
154468
|
+
OperationalState4.Docked
|
|
154469
|
+
];
|
|
154470
|
+
function makeRvcOperationalError(errorStateId) {
|
|
154471
|
+
if (errorStateId === ErrorState.NoError) {
|
|
154472
|
+
return { errorStateId };
|
|
154473
|
+
}
|
|
154474
|
+
return { errorStateId, errorStateDetails: ErrorState[errorStateId] };
|
|
154475
|
+
}
|
|
154476
|
+
var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
154477
|
+
async initialize() {
|
|
154478
|
+
this.state.operationalStateList = advertisedOperationalStates.map((id) => ({
|
|
154479
|
+
operationalStateId: id
|
|
154480
|
+
}));
|
|
154481
|
+
this.state.operationalState = OperationalState4.Stopped;
|
|
154482
|
+
this.state.operationalError = { errorStateId: ErrorState.NoError };
|
|
154483
|
+
await super.initialize();
|
|
154484
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
154485
|
+
this.update(homeAssistant.entity);
|
|
154486
|
+
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
154487
|
+
}
|
|
154488
|
+
update(entity) {
|
|
154489
|
+
if (!entity.state || !entity.state.attributes) {
|
|
154490
|
+
return;
|
|
154491
|
+
}
|
|
154492
|
+
const newState = this.state.config.getOperationalState(
|
|
154493
|
+
entity.state,
|
|
154494
|
+
this.agent
|
|
154495
|
+
);
|
|
154496
|
+
const previousState = this.state.operationalState;
|
|
154497
|
+
const errorStateId = newState === OperationalState4.Error ? ErrorState.Stuck : ErrorState.NoError;
|
|
154498
|
+
const operationalError = makeRvcOperationalError(errorStateId);
|
|
154499
|
+
applyPatchState(
|
|
154500
|
+
this.state,
|
|
154501
|
+
{
|
|
154502
|
+
operationalState: newState,
|
|
154503
|
+
operationalError
|
|
154504
|
+
},
|
|
154505
|
+
{ force: true }
|
|
154506
|
+
);
|
|
154507
|
+
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
154508
|
+
logger209.info(
|
|
154509
|
+
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
154510
|
+
);
|
|
154511
|
+
try {
|
|
154512
|
+
this.events.operationCompletion?.emit(
|
|
154513
|
+
{
|
|
154514
|
+
completionErrorCode: newState === OperationalState4.Error ? ErrorState.Stuck : ErrorState.NoError,
|
|
154515
|
+
totalOperationalTime: null,
|
|
154516
|
+
pausedTime: null
|
|
154517
|
+
},
|
|
154518
|
+
this.context
|
|
154519
|
+
);
|
|
154520
|
+
} catch (e) {
|
|
154521
|
+
logger209.debug("Failed to emit operationCompletion event:", e);
|
|
154522
|
+
}
|
|
154523
|
+
}
|
|
154524
|
+
}
|
|
154525
|
+
pause() {
|
|
154526
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154527
|
+
homeAssistant.callAction(this.state.config.pause(void 0, this.agent));
|
|
154528
|
+
return {
|
|
154529
|
+
commandResponseState: {
|
|
154530
|
+
errorStateId: ErrorState.NoError
|
|
154531
|
+
}
|
|
154532
|
+
};
|
|
154533
|
+
}
|
|
154534
|
+
resume() {
|
|
154535
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154536
|
+
homeAssistant.callAction(this.state.config.resume(void 0, this.agent));
|
|
154537
|
+
return {
|
|
154538
|
+
commandResponseState: {
|
|
154539
|
+
errorStateId: ErrorState.NoError
|
|
154540
|
+
}
|
|
154541
|
+
};
|
|
154542
|
+
}
|
|
154543
|
+
goHome() {
|
|
154544
|
+
if (this.state.operationalState === OperationalState4.Docked || this.state.operationalState === OperationalState4.Charging) {
|
|
154545
|
+
return {
|
|
154546
|
+
commandResponseState: {
|
|
154547
|
+
errorStateId: ErrorState.NoError
|
|
154548
|
+
}
|
|
154549
|
+
};
|
|
154550
|
+
}
|
|
154551
|
+
const goHomeAction = this.state.config.goHome;
|
|
154552
|
+
if (goHomeAction) {
|
|
154553
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154554
|
+
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
154555
|
+
} else {
|
|
154556
|
+
logger209.warn("GoHome command received but no goHome action configured");
|
|
154557
|
+
}
|
|
154558
|
+
return {
|
|
154559
|
+
commandResponseState: {
|
|
154560
|
+
errorStateId: ErrorState.NoError
|
|
154561
|
+
}
|
|
154562
|
+
};
|
|
154563
|
+
}
|
|
154564
|
+
};
|
|
154565
|
+
((RvcOperationalStateServerBase2) => {
|
|
154566
|
+
class State extends RvcOperationalStateServer.State {
|
|
154567
|
+
config;
|
|
154568
|
+
}
|
|
154569
|
+
RvcOperationalStateServerBase2.State = State;
|
|
154570
|
+
})(RvcOperationalStateServerBase || (RvcOperationalStateServerBase = {}));
|
|
154571
|
+
function RvcOperationalStateServer2(config11) {
|
|
154572
|
+
return RvcOperationalStateServerBase.set({ config: config11 });
|
|
154573
|
+
}
|
|
154574
|
+
|
|
154575
|
+
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-operational-state-server.ts
|
|
154576
|
+
var logger210 = Logger.get("LawnMowerRvcOperationalStateServer");
|
|
154577
|
+
function mapLawnMowerOperationalState(entity) {
|
|
154578
|
+
const state = entity.state;
|
|
154579
|
+
switch (state) {
|
|
154580
|
+
case LawnMowerActivity.mowing:
|
|
154581
|
+
return RvcOperationalState4.OperationalState.Running;
|
|
154582
|
+
case LawnMowerActivity.returning:
|
|
154583
|
+
return RvcOperationalState4.OperationalState.SeekingCharger;
|
|
154584
|
+
case LawnMowerActivity.docked:
|
|
154585
|
+
return RvcOperationalState4.OperationalState.Docked;
|
|
154586
|
+
case LawnMowerActivity.paused:
|
|
154587
|
+
return RvcOperationalState4.OperationalState.Paused;
|
|
154588
|
+
case LawnMowerActivity.error:
|
|
154589
|
+
case "unavailable":
|
|
154590
|
+
return RvcOperationalState4.OperationalState.Error;
|
|
154591
|
+
default:
|
|
154592
|
+
logger210.info(`Unknown lawn_mower state "${state}", treating as Stopped`);
|
|
154593
|
+
return RvcOperationalState4.OperationalState.Stopped;
|
|
154594
|
+
}
|
|
154595
|
+
}
|
|
154596
|
+
var LawnMowerRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
154597
|
+
getOperationalState: (entity) => mapLawnMowerOperationalState(entity),
|
|
154598
|
+
// Pause requires the PAUSE feature; mowers without it can only be docked.
|
|
154599
|
+
pause: (_, agent) => {
|
|
154600
|
+
const features3 = agent.get(HomeAssistantEntityBehavior).entity.state.attributes.supported_features ?? 0;
|
|
154601
|
+
if (testBit(features3, LawnMowerEntityFeature.PAUSE)) {
|
|
154602
|
+
return { action: "lawn_mower.pause" };
|
|
154603
|
+
}
|
|
154604
|
+
return { action: "lawn_mower.dock" };
|
|
154605
|
+
},
|
|
154606
|
+
resume: () => ({ action: "lawn_mower.start_mowing" }),
|
|
154607
|
+
goHome: () => ({ action: "lawn_mower.dock" })
|
|
154608
|
+
});
|
|
154609
|
+
|
|
154610
|
+
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-run-mode-server.ts
|
|
154611
|
+
init_dist();
|
|
154612
|
+
init_home_assistant_entity_behavior();
|
|
154613
|
+
|
|
154614
|
+
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
154615
|
+
init_esm();
|
|
154616
|
+
|
|
154617
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/mode-base.js
|
|
154618
|
+
init_nodejs();
|
|
154619
|
+
|
|
154620
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/rvc-run-mode.js
|
|
154621
|
+
init_nodejs();
|
|
154622
|
+
|
|
154623
|
+
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
154624
|
+
init_home_assistant_entity_behavior();
|
|
154625
|
+
|
|
154626
|
+
// src/matter/behaviors/infer-cleaned-area-progress.ts
|
|
154627
|
+
function inferCleanedAreaProgress(cleanedSqm, orderedAreas) {
|
|
154628
|
+
if (orderedAreas.length === 0) {
|
|
154629
|
+
return { currentArea: null, completed: [] };
|
|
154630
|
+
}
|
|
154631
|
+
const cleaned = Number.isFinite(cleanedSqm) ? Math.max(0, cleanedSqm) : 0;
|
|
154632
|
+
let cumulative = 0;
|
|
154633
|
+
const completed = [];
|
|
154634
|
+
for (const area of orderedAreas) {
|
|
154635
|
+
const size = Number.isFinite(area.sizeSqm) ? Math.max(0, area.sizeSqm) : 0;
|
|
154636
|
+
cumulative += size;
|
|
154637
|
+
if (cleaned < cumulative) {
|
|
154638
|
+
return { currentArea: area.areaId, completed };
|
|
154639
|
+
}
|
|
154640
|
+
completed.push(area.areaId);
|
|
154641
|
+
}
|
|
154642
|
+
return { currentArea: null, completed };
|
|
154643
|
+
}
|
|
154644
|
+
|
|
154645
|
+
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
154646
|
+
var logger211 = Logger.get("RvcRunModeServer");
|
|
154647
|
+
var ROOM_MODE_BASE = 100;
|
|
154648
|
+
function isRoomMode(mode) {
|
|
154649
|
+
return mode >= ROOM_MODE_BASE;
|
|
154650
|
+
}
|
|
154651
|
+
var cleaningSessions = /* @__PURE__ */ new WeakMap();
|
|
154652
|
+
function getSession(endpoint) {
|
|
154653
|
+
let session = cleaningSessions.get(endpoint);
|
|
154654
|
+
if (!session) {
|
|
154655
|
+
session = {
|
|
154656
|
+
completedAreas: /* @__PURE__ */ new Set(),
|
|
154657
|
+
lastCurrentArea: null,
|
|
154658
|
+
activeAreas: [],
|
|
154659
|
+
loggedShortCircuits: /* @__PURE__ */ new Set(),
|
|
154660
|
+
observedCleaning: false,
|
|
154661
|
+
pendingDispatches: [],
|
|
154662
|
+
cleanedAreaBaseline: null
|
|
154663
|
+
};
|
|
154664
|
+
cleaningSessions.set(endpoint, session);
|
|
154665
|
+
}
|
|
154666
|
+
return session;
|
|
154667
|
+
}
|
|
154668
|
+
var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
154669
|
+
async initialize() {
|
|
154670
|
+
await super.initialize();
|
|
154671
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
154672
|
+
this.update(homeAssistant.entity);
|
|
154673
|
+
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
154674
|
+
}
|
|
154675
|
+
update(entity) {
|
|
154676
|
+
if (!entity.state || !entity.state.attributes) {
|
|
154677
|
+
return;
|
|
154678
|
+
}
|
|
154679
|
+
const s = getSession(this.endpoint);
|
|
154680
|
+
const previousMode = this.state.currentMode;
|
|
154681
|
+
const newMode = this.state.config.getCurrentMode(entity.state, this.agent);
|
|
154682
|
+
applyPatchState(
|
|
154683
|
+
this.state,
|
|
154684
|
+
{
|
|
154685
|
+
currentMode: newMode,
|
|
154686
|
+
supportedModes: this.state.config.getSupportedModes(
|
|
154687
|
+
entity.state,
|
|
154688
|
+
this.agent
|
|
154689
|
+
)
|
|
154690
|
+
},
|
|
154691
|
+
{ force: true }
|
|
154692
|
+
);
|
|
154693
|
+
if (newMode === 1 /* Cleaning */) {
|
|
154694
|
+
s.observedCleaning = true;
|
|
154695
|
+
}
|
|
154696
|
+
if (previousMode !== newMode) {
|
|
154697
|
+
if (newMode === 0 /* Idle */) {
|
|
154698
|
+
if (s.lastCurrentArea !== null) {
|
|
154699
|
+
s.completedAreas.add(s.lastCurrentArea);
|
|
154700
|
+
s.lastCurrentArea = null;
|
|
154701
|
+
}
|
|
154702
|
+
if (s.pendingDispatches.length > 0 && s.observedCleaning) {
|
|
154703
|
+
try {
|
|
154704
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154705
|
+
const prev = serviceArea.state.currentArea;
|
|
154706
|
+
if (typeof prev === "number") {
|
|
154707
|
+
s.completedAreas.add(prev);
|
|
154708
|
+
}
|
|
154709
|
+
const next = s.pendingDispatches.shift();
|
|
154710
|
+
if (next) {
|
|
154711
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154712
|
+
homeAssistant.callAction(next.action);
|
|
154713
|
+
this.trySetCurrentArea(next.areaId);
|
|
154714
|
+
}
|
|
154715
|
+
} catch {
|
|
154716
|
+
}
|
|
154717
|
+
s.loggedShortCircuits.clear();
|
|
154718
|
+
return;
|
|
154719
|
+
}
|
|
154720
|
+
if (s.observedCleaning) {
|
|
154721
|
+
try {
|
|
154722
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154723
|
+
const last = serviceArea.state.currentArea;
|
|
154724
|
+
if (typeof last === "number") {
|
|
154725
|
+
s.completedAreas.add(last);
|
|
154726
|
+
serviceArea.state.currentArea = null;
|
|
154727
|
+
}
|
|
154728
|
+
this.updateProgressFromTracking(serviceArea);
|
|
154729
|
+
} catch {
|
|
154730
|
+
}
|
|
154731
|
+
s.observedCleaning = false;
|
|
154732
|
+
}
|
|
154733
|
+
s.loggedShortCircuits.clear();
|
|
154734
|
+
} else if (newMode === 1 /* Cleaning */) {
|
|
154735
|
+
if (s.activeAreas.length > 0 && s.lastCurrentArea === null) {
|
|
154736
|
+
const firstPending = s.activeAreas.find(
|
|
154737
|
+
(id) => !s.completedAreas.has(id)
|
|
154738
|
+
);
|
|
154739
|
+
if (firstPending !== void 0) {
|
|
154740
|
+
this.trySetCurrentArea(firstPending);
|
|
154741
|
+
}
|
|
154742
|
+
}
|
|
154743
|
+
}
|
|
154744
|
+
}
|
|
154745
|
+
if (newMode === 0 /* Idle */ && s.activeAreas.length === 0) {
|
|
154746
|
+
try {
|
|
154747
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154748
|
+
if (serviceArea.state.currentArea !== null) {
|
|
154749
|
+
serviceArea.state.currentArea = null;
|
|
154750
|
+
}
|
|
154751
|
+
} catch {
|
|
154752
|
+
}
|
|
154753
|
+
}
|
|
154754
|
+
if (newMode === 1 /* Cleaning */) {
|
|
154755
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
154756
|
+
if (mapping?.currentRoomEntity) {
|
|
154757
|
+
this.updateCurrentRoomFromSensor();
|
|
154758
|
+
} else if (mapping?.cleanedAreaEntity) {
|
|
154759
|
+
this.updateCurrentRoomFromCleanedArea();
|
|
154760
|
+
}
|
|
154761
|
+
}
|
|
154762
|
+
}
|
|
154763
|
+
/**
|
|
154764
|
+
* Emit a diagnostic INFO log exactly once per cleaning session for a
|
|
154765
|
+
* given short-circuit reason. Prevents log flooding while still
|
|
154766
|
+
* surfacing the silent paths that would otherwise be invisible.
|
|
154767
|
+
*/
|
|
154768
|
+
logShortCircuitOnce(reason, message) {
|
|
154769
|
+
const s = getSession(this.endpoint);
|
|
154770
|
+
if (s.loggedShortCircuits.has(reason)) return;
|
|
154771
|
+
s.loggedShortCircuits.add(reason);
|
|
154772
|
+
logger211.info(message);
|
|
154773
|
+
}
|
|
154774
|
+
/**
|
|
154775
|
+
* Read the currentRoomEntity sensor and update currentArea + progress
|
|
154776
|
+
* to reflect which room the vacuum is actually in right now.
|
|
154777
|
+
*/
|
|
154778
|
+
updateCurrentRoomFromSensor() {
|
|
154779
|
+
try {
|
|
154780
|
+
const s = getSession(this.endpoint);
|
|
154781
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154782
|
+
const currentRoomEntityId = homeAssistant.state.mapping?.currentRoomEntity;
|
|
154783
|
+
if (!currentRoomEntityId) {
|
|
154784
|
+
this.logShortCircuitOnce(
|
|
154785
|
+
"no-mapping",
|
|
154786
|
+
"currentRoom sensor: no currentRoomEntity in mapping, auto-detect did not run or sensor not on same HA device"
|
|
154787
|
+
);
|
|
154788
|
+
return;
|
|
154789
|
+
}
|
|
154790
|
+
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
154791
|
+
const roomState = stateProvider.getState(currentRoomEntityId);
|
|
154792
|
+
if (!roomState || !roomState.state) {
|
|
154793
|
+
this.logShortCircuitOnce(
|
|
154794
|
+
"no-state",
|
|
154795
|
+
`currentRoom sensor: no state available for ${currentRoomEntityId}`
|
|
154796
|
+
);
|
|
154797
|
+
return;
|
|
154798
|
+
}
|
|
154799
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154800
|
+
const externalSession = s.activeAreas.length === 0;
|
|
154801
|
+
const supportedAreaIds = serviceArea.state.supportedAreas.map(
|
|
154802
|
+
(a) => a.areaId
|
|
154803
|
+
);
|
|
154804
|
+
const isAllowedArea = (id) => externalSession ? supportedAreaIds.includes(id) : s.activeAreas.includes(id);
|
|
154805
|
+
const sensorAttrs = roomState.attributes;
|
|
154806
|
+
const segmentId = sensorAttrs.segment_id ?? sensorAttrs.room_id;
|
|
154807
|
+
const roomName = roomState.state;
|
|
154808
|
+
let matchedAreaId = null;
|
|
154809
|
+
if (segmentId != null && isAllowedArea(segmentId)) {
|
|
154810
|
+
matchedAreaId = segmentId;
|
|
154811
|
+
}
|
|
154812
|
+
if (matchedAreaId === null && segmentId != null) {
|
|
154813
|
+
for (const area of serviceArea.state.supportedAreas) {
|
|
154814
|
+
if (isAllowedArea(area.areaId) && area.areaId % 1e4 === segmentId) {
|
|
154815
|
+
matchedAreaId = area.areaId;
|
|
154816
|
+
break;
|
|
154817
|
+
}
|
|
154818
|
+
}
|
|
154819
|
+
}
|
|
154820
|
+
if (matchedAreaId === null && roomName) {
|
|
154821
|
+
const area = serviceArea.state.supportedAreas.find(
|
|
154822
|
+
(a) => a.areaInfo.locationInfo?.locationName?.toLowerCase() === roomName.toLowerCase()
|
|
154823
|
+
);
|
|
154824
|
+
if (area && isAllowedArea(area.areaId)) {
|
|
154825
|
+
matchedAreaId = area.areaId;
|
|
154826
|
+
}
|
|
154827
|
+
}
|
|
154828
|
+
if (matchedAreaId === null) {
|
|
154829
|
+
logger211.info(
|
|
154830
|
+
`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(", ")}]`
|
|
154831
|
+
);
|
|
154832
|
+
return;
|
|
154833
|
+
}
|
|
154834
|
+
if (matchedAreaId === s.lastCurrentArea) return;
|
|
154835
|
+
if (s.lastCurrentArea !== null) {
|
|
154836
|
+
s.completedAreas.add(s.lastCurrentArea);
|
|
154837
|
+
}
|
|
154838
|
+
s.lastCurrentArea = matchedAreaId;
|
|
154839
|
+
logger211.info(
|
|
154840
|
+
`currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
|
|
154841
|
+
);
|
|
154842
|
+
this.trySetCurrentArea(matchedAreaId);
|
|
154843
|
+
} catch (e) {
|
|
154844
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
154845
|
+
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
154846
|
+
logger211.warn(`currentRoom sensor update failed: ${msg}`);
|
|
154847
|
+
}
|
|
154848
|
+
}
|
|
154849
|
+
}
|
|
154850
|
+
/** Read the cumulative cleaned-area sensor (m2), or null if not configured. */
|
|
154851
|
+
readCleanedAreaSqm() {
|
|
154852
|
+
try {
|
|
154853
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
154854
|
+
const entityId = mapping?.cleanedAreaEntity;
|
|
154855
|
+
if (!entityId) {
|
|
154856
|
+
return null;
|
|
154857
|
+
}
|
|
154858
|
+
return this.agent.env.get(EntityStateProvider).getNumericState(entityId);
|
|
154859
|
+
} catch {
|
|
154860
|
+
return null;
|
|
154861
|
+
}
|
|
154862
|
+
}
|
|
154863
|
+
/**
|
|
154864
|
+
* For batch vacuums that report cumulative cleaned area but not the current
|
|
154865
|
+
* room, infer currentArea + progress from the cleaned area and the per-room
|
|
154866
|
+
* sizeSqm. Display-only and batch-only; skipped unless every selected area
|
|
154867
|
+
* has a size. The currentRoom sensor path takes priority (#368).
|
|
154868
|
+
*/
|
|
154869
|
+
updateCurrentRoomFromCleanedArea() {
|
|
154870
|
+
try {
|
|
154871
|
+
const s = getSession(this.endpoint);
|
|
154872
|
+
if (s.pendingDispatches.length > 0 || s.activeAreas.length === 0) {
|
|
154873
|
+
return;
|
|
154874
|
+
}
|
|
154875
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
154876
|
+
const entityId = mapping?.cleanedAreaEntity;
|
|
154877
|
+
if (!entityId) {
|
|
154878
|
+
return;
|
|
154879
|
+
}
|
|
154880
|
+
const raw = this.agent.env.get(EntityStateProvider).getNumericState(entityId);
|
|
154881
|
+
if (raw == null) {
|
|
154882
|
+
this.logShortCircuitOnce(
|
|
154883
|
+
"no-cleaned-area-state",
|
|
154884
|
+
`cleanedArea sensor: no numeric state for ${entityId}`
|
|
154885
|
+
);
|
|
154886
|
+
return;
|
|
154887
|
+
}
|
|
154888
|
+
const customAreas = mapping?.customServiceAreas;
|
|
154889
|
+
const ordered = [];
|
|
154890
|
+
for (const areaId of [...s.activeAreas].sort((a, b) => a - b)) {
|
|
154891
|
+
const size = customAreas?.[areaId - 1]?.sizeSqm;
|
|
154892
|
+
if (typeof size !== "number" || !Number.isFinite(size) || size <= 0) {
|
|
154893
|
+
this.logShortCircuitOnce(
|
|
154894
|
+
"no-sizes",
|
|
154895
|
+
"cleanedArea sensor: not every selected area has a sizeSqm"
|
|
154896
|
+
);
|
|
154897
|
+
return;
|
|
154898
|
+
}
|
|
154899
|
+
ordered.push({ areaId, sizeSqm: size });
|
|
154900
|
+
}
|
|
154901
|
+
if (s.cleanedAreaBaseline == null || raw < s.cleanedAreaBaseline) {
|
|
154902
|
+
s.cleanedAreaBaseline = raw;
|
|
154903
|
+
}
|
|
154904
|
+
const cleaned = Math.max(0, raw - s.cleanedAreaBaseline);
|
|
154905
|
+
const { currentArea, completed } = inferCleanedAreaProgress(
|
|
154906
|
+
cleaned,
|
|
154907
|
+
ordered
|
|
154908
|
+
);
|
|
154909
|
+
logger211.debug(
|
|
154910
|
+
`cleanedArea: raw=${raw} baseline=${s.cleanedAreaBaseline} cleaned=${cleaned} sizes=[${ordered.map((o) => `${o.areaId}:${o.sizeSqm}`).join(",")}] -> current=${currentArea} completed=[${completed.join(",")}]`
|
|
154911
|
+
);
|
|
154912
|
+
for (const id of completed) {
|
|
154913
|
+
s.completedAreas.add(id);
|
|
154914
|
+
}
|
|
154915
|
+
if (currentArea === s.lastCurrentArea) {
|
|
154916
|
+
return;
|
|
154917
|
+
}
|
|
154918
|
+
s.lastCurrentArea = currentArea;
|
|
154919
|
+
this.trySetCurrentArea(currentArea);
|
|
154920
|
+
} catch (e) {
|
|
154921
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
154922
|
+
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
154923
|
+
logger211.warn(`cleanedArea room update failed: ${msg}`);
|
|
154924
|
+
}
|
|
154925
|
+
}
|
|
154926
|
+
}
|
|
154927
|
+
/**
|
|
154928
|
+
* Safely update ServiceArea.currentArea and progress.
|
|
154929
|
+
* When areaId is set, marks it as Operating in progress.
|
|
154930
|
+
* When areaId is null (Idle), marks all Operating/Pending as Completed.
|
|
154931
|
+
* No-op if ServiceArea is not available on this endpoint.
|
|
154932
|
+
*/
|
|
154933
|
+
trySetCurrentArea(areaId) {
|
|
154934
|
+
try {
|
|
154935
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154936
|
+
if (serviceArea.state.currentArea !== areaId) {
|
|
154937
|
+
serviceArea.state.currentArea = areaId;
|
|
154938
|
+
logger211.debug(`currentArea set to ${areaId}`);
|
|
154939
|
+
}
|
|
154940
|
+
this.updateProgress(serviceArea, areaId);
|
|
154941
|
+
} catch {
|
|
154942
|
+
}
|
|
154943
|
+
}
|
|
154944
|
+
/**
|
|
154945
|
+
* Update progress entries to reflect the current operating area.
|
|
154946
|
+
* - null: mark all areas as Completed (cleaning done)
|
|
154947
|
+
* - areaId: mark that area as Operating, others as Pending
|
|
154948
|
+
*
|
|
154949
|
+
* Uses the activeAreas snapshot (plain number array) instead of
|
|
154950
|
+
* managed state entries, which avoids infinite recursion in
|
|
154951
|
+
* matter.js property getters during transaction pre-commit.
|
|
154952
|
+
*/
|
|
154953
|
+
updateProgress(serviceArea, areaId) {
|
|
154954
|
+
const s = getSession(this.endpoint);
|
|
154955
|
+
if (s.activeAreas.length === 0) return;
|
|
154956
|
+
const state = serviceArea.state;
|
|
154957
|
+
if (areaId === null) {
|
|
154958
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
154959
|
+
areaId: id,
|
|
154960
|
+
status: ServiceArea3.OperationalStatus.Completed
|
|
154961
|
+
}));
|
|
154962
|
+
} else {
|
|
154963
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
154964
|
+
areaId: id,
|
|
154965
|
+
status: id === areaId ? ServiceArea3.OperationalStatus.Operating : s.completedAreas.has(id) ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Pending
|
|
154966
|
+
}));
|
|
154967
|
+
}
|
|
154968
|
+
}
|
|
154969
|
+
/**
|
|
154970
|
+
* Update progress entries from tracking state without any area
|
|
154971
|
+
* operating. Used on mid-session transitions (e.g. vacuum-then-mop
|
|
154972
|
+
* tool swap) where the vacuum is temporarily idle but the session
|
|
154973
|
+
* is not finished: completed areas stay Completed, remaining areas
|
|
154974
|
+
* stay Pending.
|
|
154975
|
+
*/
|
|
154976
|
+
updateProgressFromTracking(serviceArea) {
|
|
154977
|
+
const s = getSession(this.endpoint);
|
|
154978
|
+
if (s.activeAreas.length === 0) return;
|
|
154979
|
+
const state = serviceArea.state;
|
|
154980
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
154981
|
+
areaId: id,
|
|
154982
|
+
status: s.completedAreas.has(id) ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Pending
|
|
154983
|
+
}));
|
|
154984
|
+
}
|
|
154985
|
+
/**
|
|
154986
|
+
* Stop before finishing: mark the areas the vacuum actually reached as
|
|
154987
|
+
* Completed and the rest as Skipped (an out-of-band stop per the Matter
|
|
154988
|
+
* ServiceArea spec), then clear currentArea. The old path marked every
|
|
154989
|
+
* area Completed, which told Apple Home rooms were cleaned when they were
|
|
154990
|
+
* not, so they got dropped from the next selection (#367).
|
|
154991
|
+
*/
|
|
154992
|
+
finalizeProgressOnStop() {
|
|
154993
|
+
const s = getSession(this.endpoint);
|
|
154994
|
+
try {
|
|
154995
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154996
|
+
if (s.activeAreas.length > 0) {
|
|
154997
|
+
const last = serviceArea.state.currentArea;
|
|
154998
|
+
const state = serviceArea.state;
|
|
154999
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
155000
|
+
areaId: id,
|
|
155001
|
+
status: s.completedAreas.has(id) || id === last ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Skipped
|
|
155002
|
+
}));
|
|
155003
|
+
}
|
|
155004
|
+
serviceArea.state.currentArea = null;
|
|
155005
|
+
} catch {
|
|
155006
|
+
}
|
|
155007
|
+
}
|
|
155008
|
+
/**
|
|
155009
|
+
* Find the ServiceArea area ID that corresponds to a run mode value
|
|
155010
|
+
* by matching the mode label to the area location name.
|
|
155011
|
+
*/
|
|
155012
|
+
findAreaIdForMode(mode) {
|
|
155013
|
+
try {
|
|
155014
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
155015
|
+
const modeEntry = this.state.supportedModes.find((m) => m.mode === mode);
|
|
155016
|
+
if (!modeEntry) return null;
|
|
155017
|
+
const area = serviceArea.state.supportedAreas.find(
|
|
155018
|
+
(a) => a.areaInfo.locationInfo?.locationName === modeEntry.label
|
|
155019
|
+
);
|
|
155020
|
+
return area?.areaId ?? null;
|
|
155021
|
+
} catch {
|
|
155022
|
+
return null;
|
|
155023
|
+
}
|
|
155024
|
+
}
|
|
155025
|
+
changeToMode(request) {
|
|
155026
|
+
const s = getSession(this.endpoint);
|
|
155027
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
155028
|
+
const { newMode } = request;
|
|
155029
|
+
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
155030
|
+
return {
|
|
155031
|
+
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
155032
|
+
statusText: `Unsupported mode: ${newMode}`
|
|
155033
|
+
};
|
|
155034
|
+
}
|
|
155035
|
+
if (isRoomMode(newMode)) {
|
|
155036
|
+
try {
|
|
155037
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
155038
|
+
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
155039
|
+
s.activeAreas = [...serviceArea.state.selectedAreas];
|
|
155040
|
+
s.completedAreas.clear();
|
|
155041
|
+
s.lastCurrentArea = null;
|
|
155042
|
+
s.loggedShortCircuits.clear();
|
|
155043
|
+
s.pendingDispatches = [];
|
|
155044
|
+
s.cleanedAreaBaseline = this.readCleanedAreaSqm();
|
|
155045
|
+
this.trySetCurrentArea(s.activeAreas[0]);
|
|
155046
|
+
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
155047
|
+
this.state.currentMode = newMode;
|
|
155048
|
+
return {
|
|
155049
|
+
status: ModeBase3.ModeChangeStatus.Success,
|
|
155050
|
+
statusText: "Starting room cleaning"
|
|
155051
|
+
};
|
|
155052
|
+
}
|
|
155053
|
+
} catch {
|
|
155054
|
+
}
|
|
155055
|
+
if (this.state.config.cleanRoom) {
|
|
155056
|
+
const areaId = this.findAreaIdForMode(newMode);
|
|
155057
|
+
s.activeAreas = areaId !== null ? [areaId] : [];
|
|
155058
|
+
s.completedAreas.clear();
|
|
155059
|
+
s.lastCurrentArea = null;
|
|
155060
|
+
s.loggedShortCircuits.clear();
|
|
155061
|
+
s.pendingDispatches = [];
|
|
155062
|
+
this.trySetCurrentArea(areaId);
|
|
155063
|
+
homeAssistant.callAction(
|
|
155064
|
+
this.state.config.cleanRoom(newMode, this.agent)
|
|
155065
|
+
);
|
|
155066
|
+
this.state.currentMode = newMode;
|
|
155067
|
+
return {
|
|
155068
|
+
status: ModeBase3.ModeChangeStatus.Success,
|
|
155069
|
+
statusText: "Starting room cleaning"
|
|
155070
|
+
};
|
|
155071
|
+
}
|
|
155072
|
+
}
|
|
155073
|
+
switch (newMode) {
|
|
155074
|
+
case 1 /* Cleaning */: {
|
|
155075
|
+
try {
|
|
155076
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
155077
|
+
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
155078
|
+
s.activeAreas = [...serviceArea.state.selectedAreas];
|
|
155079
|
+
s.completedAreas.clear();
|
|
155080
|
+
s.lastCurrentArea = null;
|
|
155081
|
+
s.loggedShortCircuits.clear();
|
|
155082
|
+
s.pendingDispatches = [];
|
|
155083
|
+
s.cleanedAreaBaseline = this.readCleanedAreaSqm();
|
|
155084
|
+
this.trySetCurrentArea(s.activeAreas[0]);
|
|
155085
|
+
}
|
|
155086
|
+
} catch {
|
|
155087
|
+
}
|
|
155088
|
+
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
155089
|
+
break;
|
|
155090
|
+
}
|
|
155091
|
+
case 0 /* Idle */:
|
|
155092
|
+
this.finalizeProgressOnStop();
|
|
155093
|
+
s.completedAreas.clear();
|
|
155094
|
+
s.lastCurrentArea = null;
|
|
155095
|
+
s.activeAreas = [];
|
|
155096
|
+
s.loggedShortCircuits.clear();
|
|
155097
|
+
s.pendingDispatches = [];
|
|
155098
|
+
s.observedCleaning = false;
|
|
155099
|
+
s.cleanedAreaBaseline = null;
|
|
155100
|
+
homeAssistant.callAction(
|
|
155101
|
+
this.state.config.returnToBase(void 0, this.agent)
|
|
155102
|
+
);
|
|
155103
|
+
break;
|
|
155104
|
+
default:
|
|
155105
|
+
homeAssistant.callAction(this.state.config.pause(void 0, this.agent));
|
|
155106
|
+
break;
|
|
155107
|
+
}
|
|
155108
|
+
this.state.currentMode = newMode;
|
|
155109
|
+
return {
|
|
155110
|
+
status: ModeBase3.ModeChangeStatus.Success,
|
|
155111
|
+
statusText: "Mode switched"
|
|
155112
|
+
};
|
|
155113
|
+
}
|
|
155114
|
+
};
|
|
155115
|
+
((RvcRunModeServerBase2) => {
|
|
155116
|
+
class State extends RvcRunModeServer.State {
|
|
155117
|
+
config;
|
|
155118
|
+
}
|
|
155119
|
+
RvcRunModeServerBase2.State = State;
|
|
155120
|
+
})(RvcRunModeServerBase || (RvcRunModeServerBase = {}));
|
|
155121
|
+
function RvcRunModeServer2(config11, initialState) {
|
|
155122
|
+
const defaultModes = [
|
|
155123
|
+
{
|
|
155124
|
+
label: "Idle",
|
|
155125
|
+
mode: 0 /* Idle */,
|
|
155126
|
+
modeTags: [{ value: RvcRunMode3.ModeTag.Idle }]
|
|
155127
|
+
},
|
|
155128
|
+
{
|
|
155129
|
+
label: "Cleaning",
|
|
155130
|
+
mode: 1 /* Cleaning */,
|
|
155131
|
+
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
155132
|
+
}
|
|
155133
|
+
];
|
|
155134
|
+
return RvcRunModeServerBase.set({
|
|
155135
|
+
config: config11,
|
|
155136
|
+
supportedModes: initialState?.supportedModes ?? defaultModes,
|
|
155137
|
+
currentMode: initialState?.currentMode ?? 0 /* Idle */
|
|
155138
|
+
});
|
|
155139
|
+
}
|
|
155140
|
+
|
|
155141
|
+
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-run-mode-server.ts
|
|
155142
|
+
var supportedModes = [
|
|
155143
|
+
{
|
|
155144
|
+
label: "Idle",
|
|
155145
|
+
mode: 0 /* Idle */,
|
|
155146
|
+
modeTags: [{ value: RvcRunMode3.ModeTag.Idle }]
|
|
155147
|
+
},
|
|
155148
|
+
{
|
|
155149
|
+
label: "Mowing",
|
|
155150
|
+
mode: 1 /* Cleaning */,
|
|
155151
|
+
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
155152
|
+
}
|
|
155153
|
+
];
|
|
155154
|
+
function mapLawnMowerRunMode(entity) {
|
|
155155
|
+
const state = entity.state;
|
|
155156
|
+
const active = state === LawnMowerActivity.mowing || state === LawnMowerActivity.paused;
|
|
155157
|
+
return active ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
155158
|
+
}
|
|
155159
|
+
function createLawnMowerRvcRunModeServer() {
|
|
155160
|
+
return RvcRunModeServer2(
|
|
155161
|
+
{
|
|
155162
|
+
getCurrentMode: (entity) => mapLawnMowerRunMode(entity),
|
|
155163
|
+
getSupportedModes: () => supportedModes,
|
|
155164
|
+
start: () => ({ action: "lawn_mower.start_mowing" }),
|
|
155165
|
+
returnToBase: () => ({ action: "lawn_mower.dock" }),
|
|
155166
|
+
pause: (_, agent) => {
|
|
155167
|
+
const features3 = agent.get(HomeAssistantEntityBehavior).entity.state.attributes.supported_features ?? 0;
|
|
155168
|
+
if (testBit(features3, LawnMowerEntityFeature.PAUSE)) {
|
|
155169
|
+
return { action: "lawn_mower.pause" };
|
|
155170
|
+
}
|
|
155171
|
+
return { action: "lawn_mower.dock" };
|
|
155172
|
+
}
|
|
155173
|
+
},
|
|
155174
|
+
{ supportedModes, currentMode: 0 /* Idle */ }
|
|
155175
|
+
);
|
|
155176
|
+
}
|
|
155177
|
+
|
|
155178
|
+
// src/matter/endpoints/legacy/lawn-mower/index.ts
|
|
155179
|
+
var LawnMowerEndpointType = RoboticVacuumCleanerDevice.with(
|
|
155180
|
+
BasicInformationServer2,
|
|
155181
|
+
IdentifyServer2,
|
|
155182
|
+
HomeAssistantEntityBehavior,
|
|
155183
|
+
LawnMowerRvcOperationalStateServer
|
|
155184
|
+
);
|
|
155185
|
+
function LawnMowerDevice(homeAssistantEntity) {
|
|
155186
|
+
if (homeAssistantEntity.entity.state === void 0) {
|
|
155187
|
+
return void 0;
|
|
155188
|
+
}
|
|
155189
|
+
const attributes8 = homeAssistantEntity.entity.state.attributes;
|
|
155190
|
+
let device = LawnMowerEndpointType.with(
|
|
155191
|
+
createLawnMowerRvcRunModeServer()
|
|
155192
|
+
).set({ homeAssistantEntity });
|
|
155193
|
+
const hasBattery = homeAssistantEntity.mapping?.batteryEntity != null || attributes8.battery_level != null || attributes8.battery != null;
|
|
155194
|
+
if (hasBattery) {
|
|
155195
|
+
device = device.with(DefaultPowerSourceServer);
|
|
155196
|
+
}
|
|
155197
|
+
return device;
|
|
155198
|
+
}
|
|
155199
|
+
|
|
154413
155200
|
// src/matter/endpoints/legacy/light/devices/color-temperature-light.ts
|
|
154414
155201
|
init_home_assistant_entity_behavior();
|
|
154415
155202
|
|
|
@@ -154425,7 +155212,7 @@ init_nodejs();
|
|
|
154425
155212
|
|
|
154426
155213
|
// src/matter/behaviors/color-control-server.ts
|
|
154427
155214
|
init_home_assistant_entity_behavior();
|
|
154428
|
-
var
|
|
155215
|
+
var logger212 = Logger.get("ColorControlServer");
|
|
154429
155216
|
var optimisticColorState = /* @__PURE__ */ new Map();
|
|
154430
155217
|
var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
|
|
154431
155218
|
var OPTIMISTIC_TOLERANCE2 = 5;
|
|
@@ -154464,7 +155251,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
154464
155251
|
if (this.state.startUpColorTemperatureMireds == null) {
|
|
154465
155252
|
this.state.startUpColorTemperatureMireds = defaultMireds;
|
|
154466
155253
|
}
|
|
154467
|
-
|
|
155254
|
+
logger212.debug(
|
|
154468
155255
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
154469
155256
|
);
|
|
154470
155257
|
}
|
|
@@ -154965,7 +155752,7 @@ init_home_assistant_entity_behavior();
|
|
|
154965
155752
|
// src/matter/behaviors/lock-server.ts
|
|
154966
155753
|
init_esm();
|
|
154967
155754
|
init_home_assistant_entity_behavior();
|
|
154968
|
-
var
|
|
155755
|
+
var logger213 = Logger.get("LockServer");
|
|
154969
155756
|
var SUPPORTED_SLOT = 1;
|
|
154970
155757
|
function normalizeSupportedIndex(index) {
|
|
154971
155758
|
if (index === 0 || index === SUPPORTED_SLOT) {
|
|
@@ -155236,7 +156023,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
155236
156023
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
155237
156024
|
const action = this.state.config.lock(void 0, this.agent);
|
|
155238
156025
|
const hasPinProvided = !!request.pinCode;
|
|
155239
|
-
|
|
156026
|
+
logger213.debug(
|
|
155240
156027
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
155241
156028
|
);
|
|
155242
156029
|
if (request.pinCode) {
|
|
@@ -155249,12 +156036,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
155249
156036
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
155250
156037
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
155251
156038
|
const hasPinProvided = !!request.pinCode;
|
|
155252
|
-
|
|
156039
|
+
logger213.debug(
|
|
155253
156040
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
155254
156041
|
);
|
|
155255
156042
|
if (this.state.requirePinForRemoteOperation) {
|
|
155256
156043
|
if (!request.pinCode) {
|
|
155257
|
-
|
|
156044
|
+
logger213.info(
|
|
155258
156045
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
155259
156046
|
);
|
|
155260
156047
|
throw new StatusResponseError(
|
|
@@ -155264,12 +156051,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
155264
156051
|
}
|
|
155265
156052
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
155266
156053
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
155267
|
-
|
|
156054
|
+
logger213.info(
|
|
155268
156055
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
155269
156056
|
);
|
|
155270
156057
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
155271
156058
|
}
|
|
155272
|
-
|
|
156059
|
+
logger213.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
155273
156060
|
action.data = { ...action.data, code: providedPin };
|
|
155274
156061
|
}
|
|
155275
156062
|
homeAssistant.callAction(action);
|
|
@@ -155402,7 +156189,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155402
156189
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
155403
156190
|
const action = this.state.config.lock(void 0, this.agent);
|
|
155404
156191
|
const hasPinProvided = !!request.pinCode;
|
|
155405
|
-
|
|
156192
|
+
logger213.debug(
|
|
155406
156193
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
155407
156194
|
);
|
|
155408
156195
|
if (request.pinCode) {
|
|
@@ -155416,12 +156203,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155416
156203
|
const unlatchConfig = this.state.config.unlatch;
|
|
155417
156204
|
const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
|
|
155418
156205
|
const hasPinProvided = !!request.pinCode;
|
|
155419
|
-
|
|
156206
|
+
logger213.debug(
|
|
155420
156207
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
|
|
155421
156208
|
);
|
|
155422
156209
|
if (this.state.requirePinForRemoteOperation) {
|
|
155423
156210
|
if (!request.pinCode) {
|
|
155424
|
-
|
|
156211
|
+
logger213.info(
|
|
155425
156212
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
155426
156213
|
);
|
|
155427
156214
|
throw new StatusResponseError(
|
|
@@ -155431,12 +156218,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155431
156218
|
}
|
|
155432
156219
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
155433
156220
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
155434
|
-
|
|
156221
|
+
logger213.info(
|
|
155435
156222
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
155436
156223
|
);
|
|
155437
156224
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
155438
156225
|
}
|
|
155439
|
-
|
|
156226
|
+
logger213.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
155440
156227
|
action.data = { ...action.data, code: providedPin };
|
|
155441
156228
|
}
|
|
155442
156229
|
homeAssistant.callAction(action);
|
|
@@ -155451,12 +156238,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155451
156238
|
}
|
|
155452
156239
|
const action = unlatchConfig(void 0, this.agent);
|
|
155453
156240
|
const hasPinProvided = !!request.pinCode;
|
|
155454
|
-
|
|
156241
|
+
logger213.debug(
|
|
155455
156242
|
`unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
155456
156243
|
);
|
|
155457
156244
|
if (this.state.requirePinForRemoteOperation) {
|
|
155458
156245
|
if (!request.pinCode) {
|
|
155459
|
-
|
|
156246
|
+
logger213.info(
|
|
155460
156247
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
155461
156248
|
);
|
|
155462
156249
|
throw new StatusResponseError(
|
|
@@ -155466,12 +156253,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155466
156253
|
}
|
|
155467
156254
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
155468
156255
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
155469
|
-
|
|
156256
|
+
logger213.info(
|
|
155470
156257
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
155471
156258
|
);
|
|
155472
156259
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
155473
156260
|
}
|
|
155474
|
-
|
|
156261
|
+
logger213.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
|
|
155475
156262
|
action.data = { ...action.data, code: providedPin };
|
|
155476
156263
|
}
|
|
155477
156264
|
homeAssistant.callAction(action);
|
|
@@ -155603,7 +156390,7 @@ init_home_assistant_entity_behavior();
|
|
|
155603
156390
|
init_dist();
|
|
155604
156391
|
init_esm();
|
|
155605
156392
|
init_home_assistant_entity_behavior();
|
|
155606
|
-
var
|
|
156393
|
+
var logger214 = Logger.get("MediaPlayerKeypadInputServer");
|
|
155607
156394
|
var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
155608
156395
|
sendKey(request) {
|
|
155609
156396
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -155614,12 +156401,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
|
155614
156401
|
const features3 = attributes8.supported_features ?? 0;
|
|
155615
156402
|
const action = this.mapKeyToAction(request.keyCode, features3);
|
|
155616
156403
|
if (!action) {
|
|
155617
|
-
|
|
156404
|
+
logger214.debug(
|
|
155618
156405
|
`Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
|
|
155619
156406
|
);
|
|
155620
156407
|
return { status: KeypadInput3.Status.UnsupportedKey };
|
|
155621
156408
|
}
|
|
155622
|
-
|
|
156409
|
+
logger214.debug(
|
|
155623
156410
|
`sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
|
|
155624
156411
|
);
|
|
155625
156412
|
homeAssistant.callAction({ action });
|
|
@@ -155898,7 +156685,7 @@ init_home_assistant_entity_behavior();
|
|
|
155898
156685
|
// src/matter/behaviors/speaker-level-control-server.ts
|
|
155899
156686
|
init_esm();
|
|
155900
156687
|
init_home_assistant_entity_behavior();
|
|
155901
|
-
var
|
|
156688
|
+
var logger215 = Logger.get("SpeakerLevelControlServer");
|
|
155902
156689
|
var optimisticLevelState2 = /* @__PURE__ */ new Map();
|
|
155903
156690
|
var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
|
|
155904
156691
|
var OPTIMISTIC_TOLERANCE3 = 5;
|
|
@@ -155941,7 +156728,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
155941
156728
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
155942
156729
|
}
|
|
155943
156730
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
155944
|
-
|
|
156731
|
+
logger215.debug(
|
|
155945
156732
|
`[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
|
|
155946
156733
|
);
|
|
155947
156734
|
const optimistic = optimisticLevelState2.get(entity.entity_id);
|
|
@@ -155989,7 +156776,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
155989
156776
|
const config11 = this.state.config;
|
|
155990
156777
|
const entityId = homeAssistant.entity.entity_id;
|
|
155991
156778
|
const levelPercent = level / 254;
|
|
155992
|
-
|
|
156779
|
+
logger215.debug(
|
|
155993
156780
|
`[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
|
|
155994
156781
|
);
|
|
155995
156782
|
const current = config11.getValuePercent(
|
|
@@ -157354,7 +158141,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
|
|
|
157354
158141
|
};
|
|
157355
158142
|
|
|
157356
158143
|
// src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
|
|
157357
|
-
var
|
|
158144
|
+
var logger216 = Logger.get("TvocSensor");
|
|
157358
158145
|
function airQualityFromUgm3(value) {
|
|
157359
158146
|
if (value <= 300) return AirQuality3.AirQualityEnum.Good;
|
|
157360
158147
|
if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
|
|
@@ -157395,17 +158182,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
157395
158182
|
const attributes8 = entity.state.attributes;
|
|
157396
158183
|
const deviceClass = attributes8.device_class;
|
|
157397
158184
|
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
157398
|
-
|
|
158185
|
+
logger216.debug(
|
|
157399
158186
|
`[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
|
|
157400
158187
|
);
|
|
157401
158188
|
if (state != null && !Number.isNaN(+state)) {
|
|
157402
158189
|
const value = +state;
|
|
157403
158190
|
airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
|
|
157404
|
-
|
|
158191
|
+
logger216.debug(
|
|
157405
158192
|
`[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
|
|
157406
158193
|
);
|
|
157407
158194
|
} else {
|
|
157408
|
-
|
|
158195
|
+
logger216.warn(
|
|
157409
158196
|
`[${entity.entity_id}] TVOC state not a valid number: "${state}"`
|
|
157410
158197
|
);
|
|
157411
158198
|
}
|
|
@@ -157619,7 +158406,7 @@ init_home_assistant_entity_behavior();
|
|
|
157619
158406
|
// src/matter/behaviors/pm25-concentration-measurement-server.ts
|
|
157620
158407
|
init_esm();
|
|
157621
158408
|
init_home_assistant_entity_behavior();
|
|
157622
|
-
var
|
|
158409
|
+
var logger217 = Logger.get("Pm25ConcentrationMeasurementServer");
|
|
157623
158410
|
var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
|
|
157624
158411
|
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
157625
158412
|
);
|
|
@@ -157643,11 +158430,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
157643
158430
|
if (this.state.measurementMedium === void 0) {
|
|
157644
158431
|
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
157645
158432
|
}
|
|
157646
|
-
|
|
158433
|
+
logger217.debug(
|
|
157647
158434
|
"Pm25ConcentrationMeasurementServer: before super.initialize()"
|
|
157648
158435
|
);
|
|
157649
158436
|
await super.initialize();
|
|
157650
|
-
|
|
158437
|
+
logger217.debug(
|
|
157651
158438
|
"Pm25ConcentrationMeasurementServer: after super.initialize()"
|
|
157652
158439
|
);
|
|
157653
158440
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -157670,7 +158457,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
157670
158457
|
};
|
|
157671
158458
|
|
|
157672
158459
|
// src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
|
|
157673
|
-
var
|
|
158460
|
+
var logger218 = Logger.get("Pm25AirQualityServer");
|
|
157674
158461
|
var Pm25AirQualityServerBase = AirQualityServer.with(
|
|
157675
158462
|
AirQuality3.Feature.Fair,
|
|
157676
158463
|
AirQuality3.Feature.Moderate,
|
|
@@ -157682,9 +158469,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
|
|
|
157682
158469
|
if (this.state.airQuality === void 0) {
|
|
157683
158470
|
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
157684
158471
|
}
|
|
157685
|
-
|
|
158472
|
+
logger218.debug("Pm25AirQualityServer: before super.initialize()");
|
|
157686
158473
|
await super.initialize();
|
|
157687
|
-
|
|
158474
|
+
logger218.debug("Pm25AirQualityServer: after super.initialize()");
|
|
157688
158475
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
157689
158476
|
this.update(homeAssistant.entity);
|
|
157690
158477
|
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
@@ -158073,7 +158860,7 @@ init_home_assistant_entity_behavior();
|
|
|
158073
158860
|
init_dist();
|
|
158074
158861
|
init_esm();
|
|
158075
158862
|
init_home_assistant_entity_behavior();
|
|
158076
|
-
var
|
|
158863
|
+
var logger219 = Logger.get("VacuumIdentifyServer");
|
|
158077
158864
|
var IDENTIFY_BUTTON_SUFFIXES = ["_identify", "_locate", "_find_me"];
|
|
158078
158865
|
var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
158079
158866
|
triggerEffect(effect) {
|
|
@@ -158090,19 +158877,19 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
158090
158877
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
158091
158878
|
const features3 = homeAssistant.entity.state.attributes.supported_features ?? 0;
|
|
158092
158879
|
if (testBit(features3, VacuumDeviceFeature.LOCATE)) {
|
|
158093
|
-
|
|
158880
|
+
logger219.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
|
|
158094
158881
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
158095
158882
|
return;
|
|
158096
158883
|
}
|
|
158097
158884
|
const sibling = this.#findIdentifyButton(homeAssistant);
|
|
158098
158885
|
if (sibling) {
|
|
158099
|
-
|
|
158886
|
+
logger219.info(
|
|
158100
158887
|
`${source} \u2192 button.press ${sibling} for ${homeAssistant.entityId}`
|
|
158101
158888
|
);
|
|
158102
158889
|
homeAssistant.callAction({ action: "button.press", target: sibling });
|
|
158103
158890
|
return;
|
|
158104
158891
|
}
|
|
158105
|
-
|
|
158892
|
+
logger219.warn(
|
|
158106
158893
|
`${source} for ${homeAssistant.entityId}, LOCATE not in supported_features (${features3}), trying vacuum.locate anyway`
|
|
158107
158894
|
);
|
|
158108
158895
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
@@ -158125,533 +158912,6 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
158125
158912
|
}
|
|
158126
158913
|
};
|
|
158127
158914
|
|
|
158128
|
-
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
158129
|
-
init_esm();
|
|
158130
|
-
|
|
158131
|
-
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/mode-base.js
|
|
158132
|
-
init_nodejs();
|
|
158133
|
-
|
|
158134
|
-
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/rvc-run-mode.js
|
|
158135
|
-
init_nodejs();
|
|
158136
|
-
|
|
158137
|
-
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
158138
|
-
init_home_assistant_entity_behavior();
|
|
158139
|
-
|
|
158140
|
-
// src/matter/behaviors/infer-cleaned-area-progress.ts
|
|
158141
|
-
function inferCleanedAreaProgress(cleanedSqm, orderedAreas) {
|
|
158142
|
-
if (orderedAreas.length === 0) {
|
|
158143
|
-
return { currentArea: null, completed: [] };
|
|
158144
|
-
}
|
|
158145
|
-
const cleaned = Number.isFinite(cleanedSqm) ? Math.max(0, cleanedSqm) : 0;
|
|
158146
|
-
let cumulative = 0;
|
|
158147
|
-
const completed = [];
|
|
158148
|
-
for (const area of orderedAreas) {
|
|
158149
|
-
const size = Number.isFinite(area.sizeSqm) ? Math.max(0, area.sizeSqm) : 0;
|
|
158150
|
-
cumulative += size;
|
|
158151
|
-
if (cleaned < cumulative) {
|
|
158152
|
-
return { currentArea: area.areaId, completed };
|
|
158153
|
-
}
|
|
158154
|
-
completed.push(area.areaId);
|
|
158155
|
-
}
|
|
158156
|
-
return { currentArea: null, completed };
|
|
158157
|
-
}
|
|
158158
|
-
|
|
158159
|
-
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
158160
|
-
var logger217 = Logger.get("RvcRunModeServer");
|
|
158161
|
-
var ROOM_MODE_BASE = 100;
|
|
158162
|
-
function isRoomMode(mode) {
|
|
158163
|
-
return mode >= ROOM_MODE_BASE;
|
|
158164
|
-
}
|
|
158165
|
-
var cleaningSessions = /* @__PURE__ */ new WeakMap();
|
|
158166
|
-
function getSession(endpoint) {
|
|
158167
|
-
let session = cleaningSessions.get(endpoint);
|
|
158168
|
-
if (!session) {
|
|
158169
|
-
session = {
|
|
158170
|
-
completedAreas: /* @__PURE__ */ new Set(),
|
|
158171
|
-
lastCurrentArea: null,
|
|
158172
|
-
activeAreas: [],
|
|
158173
|
-
loggedShortCircuits: /* @__PURE__ */ new Set(),
|
|
158174
|
-
observedCleaning: false,
|
|
158175
|
-
pendingDispatches: [],
|
|
158176
|
-
cleanedAreaBaseline: null
|
|
158177
|
-
};
|
|
158178
|
-
cleaningSessions.set(endpoint, session);
|
|
158179
|
-
}
|
|
158180
|
-
return session;
|
|
158181
|
-
}
|
|
158182
|
-
var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
158183
|
-
async initialize() {
|
|
158184
|
-
await super.initialize();
|
|
158185
|
-
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
158186
|
-
this.update(homeAssistant.entity);
|
|
158187
|
-
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
158188
|
-
}
|
|
158189
|
-
update(entity) {
|
|
158190
|
-
if (!entity.state || !entity.state.attributes) {
|
|
158191
|
-
return;
|
|
158192
|
-
}
|
|
158193
|
-
const s = getSession(this.endpoint);
|
|
158194
|
-
const previousMode = this.state.currentMode;
|
|
158195
|
-
const newMode = this.state.config.getCurrentMode(entity.state, this.agent);
|
|
158196
|
-
applyPatchState(
|
|
158197
|
-
this.state,
|
|
158198
|
-
{
|
|
158199
|
-
currentMode: newMode,
|
|
158200
|
-
supportedModes: this.state.config.getSupportedModes(
|
|
158201
|
-
entity.state,
|
|
158202
|
-
this.agent
|
|
158203
|
-
)
|
|
158204
|
-
},
|
|
158205
|
-
{ force: true }
|
|
158206
|
-
);
|
|
158207
|
-
if (newMode === 1 /* Cleaning */) {
|
|
158208
|
-
s.observedCleaning = true;
|
|
158209
|
-
}
|
|
158210
|
-
if (previousMode !== newMode) {
|
|
158211
|
-
if (newMode === 0 /* Idle */) {
|
|
158212
|
-
if (s.lastCurrentArea !== null) {
|
|
158213
|
-
s.completedAreas.add(s.lastCurrentArea);
|
|
158214
|
-
s.lastCurrentArea = null;
|
|
158215
|
-
}
|
|
158216
|
-
if (s.pendingDispatches.length > 0 && s.observedCleaning) {
|
|
158217
|
-
try {
|
|
158218
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158219
|
-
const prev = serviceArea.state.currentArea;
|
|
158220
|
-
if (typeof prev === "number") {
|
|
158221
|
-
s.completedAreas.add(prev);
|
|
158222
|
-
}
|
|
158223
|
-
const next = s.pendingDispatches.shift();
|
|
158224
|
-
if (next) {
|
|
158225
|
-
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
158226
|
-
homeAssistant.callAction(next.action);
|
|
158227
|
-
this.trySetCurrentArea(next.areaId);
|
|
158228
|
-
}
|
|
158229
|
-
} catch {
|
|
158230
|
-
}
|
|
158231
|
-
s.loggedShortCircuits.clear();
|
|
158232
|
-
return;
|
|
158233
|
-
}
|
|
158234
|
-
if (s.observedCleaning) {
|
|
158235
|
-
try {
|
|
158236
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158237
|
-
const last = serviceArea.state.currentArea;
|
|
158238
|
-
if (typeof last === "number") {
|
|
158239
|
-
s.completedAreas.add(last);
|
|
158240
|
-
serviceArea.state.currentArea = null;
|
|
158241
|
-
}
|
|
158242
|
-
this.updateProgressFromTracking(serviceArea);
|
|
158243
|
-
} catch {
|
|
158244
|
-
}
|
|
158245
|
-
s.observedCleaning = false;
|
|
158246
|
-
}
|
|
158247
|
-
s.loggedShortCircuits.clear();
|
|
158248
|
-
} else if (newMode === 1 /* Cleaning */) {
|
|
158249
|
-
if (s.activeAreas.length > 0 && s.lastCurrentArea === null) {
|
|
158250
|
-
const firstPending = s.activeAreas.find(
|
|
158251
|
-
(id) => !s.completedAreas.has(id)
|
|
158252
|
-
);
|
|
158253
|
-
if (firstPending !== void 0) {
|
|
158254
|
-
this.trySetCurrentArea(firstPending);
|
|
158255
|
-
}
|
|
158256
|
-
}
|
|
158257
|
-
}
|
|
158258
|
-
}
|
|
158259
|
-
if (newMode === 0 /* Idle */ && s.activeAreas.length === 0) {
|
|
158260
|
-
try {
|
|
158261
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158262
|
-
if (serviceArea.state.currentArea !== null) {
|
|
158263
|
-
serviceArea.state.currentArea = null;
|
|
158264
|
-
}
|
|
158265
|
-
} catch {
|
|
158266
|
-
}
|
|
158267
|
-
}
|
|
158268
|
-
if (newMode === 1 /* Cleaning */) {
|
|
158269
|
-
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
158270
|
-
if (mapping?.currentRoomEntity) {
|
|
158271
|
-
this.updateCurrentRoomFromSensor();
|
|
158272
|
-
} else if (mapping?.cleanedAreaEntity) {
|
|
158273
|
-
this.updateCurrentRoomFromCleanedArea();
|
|
158274
|
-
}
|
|
158275
|
-
}
|
|
158276
|
-
}
|
|
158277
|
-
/**
|
|
158278
|
-
* Emit a diagnostic INFO log exactly once per cleaning session for a
|
|
158279
|
-
* given short-circuit reason. Prevents log flooding while still
|
|
158280
|
-
* surfacing the silent paths that would otherwise be invisible.
|
|
158281
|
-
*/
|
|
158282
|
-
logShortCircuitOnce(reason, message) {
|
|
158283
|
-
const s = getSession(this.endpoint);
|
|
158284
|
-
if (s.loggedShortCircuits.has(reason)) return;
|
|
158285
|
-
s.loggedShortCircuits.add(reason);
|
|
158286
|
-
logger217.info(message);
|
|
158287
|
-
}
|
|
158288
|
-
/**
|
|
158289
|
-
* Read the currentRoomEntity sensor and update currentArea + progress
|
|
158290
|
-
* to reflect which room the vacuum is actually in right now.
|
|
158291
|
-
*/
|
|
158292
|
-
updateCurrentRoomFromSensor() {
|
|
158293
|
-
try {
|
|
158294
|
-
const s = getSession(this.endpoint);
|
|
158295
|
-
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
158296
|
-
const currentRoomEntityId = homeAssistant.state.mapping?.currentRoomEntity;
|
|
158297
|
-
if (!currentRoomEntityId) {
|
|
158298
|
-
this.logShortCircuitOnce(
|
|
158299
|
-
"no-mapping",
|
|
158300
|
-
"currentRoom sensor: no currentRoomEntity in mapping, auto-detect did not run or sensor not on same HA device"
|
|
158301
|
-
);
|
|
158302
|
-
return;
|
|
158303
|
-
}
|
|
158304
|
-
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
158305
|
-
const roomState = stateProvider.getState(currentRoomEntityId);
|
|
158306
|
-
if (!roomState || !roomState.state) {
|
|
158307
|
-
this.logShortCircuitOnce(
|
|
158308
|
-
"no-state",
|
|
158309
|
-
`currentRoom sensor: no state available for ${currentRoomEntityId}`
|
|
158310
|
-
);
|
|
158311
|
-
return;
|
|
158312
|
-
}
|
|
158313
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158314
|
-
const externalSession = s.activeAreas.length === 0;
|
|
158315
|
-
const supportedAreaIds = serviceArea.state.supportedAreas.map(
|
|
158316
|
-
(a) => a.areaId
|
|
158317
|
-
);
|
|
158318
|
-
const isAllowedArea = (id) => externalSession ? supportedAreaIds.includes(id) : s.activeAreas.includes(id);
|
|
158319
|
-
const sensorAttrs = roomState.attributes;
|
|
158320
|
-
const segmentId = sensorAttrs.segment_id ?? sensorAttrs.room_id;
|
|
158321
|
-
const roomName = roomState.state;
|
|
158322
|
-
let matchedAreaId = null;
|
|
158323
|
-
if (segmentId != null && isAllowedArea(segmentId)) {
|
|
158324
|
-
matchedAreaId = segmentId;
|
|
158325
|
-
}
|
|
158326
|
-
if (matchedAreaId === null && segmentId != null) {
|
|
158327
|
-
for (const area of serviceArea.state.supportedAreas) {
|
|
158328
|
-
if (isAllowedArea(area.areaId) && area.areaId % 1e4 === segmentId) {
|
|
158329
|
-
matchedAreaId = area.areaId;
|
|
158330
|
-
break;
|
|
158331
|
-
}
|
|
158332
|
-
}
|
|
158333
|
-
}
|
|
158334
|
-
if (matchedAreaId === null && roomName) {
|
|
158335
|
-
const area = serviceArea.state.supportedAreas.find(
|
|
158336
|
-
(a) => a.areaInfo.locationInfo?.locationName?.toLowerCase() === roomName.toLowerCase()
|
|
158337
|
-
);
|
|
158338
|
-
if (area && isAllowedArea(area.areaId)) {
|
|
158339
|
-
matchedAreaId = area.areaId;
|
|
158340
|
-
}
|
|
158341
|
-
}
|
|
158342
|
-
if (matchedAreaId === null) {
|
|
158343
|
-
logger217.info(
|
|
158344
|
-
`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(", ")}]`
|
|
158345
|
-
);
|
|
158346
|
-
return;
|
|
158347
|
-
}
|
|
158348
|
-
if (matchedAreaId === s.lastCurrentArea) return;
|
|
158349
|
-
if (s.lastCurrentArea !== null) {
|
|
158350
|
-
s.completedAreas.add(s.lastCurrentArea);
|
|
158351
|
-
}
|
|
158352
|
-
s.lastCurrentArea = matchedAreaId;
|
|
158353
|
-
logger217.info(
|
|
158354
|
-
`currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
|
|
158355
|
-
);
|
|
158356
|
-
this.trySetCurrentArea(matchedAreaId);
|
|
158357
|
-
} catch (e) {
|
|
158358
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
158359
|
-
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
158360
|
-
logger217.warn(`currentRoom sensor update failed: ${msg}`);
|
|
158361
|
-
}
|
|
158362
|
-
}
|
|
158363
|
-
}
|
|
158364
|
-
/** Read the cumulative cleaned-area sensor (m2), or null if not configured. */
|
|
158365
|
-
readCleanedAreaSqm() {
|
|
158366
|
-
try {
|
|
158367
|
-
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
158368
|
-
const entityId = mapping?.cleanedAreaEntity;
|
|
158369
|
-
if (!entityId) {
|
|
158370
|
-
return null;
|
|
158371
|
-
}
|
|
158372
|
-
return this.agent.env.get(EntityStateProvider).getNumericState(entityId);
|
|
158373
|
-
} catch {
|
|
158374
|
-
return null;
|
|
158375
|
-
}
|
|
158376
|
-
}
|
|
158377
|
-
/**
|
|
158378
|
-
* For batch vacuums that report cumulative cleaned area but not the current
|
|
158379
|
-
* room, infer currentArea + progress from the cleaned area and the per-room
|
|
158380
|
-
* sizeSqm. Display-only and batch-only; skipped unless every selected area
|
|
158381
|
-
* has a size. The currentRoom sensor path takes priority (#368).
|
|
158382
|
-
*/
|
|
158383
|
-
updateCurrentRoomFromCleanedArea() {
|
|
158384
|
-
try {
|
|
158385
|
-
const s = getSession(this.endpoint);
|
|
158386
|
-
if (s.pendingDispatches.length > 0 || s.activeAreas.length === 0) {
|
|
158387
|
-
return;
|
|
158388
|
-
}
|
|
158389
|
-
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
158390
|
-
const entityId = mapping?.cleanedAreaEntity;
|
|
158391
|
-
if (!entityId) {
|
|
158392
|
-
return;
|
|
158393
|
-
}
|
|
158394
|
-
const raw = this.agent.env.get(EntityStateProvider).getNumericState(entityId);
|
|
158395
|
-
if (raw == null) {
|
|
158396
|
-
this.logShortCircuitOnce(
|
|
158397
|
-
"no-cleaned-area-state",
|
|
158398
|
-
`cleanedArea sensor: no numeric state for ${entityId}`
|
|
158399
|
-
);
|
|
158400
|
-
return;
|
|
158401
|
-
}
|
|
158402
|
-
const customAreas = mapping?.customServiceAreas;
|
|
158403
|
-
const ordered = [];
|
|
158404
|
-
for (const areaId of [...s.activeAreas].sort((a, b) => a - b)) {
|
|
158405
|
-
const size = customAreas?.[areaId - 1]?.sizeSqm;
|
|
158406
|
-
if (typeof size !== "number" || !Number.isFinite(size) || size <= 0) {
|
|
158407
|
-
this.logShortCircuitOnce(
|
|
158408
|
-
"no-sizes",
|
|
158409
|
-
"cleanedArea sensor: not every selected area has a sizeSqm"
|
|
158410
|
-
);
|
|
158411
|
-
return;
|
|
158412
|
-
}
|
|
158413
|
-
ordered.push({ areaId, sizeSqm: size });
|
|
158414
|
-
}
|
|
158415
|
-
if (s.cleanedAreaBaseline == null || raw < s.cleanedAreaBaseline) {
|
|
158416
|
-
s.cleanedAreaBaseline = raw;
|
|
158417
|
-
}
|
|
158418
|
-
const cleaned = Math.max(0, raw - s.cleanedAreaBaseline);
|
|
158419
|
-
const { currentArea, completed } = inferCleanedAreaProgress(
|
|
158420
|
-
cleaned,
|
|
158421
|
-
ordered
|
|
158422
|
-
);
|
|
158423
|
-
logger217.debug(
|
|
158424
|
-
`cleanedArea: raw=${raw} baseline=${s.cleanedAreaBaseline} cleaned=${cleaned} sizes=[${ordered.map((o) => `${o.areaId}:${o.sizeSqm}`).join(",")}] -> current=${currentArea} completed=[${completed.join(",")}]`
|
|
158425
|
-
);
|
|
158426
|
-
for (const id of completed) {
|
|
158427
|
-
s.completedAreas.add(id);
|
|
158428
|
-
}
|
|
158429
|
-
if (currentArea === s.lastCurrentArea) {
|
|
158430
|
-
return;
|
|
158431
|
-
}
|
|
158432
|
-
s.lastCurrentArea = currentArea;
|
|
158433
|
-
this.trySetCurrentArea(currentArea);
|
|
158434
|
-
} catch (e) {
|
|
158435
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
158436
|
-
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
158437
|
-
logger217.warn(`cleanedArea room update failed: ${msg}`);
|
|
158438
|
-
}
|
|
158439
|
-
}
|
|
158440
|
-
}
|
|
158441
|
-
/**
|
|
158442
|
-
* Safely update ServiceArea.currentArea and progress.
|
|
158443
|
-
* When areaId is set, marks it as Operating in progress.
|
|
158444
|
-
* When areaId is null (Idle), marks all Operating/Pending as Completed.
|
|
158445
|
-
* No-op if ServiceArea is not available on this endpoint.
|
|
158446
|
-
*/
|
|
158447
|
-
trySetCurrentArea(areaId) {
|
|
158448
|
-
try {
|
|
158449
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158450
|
-
if (serviceArea.state.currentArea !== areaId) {
|
|
158451
|
-
serviceArea.state.currentArea = areaId;
|
|
158452
|
-
logger217.debug(`currentArea set to ${areaId}`);
|
|
158453
|
-
}
|
|
158454
|
-
this.updateProgress(serviceArea, areaId);
|
|
158455
|
-
} catch {
|
|
158456
|
-
}
|
|
158457
|
-
}
|
|
158458
|
-
/**
|
|
158459
|
-
* Update progress entries to reflect the current operating area.
|
|
158460
|
-
* - null: mark all areas as Completed (cleaning done)
|
|
158461
|
-
* - areaId: mark that area as Operating, others as Pending
|
|
158462
|
-
*
|
|
158463
|
-
* Uses the activeAreas snapshot (plain number array) instead of
|
|
158464
|
-
* managed state entries, which avoids infinite recursion in
|
|
158465
|
-
* matter.js property getters during transaction pre-commit.
|
|
158466
|
-
*/
|
|
158467
|
-
updateProgress(serviceArea, areaId) {
|
|
158468
|
-
const s = getSession(this.endpoint);
|
|
158469
|
-
if (s.activeAreas.length === 0) return;
|
|
158470
|
-
const state = serviceArea.state;
|
|
158471
|
-
if (areaId === null) {
|
|
158472
|
-
state.progress = s.activeAreas.map((id) => ({
|
|
158473
|
-
areaId: id,
|
|
158474
|
-
status: ServiceArea3.OperationalStatus.Completed
|
|
158475
|
-
}));
|
|
158476
|
-
} else {
|
|
158477
|
-
state.progress = s.activeAreas.map((id) => ({
|
|
158478
|
-
areaId: id,
|
|
158479
|
-
status: id === areaId ? ServiceArea3.OperationalStatus.Operating : s.completedAreas.has(id) ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Pending
|
|
158480
|
-
}));
|
|
158481
|
-
}
|
|
158482
|
-
}
|
|
158483
|
-
/**
|
|
158484
|
-
* Update progress entries from tracking state without any area
|
|
158485
|
-
* operating. Used on mid-session transitions (e.g. vacuum-then-mop
|
|
158486
|
-
* tool swap) where the vacuum is temporarily idle but the session
|
|
158487
|
-
* is not finished: completed areas stay Completed, remaining areas
|
|
158488
|
-
* stay Pending.
|
|
158489
|
-
*/
|
|
158490
|
-
updateProgressFromTracking(serviceArea) {
|
|
158491
|
-
const s = getSession(this.endpoint);
|
|
158492
|
-
if (s.activeAreas.length === 0) return;
|
|
158493
|
-
const state = serviceArea.state;
|
|
158494
|
-
state.progress = s.activeAreas.map((id) => ({
|
|
158495
|
-
areaId: id,
|
|
158496
|
-
status: s.completedAreas.has(id) ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Pending
|
|
158497
|
-
}));
|
|
158498
|
-
}
|
|
158499
|
-
/**
|
|
158500
|
-
* Stop before finishing: mark the areas the vacuum actually reached as
|
|
158501
|
-
* Completed and the rest as Skipped (an out-of-band stop per the Matter
|
|
158502
|
-
* ServiceArea spec), then clear currentArea. The old path marked every
|
|
158503
|
-
* area Completed, which told Apple Home rooms were cleaned when they were
|
|
158504
|
-
* not, so they got dropped from the next selection (#367).
|
|
158505
|
-
*/
|
|
158506
|
-
finalizeProgressOnStop() {
|
|
158507
|
-
const s = getSession(this.endpoint);
|
|
158508
|
-
try {
|
|
158509
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158510
|
-
if (s.activeAreas.length > 0) {
|
|
158511
|
-
const last = serviceArea.state.currentArea;
|
|
158512
|
-
const state = serviceArea.state;
|
|
158513
|
-
state.progress = s.activeAreas.map((id) => ({
|
|
158514
|
-
areaId: id,
|
|
158515
|
-
status: s.completedAreas.has(id) || id === last ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Skipped
|
|
158516
|
-
}));
|
|
158517
|
-
}
|
|
158518
|
-
serviceArea.state.currentArea = null;
|
|
158519
|
-
} catch {
|
|
158520
|
-
}
|
|
158521
|
-
}
|
|
158522
|
-
/**
|
|
158523
|
-
* Find the ServiceArea area ID that corresponds to a run mode value
|
|
158524
|
-
* by matching the mode label to the area location name.
|
|
158525
|
-
*/
|
|
158526
|
-
findAreaIdForMode(mode) {
|
|
158527
|
-
try {
|
|
158528
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158529
|
-
const modeEntry = this.state.supportedModes.find((m) => m.mode === mode);
|
|
158530
|
-
if (!modeEntry) return null;
|
|
158531
|
-
const area = serviceArea.state.supportedAreas.find(
|
|
158532
|
-
(a) => a.areaInfo.locationInfo?.locationName === modeEntry.label
|
|
158533
|
-
);
|
|
158534
|
-
return area?.areaId ?? null;
|
|
158535
|
-
} catch {
|
|
158536
|
-
return null;
|
|
158537
|
-
}
|
|
158538
|
-
}
|
|
158539
|
-
changeToMode(request) {
|
|
158540
|
-
const s = getSession(this.endpoint);
|
|
158541
|
-
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
158542
|
-
const { newMode } = request;
|
|
158543
|
-
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
158544
|
-
return {
|
|
158545
|
-
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
158546
|
-
statusText: `Unsupported mode: ${newMode}`
|
|
158547
|
-
};
|
|
158548
|
-
}
|
|
158549
|
-
if (isRoomMode(newMode)) {
|
|
158550
|
-
try {
|
|
158551
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158552
|
-
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
158553
|
-
s.activeAreas = [...serviceArea.state.selectedAreas];
|
|
158554
|
-
s.completedAreas.clear();
|
|
158555
|
-
s.lastCurrentArea = null;
|
|
158556
|
-
s.loggedShortCircuits.clear();
|
|
158557
|
-
s.pendingDispatches = [];
|
|
158558
|
-
s.cleanedAreaBaseline = this.readCleanedAreaSqm();
|
|
158559
|
-
this.trySetCurrentArea(s.activeAreas[0]);
|
|
158560
|
-
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
158561
|
-
this.state.currentMode = newMode;
|
|
158562
|
-
return {
|
|
158563
|
-
status: ModeBase3.ModeChangeStatus.Success,
|
|
158564
|
-
statusText: "Starting room cleaning"
|
|
158565
|
-
};
|
|
158566
|
-
}
|
|
158567
|
-
} catch {
|
|
158568
|
-
}
|
|
158569
|
-
if (this.state.config.cleanRoom) {
|
|
158570
|
-
const areaId = this.findAreaIdForMode(newMode);
|
|
158571
|
-
s.activeAreas = areaId !== null ? [areaId] : [];
|
|
158572
|
-
s.completedAreas.clear();
|
|
158573
|
-
s.lastCurrentArea = null;
|
|
158574
|
-
s.loggedShortCircuits.clear();
|
|
158575
|
-
s.pendingDispatches = [];
|
|
158576
|
-
this.trySetCurrentArea(areaId);
|
|
158577
|
-
homeAssistant.callAction(
|
|
158578
|
-
this.state.config.cleanRoom(newMode, this.agent)
|
|
158579
|
-
);
|
|
158580
|
-
this.state.currentMode = newMode;
|
|
158581
|
-
return {
|
|
158582
|
-
status: ModeBase3.ModeChangeStatus.Success,
|
|
158583
|
-
statusText: "Starting room cleaning"
|
|
158584
|
-
};
|
|
158585
|
-
}
|
|
158586
|
-
}
|
|
158587
|
-
switch (newMode) {
|
|
158588
|
-
case 1 /* Cleaning */: {
|
|
158589
|
-
try {
|
|
158590
|
-
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
158591
|
-
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
158592
|
-
s.activeAreas = [...serviceArea.state.selectedAreas];
|
|
158593
|
-
s.completedAreas.clear();
|
|
158594
|
-
s.lastCurrentArea = null;
|
|
158595
|
-
s.loggedShortCircuits.clear();
|
|
158596
|
-
s.pendingDispatches = [];
|
|
158597
|
-
s.cleanedAreaBaseline = this.readCleanedAreaSqm();
|
|
158598
|
-
this.trySetCurrentArea(s.activeAreas[0]);
|
|
158599
|
-
}
|
|
158600
|
-
} catch {
|
|
158601
|
-
}
|
|
158602
|
-
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
158603
|
-
break;
|
|
158604
|
-
}
|
|
158605
|
-
case 0 /* Idle */:
|
|
158606
|
-
this.finalizeProgressOnStop();
|
|
158607
|
-
s.completedAreas.clear();
|
|
158608
|
-
s.lastCurrentArea = null;
|
|
158609
|
-
s.activeAreas = [];
|
|
158610
|
-
s.loggedShortCircuits.clear();
|
|
158611
|
-
s.pendingDispatches = [];
|
|
158612
|
-
s.observedCleaning = false;
|
|
158613
|
-
s.cleanedAreaBaseline = null;
|
|
158614
|
-
homeAssistant.callAction(
|
|
158615
|
-
this.state.config.returnToBase(void 0, this.agent)
|
|
158616
|
-
);
|
|
158617
|
-
break;
|
|
158618
|
-
default:
|
|
158619
|
-
homeAssistant.callAction(this.state.config.pause(void 0, this.agent));
|
|
158620
|
-
break;
|
|
158621
|
-
}
|
|
158622
|
-
this.state.currentMode = newMode;
|
|
158623
|
-
return {
|
|
158624
|
-
status: ModeBase3.ModeChangeStatus.Success,
|
|
158625
|
-
statusText: "Mode switched"
|
|
158626
|
-
};
|
|
158627
|
-
}
|
|
158628
|
-
};
|
|
158629
|
-
((RvcRunModeServerBase2) => {
|
|
158630
|
-
class State extends RvcRunModeServer.State {
|
|
158631
|
-
config;
|
|
158632
|
-
}
|
|
158633
|
-
RvcRunModeServerBase2.State = State;
|
|
158634
|
-
})(RvcRunModeServerBase || (RvcRunModeServerBase = {}));
|
|
158635
|
-
function RvcRunModeServer2(config11, initialState) {
|
|
158636
|
-
const defaultModes = [
|
|
158637
|
-
{
|
|
158638
|
-
label: "Idle",
|
|
158639
|
-
mode: 0 /* Idle */,
|
|
158640
|
-
modeTags: [{ value: RvcRunMode3.ModeTag.Idle }]
|
|
158641
|
-
},
|
|
158642
|
-
{
|
|
158643
|
-
label: "Cleaning",
|
|
158644
|
-
mode: 1 /* Cleaning */,
|
|
158645
|
-
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
158646
|
-
}
|
|
158647
|
-
];
|
|
158648
|
-
return RvcRunModeServerBase.set({
|
|
158649
|
-
config: config11,
|
|
158650
|
-
supportedModes: initialState?.supportedModes ?? defaultModes,
|
|
158651
|
-
currentMode: initialState?.currentMode ?? 0 /* Idle */
|
|
158652
|
-
});
|
|
158653
|
-
}
|
|
158654
|
-
|
|
158655
158915
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
158656
158916
|
init_dist();
|
|
158657
158917
|
init_esm();
|
|
@@ -158828,14 +159088,14 @@ init_esm();
|
|
|
158828
159088
|
|
|
158829
159089
|
// src/matter/behaviors/service-area-server.ts
|
|
158830
159090
|
init_esm();
|
|
158831
|
-
var
|
|
159091
|
+
var logger220 = Logger.get("ServiceAreaServer");
|
|
158832
159092
|
var ServiceAreaWithProgress = ServiceAreaBehavior.with(
|
|
158833
159093
|
ServiceArea3.Feature.ProgressReporting
|
|
158834
159094
|
);
|
|
158835
159095
|
var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
158836
159096
|
selectAreas(request) {
|
|
158837
159097
|
const { newAreas } = request;
|
|
158838
|
-
|
|
159098
|
+
logger220.info(
|
|
158839
159099
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
158840
159100
|
);
|
|
158841
159101
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -158844,7 +159104,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
158844
159104
|
(id) => !supportedAreaIds.includes(id)
|
|
158845
159105
|
);
|
|
158846
159106
|
if (invalidAreas.length > 0) {
|
|
158847
|
-
|
|
159107
|
+
logger220.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
158848
159108
|
return {
|
|
158849
159109
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
158850
159110
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -158856,7 +159116,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
158856
159116
|
status: ServiceArea3.OperationalStatus.Pending
|
|
158857
159117
|
}));
|
|
158858
159118
|
this.state.currentArea = null;
|
|
158859
|
-
|
|
159119
|
+
logger220.info(
|
|
158860
159120
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
158861
159121
|
);
|
|
158862
159122
|
return {
|
|
@@ -158877,7 +159137,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
158877
159137
|
ServiceAreaServerBase2.State = State;
|
|
158878
159138
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
158879
159139
|
function ServiceAreaServer2(initialState) {
|
|
158880
|
-
|
|
159140
|
+
logger220.info(
|
|
158881
159141
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
158882
159142
|
);
|
|
158883
159143
|
return ServiceAreaServerBase.set({
|
|
@@ -158894,7 +159154,7 @@ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
|
|
|
158894
159154
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
|
|
158895
159155
|
selectAreas(request) {
|
|
158896
159156
|
const { newAreas } = request;
|
|
158897
|
-
|
|
159157
|
+
logger220.info(
|
|
158898
159158
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
158899
159159
|
);
|
|
158900
159160
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -158903,7 +159163,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158903
159163
|
(id) => !supportedAreaIds.includes(id)
|
|
158904
159164
|
);
|
|
158905
159165
|
if (invalidAreas.length > 0) {
|
|
158906
|
-
|
|
159166
|
+
logger220.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
158907
159167
|
return {
|
|
158908
159168
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
158909
159169
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -158915,7 +159175,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158915
159175
|
status: ServiceArea3.OperationalStatus.Pending
|
|
158916
159176
|
}));
|
|
158917
159177
|
this.state.currentArea = null;
|
|
158918
|
-
|
|
159178
|
+
logger220.info(
|
|
158919
159179
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
158920
159180
|
);
|
|
158921
159181
|
return {
|
|
@@ -158936,14 +159196,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158936
159196
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
158937
159197
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
158938
159198
|
function ServiceAreaServerWithMaps(initialState) {
|
|
158939
|
-
|
|
159199
|
+
logger220.info(
|
|
158940
159200
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
158941
159201
|
);
|
|
158942
159202
|
for (const map of initialState.supportedMaps) {
|
|
158943
159203
|
const areaCount = initialState.supportedAreas.filter(
|
|
158944
159204
|
(a) => a.mapId === map.mapId
|
|
158945
159205
|
).length;
|
|
158946
|
-
|
|
159206
|
+
logger220.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
158947
159207
|
}
|
|
158948
159208
|
return ServiceAreaServerWithMapsBase.set({
|
|
158949
159209
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -158955,7 +159215,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
158955
159215
|
}
|
|
158956
159216
|
|
|
158957
159217
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
158958
|
-
var
|
|
159218
|
+
var logger221 = Logger.get("VacuumServiceAreaServer");
|
|
158959
159219
|
function toAreaId(roomId) {
|
|
158960
159220
|
if (typeof roomId === "number") {
|
|
158961
159221
|
return roomId;
|
|
@@ -159034,13 +159294,13 @@ function createVacuumServiceAreaServer(attributes8, roomEntities, includeUnnamed
|
|
|
159034
159294
|
let rooms;
|
|
159035
159295
|
if (roomEntities && roomEntities.length > 0) {
|
|
159036
159296
|
rooms = buttonEntitiesToRooms(roomEntities, attributes8);
|
|
159037
|
-
|
|
159297
|
+
logger221.info(
|
|
159038
159298
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
159039
159299
|
);
|
|
159040
159300
|
} else {
|
|
159041
159301
|
rooms = parseVacuumRooms(attributes8, includeUnnamedRooms);
|
|
159042
159302
|
if (rooms.length > 0) {
|
|
159043
|
-
|
|
159303
|
+
logger221.info(
|
|
159044
159304
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
159045
159305
|
);
|
|
159046
159306
|
}
|
|
@@ -159094,7 +159354,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
159094
159354
|
landmarkInfo: null
|
|
159095
159355
|
}
|
|
159096
159356
|
}));
|
|
159097
|
-
|
|
159357
|
+
logger221.info(
|
|
159098
159358
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
159099
159359
|
);
|
|
159100
159360
|
return ServiceAreaServer2({
|
|
@@ -159116,7 +159376,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
159116
159376
|
landmarkInfo: null
|
|
159117
159377
|
}
|
|
159118
159378
|
}));
|
|
159119
|
-
|
|
159379
|
+
logger221.info(
|
|
159120
159380
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
|
|
159121
159381
|
);
|
|
159122
159382
|
return ServiceAreaServer2({
|
|
@@ -159127,11 +159387,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
159127
159387
|
}
|
|
159128
159388
|
|
|
159129
159389
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
159130
|
-
var
|
|
159390
|
+
var logger222 = Logger.get("VacuumRvcRunModeServer");
|
|
159131
159391
|
function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
|
|
159132
159392
|
const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
159133
159393
|
const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
|
|
159134
|
-
|
|
159394
|
+
logger222.info(
|
|
159135
159395
|
`Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
|
|
159136
159396
|
);
|
|
159137
159397
|
return {
|
|
@@ -159236,14 +159496,14 @@ function mergeBatchData(areas) {
|
|
|
159236
159496
|
function handleCustomServiceAreas(selectedAreas, customAreas, session) {
|
|
159237
159497
|
const matched = selectedAreas.map((areaId) => ({ areaId, area: customAreas[areaId - 1] })).filter((m) => !!m.area);
|
|
159238
159498
|
if (matched.length === 0) {
|
|
159239
|
-
|
|
159499
|
+
logger222.warn(
|
|
159240
159500
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
159241
159501
|
);
|
|
159242
159502
|
return { action: "vacuum.start" };
|
|
159243
159503
|
}
|
|
159244
159504
|
const batchArea = matched.find(({ area }) => area.batchDispatch === true);
|
|
159245
159505
|
if (batchArea) {
|
|
159246
|
-
|
|
159506
|
+
logger222.info(
|
|
159247
159507
|
`Custom service areas (batch): single call for ${matched.length} room(s): ${matched.map(({ area }) => area.name).join(", ")}`
|
|
159248
159508
|
);
|
|
159249
159509
|
session.pendingDispatches = [];
|
|
@@ -159264,7 +159524,7 @@ function handleCustomServiceAreas(selectedAreas, customAreas, session) {
|
|
|
159264
159524
|
}
|
|
159265
159525
|
};
|
|
159266
159526
|
}
|
|
159267
|
-
|
|
159527
|
+
logger222.info(
|
|
159268
159528
|
`Custom service areas: ${matched.length} room(s) queued: ${matched.map(({ area }) => `${area.service} (${area.name})`).join(", ")}`
|
|
159269
159529
|
);
|
|
159270
159530
|
session.pendingDispatches = matched.slice(1).map(({ areaId, area }) => ({
|
|
@@ -159300,7 +159560,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159300
159560
|
VacuumState.paused
|
|
159301
159561
|
];
|
|
159302
159562
|
const isCleaning = cleaningStates.includes(state);
|
|
159303
|
-
|
|
159563
|
+
logger222.debug(
|
|
159304
159564
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
159305
159565
|
);
|
|
159306
159566
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -159334,7 +159594,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159334
159594
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
159335
159595
|
const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
|
|
159336
159596
|
if (haAreaIds.length > 0) {
|
|
159337
|
-
|
|
159597
|
+
logger222.info(
|
|
159338
159598
|
`CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
|
|
159339
159599
|
);
|
|
159340
159600
|
return {
|
|
@@ -159353,7 +159613,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159353
159613
|
}
|
|
159354
159614
|
}
|
|
159355
159615
|
if (matched.length > 0) {
|
|
159356
|
-
|
|
159616
|
+
logger222.info(
|
|
159357
159617
|
`Roborock: ${matched.length} room button(s) queued: ${matched.map((m) => m.entityId).join(", ")}`
|
|
159358
159618
|
);
|
|
159359
159619
|
session.pendingDispatches = matched.slice(1).map(({ areaId, entityId }) => ({
|
|
@@ -159387,14 +159647,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
159387
159647
|
}
|
|
159388
159648
|
}
|
|
159389
159649
|
if (roomIds.length > 0) {
|
|
159390
|
-
|
|
159650
|
+
logger222.info(
|
|
159391
159651
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
159392
159652
|
);
|
|
159393
159653
|
if (isDreameVacuum(attributes8)) {
|
|
159394
159654
|
if (targetMapName) {
|
|
159395
159655
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
159396
159656
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
159397
|
-
|
|
159657
|
+
logger222.info(
|
|
159398
159658
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
159399
159659
|
);
|
|
159400
159660
|
homeAssistant.callAction({
|
|
@@ -159421,7 +159681,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159421
159681
|
}
|
|
159422
159682
|
if (isEcovacsVacuum(attributes8)) {
|
|
159423
159683
|
const roomIdStr = roomIds.join(",");
|
|
159424
|
-
|
|
159684
|
+
logger222.info(
|
|
159425
159685
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
159426
159686
|
);
|
|
159427
159687
|
return {
|
|
@@ -159436,14 +159696,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
159436
159696
|
}
|
|
159437
159697
|
};
|
|
159438
159698
|
}
|
|
159439
|
-
|
|
159699
|
+
logger222.warn(
|
|
159440
159700
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
159441
159701
|
);
|
|
159442
159702
|
}
|
|
159443
159703
|
}
|
|
159444
159704
|
} catch {
|
|
159445
159705
|
}
|
|
159446
|
-
|
|
159706
|
+
logger222.info("Starting regular cleaning (no areas selected)");
|
|
159447
159707
|
return { action: "vacuum.start" };
|
|
159448
159708
|
},
|
|
159449
159709
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -159458,7 +159718,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159458
159718
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
159459
159719
|
const entity = homeAssistant.entity;
|
|
159460
159720
|
const attributes8 = entity.state.attributes;
|
|
159461
|
-
|
|
159721
|
+
logger222.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
159462
159722
|
const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
|
|
159463
159723
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
159464
159724
|
const sorted = [...cleanAreaRooms].sort(
|
|
@@ -159467,7 +159727,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159467
159727
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
159468
159728
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
159469
159729
|
const area = sorted[areaIndex];
|
|
159470
|
-
|
|
159730
|
+
logger222.info(
|
|
159471
159731
|
`cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
|
|
159472
159732
|
);
|
|
159473
159733
|
return {
|
|
@@ -159484,7 +159744,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159484
159744
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
159485
159745
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
159486
159746
|
const area = sorted[areaIndex];
|
|
159487
|
-
|
|
159747
|
+
logger222.info(
|
|
159488
159748
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
159489
159749
|
);
|
|
159490
159750
|
return {
|
|
@@ -159505,7 +159765,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159505
159765
|
}
|
|
159506
159766
|
const rooms = parseVacuumRooms(attributes8);
|
|
159507
159767
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
159508
|
-
|
|
159768
|
+
logger222.info(
|
|
159509
159769
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
159510
159770
|
);
|
|
159511
159771
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -159515,7 +159775,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159515
159775
|
if (room.mapName) {
|
|
159516
159776
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
159517
159777
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
159518
|
-
|
|
159778
|
+
logger222.info(
|
|
159519
159779
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
159520
159780
|
);
|
|
159521
159781
|
homeAssistant.callAction({
|
|
@@ -159524,7 +159784,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159524
159784
|
data: { option: room.mapName }
|
|
159525
159785
|
});
|
|
159526
159786
|
}
|
|
159527
|
-
|
|
159787
|
+
logger222.debug(
|
|
159528
159788
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
159529
159789
|
);
|
|
159530
159790
|
return {
|
|
@@ -159535,7 +159795,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159535
159795
|
};
|
|
159536
159796
|
}
|
|
159537
159797
|
if (isRoborockVacuum(attributes8) || isXiaomiMiotVacuum(attributes8)) {
|
|
159538
|
-
|
|
159798
|
+
logger222.debug(
|
|
159539
159799
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
159540
159800
|
);
|
|
159541
159801
|
return {
|
|
@@ -159548,7 +159808,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159548
159808
|
}
|
|
159549
159809
|
if (isEcovacsVacuum(attributes8)) {
|
|
159550
159810
|
const roomIdStr = String(commandId3);
|
|
159551
|
-
|
|
159811
|
+
logger222.info(
|
|
159552
159812
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
159553
159813
|
);
|
|
159554
159814
|
return {
|
|
@@ -159563,7 +159823,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159563
159823
|
}
|
|
159564
159824
|
};
|
|
159565
159825
|
}
|
|
159566
|
-
|
|
159826
|
+
logger222.warn(
|
|
159567
159827
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
159568
159828
|
);
|
|
159569
159829
|
}
|
|
@@ -159574,31 +159834,31 @@ function createVacuumRvcRunModeServer(attributes8, includeUnnamedRooms = false,
|
|
|
159574
159834
|
const allRooms = parseVacuumRooms(attributes8, true);
|
|
159575
159835
|
const rooms = includeUnnamedRooms ? allRooms : parseVacuumRooms(attributes8, false);
|
|
159576
159836
|
const filteredCount = allRooms.length - rooms.length;
|
|
159577
|
-
const
|
|
159837
|
+
const supportedModes2 = buildSupportedModes2(
|
|
159578
159838
|
attributes8,
|
|
159579
159839
|
includeUnnamedRooms,
|
|
159580
159840
|
customAreas,
|
|
159581
159841
|
disableRoomModes
|
|
159582
159842
|
);
|
|
159583
|
-
|
|
159584
|
-
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${
|
|
159843
|
+
logger222.info(
|
|
159844
|
+
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes2.length} total modes`
|
|
159585
159845
|
);
|
|
159586
159846
|
if (rooms.length > 0) {
|
|
159587
|
-
|
|
159847
|
+
logger222.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
159588
159848
|
}
|
|
159589
159849
|
if (filteredCount > 0) {
|
|
159590
159850
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
159591
|
-
|
|
159851
|
+
logger222.info(
|
|
159592
159852
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
159593
159853
|
);
|
|
159594
159854
|
}
|
|
159595
159855
|
if (allRooms.length === 0) {
|
|
159596
|
-
|
|
159856
|
+
logger222.debug(
|
|
159597
159857
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes8.rooms)}, segments=${JSON.stringify(attributes8.segments)}, room_list=${attributes8.room_list}`
|
|
159598
159858
|
);
|
|
159599
159859
|
}
|
|
159600
159860
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
159601
|
-
supportedModes,
|
|
159861
|
+
supportedModes: supportedModes2,
|
|
159602
159862
|
currentMode: 0 /* Idle */
|
|
159603
159863
|
});
|
|
159604
159864
|
}
|
|
@@ -159627,7 +159887,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
|
|
|
159627
159887
|
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
159628
159888
|
});
|
|
159629
159889
|
}
|
|
159630
|
-
|
|
159890
|
+
logger222.info(
|
|
159631
159891
|
`Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
|
|
159632
159892
|
);
|
|
159633
159893
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
@@ -159687,7 +159947,7 @@ init_nodejs();
|
|
|
159687
159947
|
|
|
159688
159948
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
159689
159949
|
init_home_assistant_entity_behavior();
|
|
159690
|
-
var
|
|
159950
|
+
var logger223 = Logger.get("RvcCleanModeServerBase");
|
|
159691
159951
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
159692
159952
|
// Pending mode from a recent changeToMode command.
|
|
159693
159953
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -159734,14 +159994,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
159734
159994
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
159735
159995
|
const { newMode } = request;
|
|
159736
159996
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
159737
|
-
|
|
159997
|
+
logger223.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
159738
159998
|
return {
|
|
159739
159999
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
159740
160000
|
statusText: `Unsupported mode: ${newMode}`
|
|
159741
160001
|
};
|
|
159742
160002
|
}
|
|
159743
160003
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
159744
|
-
|
|
160004
|
+
logger223.info(
|
|
159745
160005
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
159746
160006
|
);
|
|
159747
160007
|
this.pendingMode = newMode;
|
|
@@ -159749,7 +160009,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
159749
160009
|
this.state.currentMode = newMode;
|
|
159750
160010
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
159751
160011
|
if (action) {
|
|
159752
|
-
|
|
160012
|
+
logger223.info(
|
|
159753
160013
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
159754
160014
|
);
|
|
159755
160015
|
homeAssistant.callAction(action);
|
|
@@ -159782,7 +160042,7 @@ function RvcCleanModeServer2(config11, initialState) {
|
|
|
159782
160042
|
}
|
|
159783
160043
|
|
|
159784
160044
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
159785
|
-
var
|
|
160045
|
+
var logger224 = Logger.get("VacuumRvcCleanModeServer");
|
|
159786
160046
|
var MODE_VACUUM = 0;
|
|
159787
160047
|
var MODE_VACUUM_AND_MOP = 1;
|
|
159788
160048
|
var MODE_MOP = 2;
|
|
@@ -160052,7 +160312,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
160052
160312
|
const match = availableOptions.find((o) => classifyCleanOption(o) === type);
|
|
160053
160313
|
if (match) return match;
|
|
160054
160314
|
}
|
|
160055
|
-
|
|
160315
|
+
logger224.warn(
|
|
160056
160316
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
160057
160317
|
);
|
|
160058
160318
|
return availableOptions[0];
|
|
@@ -160061,7 +160321,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
160061
160321
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
160062
160322
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
160063
160323
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
160064
|
-
|
|
160324
|
+
logger224.info(
|
|
160065
160325
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
160066
160326
|
);
|
|
160067
160327
|
return {
|
|
@@ -160150,7 +160410,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160150
160410
|
}
|
|
160151
160411
|
}
|
|
160152
160412
|
if (speedMode !== void 0) {
|
|
160153
|
-
|
|
160413
|
+
logger224.debug(
|
|
160154
160414
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
160155
160415
|
);
|
|
160156
160416
|
return speedMode;
|
|
@@ -160171,7 +160431,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160171
160431
|
}
|
|
160172
160432
|
}
|
|
160173
160433
|
if (mopMode !== void 0) {
|
|
160174
|
-
|
|
160434
|
+
logger224.debug(
|
|
160175
160435
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
160176
160436
|
);
|
|
160177
160437
|
return mopMode;
|
|
@@ -160189,14 +160449,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160189
160449
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
160190
160450
|
const vacuumEntityId = homeAssistant.entityId;
|
|
160191
160451
|
const mapping = homeAssistant.state.mapping;
|
|
160192
|
-
|
|
160452
|
+
logger224.info(
|
|
160193
160453
|
`setCleanMode(${mode}) for ${vacuumEntityId}, suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})}`
|
|
160194
160454
|
);
|
|
160195
160455
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
160196
160456
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
160197
160457
|
const mopName = mopIntensityList[mopIndex];
|
|
160198
160458
|
if (!mopName) {
|
|
160199
|
-
|
|
160459
|
+
logger224.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
160200
160460
|
return void 0;
|
|
160201
160461
|
}
|
|
160202
160462
|
if (hasCleanTypes) {
|
|
@@ -160209,18 +160469,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160209
160469
|
mapping.mopIntensityEntity,
|
|
160210
160470
|
agent
|
|
160211
160471
|
);
|
|
160212
|
-
|
|
160472
|
+
logger224.info(
|
|
160213
160473
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
160214
160474
|
);
|
|
160215
160475
|
let option = matchMopIntensityOption(mopName, options);
|
|
160216
160476
|
if (!option && options && mopIndex < options.length) {
|
|
160217
160477
|
option = options[mopIndex];
|
|
160218
|
-
|
|
160478
|
+
logger224.info(
|
|
160219
160479
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
160220
160480
|
);
|
|
160221
160481
|
}
|
|
160222
160482
|
if (option) {
|
|
160223
|
-
|
|
160483
|
+
logger224.info(
|
|
160224
160484
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
160225
160485
|
);
|
|
160226
160486
|
return {
|
|
@@ -160229,11 +160489,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160229
160489
|
target: mapping.mopIntensityEntity
|
|
160230
160490
|
};
|
|
160231
160491
|
}
|
|
160232
|
-
|
|
160492
|
+
logger224.warn(
|
|
160233
160493
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
160234
160494
|
);
|
|
160235
160495
|
} else {
|
|
160236
|
-
|
|
160496
|
+
logger224.warn(
|
|
160237
160497
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
160238
160498
|
);
|
|
160239
160499
|
}
|
|
@@ -160243,7 +160503,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160243
160503
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
160244
160504
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
160245
160505
|
if (!fanSpeedName) {
|
|
160246
|
-
|
|
160506
|
+
logger224.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
160247
160507
|
return void 0;
|
|
160248
160508
|
}
|
|
160249
160509
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -160256,7 +160516,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160256
160516
|
mapping.suctionLevelEntity,
|
|
160257
160517
|
agent
|
|
160258
160518
|
);
|
|
160259
|
-
|
|
160519
|
+
logger224.info(
|
|
160260
160520
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
160261
160521
|
);
|
|
160262
160522
|
let option = matchFanSpeedOption(
|
|
@@ -160266,12 +160526,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160266
160526
|
);
|
|
160267
160527
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
160268
160528
|
option = options[fanSpeedIndex];
|
|
160269
|
-
|
|
160529
|
+
logger224.info(
|
|
160270
160530
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
160271
160531
|
);
|
|
160272
160532
|
}
|
|
160273
160533
|
if (option) {
|
|
160274
|
-
|
|
160534
|
+
logger224.info(
|
|
160275
160535
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
160276
160536
|
);
|
|
160277
160537
|
return {
|
|
@@ -160280,7 +160540,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160280
160540
|
target: mapping.suctionLevelEntity
|
|
160281
160541
|
};
|
|
160282
160542
|
}
|
|
160283
|
-
|
|
160543
|
+
logger224.warn(
|
|
160284
160544
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
160285
160545
|
);
|
|
160286
160546
|
return void 0;
|
|
@@ -160290,7 +160550,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160290
160550
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
160291
160551
|
);
|
|
160292
160552
|
}
|
|
160293
|
-
|
|
160553
|
+
logger224.info(
|
|
160294
160554
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
160295
160555
|
);
|
|
160296
160556
|
return {
|
|
@@ -160300,7 +160560,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160300
160560
|
};
|
|
160301
160561
|
}
|
|
160302
160562
|
if (!hasCleanTypes) {
|
|
160303
|
-
|
|
160563
|
+
logger224.debug(
|
|
160304
160564
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
160305
160565
|
);
|
|
160306
160566
|
return void 0;
|
|
@@ -160312,7 +160572,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160312
160572
|
agent
|
|
160313
160573
|
);
|
|
160314
160574
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
160315
|
-
|
|
160575
|
+
logger224.info(
|
|
160316
160576
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
160317
160577
|
);
|
|
160318
160578
|
return {
|
|
@@ -160324,20 +160584,20 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160324
160584
|
};
|
|
160325
160585
|
}
|
|
160326
160586
|
function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityList, cleaningModeOptions, customFanSpeedTags) {
|
|
160327
|
-
const
|
|
160587
|
+
const supportedModes2 = buildSupportedModes3(
|
|
160328
160588
|
fanSpeedList,
|
|
160329
160589
|
mopIntensityList,
|
|
160330
160590
|
cleaningModeOptions,
|
|
160331
160591
|
customFanSpeedTags
|
|
160332
160592
|
);
|
|
160333
|
-
|
|
160334
|
-
`Creating VacuumRvcCleanModeServer with ${
|
|
160593
|
+
logger224.info(
|
|
160594
|
+
`Creating VacuumRvcCleanModeServer with ${supportedModes2.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
160335
160595
|
);
|
|
160336
|
-
|
|
160337
|
-
`Modes: ${
|
|
160596
|
+
logger224.info(
|
|
160597
|
+
`Modes: ${supportedModes2.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
160338
160598
|
);
|
|
160339
160599
|
const initialState = {
|
|
160340
|
-
supportedModes,
|
|
160600
|
+
supportedModes: supportedModes2,
|
|
160341
160601
|
currentMode: MODE_VACUUM
|
|
160342
160602
|
};
|
|
160343
160603
|
return RvcCleanModeServer2(
|
|
@@ -160396,141 +160656,7 @@ function resolveMopIntensityList(mopIntensityEntity) {
|
|
|
160396
160656
|
init_dist();
|
|
160397
160657
|
init_esm();
|
|
160398
160658
|
init_home_assistant_entity_behavior();
|
|
160399
|
-
|
|
160400
|
-
// src/matter/behaviors/rvc-operational-state-server.ts
|
|
160401
|
-
init_esm();
|
|
160402
|
-
|
|
160403
|
-
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/behaviors/rvc-operational-state.js
|
|
160404
|
-
init_nodejs();
|
|
160405
|
-
|
|
160406
|
-
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/rvc-operational-state.js
|
|
160407
|
-
init_nodejs();
|
|
160408
|
-
|
|
160409
|
-
// src/matter/behaviors/rvc-operational-state-server.ts
|
|
160410
|
-
init_home_assistant_entity_behavior();
|
|
160411
|
-
var OperationalState4 = RvcOperationalState4.OperationalState;
|
|
160412
|
-
var ErrorState = RvcOperationalState4.ErrorState;
|
|
160413
|
-
var logger223 = Logger.get("RvcOperationalStateServer");
|
|
160414
|
-
var activeStates = /* @__PURE__ */ new Set([
|
|
160415
|
-
OperationalState4.Running,
|
|
160416
|
-
OperationalState4.SeekingCharger
|
|
160417
|
-
]);
|
|
160418
|
-
var advertisedOperationalStates = [
|
|
160419
|
-
OperationalState4.Stopped,
|
|
160420
|
-
OperationalState4.Running,
|
|
160421
|
-
OperationalState4.Paused,
|
|
160422
|
-
OperationalState4.Error,
|
|
160423
|
-
OperationalState4.SeekingCharger,
|
|
160424
|
-
OperationalState4.Charging,
|
|
160425
|
-
OperationalState4.Docked
|
|
160426
|
-
];
|
|
160427
|
-
function makeRvcOperationalError(errorStateId) {
|
|
160428
|
-
if (errorStateId === ErrorState.NoError) {
|
|
160429
|
-
return { errorStateId };
|
|
160430
|
-
}
|
|
160431
|
-
return { errorStateId, errorStateDetails: ErrorState[errorStateId] };
|
|
160432
|
-
}
|
|
160433
|
-
var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
160434
|
-
async initialize() {
|
|
160435
|
-
this.state.operationalStateList = advertisedOperationalStates.map((id) => ({
|
|
160436
|
-
operationalStateId: id
|
|
160437
|
-
}));
|
|
160438
|
-
this.state.operationalState = OperationalState4.Stopped;
|
|
160439
|
-
this.state.operationalError = { errorStateId: ErrorState.NoError };
|
|
160440
|
-
await super.initialize();
|
|
160441
|
-
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
160442
|
-
this.update(homeAssistant.entity);
|
|
160443
|
-
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
160444
|
-
}
|
|
160445
|
-
update(entity) {
|
|
160446
|
-
if (!entity.state || !entity.state.attributes) {
|
|
160447
|
-
return;
|
|
160448
|
-
}
|
|
160449
|
-
const newState = this.state.config.getOperationalState(
|
|
160450
|
-
entity.state,
|
|
160451
|
-
this.agent
|
|
160452
|
-
);
|
|
160453
|
-
const previousState = this.state.operationalState;
|
|
160454
|
-
const errorStateId = newState === OperationalState4.Error ? ErrorState.Stuck : ErrorState.NoError;
|
|
160455
|
-
const operationalError = makeRvcOperationalError(errorStateId);
|
|
160456
|
-
applyPatchState(
|
|
160457
|
-
this.state,
|
|
160458
|
-
{
|
|
160459
|
-
operationalState: newState,
|
|
160460
|
-
operationalError
|
|
160461
|
-
},
|
|
160462
|
-
{ force: true }
|
|
160463
|
-
);
|
|
160464
|
-
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
160465
|
-
logger223.info(
|
|
160466
|
-
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
160467
|
-
);
|
|
160468
|
-
try {
|
|
160469
|
-
this.events.operationCompletion?.emit(
|
|
160470
|
-
{
|
|
160471
|
-
completionErrorCode: newState === OperationalState4.Error ? ErrorState.Stuck : ErrorState.NoError,
|
|
160472
|
-
totalOperationalTime: null,
|
|
160473
|
-
pausedTime: null
|
|
160474
|
-
},
|
|
160475
|
-
this.context
|
|
160476
|
-
);
|
|
160477
|
-
} catch (e) {
|
|
160478
|
-
logger223.debug("Failed to emit operationCompletion event:", e);
|
|
160479
|
-
}
|
|
160480
|
-
}
|
|
160481
|
-
}
|
|
160482
|
-
pause() {
|
|
160483
|
-
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
160484
|
-
homeAssistant.callAction(this.state.config.pause(void 0, this.agent));
|
|
160485
|
-
return {
|
|
160486
|
-
commandResponseState: {
|
|
160487
|
-
errorStateId: ErrorState.NoError
|
|
160488
|
-
}
|
|
160489
|
-
};
|
|
160490
|
-
}
|
|
160491
|
-
resume() {
|
|
160492
|
-
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
160493
|
-
homeAssistant.callAction(this.state.config.resume(void 0, this.agent));
|
|
160494
|
-
return {
|
|
160495
|
-
commandResponseState: {
|
|
160496
|
-
errorStateId: ErrorState.NoError
|
|
160497
|
-
}
|
|
160498
|
-
};
|
|
160499
|
-
}
|
|
160500
|
-
goHome() {
|
|
160501
|
-
if (this.state.operationalState === OperationalState4.Docked || this.state.operationalState === OperationalState4.Charging) {
|
|
160502
|
-
return {
|
|
160503
|
-
commandResponseState: {
|
|
160504
|
-
errorStateId: ErrorState.NoError
|
|
160505
|
-
}
|
|
160506
|
-
};
|
|
160507
|
-
}
|
|
160508
|
-
const goHomeAction = this.state.config.goHome;
|
|
160509
|
-
if (goHomeAction) {
|
|
160510
|
-
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
160511
|
-
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
160512
|
-
} else {
|
|
160513
|
-
logger223.warn("GoHome command received but no goHome action configured");
|
|
160514
|
-
}
|
|
160515
|
-
return {
|
|
160516
|
-
commandResponseState: {
|
|
160517
|
-
errorStateId: ErrorState.NoError
|
|
160518
|
-
}
|
|
160519
|
-
};
|
|
160520
|
-
}
|
|
160521
|
-
};
|
|
160522
|
-
((RvcOperationalStateServerBase2) => {
|
|
160523
|
-
class State extends RvcOperationalStateServer.State {
|
|
160524
|
-
config;
|
|
160525
|
-
}
|
|
160526
|
-
RvcOperationalStateServerBase2.State = State;
|
|
160527
|
-
})(RvcOperationalStateServerBase || (RvcOperationalStateServerBase = {}));
|
|
160528
|
-
function RvcOperationalStateServer2(config11) {
|
|
160529
|
-
return RvcOperationalStateServerBase.set({ config: config11 });
|
|
160530
|
-
}
|
|
160531
|
-
|
|
160532
|
-
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
|
|
160533
|
-
var logger224 = Logger.get("VacuumRvcOperationalStateServer");
|
|
160659
|
+
var logger225 = Logger.get("VacuumRvcOperationalStateServer");
|
|
160534
160660
|
function isCharging(entity) {
|
|
160535
160661
|
const attrs = entity.attributes;
|
|
160536
160662
|
if (attrs.is_charging === true || attrs.charging === true) return true;
|
|
@@ -160575,16 +160701,16 @@ function mapVacuumOperationalState(entity) {
|
|
|
160575
160701
|
operationalState = RvcOperationalState4.OperationalState.Error;
|
|
160576
160702
|
} else {
|
|
160577
160703
|
if (state.toLowerCase().includes("clean")) {
|
|
160578
|
-
|
|
160704
|
+
logger225.info(
|
|
160579
160705
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
160580
160706
|
);
|
|
160581
160707
|
operationalState = RvcOperationalState4.OperationalState.Running;
|
|
160582
160708
|
} else {
|
|
160583
|
-
|
|
160709
|
+
logger225.info(`Unknown vacuum state "${state}", treating as Stopped`);
|
|
160584
160710
|
operationalState = RvcOperationalState4.OperationalState.Stopped;
|
|
160585
160711
|
}
|
|
160586
160712
|
}
|
|
160587
|
-
|
|
160713
|
+
logger225.debug(
|
|
160588
160714
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState4.OperationalState[operationalState]}`
|
|
160589
160715
|
);
|
|
160590
160716
|
return operationalState;
|
|
@@ -160609,7 +160735,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
160609
160735
|
});
|
|
160610
160736
|
|
|
160611
160737
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
160612
|
-
var
|
|
160738
|
+
var logger226 = Logger.get("VacuumDevice");
|
|
160613
160739
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
160614
160740
|
BasicInformationServer2,
|
|
160615
160741
|
VacuumIdentifyServer,
|
|
@@ -160623,7 +160749,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
160623
160749
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
160624
160750
|
const attributes8 = homeAssistantEntity.entity.state.attributes;
|
|
160625
160751
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
160626
|
-
|
|
160752
|
+
logger226.info(
|
|
160627
160753
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
160628
160754
|
);
|
|
160629
160755
|
const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
|
|
@@ -160636,32 +160762,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
160636
160762
|
)
|
|
160637
160763
|
).set({ homeAssistantEntity });
|
|
160638
160764
|
if (includeOnOff) {
|
|
160639
|
-
|
|
160765
|
+
logger226.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
160640
160766
|
device = device.with(VacuumOnOffServer);
|
|
160641
160767
|
}
|
|
160642
160768
|
device = device.with(VacuumPowerSourceServer);
|
|
160643
160769
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
160644
160770
|
const rooms = parseVacuumRooms(attributes8);
|
|
160645
|
-
|
|
160771
|
+
logger226.info(
|
|
160646
160772
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
|
|
160647
160773
|
);
|
|
160648
160774
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
160649
|
-
|
|
160775
|
+
logger226.info(
|
|
160650
160776
|
`${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
|
|
160651
160777
|
);
|
|
160652
160778
|
device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
|
|
160653
160779
|
} else if (customAreas && customAreas.length > 0) {
|
|
160654
|
-
|
|
160780
|
+
logger226.info(
|
|
160655
160781
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
160656
160782
|
);
|
|
160657
160783
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
160658
160784
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
160659
|
-
|
|
160785
|
+
logger226.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
160660
160786
|
device = device.with(
|
|
160661
160787
|
createVacuumServiceAreaServer(attributes8, roomEntities)
|
|
160662
160788
|
);
|
|
160663
160789
|
} else {
|
|
160664
|
-
|
|
160790
|
+
logger226.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
160665
160791
|
device = device.with(createDefaultServiceAreaServer());
|
|
160666
160792
|
}
|
|
160667
160793
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -160672,7 +160798,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
160672
160798
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
160673
160799
|
);
|
|
160674
160800
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
160675
|
-
|
|
160801
|
+
logger226.info(
|
|
160676
160802
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
160677
160803
|
);
|
|
160678
160804
|
device = device.with(
|
|
@@ -160685,7 +160811,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
160685
160811
|
)
|
|
160686
160812
|
);
|
|
160687
160813
|
} else {
|
|
160688
|
-
|
|
160814
|
+
logger226.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
160689
160815
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
160690
160816
|
}
|
|
160691
160817
|
return device;
|
|
@@ -160851,7 +160977,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
160851
160977
|
);
|
|
160852
160978
|
|
|
160853
160979
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
160854
|
-
var
|
|
160980
|
+
var logger227 = Logger.get("WaterHeaterDevice");
|
|
160855
160981
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
160856
160982
|
BasicInformationServer2,
|
|
160857
160983
|
IdentifyServer2,
|
|
@@ -160867,7 +160993,7 @@ function toMatterTemp2(value) {
|
|
|
160867
160993
|
}
|
|
160868
160994
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
160869
160995
|
const attributes8 = homeAssistantEntity.entity.state.attributes;
|
|
160870
|
-
|
|
160996
|
+
logger227.debug(
|
|
160871
160997
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes8.min_temp}, max_temp=${attributes8.max_temp}`
|
|
160872
160998
|
);
|
|
160873
160999
|
const minLimit = toMatterTemp2(attributes8.min_temp) ?? 0;
|
|
@@ -161015,6 +161141,7 @@ var deviceCtrs = {
|
|
|
161015
161141
|
siren: SirenDevice,
|
|
161016
161142
|
media_player: MediaPlayerDevice,
|
|
161017
161143
|
humidifier: HumidifierDevice,
|
|
161144
|
+
lawn_mower: LawnMowerDevice,
|
|
161018
161145
|
vacuum: VacuumDevice,
|
|
161019
161146
|
valve: ValveDevice,
|
|
161020
161147
|
alarm_control_panel: AlarmControlPanelDevice,
|
|
@@ -161044,6 +161171,7 @@ var matterDeviceTypeFactories = {
|
|
|
161044
161171
|
fan: FanDevice2,
|
|
161045
161172
|
air_purifier: AirPurifierEndpoint,
|
|
161046
161173
|
robot_vacuum_cleaner: (ha) => VacuumDevice(ha),
|
|
161174
|
+
robotic_lawn_mower: (ha) => LawnMowerDevice(ha),
|
|
161047
161175
|
humidifier_dehumidifier: HumidifierDevice,
|
|
161048
161176
|
speaker: SpeakerMediaPlayerDevice,
|
|
161049
161177
|
basic_video_player: VideoPlayerDevice,
|
|
@@ -161077,7 +161205,7 @@ var matterDeviceTypeFactories = {
|
|
|
161077
161205
|
};
|
|
161078
161206
|
|
|
161079
161207
|
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
161080
|
-
var
|
|
161208
|
+
var logger228 = Logger.get("UserComposedEndpoint");
|
|
161081
161209
|
function stripBasicInformation(type) {
|
|
161082
161210
|
const behaviors = { ...type.behaviors };
|
|
161083
161211
|
delete behaviors.bridgedDeviceBasicInformation;
|
|
@@ -161133,7 +161261,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161133
161261
|
{ vacuumOnOff: registry2.isVacuumOnOffEnabled() }
|
|
161134
161262
|
);
|
|
161135
161263
|
if (!primaryType) {
|
|
161136
|
-
|
|
161264
|
+
logger228.warn(
|
|
161137
161265
|
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
161138
161266
|
);
|
|
161139
161267
|
return void 0;
|
|
@@ -161148,7 +161276,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161148
161276
|
if (!sub.entityId) continue;
|
|
161149
161277
|
const subPayload = buildEntityPayload4(registry2, sub.entityId);
|
|
161150
161278
|
if (!subPayload) {
|
|
161151
|
-
|
|
161279
|
+
logger228.warn(
|
|
161152
161280
|
`Cannot find entity state for composed sub-entity ${sub.entityId}`
|
|
161153
161281
|
);
|
|
161154
161282
|
continue;
|
|
@@ -161159,7 +161287,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161159
161287
|
};
|
|
161160
161288
|
const subType = createLegacyEndpointType(subPayload, subMapping);
|
|
161161
161289
|
if (!subType) {
|
|
161162
|
-
|
|
161290
|
+
logger228.warn(
|
|
161163
161291
|
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
161164
161292
|
);
|
|
161165
161293
|
continue;
|
|
@@ -161172,7 +161300,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161172
161300
|
mappedIds.push(sub.entityId);
|
|
161173
161301
|
}
|
|
161174
161302
|
if (parts.length < 2) {
|
|
161175
|
-
|
|
161303
|
+
logger228.warn(
|
|
161176
161304
|
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
161177
161305
|
);
|
|
161178
161306
|
return void 0;
|
|
@@ -161195,7 +161323,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161195
161323
|
const labels = parts.map(
|
|
161196
161324
|
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
161197
161325
|
).join("+");
|
|
161198
|
-
|
|
161326
|
+
logger228.info(
|
|
161199
161327
|
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
161200
161328
|
);
|
|
161201
161329
|
return endpoint;
|
|
@@ -161283,7 +161411,7 @@ function asStandaloneEndpointType(type) {
|
|
|
161283
161411
|
}
|
|
161284
161412
|
|
|
161285
161413
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
161286
|
-
var
|
|
161414
|
+
var logger229 = Logger.get("LegacyEndpoint");
|
|
161287
161415
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
161288
161416
|
static async create(registry2, entityId, mapping, pluginDomainMappings, standalone = false) {
|
|
161289
161417
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -161293,25 +161421,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161293
161421
|
return;
|
|
161294
161422
|
}
|
|
161295
161423
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
161296
|
-
|
|
161424
|
+
logger229.debug(
|
|
161297
161425
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
161298
161426
|
);
|
|
161299
161427
|
return;
|
|
161300
161428
|
}
|
|
161301
161429
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
161302
|
-
|
|
161430
|
+
logger229.debug(
|
|
161303
161431
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
161304
161432
|
);
|
|
161305
161433
|
return;
|
|
161306
161434
|
}
|
|
161307
161435
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
161308
|
-
|
|
161436
|
+
logger229.debug(
|
|
161309
161437
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
161310
161438
|
);
|
|
161311
161439
|
return;
|
|
161312
161440
|
}
|
|
161313
161441
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
161314
|
-
|
|
161442
|
+
logger229.debug(
|
|
161315
161443
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
161316
161444
|
);
|
|
161317
161445
|
return;
|
|
@@ -161331,7 +161459,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161331
161459
|
humidityEntity: humidityEntityId
|
|
161332
161460
|
};
|
|
161333
161461
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
161334
|
-
|
|
161462
|
+
logger229.debug(
|
|
161335
161463
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
161336
161464
|
);
|
|
161337
161465
|
}
|
|
@@ -161350,7 +161478,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161350
161478
|
pressureEntity: pressureEntityId
|
|
161351
161479
|
};
|
|
161352
161480
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
161353
|
-
|
|
161481
|
+
logger229.debug(
|
|
161354
161482
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
161355
161483
|
);
|
|
161356
161484
|
}
|
|
@@ -161368,7 +161496,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161368
161496
|
batteryEntity: batteryEntityId
|
|
161369
161497
|
};
|
|
161370
161498
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
161371
|
-
|
|
161499
|
+
logger229.debug(
|
|
161372
161500
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
161373
161501
|
);
|
|
161374
161502
|
}
|
|
@@ -161386,7 +161514,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161386
161514
|
powerEntity: powerEntityId
|
|
161387
161515
|
};
|
|
161388
161516
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
161389
|
-
|
|
161517
|
+
logger229.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
161390
161518
|
}
|
|
161391
161519
|
}
|
|
161392
161520
|
}
|
|
@@ -161403,7 +161531,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161403
161531
|
energyEntity: energyEntityId
|
|
161404
161532
|
};
|
|
161405
161533
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
161406
|
-
|
|
161534
|
+
logger229.debug(
|
|
161407
161535
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
161408
161536
|
);
|
|
161409
161537
|
}
|
|
@@ -161419,7 +161547,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161419
161547
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161420
161548
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
161421
161549
|
};
|
|
161422
|
-
|
|
161550
|
+
logger229.info(
|
|
161423
161551
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
161424
161552
|
);
|
|
161425
161553
|
}
|
|
@@ -161429,7 +161557,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161429
161557
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161430
161558
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
161431
161559
|
};
|
|
161432
|
-
|
|
161560
|
+
logger229.info(
|
|
161433
161561
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
161434
161562
|
);
|
|
161435
161563
|
}
|
|
@@ -161439,7 +161567,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161439
161567
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161440
161568
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
161441
161569
|
};
|
|
161442
|
-
|
|
161570
|
+
logger229.info(
|
|
161443
161571
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
161444
161572
|
);
|
|
161445
161573
|
}
|
|
@@ -161449,7 +161577,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161449
161577
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161450
161578
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
161451
161579
|
};
|
|
161452
|
-
|
|
161580
|
+
logger229.info(
|
|
161453
161581
|
`Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
|
|
161454
161582
|
);
|
|
161455
161583
|
}
|
|
@@ -161464,7 +161592,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161464
161592
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161465
161593
|
cleanAreaRooms
|
|
161466
161594
|
};
|
|
161467
|
-
|
|
161595
|
+
logger229.info(
|
|
161468
161596
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
161469
161597
|
);
|
|
161470
161598
|
}
|
|
@@ -161485,7 +161613,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161485
161613
|
rooms: roomsObj
|
|
161486
161614
|
}
|
|
161487
161615
|
};
|
|
161488
|
-
|
|
161616
|
+
logger229.debug(
|
|
161489
161617
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
161490
161618
|
);
|
|
161491
161619
|
} else {
|
|
@@ -161502,7 +161630,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161502
161630
|
rooms: roomsObj
|
|
161503
161631
|
}
|
|
161504
161632
|
};
|
|
161505
|
-
|
|
161633
|
+
logger229.debug(
|
|
161506
161634
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
161507
161635
|
);
|
|
161508
161636
|
}
|
|
@@ -161511,7 +161639,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161511
161639
|
}
|
|
161512
161640
|
}
|
|
161513
161641
|
if (standalone && ((effectiveMapping?.composedEntities?.length ?? 0) > 0 || effectiveMapping?.climateExposeFan === true)) {
|
|
161514
|
-
|
|
161642
|
+
logger229.warn(
|
|
161515
161643
|
`Composed mappings are not supported in server mode, exposing ${entityId} as a flat standalone endpoint`
|
|
161516
161644
|
);
|
|
161517
161645
|
}
|
|
@@ -161528,7 +161656,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161528
161656
|
if (composed) {
|
|
161529
161657
|
return composed;
|
|
161530
161658
|
}
|
|
161531
|
-
|
|
161659
|
+
logger229.warn(
|
|
161532
161660
|
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
161533
161661
|
);
|
|
161534
161662
|
}
|
|
@@ -161587,7 +161715,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161587
161715
|
if (composed) {
|
|
161588
161716
|
return composed;
|
|
161589
161717
|
}
|
|
161590
|
-
|
|
161718
|
+
logger229.warn(
|
|
161591
161719
|
`Companion fan creation failed for ${entityId}, falling back to standalone`
|
|
161592
161720
|
);
|
|
161593
161721
|
}
|
|
@@ -161654,11 +161782,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161654
161782
|
}
|
|
161655
161783
|
if (mappedChanged) {
|
|
161656
161784
|
this.pendingMappedChange = true;
|
|
161657
|
-
|
|
161785
|
+
logger229.debug(
|
|
161658
161786
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
161659
161787
|
);
|
|
161660
161788
|
}
|
|
161661
|
-
|
|
161789
|
+
logger229.debug(
|
|
161662
161790
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
161663
161791
|
);
|
|
161664
161792
|
this.lastState = state;
|
|
@@ -161711,7 +161839,7 @@ import {
|
|
|
161711
161839
|
getCollection
|
|
161712
161840
|
} from "home-assistant-js-websocket";
|
|
161713
161841
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
161714
|
-
var
|
|
161842
|
+
var logger230 = Logger.get("SubscribeEntities");
|
|
161715
161843
|
function processEvent(store, updates) {
|
|
161716
161844
|
const state = { ...store.state };
|
|
161717
161845
|
if (updates.a) {
|
|
@@ -161737,7 +161865,7 @@ function processEvent(store, updates) {
|
|
|
161737
161865
|
for (const entityId in updates.c) {
|
|
161738
161866
|
let entityState = state[entityId];
|
|
161739
161867
|
if (!entityState) {
|
|
161740
|
-
|
|
161868
|
+
logger230.warn("Received state update for unknown entity", entityId);
|
|
161741
161869
|
continue;
|
|
161742
161870
|
}
|
|
161743
161871
|
entityState = { ...entityState };
|
|
@@ -161826,7 +161954,7 @@ var subscribeEntities = (conn, onChange, entityIds) => {
|
|
|
161826
161954
|
// src/services/bridges/entity-isolation-service.ts
|
|
161827
161955
|
init_esm();
|
|
161828
161956
|
init_diagnostic_event_bus();
|
|
161829
|
-
var
|
|
161957
|
+
var logger231 = Logger.get("EntityIsolation");
|
|
161830
161958
|
var EntityIsolationServiceImpl = class {
|
|
161831
161959
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
161832
161960
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -161891,13 +162019,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
161891
162019
|
}
|
|
161892
162020
|
const parsed = this.parseEndpointPath(msg);
|
|
161893
162021
|
if (!parsed) {
|
|
161894
|
-
|
|
162022
|
+
logger231.warn("Could not parse entity from error:", msg);
|
|
161895
162023
|
return false;
|
|
161896
162024
|
}
|
|
161897
162025
|
const { bridgeId, entityName } = parsed;
|
|
161898
162026
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
161899
162027
|
if (!callback) {
|
|
161900
|
-
|
|
162028
|
+
logger231.warn(
|
|
161901
162029
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
161902
162030
|
);
|
|
161903
162031
|
return false;
|
|
@@ -161908,7 +162036,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
161908
162036
|
}
|
|
161909
162037
|
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
161910
162038
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
161911
|
-
|
|
162039
|
+
logger231.warn(
|
|
161912
162040
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
161913
162041
|
);
|
|
161914
162042
|
diagnosticEventBus.emit("entity_error", `Entity isolated: ${entityName}`, {
|
|
@@ -161920,7 +162048,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
161920
162048
|
await callback(entityName);
|
|
161921
162049
|
return true;
|
|
161922
162050
|
} catch (e) {
|
|
161923
|
-
|
|
162051
|
+
logger231.error(`Failed to isolate entity ${entityName}:`, e);
|
|
161924
162052
|
return false;
|
|
161925
162053
|
}
|
|
161926
162054
|
}
|
|
@@ -163264,11 +163392,11 @@ function makeWarmStartState(state, now = (/* @__PURE__ */ new Date()).toISOStrin
|
|
|
163264
163392
|
return { ...state, last_updated: now };
|
|
163265
163393
|
}
|
|
163266
163394
|
var ServerModeBridge = class {
|
|
163267
|
-
constructor(
|
|
163395
|
+
constructor(logger234, dataProvider, endpointManager, server) {
|
|
163268
163396
|
this.dataProvider = dataProvider;
|
|
163269
163397
|
this.endpointManager = endpointManager;
|
|
163270
163398
|
this.server = server;
|
|
163271
|
-
this.log =
|
|
163399
|
+
this.log = logger234.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
163272
163400
|
}
|
|
163273
163401
|
dataProvider;
|
|
163274
163402
|
endpointManager;
|
|
@@ -163902,7 +164030,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
163902
164030
|
}
|
|
163903
164031
|
|
|
163904
164032
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
163905
|
-
var
|
|
164033
|
+
var logger232 = Logger.get("ServerModeVacuumEndpoint");
|
|
163906
164034
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
163907
164035
|
static async create(registry2, entityId, mapping) {
|
|
163908
164036
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -163912,7 +164040,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163912
164040
|
return void 0;
|
|
163913
164041
|
}
|
|
163914
164042
|
let effectiveMapping = mapping;
|
|
163915
|
-
|
|
164043
|
+
logger232.info(
|
|
163916
164044
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
163917
164045
|
);
|
|
163918
164046
|
if (entity.device_id) {
|
|
@@ -163927,15 +164055,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163927
164055
|
batteryEntity: batteryEntityId
|
|
163928
164056
|
};
|
|
163929
164057
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
163930
|
-
|
|
164058
|
+
logger232.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
163931
164059
|
} else {
|
|
163932
164060
|
const attrs = state.attributes;
|
|
163933
164061
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
163934
|
-
|
|
164062
|
+
logger232.info(
|
|
163935
164063
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
163936
164064
|
);
|
|
163937
164065
|
} else {
|
|
163938
|
-
|
|
164066
|
+
logger232.warn(
|
|
163939
164067
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
163940
164068
|
);
|
|
163941
164069
|
}
|
|
@@ -163950,7 +164078,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163950
164078
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163951
164079
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
163952
164080
|
};
|
|
163953
|
-
|
|
164081
|
+
logger232.info(
|
|
163954
164082
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
163955
164083
|
);
|
|
163956
164084
|
}
|
|
@@ -163960,7 +164088,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163960
164088
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163961
164089
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
163962
164090
|
};
|
|
163963
|
-
|
|
164091
|
+
logger232.info(
|
|
163964
164092
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
163965
164093
|
);
|
|
163966
164094
|
}
|
|
@@ -163970,7 +164098,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163970
164098
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163971
164099
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
163972
164100
|
};
|
|
163973
|
-
|
|
164101
|
+
logger232.info(
|
|
163974
164102
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
163975
164103
|
);
|
|
163976
164104
|
}
|
|
@@ -163980,7 +164108,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163980
164108
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163981
164109
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
163982
164110
|
};
|
|
163983
|
-
|
|
164111
|
+
logger232.info(
|
|
163984
164112
|
`${entityId}: Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity}`
|
|
163985
164113
|
);
|
|
163986
164114
|
}
|
|
@@ -163995,7 +164123,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163995
164123
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163996
164124
|
cleanAreaRooms
|
|
163997
164125
|
};
|
|
163998
|
-
|
|
164126
|
+
logger232.info(
|
|
163999
164127
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
164000
164128
|
);
|
|
164001
164129
|
}
|
|
@@ -164016,7 +164144,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
164016
164144
|
rooms: roomsObj
|
|
164017
164145
|
}
|
|
164018
164146
|
};
|
|
164019
|
-
|
|
164147
|
+
logger232.info(
|
|
164020
164148
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
164021
164149
|
);
|
|
164022
164150
|
} else {
|
|
@@ -164033,14 +164161,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
164033
164161
|
rooms: roomsObj
|
|
164034
164162
|
}
|
|
164035
164163
|
};
|
|
164036
|
-
|
|
164164
|
+
logger232.info(
|
|
164037
164165
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
164038
164166
|
);
|
|
164039
164167
|
}
|
|
164040
164168
|
}
|
|
164041
164169
|
}
|
|
164042
164170
|
} else {
|
|
164043
|
-
|
|
164171
|
+
logger232.warn(`${entityId}: No device_id, cannot auto-assign battery`);
|
|
164044
164172
|
}
|
|
164045
164173
|
const payload = {
|
|
164046
164174
|
entity_id: entityId,
|
|
@@ -164112,11 +164240,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
164112
164240
|
}
|
|
164113
164241
|
if (mappedChanged) {
|
|
164114
164242
|
this.pendingMappedChange = true;
|
|
164115
|
-
|
|
164243
|
+
logger232.debug(
|
|
164116
164244
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
164117
164245
|
);
|
|
164118
164246
|
}
|
|
164119
|
-
|
|
164247
|
+
logger232.debug(
|
|
164120
164248
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
164121
164249
|
);
|
|
164122
164250
|
this.lastState = state;
|
|
@@ -164601,10 +164729,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
164601
164729
|
// src/core/ioc/app-environment.ts
|
|
164602
164730
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
164603
164731
|
constructor(rootEnv, options) {
|
|
164604
|
-
const
|
|
164732
|
+
const logger234 = rootEnv.get(LoggerService);
|
|
164605
164733
|
super({
|
|
164606
164734
|
id: "App",
|
|
164607
|
-
log:
|
|
164735
|
+
log: logger234.get("AppContainer"),
|
|
164608
164736
|
parent: rootEnv
|
|
164609
164737
|
});
|
|
164610
164738
|
this.options = options;
|
|
@@ -164618,8 +164746,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
164618
164746
|
}
|
|
164619
164747
|
construction;
|
|
164620
164748
|
async init() {
|
|
164621
|
-
const
|
|
164622
|
-
this.set(LoggerService,
|
|
164749
|
+
const logger234 = this.get(LoggerService);
|
|
164750
|
+
this.set(LoggerService, logger234);
|
|
164623
164751
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
164624
164752
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
164625
164753
|
this.set(
|
|
@@ -164636,7 +164764,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
164636
164764
|
);
|
|
164637
164765
|
this.set(
|
|
164638
164766
|
HomeAssistantClient,
|
|
164639
|
-
new HomeAssistantClient(
|
|
164767
|
+
new HomeAssistantClient(logger234, this.options.homeAssistant)
|
|
164640
164768
|
);
|
|
164641
164769
|
this.set(
|
|
164642
164770
|
HomeAssistantConfig,
|
|
@@ -164644,7 +164772,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
164644
164772
|
);
|
|
164645
164773
|
this.set(
|
|
164646
164774
|
HomeAssistantActions,
|
|
164647
|
-
new HomeAssistantActions(
|
|
164775
|
+
new HomeAssistantActions(logger234, await this.load(HomeAssistantClient))
|
|
164648
164776
|
);
|
|
164649
164777
|
this.set(
|
|
164650
164778
|
HomeAssistantRegistry,
|
|
@@ -164680,7 +164808,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
164680
164808
|
this.set(
|
|
164681
164809
|
WebApi,
|
|
164682
164810
|
new WebApi(
|
|
164683
|
-
|
|
164811
|
+
logger234,
|
|
164684
164812
|
await this.load(BridgeService),
|
|
164685
164813
|
await this.load(HomeAssistantClient),
|
|
164686
164814
|
await this.load(HomeAssistantRegistry),
|
|
@@ -164705,7 +164833,7 @@ init_esm();
|
|
|
164705
164833
|
init_nodejs();
|
|
164706
164834
|
|
|
164707
164835
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
164708
|
-
var
|
|
164836
|
+
var logger233 = Logger.get("PatchLevelControlTlv");
|
|
164709
164837
|
function patchLevelControlTlv() {
|
|
164710
164838
|
let patched = 0;
|
|
164711
164839
|
const moveToLevelFields = LevelControl3.MoveToLevelRequest.fieldDefinitions;
|
|
@@ -164719,11 +164847,11 @@ function patchLevelControlTlv() {
|
|
|
164719
164847
|
patched++;
|
|
164720
164848
|
}
|
|
164721
164849
|
if (patched > 0) {
|
|
164722
|
-
|
|
164850
|
+
logger233.info(
|
|
164723
164851
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
164724
164852
|
);
|
|
164725
164853
|
} else {
|
|
164726
|
-
|
|
164854
|
+
logger233.warn(
|
|
164727
164855
|
"Failed to patch LevelControl TLV schemas, field definitions not found. Google Home brightness adjustment may not work."
|
|
164728
164856
|
);
|
|
164729
164857
|
}
|
|
@@ -167015,13 +167143,13 @@ export {
|
|
|
167015
167143
|
@matter/main/dist/esm/forwards/behaviors/smoke-co-alarm.js:
|
|
167016
167144
|
@matter/main/dist/esm/forwards/behaviors/operational-state.js:
|
|
167017
167145
|
@matter/main/dist/esm/forwards/clusters/operational-state.js:
|
|
167018
|
-
@matter/main/dist/esm/forwards/behaviors/
|
|
167019
|
-
@matter/main/dist/esm/forwards/
|
|
167146
|
+
@matter/main/dist/esm/forwards/behaviors/rvc-operational-state.js:
|
|
167147
|
+
@matter/main/dist/esm/forwards/clusters/rvc-operational-state.js:
|
|
167020
167148
|
@matter/main/dist/esm/forwards/clusters/mode-base.js:
|
|
167021
167149
|
@matter/main/dist/esm/forwards/clusters/rvc-run-mode.js:
|
|
167150
|
+
@matter/main/dist/esm/forwards/behaviors/color-control.js:
|
|
167151
|
+
@matter/main/dist/esm/forwards/behaviors/pump-configuration-and-control.js:
|
|
167022
167152
|
@matter/main/dist/esm/forwards/clusters/rvc-clean-mode.js:
|
|
167023
|
-
@matter/main/dist/esm/forwards/behaviors/rvc-operational-state.js:
|
|
167024
|
-
@matter/main/dist/esm/forwards/clusters/rvc-operational-state.js:
|
|
167025
167153
|
@matter/main/dist/esm/forwards/clusters/level-control.js:
|
|
167026
167154
|
(**
|
|
167027
167155
|
* @license
|