@riddix/hamh 2.1.0-alpha.738 → 2.1.0-alpha.740
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) {
|
|
@@ -124074,7 +124074,6 @@ var init_binary_sensor = __esm({
|
|
|
124074
124074
|
BinarySensorDeviceClass2["Power"] = "power";
|
|
124075
124075
|
BinarySensorDeviceClass2["Presence"] = "presence";
|
|
124076
124076
|
BinarySensorDeviceClass2["Problem"] = "problem";
|
|
124077
|
-
BinarySensorDeviceClass2["Rain"] = "rain";
|
|
124078
124077
|
BinarySensorDeviceClass2["Running"] = "running";
|
|
124079
124078
|
BinarySensorDeviceClass2["Safety"] = "safety";
|
|
124080
124079
|
BinarySensorDeviceClass2["Smoke"] = "smoke";
|
|
@@ -124190,6 +124189,26 @@ var init_humidifer = __esm({
|
|
|
124190
124189
|
}
|
|
124191
124190
|
});
|
|
124192
124191
|
|
|
124192
|
+
// ../common/dist/domains/lawn-mower.js
|
|
124193
|
+
var LawnMowerActivity, LawnMowerEntityFeature;
|
|
124194
|
+
var init_lawn_mower = __esm({
|
|
124195
|
+
"../common/dist/domains/lawn-mower.js"() {
|
|
124196
|
+
"use strict";
|
|
124197
|
+
(function(LawnMowerActivity2) {
|
|
124198
|
+
LawnMowerActivity2["error"] = "error";
|
|
124199
|
+
LawnMowerActivity2["paused"] = "paused";
|
|
124200
|
+
LawnMowerActivity2["mowing"] = "mowing";
|
|
124201
|
+
LawnMowerActivity2["docked"] = "docked";
|
|
124202
|
+
LawnMowerActivity2["returning"] = "returning";
|
|
124203
|
+
})(LawnMowerActivity || (LawnMowerActivity = {}));
|
|
124204
|
+
(function(LawnMowerEntityFeature2) {
|
|
124205
|
+
LawnMowerEntityFeature2[LawnMowerEntityFeature2["START_MOWING"] = 1] = "START_MOWING";
|
|
124206
|
+
LawnMowerEntityFeature2[LawnMowerEntityFeature2["PAUSE"] = 2] = "PAUSE";
|
|
124207
|
+
LawnMowerEntityFeature2[LawnMowerEntityFeature2["DOCK"] = 4] = "DOCK";
|
|
124208
|
+
})(LawnMowerEntityFeature || (LawnMowerEntityFeature = {}));
|
|
124209
|
+
}
|
|
124210
|
+
});
|
|
124211
|
+
|
|
124193
124212
|
// ../common/dist/domains/light.js
|
|
124194
124213
|
var LightDeviceColorMode;
|
|
124195
124214
|
var init_light = __esm({
|
|
@@ -124406,6 +124425,7 @@ var init_domains = __esm({
|
|
|
124406
124425
|
init_event2();
|
|
124407
124426
|
init_fan();
|
|
124408
124427
|
init_humidifer();
|
|
124428
|
+
init_lawn_mower();
|
|
124409
124429
|
init_light();
|
|
124410
124430
|
init_lock();
|
|
124411
124431
|
init_media_player();
|
|
@@ -124462,6 +124482,7 @@ var init_home_assistant_domain = __esm({
|
|
|
124462
124482
|
HomeAssistantDomain2["input_boolean"] = "input_boolean";
|
|
124463
124483
|
HomeAssistantDomain2["input_button"] = "input_button";
|
|
124464
124484
|
HomeAssistantDomain2["input_select"] = "input_select";
|
|
124485
|
+
HomeAssistantDomain2["lawn_mower"] = "lawn_mower";
|
|
124465
124486
|
HomeAssistantDomain2["light"] = "light";
|
|
124466
124487
|
HomeAssistantDomain2["lock"] = "lock";
|
|
124467
124488
|
HomeAssistantDomain2["media_player"] = "media_player";
|
|
@@ -125292,10 +125313,10 @@ var init_home_assistant_actions = __esm({
|
|
|
125292
125313
|
circuitBreakerResetMs: 3e4
|
|
125293
125314
|
};
|
|
125294
125315
|
HomeAssistantActions = class extends Service {
|
|
125295
|
-
constructor(
|
|
125316
|
+
constructor(logger234, client, config11) {
|
|
125296
125317
|
super("HomeAssistantActions");
|
|
125297
125318
|
this.client = client;
|
|
125298
|
-
this.log =
|
|
125319
|
+
this.log = logger234.get(this);
|
|
125299
125320
|
this.config = { ...defaultConfig, ...config11 };
|
|
125300
125321
|
this.circuitBreaker = new CircuitBreaker(
|
|
125301
125322
|
this.config.circuitBreakerThreshold,
|
|
@@ -125635,10 +125656,10 @@ var DiagnosticService = class {
|
|
|
125635
125656
|
};
|
|
125636
125657
|
|
|
125637
125658
|
// src/api/access-log.ts
|
|
125638
|
-
function accessLogger(
|
|
125659
|
+
function accessLogger(logger234) {
|
|
125639
125660
|
return (req, res, next) => {
|
|
125640
125661
|
res.on("finish", () => {
|
|
125641
|
-
|
|
125662
|
+
logger234.debug(
|
|
125642
125663
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
125643
125664
|
);
|
|
125644
125665
|
});
|
|
@@ -129518,7 +129539,7 @@ var WebSocketApi = class {
|
|
|
129518
129539
|
|
|
129519
129540
|
// src/api/web-api.ts
|
|
129520
129541
|
var WebApi = class extends Service {
|
|
129521
|
-
constructor(
|
|
129542
|
+
constructor(logger234, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
|
|
129522
129543
|
super("WebApi");
|
|
129523
129544
|
this.bridgeService = bridgeService;
|
|
129524
129545
|
this.haClient = haClient;
|
|
@@ -129529,8 +129550,8 @@ var WebApi = class extends Service {
|
|
|
129529
129550
|
this.settingsStorage = settingsStorage;
|
|
129530
129551
|
this.backupService = backupService;
|
|
129531
129552
|
this.props = props;
|
|
129532
|
-
this.logger =
|
|
129533
|
-
this.log =
|
|
129553
|
+
this.logger = logger234;
|
|
129554
|
+
this.log = logger234.get(this);
|
|
129534
129555
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
129535
129556
|
this.startTime = Date.now();
|
|
129536
129557
|
this.wsApi = new WebSocketApi(
|
|
@@ -130621,10 +130642,10 @@ function isTransientConnectError(reason) {
|
|
|
130621
130642
|
return msg.includes("socket hang up") || msg.includes("tls") || msg.includes("TLS");
|
|
130622
130643
|
}
|
|
130623
130644
|
var HomeAssistantClient = class extends Service {
|
|
130624
|
-
constructor(
|
|
130645
|
+
constructor(logger234, options) {
|
|
130625
130646
|
super("HomeAssistantClient");
|
|
130626
130647
|
this.options = options;
|
|
130627
|
-
this.log =
|
|
130648
|
+
this.log = logger234.get(this);
|
|
130628
130649
|
}
|
|
130629
130650
|
options;
|
|
130630
130651
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
@@ -139320,10 +139341,10 @@ var UnsupportedModeError = class extends ImplementationError {
|
|
|
139320
139341
|
};
|
|
139321
139342
|
var ModeUtils;
|
|
139322
139343
|
((ModeUtils2) => {
|
|
139323
|
-
function assertSupportedModes(
|
|
139344
|
+
function assertSupportedModes(supportedModes2) {
|
|
139324
139345
|
const labels = /* @__PURE__ */ new Set();
|
|
139325
139346
|
const modes = /* @__PURE__ */ new Set();
|
|
139326
|
-
for (const { mode, label } of
|
|
139347
|
+
for (const { mode, label } of supportedModes2) {
|
|
139327
139348
|
if (labels.has(label)) {
|
|
139328
139349
|
throw new ImplementationError(`Duplicate label in supportedModes: ${label}`);
|
|
139329
139350
|
}
|
|
@@ -139335,18 +139356,18 @@ var ModeUtils;
|
|
|
139335
139356
|
}
|
|
139336
139357
|
}
|
|
139337
139358
|
ModeUtils2.assertSupportedModes = assertSupportedModes;
|
|
139338
|
-
function assertMode(
|
|
139339
|
-
if (!
|
|
139359
|
+
function assertMode(supportedModes2, newMode) {
|
|
139360
|
+
if (!supportedModes2.some(({ mode }) => mode === newMode)) {
|
|
139340
139361
|
throw new UnsupportedModeError(
|
|
139341
|
-
`Can not use unsupported mode: ${newMode}. Allowed modes are ${
|
|
139362
|
+
`Can not use unsupported mode: ${newMode}. Allowed modes are ${supportedModes2.map(({ mode }) => mode).join(", ")}`
|
|
139342
139363
|
);
|
|
139343
139364
|
}
|
|
139344
139365
|
}
|
|
139345
139366
|
ModeUtils2.assertMode = assertMode;
|
|
139346
|
-
function assertModeChange(
|
|
139367
|
+
function assertModeChange(supportedModes2, currentMode, newMode) {
|
|
139347
139368
|
if (currentMode !== newMode) {
|
|
139348
139369
|
try {
|
|
139349
|
-
assertMode(
|
|
139370
|
+
assertMode(supportedModes2, newMode);
|
|
139350
139371
|
} catch (error) {
|
|
139351
139372
|
UnsupportedModeError.accept(error);
|
|
139352
139373
|
return {
|
|
@@ -148167,10 +148188,10 @@ function seedExistingSessionStarts(startedAt, sessions, now = Date.now()) {
|
|
|
148167
148188
|
var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
148168
148189
|
var DEAD_SESSION_TIMEOUT_MS = 6e4;
|
|
148169
148190
|
var Bridge = class {
|
|
148170
|
-
constructor(env,
|
|
148191
|
+
constructor(env, logger234, dataProvider, endpointManager) {
|
|
148171
148192
|
this.dataProvider = dataProvider;
|
|
148172
148193
|
this.endpointManager = endpointManager;
|
|
148173
|
-
this.log =
|
|
148194
|
+
this.log = logger234.get(`Bridge / ${dataProvider.id}`);
|
|
148174
148195
|
this.server = new BridgeServerNode(
|
|
148175
148196
|
env,
|
|
148176
148197
|
this.dataProvider,
|
|
@@ -153169,8 +153190,7 @@ var deviceClasses = {
|
|
|
153169
153190
|
[BinarySensorDeviceClass.Occupancy]: OccupancySensorType,
|
|
153170
153191
|
[BinarySensorDeviceClass.Presence]: OccupancySensorType,
|
|
153171
153192
|
[BinarySensorDeviceClass.Smoke]: SmokeAlarmType,
|
|
153172
|
-
[BinarySensorDeviceClass.Moisture]: DetectorContactSensorType
|
|
153173
|
-
[BinarySensorDeviceClass.Rain]: DetectorContactSensorType
|
|
153193
|
+
[BinarySensorDeviceClass.Moisture]: DetectorContactSensorType
|
|
153174
153194
|
};
|
|
153175
153195
|
var batteryTypes = /* @__PURE__ */ new Map([
|
|
153176
153196
|
[ContactSensorType, ContactSensorWithBatteryType],
|
|
@@ -154410,6 +154430,771 @@ function InputButtonDevice(homeAssistantEntity) {
|
|
|
154410
154430
|
return InputButtonEndpointType.set({ homeAssistantEntity });
|
|
154411
154431
|
}
|
|
154412
154432
|
|
|
154433
|
+
// src/matter/endpoints/legacy/lawn-mower/index.ts
|
|
154434
|
+
init_home_assistant_entity_behavior();
|
|
154435
|
+
|
|
154436
|
+
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-operational-state-server.ts
|
|
154437
|
+
init_dist();
|
|
154438
|
+
init_esm();
|
|
154439
|
+
init_home_assistant_entity_behavior();
|
|
154440
|
+
|
|
154441
|
+
// src/matter/behaviors/rvc-operational-state-server.ts
|
|
154442
|
+
init_esm();
|
|
154443
|
+
|
|
154444
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/behaviors/rvc-operational-state.js
|
|
154445
|
+
init_nodejs();
|
|
154446
|
+
|
|
154447
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/rvc-operational-state.js
|
|
154448
|
+
init_nodejs();
|
|
154449
|
+
|
|
154450
|
+
// src/matter/behaviors/rvc-operational-state-server.ts
|
|
154451
|
+
init_home_assistant_entity_behavior();
|
|
154452
|
+
var OperationalState4 = RvcOperationalState4.OperationalState;
|
|
154453
|
+
var ErrorState = RvcOperationalState4.ErrorState;
|
|
154454
|
+
var logger209 = Logger.get("RvcOperationalStateServer");
|
|
154455
|
+
var activeStates = /* @__PURE__ */ new Set([
|
|
154456
|
+
OperationalState4.Running,
|
|
154457
|
+
OperationalState4.SeekingCharger
|
|
154458
|
+
]);
|
|
154459
|
+
var advertisedOperationalStates = [
|
|
154460
|
+
OperationalState4.Stopped,
|
|
154461
|
+
OperationalState4.Running,
|
|
154462
|
+
OperationalState4.Paused,
|
|
154463
|
+
OperationalState4.Error,
|
|
154464
|
+
OperationalState4.SeekingCharger,
|
|
154465
|
+
OperationalState4.Charging,
|
|
154466
|
+
OperationalState4.Docked
|
|
154467
|
+
];
|
|
154468
|
+
function makeRvcOperationalError(errorStateId) {
|
|
154469
|
+
if (errorStateId === ErrorState.NoError) {
|
|
154470
|
+
return { errorStateId };
|
|
154471
|
+
}
|
|
154472
|
+
return { errorStateId, errorStateDetails: ErrorState[errorStateId] };
|
|
154473
|
+
}
|
|
154474
|
+
var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
154475
|
+
async initialize() {
|
|
154476
|
+
this.state.operationalStateList = advertisedOperationalStates.map((id) => ({
|
|
154477
|
+
operationalStateId: id
|
|
154478
|
+
}));
|
|
154479
|
+
this.state.operationalState = OperationalState4.Stopped;
|
|
154480
|
+
this.state.operationalError = { errorStateId: ErrorState.NoError };
|
|
154481
|
+
await super.initialize();
|
|
154482
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
154483
|
+
this.update(homeAssistant.entity);
|
|
154484
|
+
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
154485
|
+
}
|
|
154486
|
+
update(entity) {
|
|
154487
|
+
if (!entity.state || !entity.state.attributes) {
|
|
154488
|
+
return;
|
|
154489
|
+
}
|
|
154490
|
+
const newState = this.state.config.getOperationalState(
|
|
154491
|
+
entity.state,
|
|
154492
|
+
this.agent
|
|
154493
|
+
);
|
|
154494
|
+
const previousState = this.state.operationalState;
|
|
154495
|
+
const errorStateId = newState === OperationalState4.Error ? ErrorState.Stuck : ErrorState.NoError;
|
|
154496
|
+
const operationalError = makeRvcOperationalError(errorStateId);
|
|
154497
|
+
applyPatchState(
|
|
154498
|
+
this.state,
|
|
154499
|
+
{
|
|
154500
|
+
operationalState: newState,
|
|
154501
|
+
operationalError
|
|
154502
|
+
},
|
|
154503
|
+
{ force: true }
|
|
154504
|
+
);
|
|
154505
|
+
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
154506
|
+
logger209.info(
|
|
154507
|
+
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
154508
|
+
);
|
|
154509
|
+
try {
|
|
154510
|
+
this.events.operationCompletion?.emit(
|
|
154511
|
+
{
|
|
154512
|
+
completionErrorCode: newState === OperationalState4.Error ? ErrorState.Stuck : ErrorState.NoError,
|
|
154513
|
+
totalOperationalTime: null,
|
|
154514
|
+
pausedTime: null
|
|
154515
|
+
},
|
|
154516
|
+
this.context
|
|
154517
|
+
);
|
|
154518
|
+
} catch (e) {
|
|
154519
|
+
logger209.debug("Failed to emit operationCompletion event:", e);
|
|
154520
|
+
}
|
|
154521
|
+
}
|
|
154522
|
+
}
|
|
154523
|
+
pause() {
|
|
154524
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154525
|
+
homeAssistant.callAction(this.state.config.pause(void 0, this.agent));
|
|
154526
|
+
return {
|
|
154527
|
+
commandResponseState: {
|
|
154528
|
+
errorStateId: ErrorState.NoError
|
|
154529
|
+
}
|
|
154530
|
+
};
|
|
154531
|
+
}
|
|
154532
|
+
resume() {
|
|
154533
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154534
|
+
homeAssistant.callAction(this.state.config.resume(void 0, this.agent));
|
|
154535
|
+
return {
|
|
154536
|
+
commandResponseState: {
|
|
154537
|
+
errorStateId: ErrorState.NoError
|
|
154538
|
+
}
|
|
154539
|
+
};
|
|
154540
|
+
}
|
|
154541
|
+
goHome() {
|
|
154542
|
+
if (this.state.operationalState === OperationalState4.Docked || this.state.operationalState === OperationalState4.Charging) {
|
|
154543
|
+
return {
|
|
154544
|
+
commandResponseState: {
|
|
154545
|
+
errorStateId: ErrorState.NoError
|
|
154546
|
+
}
|
|
154547
|
+
};
|
|
154548
|
+
}
|
|
154549
|
+
const goHomeAction = this.state.config.goHome;
|
|
154550
|
+
if (goHomeAction) {
|
|
154551
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154552
|
+
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
154553
|
+
} else {
|
|
154554
|
+
logger209.warn("GoHome command received but no goHome action configured");
|
|
154555
|
+
}
|
|
154556
|
+
return {
|
|
154557
|
+
commandResponseState: {
|
|
154558
|
+
errorStateId: ErrorState.NoError
|
|
154559
|
+
}
|
|
154560
|
+
};
|
|
154561
|
+
}
|
|
154562
|
+
};
|
|
154563
|
+
((RvcOperationalStateServerBase2) => {
|
|
154564
|
+
class State extends RvcOperationalStateServer.State {
|
|
154565
|
+
config;
|
|
154566
|
+
}
|
|
154567
|
+
RvcOperationalStateServerBase2.State = State;
|
|
154568
|
+
})(RvcOperationalStateServerBase || (RvcOperationalStateServerBase = {}));
|
|
154569
|
+
function RvcOperationalStateServer2(config11) {
|
|
154570
|
+
return RvcOperationalStateServerBase.set({ config: config11 });
|
|
154571
|
+
}
|
|
154572
|
+
|
|
154573
|
+
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-operational-state-server.ts
|
|
154574
|
+
var logger210 = Logger.get("LawnMowerRvcOperationalStateServer");
|
|
154575
|
+
function mapLawnMowerOperationalState(entity) {
|
|
154576
|
+
const state = entity.state;
|
|
154577
|
+
switch (state) {
|
|
154578
|
+
case LawnMowerActivity.mowing:
|
|
154579
|
+
return RvcOperationalState4.OperationalState.Running;
|
|
154580
|
+
case LawnMowerActivity.returning:
|
|
154581
|
+
return RvcOperationalState4.OperationalState.SeekingCharger;
|
|
154582
|
+
case LawnMowerActivity.docked:
|
|
154583
|
+
return RvcOperationalState4.OperationalState.Docked;
|
|
154584
|
+
case LawnMowerActivity.paused:
|
|
154585
|
+
return RvcOperationalState4.OperationalState.Paused;
|
|
154586
|
+
case LawnMowerActivity.error:
|
|
154587
|
+
case "unavailable":
|
|
154588
|
+
return RvcOperationalState4.OperationalState.Error;
|
|
154589
|
+
default:
|
|
154590
|
+
logger210.info(`Unknown lawn_mower state "${state}", treating as Stopped`);
|
|
154591
|
+
return RvcOperationalState4.OperationalState.Stopped;
|
|
154592
|
+
}
|
|
154593
|
+
}
|
|
154594
|
+
var LawnMowerRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
154595
|
+
getOperationalState: (entity) => mapLawnMowerOperationalState(entity),
|
|
154596
|
+
// Pause requires the PAUSE feature; mowers without it can only be docked.
|
|
154597
|
+
pause: (_, agent) => {
|
|
154598
|
+
const features3 = agent.get(HomeAssistantEntityBehavior).entity.state.attributes.supported_features ?? 0;
|
|
154599
|
+
if (testBit(features3, LawnMowerEntityFeature.PAUSE)) {
|
|
154600
|
+
return { action: "lawn_mower.pause" };
|
|
154601
|
+
}
|
|
154602
|
+
return { action: "lawn_mower.dock" };
|
|
154603
|
+
},
|
|
154604
|
+
resume: () => ({ action: "lawn_mower.start_mowing" }),
|
|
154605
|
+
goHome: () => ({ action: "lawn_mower.dock" })
|
|
154606
|
+
});
|
|
154607
|
+
|
|
154608
|
+
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-run-mode-server.ts
|
|
154609
|
+
init_dist();
|
|
154610
|
+
init_home_assistant_entity_behavior();
|
|
154611
|
+
|
|
154612
|
+
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
154613
|
+
init_esm();
|
|
154614
|
+
|
|
154615
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/mode-base.js
|
|
154616
|
+
init_nodejs();
|
|
154617
|
+
|
|
154618
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.2/node_modules/@matter/main/dist/esm/forwards/clusters/rvc-run-mode.js
|
|
154619
|
+
init_nodejs();
|
|
154620
|
+
|
|
154621
|
+
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
154622
|
+
init_home_assistant_entity_behavior();
|
|
154623
|
+
|
|
154624
|
+
// src/matter/behaviors/infer-cleaned-area-progress.ts
|
|
154625
|
+
function inferCleanedAreaProgress(cleanedSqm, orderedAreas) {
|
|
154626
|
+
if (orderedAreas.length === 0) {
|
|
154627
|
+
return { currentArea: null, completed: [] };
|
|
154628
|
+
}
|
|
154629
|
+
const cleaned = Number.isFinite(cleanedSqm) ? Math.max(0, cleanedSqm) : 0;
|
|
154630
|
+
let cumulative = 0;
|
|
154631
|
+
const completed = [];
|
|
154632
|
+
for (const area of orderedAreas) {
|
|
154633
|
+
const size = Number.isFinite(area.sizeSqm) ? Math.max(0, area.sizeSqm) : 0;
|
|
154634
|
+
cumulative += size;
|
|
154635
|
+
if (cleaned < cumulative) {
|
|
154636
|
+
return { currentArea: area.areaId, completed };
|
|
154637
|
+
}
|
|
154638
|
+
completed.push(area.areaId);
|
|
154639
|
+
}
|
|
154640
|
+
return { currentArea: null, completed };
|
|
154641
|
+
}
|
|
154642
|
+
|
|
154643
|
+
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
154644
|
+
var logger211 = Logger.get("RvcRunModeServer");
|
|
154645
|
+
var ROOM_MODE_BASE = 100;
|
|
154646
|
+
function isRoomMode(mode) {
|
|
154647
|
+
return mode >= ROOM_MODE_BASE;
|
|
154648
|
+
}
|
|
154649
|
+
var cleaningSessions = /* @__PURE__ */ new WeakMap();
|
|
154650
|
+
function getSession(endpoint) {
|
|
154651
|
+
let session = cleaningSessions.get(endpoint);
|
|
154652
|
+
if (!session) {
|
|
154653
|
+
session = {
|
|
154654
|
+
completedAreas: /* @__PURE__ */ new Set(),
|
|
154655
|
+
lastCurrentArea: null,
|
|
154656
|
+
activeAreas: [],
|
|
154657
|
+
loggedShortCircuits: /* @__PURE__ */ new Set(),
|
|
154658
|
+
observedCleaning: false,
|
|
154659
|
+
pendingDispatches: [],
|
|
154660
|
+
cleanedAreaBaseline: null
|
|
154661
|
+
};
|
|
154662
|
+
cleaningSessions.set(endpoint, session);
|
|
154663
|
+
}
|
|
154664
|
+
return session;
|
|
154665
|
+
}
|
|
154666
|
+
var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
154667
|
+
async initialize() {
|
|
154668
|
+
await super.initialize();
|
|
154669
|
+
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
154670
|
+
this.update(homeAssistant.entity);
|
|
154671
|
+
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
154672
|
+
}
|
|
154673
|
+
update(entity) {
|
|
154674
|
+
if (!entity.state || !entity.state.attributes) {
|
|
154675
|
+
return;
|
|
154676
|
+
}
|
|
154677
|
+
const s = getSession(this.endpoint);
|
|
154678
|
+
const previousMode = this.state.currentMode;
|
|
154679
|
+
const newMode = this.state.config.getCurrentMode(entity.state, this.agent);
|
|
154680
|
+
applyPatchState(
|
|
154681
|
+
this.state,
|
|
154682
|
+
{
|
|
154683
|
+
currentMode: newMode,
|
|
154684
|
+
supportedModes: this.state.config.getSupportedModes(
|
|
154685
|
+
entity.state,
|
|
154686
|
+
this.agent
|
|
154687
|
+
)
|
|
154688
|
+
},
|
|
154689
|
+
{ force: true }
|
|
154690
|
+
);
|
|
154691
|
+
if (newMode === 1 /* Cleaning */) {
|
|
154692
|
+
s.observedCleaning = true;
|
|
154693
|
+
}
|
|
154694
|
+
if (previousMode !== newMode) {
|
|
154695
|
+
if (newMode === 0 /* Idle */) {
|
|
154696
|
+
if (s.lastCurrentArea !== null) {
|
|
154697
|
+
s.completedAreas.add(s.lastCurrentArea);
|
|
154698
|
+
s.lastCurrentArea = null;
|
|
154699
|
+
}
|
|
154700
|
+
if (s.pendingDispatches.length > 0 && s.observedCleaning) {
|
|
154701
|
+
try {
|
|
154702
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154703
|
+
const prev = serviceArea.state.currentArea;
|
|
154704
|
+
if (typeof prev === "number") {
|
|
154705
|
+
s.completedAreas.add(prev);
|
|
154706
|
+
}
|
|
154707
|
+
const next = s.pendingDispatches.shift();
|
|
154708
|
+
if (next) {
|
|
154709
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154710
|
+
homeAssistant.callAction(next.action);
|
|
154711
|
+
this.trySetCurrentArea(next.areaId);
|
|
154712
|
+
}
|
|
154713
|
+
} catch {
|
|
154714
|
+
}
|
|
154715
|
+
s.loggedShortCircuits.clear();
|
|
154716
|
+
return;
|
|
154717
|
+
}
|
|
154718
|
+
if (s.observedCleaning) {
|
|
154719
|
+
try {
|
|
154720
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154721
|
+
const last = serviceArea.state.currentArea;
|
|
154722
|
+
if (typeof last === "number") {
|
|
154723
|
+
s.completedAreas.add(last);
|
|
154724
|
+
serviceArea.state.currentArea = null;
|
|
154725
|
+
}
|
|
154726
|
+
this.updateProgressFromTracking(serviceArea);
|
|
154727
|
+
} catch {
|
|
154728
|
+
}
|
|
154729
|
+
s.observedCleaning = false;
|
|
154730
|
+
}
|
|
154731
|
+
s.loggedShortCircuits.clear();
|
|
154732
|
+
} else if (newMode === 1 /* Cleaning */) {
|
|
154733
|
+
if (s.activeAreas.length > 0 && s.lastCurrentArea === null) {
|
|
154734
|
+
const firstPending = s.activeAreas.find(
|
|
154735
|
+
(id) => !s.completedAreas.has(id)
|
|
154736
|
+
);
|
|
154737
|
+
if (firstPending !== void 0) {
|
|
154738
|
+
this.trySetCurrentArea(firstPending);
|
|
154739
|
+
}
|
|
154740
|
+
}
|
|
154741
|
+
}
|
|
154742
|
+
}
|
|
154743
|
+
if (newMode === 0 /* Idle */ && s.activeAreas.length === 0) {
|
|
154744
|
+
try {
|
|
154745
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154746
|
+
if (serviceArea.state.currentArea !== null) {
|
|
154747
|
+
serviceArea.state.currentArea = null;
|
|
154748
|
+
}
|
|
154749
|
+
} catch {
|
|
154750
|
+
}
|
|
154751
|
+
}
|
|
154752
|
+
if (newMode === 1 /* Cleaning */) {
|
|
154753
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
154754
|
+
if (mapping?.currentRoomEntity) {
|
|
154755
|
+
this.updateCurrentRoomFromSensor();
|
|
154756
|
+
} else if (mapping?.cleanedAreaEntity) {
|
|
154757
|
+
this.updateCurrentRoomFromCleanedArea();
|
|
154758
|
+
}
|
|
154759
|
+
}
|
|
154760
|
+
}
|
|
154761
|
+
/**
|
|
154762
|
+
* Emit a diagnostic INFO log exactly once per cleaning session for a
|
|
154763
|
+
* given short-circuit reason. Prevents log flooding while still
|
|
154764
|
+
* surfacing the silent paths that would otherwise be invisible.
|
|
154765
|
+
*/
|
|
154766
|
+
logShortCircuitOnce(reason, message) {
|
|
154767
|
+
const s = getSession(this.endpoint);
|
|
154768
|
+
if (s.loggedShortCircuits.has(reason)) return;
|
|
154769
|
+
s.loggedShortCircuits.add(reason);
|
|
154770
|
+
logger211.info(message);
|
|
154771
|
+
}
|
|
154772
|
+
/**
|
|
154773
|
+
* Read the currentRoomEntity sensor and update currentArea + progress
|
|
154774
|
+
* to reflect which room the vacuum is actually in right now.
|
|
154775
|
+
*/
|
|
154776
|
+
updateCurrentRoomFromSensor() {
|
|
154777
|
+
try {
|
|
154778
|
+
const s = getSession(this.endpoint);
|
|
154779
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154780
|
+
const currentRoomEntityId = homeAssistant.state.mapping?.currentRoomEntity;
|
|
154781
|
+
if (!currentRoomEntityId) {
|
|
154782
|
+
this.logShortCircuitOnce(
|
|
154783
|
+
"no-mapping",
|
|
154784
|
+
"currentRoom sensor: no currentRoomEntity in mapping, auto-detect did not run or sensor not on same HA device"
|
|
154785
|
+
);
|
|
154786
|
+
return;
|
|
154787
|
+
}
|
|
154788
|
+
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
154789
|
+
const roomState = stateProvider.getState(currentRoomEntityId);
|
|
154790
|
+
if (!roomState || !roomState.state) {
|
|
154791
|
+
this.logShortCircuitOnce(
|
|
154792
|
+
"no-state",
|
|
154793
|
+
`currentRoom sensor: no state available for ${currentRoomEntityId}`
|
|
154794
|
+
);
|
|
154795
|
+
return;
|
|
154796
|
+
}
|
|
154797
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154798
|
+
const externalSession = s.activeAreas.length === 0;
|
|
154799
|
+
const supportedAreaIds = serviceArea.state.supportedAreas.map(
|
|
154800
|
+
(a) => a.areaId
|
|
154801
|
+
);
|
|
154802
|
+
const isAllowedArea = (id) => externalSession ? supportedAreaIds.includes(id) : s.activeAreas.includes(id);
|
|
154803
|
+
const sensorAttrs = roomState.attributes;
|
|
154804
|
+
const segmentId = sensorAttrs.segment_id ?? sensorAttrs.room_id;
|
|
154805
|
+
const roomName = roomState.state;
|
|
154806
|
+
let matchedAreaId = null;
|
|
154807
|
+
if (segmentId != null && isAllowedArea(segmentId)) {
|
|
154808
|
+
matchedAreaId = segmentId;
|
|
154809
|
+
}
|
|
154810
|
+
if (matchedAreaId === null && segmentId != null) {
|
|
154811
|
+
for (const area of serviceArea.state.supportedAreas) {
|
|
154812
|
+
if (isAllowedArea(area.areaId) && area.areaId % 1e4 === segmentId) {
|
|
154813
|
+
matchedAreaId = area.areaId;
|
|
154814
|
+
break;
|
|
154815
|
+
}
|
|
154816
|
+
}
|
|
154817
|
+
}
|
|
154818
|
+
if (matchedAreaId === null && roomName) {
|
|
154819
|
+
const area = serviceArea.state.supportedAreas.find(
|
|
154820
|
+
(a) => a.areaInfo.locationInfo?.locationName?.toLowerCase() === roomName.toLowerCase()
|
|
154821
|
+
);
|
|
154822
|
+
if (area && isAllowedArea(area.areaId)) {
|
|
154823
|
+
matchedAreaId = area.areaId;
|
|
154824
|
+
}
|
|
154825
|
+
}
|
|
154826
|
+
if (matchedAreaId === null) {
|
|
154827
|
+
logger211.info(
|
|
154828
|
+
`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(", ")}]`
|
|
154829
|
+
);
|
|
154830
|
+
return;
|
|
154831
|
+
}
|
|
154832
|
+
if (matchedAreaId === s.lastCurrentArea) return;
|
|
154833
|
+
if (s.lastCurrentArea !== null) {
|
|
154834
|
+
s.completedAreas.add(s.lastCurrentArea);
|
|
154835
|
+
}
|
|
154836
|
+
s.lastCurrentArea = matchedAreaId;
|
|
154837
|
+
logger211.info(
|
|
154838
|
+
`currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
|
|
154839
|
+
);
|
|
154840
|
+
this.trySetCurrentArea(matchedAreaId);
|
|
154841
|
+
} catch (e) {
|
|
154842
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
154843
|
+
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
154844
|
+
logger211.warn(`currentRoom sensor update failed: ${msg}`);
|
|
154845
|
+
}
|
|
154846
|
+
}
|
|
154847
|
+
}
|
|
154848
|
+
/** Read the cumulative cleaned-area sensor (m2), or null if not configured. */
|
|
154849
|
+
readCleanedAreaSqm() {
|
|
154850
|
+
try {
|
|
154851
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
154852
|
+
const entityId = mapping?.cleanedAreaEntity;
|
|
154853
|
+
if (!entityId) {
|
|
154854
|
+
return null;
|
|
154855
|
+
}
|
|
154856
|
+
return this.agent.env.get(EntityStateProvider).getNumericState(entityId);
|
|
154857
|
+
} catch {
|
|
154858
|
+
return null;
|
|
154859
|
+
}
|
|
154860
|
+
}
|
|
154861
|
+
/**
|
|
154862
|
+
* For batch vacuums that report cumulative cleaned area but not the current
|
|
154863
|
+
* room, infer currentArea + progress from the cleaned area and the per-room
|
|
154864
|
+
* sizeSqm. Display-only and batch-only; skipped unless every selected area
|
|
154865
|
+
* has a size. The currentRoom sensor path takes priority (#368).
|
|
154866
|
+
*/
|
|
154867
|
+
updateCurrentRoomFromCleanedArea() {
|
|
154868
|
+
try {
|
|
154869
|
+
const s = getSession(this.endpoint);
|
|
154870
|
+
if (s.pendingDispatches.length > 0 || s.activeAreas.length === 0) {
|
|
154871
|
+
return;
|
|
154872
|
+
}
|
|
154873
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
154874
|
+
const entityId = mapping?.cleanedAreaEntity;
|
|
154875
|
+
if (!entityId) {
|
|
154876
|
+
return;
|
|
154877
|
+
}
|
|
154878
|
+
const raw = this.agent.env.get(EntityStateProvider).getNumericState(entityId);
|
|
154879
|
+
if (raw == null) {
|
|
154880
|
+
this.logShortCircuitOnce(
|
|
154881
|
+
"no-cleaned-area-state",
|
|
154882
|
+
`cleanedArea sensor: no numeric state for ${entityId}`
|
|
154883
|
+
);
|
|
154884
|
+
return;
|
|
154885
|
+
}
|
|
154886
|
+
const customAreas = mapping?.customServiceAreas;
|
|
154887
|
+
const ordered = [];
|
|
154888
|
+
for (const areaId of [...s.activeAreas].sort((a, b) => a - b)) {
|
|
154889
|
+
const size = customAreas?.[areaId - 1]?.sizeSqm;
|
|
154890
|
+
if (typeof size !== "number" || !Number.isFinite(size) || size <= 0) {
|
|
154891
|
+
this.logShortCircuitOnce(
|
|
154892
|
+
"no-sizes",
|
|
154893
|
+
"cleanedArea sensor: not every selected area has a sizeSqm"
|
|
154894
|
+
);
|
|
154895
|
+
return;
|
|
154896
|
+
}
|
|
154897
|
+
ordered.push({ areaId, sizeSqm: size });
|
|
154898
|
+
}
|
|
154899
|
+
if (s.cleanedAreaBaseline == null || raw < s.cleanedAreaBaseline) {
|
|
154900
|
+
s.cleanedAreaBaseline = raw;
|
|
154901
|
+
}
|
|
154902
|
+
const cleaned = Math.max(0, raw - s.cleanedAreaBaseline);
|
|
154903
|
+
const { currentArea, completed } = inferCleanedAreaProgress(
|
|
154904
|
+
cleaned,
|
|
154905
|
+
ordered
|
|
154906
|
+
);
|
|
154907
|
+
logger211.debug(
|
|
154908
|
+
`cleanedArea: raw=${raw} baseline=${s.cleanedAreaBaseline} cleaned=${cleaned} sizes=[${ordered.map((o) => `${o.areaId}:${o.sizeSqm}`).join(",")}] -> current=${currentArea} completed=[${completed.join(",")}]`
|
|
154909
|
+
);
|
|
154910
|
+
for (const id of completed) {
|
|
154911
|
+
s.completedAreas.add(id);
|
|
154912
|
+
}
|
|
154913
|
+
if (currentArea === s.lastCurrentArea) {
|
|
154914
|
+
return;
|
|
154915
|
+
}
|
|
154916
|
+
s.lastCurrentArea = currentArea;
|
|
154917
|
+
this.trySetCurrentArea(currentArea);
|
|
154918
|
+
} catch (e) {
|
|
154919
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
154920
|
+
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
154921
|
+
logger211.warn(`cleanedArea room update failed: ${msg}`);
|
|
154922
|
+
}
|
|
154923
|
+
}
|
|
154924
|
+
}
|
|
154925
|
+
/**
|
|
154926
|
+
* Safely update ServiceArea.currentArea and progress.
|
|
154927
|
+
* When areaId is set, marks it as Operating in progress.
|
|
154928
|
+
* When areaId is null (Idle), marks all Operating/Pending as Completed.
|
|
154929
|
+
* No-op if ServiceArea is not available on this endpoint.
|
|
154930
|
+
*/
|
|
154931
|
+
trySetCurrentArea(areaId) {
|
|
154932
|
+
try {
|
|
154933
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154934
|
+
if (serviceArea.state.currentArea !== areaId) {
|
|
154935
|
+
serviceArea.state.currentArea = areaId;
|
|
154936
|
+
logger211.debug(`currentArea set to ${areaId}`);
|
|
154937
|
+
}
|
|
154938
|
+
this.updateProgress(serviceArea, areaId);
|
|
154939
|
+
} catch {
|
|
154940
|
+
}
|
|
154941
|
+
}
|
|
154942
|
+
/**
|
|
154943
|
+
* Update progress entries to reflect the current operating area.
|
|
154944
|
+
* - null: mark all areas as Completed (cleaning done)
|
|
154945
|
+
* - areaId: mark that area as Operating, others as Pending
|
|
154946
|
+
*
|
|
154947
|
+
* Uses the activeAreas snapshot (plain number array) instead of
|
|
154948
|
+
* managed state entries, which avoids infinite recursion in
|
|
154949
|
+
* matter.js property getters during transaction pre-commit.
|
|
154950
|
+
*/
|
|
154951
|
+
updateProgress(serviceArea, areaId) {
|
|
154952
|
+
const s = getSession(this.endpoint);
|
|
154953
|
+
if (s.activeAreas.length === 0) return;
|
|
154954
|
+
const state = serviceArea.state;
|
|
154955
|
+
if (areaId === null) {
|
|
154956
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
154957
|
+
areaId: id,
|
|
154958
|
+
status: ServiceArea3.OperationalStatus.Completed
|
|
154959
|
+
}));
|
|
154960
|
+
} else {
|
|
154961
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
154962
|
+
areaId: id,
|
|
154963
|
+
status: id === areaId ? ServiceArea3.OperationalStatus.Operating : s.completedAreas.has(id) ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Pending
|
|
154964
|
+
}));
|
|
154965
|
+
}
|
|
154966
|
+
}
|
|
154967
|
+
/**
|
|
154968
|
+
* Update progress entries from tracking state without any area
|
|
154969
|
+
* operating. Used on mid-session transitions (e.g. vacuum-then-mop
|
|
154970
|
+
* tool swap) where the vacuum is temporarily idle but the session
|
|
154971
|
+
* is not finished: completed areas stay Completed, remaining areas
|
|
154972
|
+
* stay Pending.
|
|
154973
|
+
*/
|
|
154974
|
+
updateProgressFromTracking(serviceArea) {
|
|
154975
|
+
const s = getSession(this.endpoint);
|
|
154976
|
+
if (s.activeAreas.length === 0) return;
|
|
154977
|
+
const state = serviceArea.state;
|
|
154978
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
154979
|
+
areaId: id,
|
|
154980
|
+
status: s.completedAreas.has(id) ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Pending
|
|
154981
|
+
}));
|
|
154982
|
+
}
|
|
154983
|
+
/**
|
|
154984
|
+
* Stop before finishing: mark the areas the vacuum actually reached as
|
|
154985
|
+
* Completed and the rest as Skipped (an out-of-band stop per the Matter
|
|
154986
|
+
* ServiceArea spec), then clear currentArea. The old path marked every
|
|
154987
|
+
* area Completed, which told Apple Home rooms were cleaned when they were
|
|
154988
|
+
* not, so they got dropped from the next selection (#367).
|
|
154989
|
+
*/
|
|
154990
|
+
finalizeProgressOnStop() {
|
|
154991
|
+
const s = getSession(this.endpoint);
|
|
154992
|
+
try {
|
|
154993
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
154994
|
+
if (s.activeAreas.length > 0) {
|
|
154995
|
+
const last = serviceArea.state.currentArea;
|
|
154996
|
+
const state = serviceArea.state;
|
|
154997
|
+
state.progress = s.activeAreas.map((id) => ({
|
|
154998
|
+
areaId: id,
|
|
154999
|
+
status: s.completedAreas.has(id) || id === last ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Skipped
|
|
155000
|
+
}));
|
|
155001
|
+
}
|
|
155002
|
+
serviceArea.state.currentArea = null;
|
|
155003
|
+
} catch {
|
|
155004
|
+
}
|
|
155005
|
+
}
|
|
155006
|
+
/**
|
|
155007
|
+
* Find the ServiceArea area ID that corresponds to a run mode value
|
|
155008
|
+
* by matching the mode label to the area location name.
|
|
155009
|
+
*/
|
|
155010
|
+
findAreaIdForMode(mode) {
|
|
155011
|
+
try {
|
|
155012
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
155013
|
+
const modeEntry = this.state.supportedModes.find((m) => m.mode === mode);
|
|
155014
|
+
if (!modeEntry) return null;
|
|
155015
|
+
const area = serviceArea.state.supportedAreas.find(
|
|
155016
|
+
(a) => a.areaInfo.locationInfo?.locationName === modeEntry.label
|
|
155017
|
+
);
|
|
155018
|
+
return area?.areaId ?? null;
|
|
155019
|
+
} catch {
|
|
155020
|
+
return null;
|
|
155021
|
+
}
|
|
155022
|
+
}
|
|
155023
|
+
changeToMode(request) {
|
|
155024
|
+
const s = getSession(this.endpoint);
|
|
155025
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
155026
|
+
const { newMode } = request;
|
|
155027
|
+
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
155028
|
+
return {
|
|
155029
|
+
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
155030
|
+
statusText: `Unsupported mode: ${newMode}`
|
|
155031
|
+
};
|
|
155032
|
+
}
|
|
155033
|
+
if (isRoomMode(newMode)) {
|
|
155034
|
+
try {
|
|
155035
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
155036
|
+
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
155037
|
+
s.activeAreas = [...serviceArea.state.selectedAreas];
|
|
155038
|
+
s.completedAreas.clear();
|
|
155039
|
+
s.lastCurrentArea = null;
|
|
155040
|
+
s.loggedShortCircuits.clear();
|
|
155041
|
+
s.pendingDispatches = [];
|
|
155042
|
+
s.cleanedAreaBaseline = this.readCleanedAreaSqm();
|
|
155043
|
+
this.trySetCurrentArea(s.activeAreas[0]);
|
|
155044
|
+
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
155045
|
+
this.state.currentMode = newMode;
|
|
155046
|
+
return {
|
|
155047
|
+
status: ModeBase3.ModeChangeStatus.Success,
|
|
155048
|
+
statusText: "Starting room cleaning"
|
|
155049
|
+
};
|
|
155050
|
+
}
|
|
155051
|
+
} catch {
|
|
155052
|
+
}
|
|
155053
|
+
if (this.state.config.cleanRoom) {
|
|
155054
|
+
const areaId = this.findAreaIdForMode(newMode);
|
|
155055
|
+
s.activeAreas = areaId !== null ? [areaId] : [];
|
|
155056
|
+
s.completedAreas.clear();
|
|
155057
|
+
s.lastCurrentArea = null;
|
|
155058
|
+
s.loggedShortCircuits.clear();
|
|
155059
|
+
s.pendingDispatches = [];
|
|
155060
|
+
this.trySetCurrentArea(areaId);
|
|
155061
|
+
homeAssistant.callAction(
|
|
155062
|
+
this.state.config.cleanRoom(newMode, this.agent)
|
|
155063
|
+
);
|
|
155064
|
+
this.state.currentMode = newMode;
|
|
155065
|
+
return {
|
|
155066
|
+
status: ModeBase3.ModeChangeStatus.Success,
|
|
155067
|
+
statusText: "Starting room cleaning"
|
|
155068
|
+
};
|
|
155069
|
+
}
|
|
155070
|
+
}
|
|
155071
|
+
switch (newMode) {
|
|
155072
|
+
case 1 /* Cleaning */: {
|
|
155073
|
+
try {
|
|
155074
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
155075
|
+
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
155076
|
+
s.activeAreas = [...serviceArea.state.selectedAreas];
|
|
155077
|
+
s.completedAreas.clear();
|
|
155078
|
+
s.lastCurrentArea = null;
|
|
155079
|
+
s.loggedShortCircuits.clear();
|
|
155080
|
+
s.pendingDispatches = [];
|
|
155081
|
+
s.cleanedAreaBaseline = this.readCleanedAreaSqm();
|
|
155082
|
+
this.trySetCurrentArea(s.activeAreas[0]);
|
|
155083
|
+
}
|
|
155084
|
+
} catch {
|
|
155085
|
+
}
|
|
155086
|
+
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
155087
|
+
break;
|
|
155088
|
+
}
|
|
155089
|
+
case 0 /* Idle */:
|
|
155090
|
+
this.finalizeProgressOnStop();
|
|
155091
|
+
s.completedAreas.clear();
|
|
155092
|
+
s.lastCurrentArea = null;
|
|
155093
|
+
s.activeAreas = [];
|
|
155094
|
+
s.loggedShortCircuits.clear();
|
|
155095
|
+
s.pendingDispatches = [];
|
|
155096
|
+
s.observedCleaning = false;
|
|
155097
|
+
s.cleanedAreaBaseline = null;
|
|
155098
|
+
homeAssistant.callAction(
|
|
155099
|
+
this.state.config.returnToBase(void 0, this.agent)
|
|
155100
|
+
);
|
|
155101
|
+
break;
|
|
155102
|
+
default:
|
|
155103
|
+
homeAssistant.callAction(this.state.config.pause(void 0, this.agent));
|
|
155104
|
+
break;
|
|
155105
|
+
}
|
|
155106
|
+
this.state.currentMode = newMode;
|
|
155107
|
+
return {
|
|
155108
|
+
status: ModeBase3.ModeChangeStatus.Success,
|
|
155109
|
+
statusText: "Mode switched"
|
|
155110
|
+
};
|
|
155111
|
+
}
|
|
155112
|
+
};
|
|
155113
|
+
((RvcRunModeServerBase2) => {
|
|
155114
|
+
class State extends RvcRunModeServer.State {
|
|
155115
|
+
config;
|
|
155116
|
+
}
|
|
155117
|
+
RvcRunModeServerBase2.State = State;
|
|
155118
|
+
})(RvcRunModeServerBase || (RvcRunModeServerBase = {}));
|
|
155119
|
+
function RvcRunModeServer2(config11, initialState) {
|
|
155120
|
+
const defaultModes = [
|
|
155121
|
+
{
|
|
155122
|
+
label: "Idle",
|
|
155123
|
+
mode: 0 /* Idle */,
|
|
155124
|
+
modeTags: [{ value: RvcRunMode3.ModeTag.Idle }]
|
|
155125
|
+
},
|
|
155126
|
+
{
|
|
155127
|
+
label: "Cleaning",
|
|
155128
|
+
mode: 1 /* Cleaning */,
|
|
155129
|
+
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
155130
|
+
}
|
|
155131
|
+
];
|
|
155132
|
+
return RvcRunModeServerBase.set({
|
|
155133
|
+
config: config11,
|
|
155134
|
+
supportedModes: initialState?.supportedModes ?? defaultModes,
|
|
155135
|
+
currentMode: initialState?.currentMode ?? 0 /* Idle */
|
|
155136
|
+
});
|
|
155137
|
+
}
|
|
155138
|
+
|
|
155139
|
+
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-run-mode-server.ts
|
|
155140
|
+
var supportedModes = [
|
|
155141
|
+
{
|
|
155142
|
+
label: "Idle",
|
|
155143
|
+
mode: 0 /* Idle */,
|
|
155144
|
+
modeTags: [{ value: RvcRunMode3.ModeTag.Idle }]
|
|
155145
|
+
},
|
|
155146
|
+
{
|
|
155147
|
+
label: "Mowing",
|
|
155148
|
+
mode: 1 /* Cleaning */,
|
|
155149
|
+
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
155150
|
+
}
|
|
155151
|
+
];
|
|
155152
|
+
function mapLawnMowerRunMode(entity) {
|
|
155153
|
+
const state = entity.state;
|
|
155154
|
+
const active = state === LawnMowerActivity.mowing || state === LawnMowerActivity.paused;
|
|
155155
|
+
return active ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
155156
|
+
}
|
|
155157
|
+
function createLawnMowerRvcRunModeServer() {
|
|
155158
|
+
return RvcRunModeServer2(
|
|
155159
|
+
{
|
|
155160
|
+
getCurrentMode: (entity) => mapLawnMowerRunMode(entity),
|
|
155161
|
+
getSupportedModes: () => supportedModes,
|
|
155162
|
+
start: () => ({ action: "lawn_mower.start_mowing" }),
|
|
155163
|
+
returnToBase: () => ({ action: "lawn_mower.dock" }),
|
|
155164
|
+
pause: (_, agent) => {
|
|
155165
|
+
const features3 = agent.get(HomeAssistantEntityBehavior).entity.state.attributes.supported_features ?? 0;
|
|
155166
|
+
if (testBit(features3, LawnMowerEntityFeature.PAUSE)) {
|
|
155167
|
+
return { action: "lawn_mower.pause" };
|
|
155168
|
+
}
|
|
155169
|
+
return { action: "lawn_mower.dock" };
|
|
155170
|
+
}
|
|
155171
|
+
},
|
|
155172
|
+
{ supportedModes, currentMode: 0 /* Idle */ }
|
|
155173
|
+
);
|
|
155174
|
+
}
|
|
155175
|
+
|
|
155176
|
+
// src/matter/endpoints/legacy/lawn-mower/index.ts
|
|
155177
|
+
var LawnMowerEndpointType = RoboticVacuumCleanerDevice.with(
|
|
155178
|
+
BasicInformationServer2,
|
|
155179
|
+
IdentifyServer2,
|
|
155180
|
+
HomeAssistantEntityBehavior,
|
|
155181
|
+
LawnMowerRvcOperationalStateServer
|
|
155182
|
+
);
|
|
155183
|
+
function LawnMowerDevice(homeAssistantEntity) {
|
|
155184
|
+
if (homeAssistantEntity.entity.state === void 0) {
|
|
155185
|
+
return void 0;
|
|
155186
|
+
}
|
|
155187
|
+
const attributes8 = homeAssistantEntity.entity.state.attributes;
|
|
155188
|
+
let device = LawnMowerEndpointType.with(
|
|
155189
|
+
createLawnMowerRvcRunModeServer()
|
|
155190
|
+
).set({ homeAssistantEntity });
|
|
155191
|
+
const hasBattery = homeAssistantEntity.mapping?.batteryEntity != null || attributes8.battery_level != null || attributes8.battery != null;
|
|
155192
|
+
if (hasBattery) {
|
|
155193
|
+
device = device.with(DefaultPowerSourceServer);
|
|
155194
|
+
}
|
|
155195
|
+
return device;
|
|
155196
|
+
}
|
|
155197
|
+
|
|
154413
155198
|
// src/matter/endpoints/legacy/light/devices/color-temperature-light.ts
|
|
154414
155199
|
init_home_assistant_entity_behavior();
|
|
154415
155200
|
|
|
@@ -154425,7 +155210,7 @@ init_nodejs();
|
|
|
154425
155210
|
|
|
154426
155211
|
// src/matter/behaviors/color-control-server.ts
|
|
154427
155212
|
init_home_assistant_entity_behavior();
|
|
154428
|
-
var
|
|
155213
|
+
var logger212 = Logger.get("ColorControlServer");
|
|
154429
155214
|
var optimisticColorState = /* @__PURE__ */ new Map();
|
|
154430
155215
|
var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
|
|
154431
155216
|
var OPTIMISTIC_TOLERANCE2 = 5;
|
|
@@ -154464,7 +155249,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
154464
155249
|
if (this.state.startUpColorTemperatureMireds == null) {
|
|
154465
155250
|
this.state.startUpColorTemperatureMireds = defaultMireds;
|
|
154466
155251
|
}
|
|
154467
|
-
|
|
155252
|
+
logger212.debug(
|
|
154468
155253
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
154469
155254
|
);
|
|
154470
155255
|
}
|
|
@@ -154965,7 +155750,7 @@ init_home_assistant_entity_behavior();
|
|
|
154965
155750
|
// src/matter/behaviors/lock-server.ts
|
|
154966
155751
|
init_esm();
|
|
154967
155752
|
init_home_assistant_entity_behavior();
|
|
154968
|
-
var
|
|
155753
|
+
var logger213 = Logger.get("LockServer");
|
|
154969
155754
|
var SUPPORTED_SLOT = 1;
|
|
154970
155755
|
function normalizeSupportedIndex(index) {
|
|
154971
155756
|
if (index === 0 || index === SUPPORTED_SLOT) {
|
|
@@ -155236,7 +156021,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
155236
156021
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
155237
156022
|
const action = this.state.config.lock(void 0, this.agent);
|
|
155238
156023
|
const hasPinProvided = !!request.pinCode;
|
|
155239
|
-
|
|
156024
|
+
logger213.debug(
|
|
155240
156025
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
155241
156026
|
);
|
|
155242
156027
|
if (request.pinCode) {
|
|
@@ -155249,12 +156034,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
155249
156034
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
155250
156035
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
155251
156036
|
const hasPinProvided = !!request.pinCode;
|
|
155252
|
-
|
|
156037
|
+
logger213.debug(
|
|
155253
156038
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
155254
156039
|
);
|
|
155255
156040
|
if (this.state.requirePinForRemoteOperation) {
|
|
155256
156041
|
if (!request.pinCode) {
|
|
155257
|
-
|
|
156042
|
+
logger213.info(
|
|
155258
156043
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
155259
156044
|
);
|
|
155260
156045
|
throw new StatusResponseError(
|
|
@@ -155264,12 +156049,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
155264
156049
|
}
|
|
155265
156050
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
155266
156051
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
155267
|
-
|
|
156052
|
+
logger213.info(
|
|
155268
156053
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
155269
156054
|
);
|
|
155270
156055
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
155271
156056
|
}
|
|
155272
|
-
|
|
156057
|
+
logger213.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
155273
156058
|
action.data = { ...action.data, code: providedPin };
|
|
155274
156059
|
}
|
|
155275
156060
|
homeAssistant.callAction(action);
|
|
@@ -155402,7 +156187,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155402
156187
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
155403
156188
|
const action = this.state.config.lock(void 0, this.agent);
|
|
155404
156189
|
const hasPinProvided = !!request.pinCode;
|
|
155405
|
-
|
|
156190
|
+
logger213.debug(
|
|
155406
156191
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
155407
156192
|
);
|
|
155408
156193
|
if (request.pinCode) {
|
|
@@ -155416,12 +156201,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155416
156201
|
const unlatchConfig = this.state.config.unlatch;
|
|
155417
156202
|
const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
|
|
155418
156203
|
const hasPinProvided = !!request.pinCode;
|
|
155419
|
-
|
|
156204
|
+
logger213.debug(
|
|
155420
156205
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
|
|
155421
156206
|
);
|
|
155422
156207
|
if (this.state.requirePinForRemoteOperation) {
|
|
155423
156208
|
if (!request.pinCode) {
|
|
155424
|
-
|
|
156209
|
+
logger213.info(
|
|
155425
156210
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
155426
156211
|
);
|
|
155427
156212
|
throw new StatusResponseError(
|
|
@@ -155431,12 +156216,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155431
156216
|
}
|
|
155432
156217
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
155433
156218
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
155434
|
-
|
|
156219
|
+
logger213.info(
|
|
155435
156220
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
155436
156221
|
);
|
|
155437
156222
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
155438
156223
|
}
|
|
155439
|
-
|
|
156224
|
+
logger213.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
155440
156225
|
action.data = { ...action.data, code: providedPin };
|
|
155441
156226
|
}
|
|
155442
156227
|
homeAssistant.callAction(action);
|
|
@@ -155451,12 +156236,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155451
156236
|
}
|
|
155452
156237
|
const action = unlatchConfig(void 0, this.agent);
|
|
155453
156238
|
const hasPinProvided = !!request.pinCode;
|
|
155454
|
-
|
|
156239
|
+
logger213.debug(
|
|
155455
156240
|
`unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
155456
156241
|
);
|
|
155457
156242
|
if (this.state.requirePinForRemoteOperation) {
|
|
155458
156243
|
if (!request.pinCode) {
|
|
155459
|
-
|
|
156244
|
+
logger213.info(
|
|
155460
156245
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
155461
156246
|
);
|
|
155462
156247
|
throw new StatusResponseError(
|
|
@@ -155466,12 +156251,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
155466
156251
|
}
|
|
155467
156252
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
155468
156253
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
155469
|
-
|
|
156254
|
+
logger213.info(
|
|
155470
156255
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
155471
156256
|
);
|
|
155472
156257
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
155473
156258
|
}
|
|
155474
|
-
|
|
156259
|
+
logger213.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
|
|
155475
156260
|
action.data = { ...action.data, code: providedPin };
|
|
155476
156261
|
}
|
|
155477
156262
|
homeAssistant.callAction(action);
|
|
@@ -155603,7 +156388,7 @@ init_home_assistant_entity_behavior();
|
|
|
155603
156388
|
init_dist();
|
|
155604
156389
|
init_esm();
|
|
155605
156390
|
init_home_assistant_entity_behavior();
|
|
155606
|
-
var
|
|
156391
|
+
var logger214 = Logger.get("MediaPlayerKeypadInputServer");
|
|
155607
156392
|
var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
155608
156393
|
sendKey(request) {
|
|
155609
156394
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -155614,12 +156399,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
|
155614
156399
|
const features3 = attributes8.supported_features ?? 0;
|
|
155615
156400
|
const action = this.mapKeyToAction(request.keyCode, features3);
|
|
155616
156401
|
if (!action) {
|
|
155617
|
-
|
|
156402
|
+
logger214.debug(
|
|
155618
156403
|
`Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
|
|
155619
156404
|
);
|
|
155620
156405
|
return { status: KeypadInput3.Status.UnsupportedKey };
|
|
155621
156406
|
}
|
|
155622
|
-
|
|
156407
|
+
logger214.debug(
|
|
155623
156408
|
`sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
|
|
155624
156409
|
);
|
|
155625
156410
|
homeAssistant.callAction({ action });
|
|
@@ -155898,7 +156683,7 @@ init_home_assistant_entity_behavior();
|
|
|
155898
156683
|
// src/matter/behaviors/speaker-level-control-server.ts
|
|
155899
156684
|
init_esm();
|
|
155900
156685
|
init_home_assistant_entity_behavior();
|
|
155901
|
-
var
|
|
156686
|
+
var logger215 = Logger.get("SpeakerLevelControlServer");
|
|
155902
156687
|
var optimisticLevelState2 = /* @__PURE__ */ new Map();
|
|
155903
156688
|
var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
|
|
155904
156689
|
var OPTIMISTIC_TOLERANCE3 = 5;
|
|
@@ -155941,7 +156726,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
155941
156726
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
155942
156727
|
}
|
|
155943
156728
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
155944
|
-
|
|
156729
|
+
logger215.debug(
|
|
155945
156730
|
`[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
|
|
155946
156731
|
);
|
|
155947
156732
|
const optimistic = optimisticLevelState2.get(entity.entity_id);
|
|
@@ -155989,7 +156774,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase8 {
|
|
|
155989
156774
|
const config11 = this.state.config;
|
|
155990
156775
|
const entityId = homeAssistant.entity.entity_id;
|
|
155991
156776
|
const levelPercent = level / 254;
|
|
155992
|
-
|
|
156777
|
+
logger215.debug(
|
|
155993
156778
|
`[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
|
|
155994
156779
|
);
|
|
155995
156780
|
const current = config11.getValuePercent(
|
|
@@ -157354,7 +158139,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
|
|
|
157354
158139
|
};
|
|
157355
158140
|
|
|
157356
158141
|
// src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
|
|
157357
|
-
var
|
|
158142
|
+
var logger216 = Logger.get("TvocSensor");
|
|
157358
158143
|
function airQualityFromUgm3(value) {
|
|
157359
158144
|
if (value <= 300) return AirQuality3.AirQualityEnum.Good;
|
|
157360
158145
|
if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
|
|
@@ -157395,17 +158180,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
157395
158180
|
const attributes8 = entity.state.attributes;
|
|
157396
158181
|
const deviceClass = attributes8.device_class;
|
|
157397
158182
|
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
157398
|
-
|
|
158183
|
+
logger216.debug(
|
|
157399
158184
|
`[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
|
|
157400
158185
|
);
|
|
157401
158186
|
if (state != null && !Number.isNaN(+state)) {
|
|
157402
158187
|
const value = +state;
|
|
157403
158188
|
airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
|
|
157404
|
-
|
|
158189
|
+
logger216.debug(
|
|
157405
158190
|
`[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
|
|
157406
158191
|
);
|
|
157407
158192
|
} else {
|
|
157408
|
-
|
|
158193
|
+
logger216.warn(
|
|
157409
158194
|
`[${entity.entity_id}] TVOC state not a valid number: "${state}"`
|
|
157410
158195
|
);
|
|
157411
158196
|
}
|
|
@@ -157619,7 +158404,7 @@ init_home_assistant_entity_behavior();
|
|
|
157619
158404
|
// src/matter/behaviors/pm25-concentration-measurement-server.ts
|
|
157620
158405
|
init_esm();
|
|
157621
158406
|
init_home_assistant_entity_behavior();
|
|
157622
|
-
var
|
|
158407
|
+
var logger217 = Logger.get("Pm25ConcentrationMeasurementServer");
|
|
157623
158408
|
var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
|
|
157624
158409
|
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
157625
158410
|
);
|
|
@@ -157643,11 +158428,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
157643
158428
|
if (this.state.measurementMedium === void 0) {
|
|
157644
158429
|
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
157645
158430
|
}
|
|
157646
|
-
|
|
158431
|
+
logger217.debug(
|
|
157647
158432
|
"Pm25ConcentrationMeasurementServer: before super.initialize()"
|
|
157648
158433
|
);
|
|
157649
158434
|
await super.initialize();
|
|
157650
|
-
|
|
158435
|
+
logger217.debug(
|
|
157651
158436
|
"Pm25ConcentrationMeasurementServer: after super.initialize()"
|
|
157652
158437
|
);
|
|
157653
158438
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -157670,7 +158455,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
157670
158455
|
};
|
|
157671
158456
|
|
|
157672
158457
|
// src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
|
|
157673
|
-
var
|
|
158458
|
+
var logger218 = Logger.get("Pm25AirQualityServer");
|
|
157674
158459
|
var Pm25AirQualityServerBase = AirQualityServer.with(
|
|
157675
158460
|
AirQuality3.Feature.Fair,
|
|
157676
158461
|
AirQuality3.Feature.Moderate,
|
|
@@ -157682,9 +158467,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
|
|
|
157682
158467
|
if (this.state.airQuality === void 0) {
|
|
157683
158468
|
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
157684
158469
|
}
|
|
157685
|
-
|
|
158470
|
+
logger218.debug("Pm25AirQualityServer: before super.initialize()");
|
|
157686
158471
|
await super.initialize();
|
|
157687
|
-
|
|
158472
|
+
logger218.debug("Pm25AirQualityServer: after super.initialize()");
|
|
157688
158473
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
157689
158474
|
this.update(homeAssistant.entity);
|
|
157690
158475
|
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
@@ -158073,7 +158858,7 @@ init_home_assistant_entity_behavior();
|
|
|
158073
158858
|
init_dist();
|
|
158074
158859
|
init_esm();
|
|
158075
158860
|
init_home_assistant_entity_behavior();
|
|
158076
|
-
var
|
|
158861
|
+
var logger219 = Logger.get("VacuumIdentifyServer");
|
|
158077
158862
|
var IDENTIFY_BUTTON_SUFFIXES = ["_identify", "_locate", "_find_me"];
|
|
158078
158863
|
var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
158079
158864
|
triggerEffect(effect) {
|
|
@@ -158090,19 +158875,19 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
158090
158875
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
158091
158876
|
const features3 = homeAssistant.entity.state.attributes.supported_features ?? 0;
|
|
158092
158877
|
if (testBit(features3, VacuumDeviceFeature.LOCATE)) {
|
|
158093
|
-
|
|
158878
|
+
logger219.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
|
|
158094
158879
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
158095
158880
|
return;
|
|
158096
158881
|
}
|
|
158097
158882
|
const sibling = this.#findIdentifyButton(homeAssistant);
|
|
158098
158883
|
if (sibling) {
|
|
158099
|
-
|
|
158884
|
+
logger219.info(
|
|
158100
158885
|
`${source} \u2192 button.press ${sibling} for ${homeAssistant.entityId}`
|
|
158101
158886
|
);
|
|
158102
158887
|
homeAssistant.callAction({ action: "button.press", target: sibling });
|
|
158103
158888
|
return;
|
|
158104
158889
|
}
|
|
158105
|
-
|
|
158890
|
+
logger219.warn(
|
|
158106
158891
|
`${source} for ${homeAssistant.entityId}, LOCATE not in supported_features (${features3}), trying vacuum.locate anyway`
|
|
158107
158892
|
);
|
|
158108
158893
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
@@ -158125,533 +158910,6 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
158125
158910
|
}
|
|
158126
158911
|
};
|
|
158127
158912
|
|
|
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
158913
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
158656
158914
|
init_dist();
|
|
158657
158915
|
init_esm();
|
|
@@ -158828,14 +159086,14 @@ init_esm();
|
|
|
158828
159086
|
|
|
158829
159087
|
// src/matter/behaviors/service-area-server.ts
|
|
158830
159088
|
init_esm();
|
|
158831
|
-
var
|
|
159089
|
+
var logger220 = Logger.get("ServiceAreaServer");
|
|
158832
159090
|
var ServiceAreaWithProgress = ServiceAreaBehavior.with(
|
|
158833
159091
|
ServiceArea3.Feature.ProgressReporting
|
|
158834
159092
|
);
|
|
158835
159093
|
var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
158836
159094
|
selectAreas(request) {
|
|
158837
159095
|
const { newAreas } = request;
|
|
158838
|
-
|
|
159096
|
+
logger220.info(
|
|
158839
159097
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
158840
159098
|
);
|
|
158841
159099
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -158844,7 +159102,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
158844
159102
|
(id) => !supportedAreaIds.includes(id)
|
|
158845
159103
|
);
|
|
158846
159104
|
if (invalidAreas.length > 0) {
|
|
158847
|
-
|
|
159105
|
+
logger220.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
158848
159106
|
return {
|
|
158849
159107
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
158850
159108
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -158856,7 +159114,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
158856
159114
|
status: ServiceArea3.OperationalStatus.Pending
|
|
158857
159115
|
}));
|
|
158858
159116
|
this.state.currentArea = null;
|
|
158859
|
-
|
|
159117
|
+
logger220.info(
|
|
158860
159118
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
158861
159119
|
);
|
|
158862
159120
|
return {
|
|
@@ -158877,7 +159135,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
158877
159135
|
ServiceAreaServerBase2.State = State;
|
|
158878
159136
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
158879
159137
|
function ServiceAreaServer2(initialState) {
|
|
158880
|
-
|
|
159138
|
+
logger220.info(
|
|
158881
159139
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
158882
159140
|
);
|
|
158883
159141
|
return ServiceAreaServerBase.set({
|
|
@@ -158894,7 +159152,7 @@ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
|
|
|
158894
159152
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
|
|
158895
159153
|
selectAreas(request) {
|
|
158896
159154
|
const { newAreas } = request;
|
|
158897
|
-
|
|
159155
|
+
logger220.info(
|
|
158898
159156
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
158899
159157
|
);
|
|
158900
159158
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -158903,7 +159161,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158903
159161
|
(id) => !supportedAreaIds.includes(id)
|
|
158904
159162
|
);
|
|
158905
159163
|
if (invalidAreas.length > 0) {
|
|
158906
|
-
|
|
159164
|
+
logger220.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
158907
159165
|
return {
|
|
158908
159166
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
158909
159167
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -158915,7 +159173,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158915
159173
|
status: ServiceArea3.OperationalStatus.Pending
|
|
158916
159174
|
}));
|
|
158917
159175
|
this.state.currentArea = null;
|
|
158918
|
-
|
|
159176
|
+
logger220.info(
|
|
158919
159177
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
158920
159178
|
);
|
|
158921
159179
|
return {
|
|
@@ -158936,14 +159194,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
158936
159194
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
158937
159195
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
158938
159196
|
function ServiceAreaServerWithMaps(initialState) {
|
|
158939
|
-
|
|
159197
|
+
logger220.info(
|
|
158940
159198
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
158941
159199
|
);
|
|
158942
159200
|
for (const map of initialState.supportedMaps) {
|
|
158943
159201
|
const areaCount = initialState.supportedAreas.filter(
|
|
158944
159202
|
(a) => a.mapId === map.mapId
|
|
158945
159203
|
).length;
|
|
158946
|
-
|
|
159204
|
+
logger220.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
158947
159205
|
}
|
|
158948
159206
|
return ServiceAreaServerWithMapsBase.set({
|
|
158949
159207
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -158955,7 +159213,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
158955
159213
|
}
|
|
158956
159214
|
|
|
158957
159215
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
158958
|
-
var
|
|
159216
|
+
var logger221 = Logger.get("VacuumServiceAreaServer");
|
|
158959
159217
|
function toAreaId(roomId) {
|
|
158960
159218
|
if (typeof roomId === "number") {
|
|
158961
159219
|
return roomId;
|
|
@@ -159034,13 +159292,13 @@ function createVacuumServiceAreaServer(attributes8, roomEntities, includeUnnamed
|
|
|
159034
159292
|
let rooms;
|
|
159035
159293
|
if (roomEntities && roomEntities.length > 0) {
|
|
159036
159294
|
rooms = buttonEntitiesToRooms(roomEntities, attributes8);
|
|
159037
|
-
|
|
159295
|
+
logger221.info(
|
|
159038
159296
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
159039
159297
|
);
|
|
159040
159298
|
} else {
|
|
159041
159299
|
rooms = parseVacuumRooms(attributes8, includeUnnamedRooms);
|
|
159042
159300
|
if (rooms.length > 0) {
|
|
159043
|
-
|
|
159301
|
+
logger221.info(
|
|
159044
159302
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
159045
159303
|
);
|
|
159046
159304
|
}
|
|
@@ -159094,7 +159352,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
159094
159352
|
landmarkInfo: null
|
|
159095
159353
|
}
|
|
159096
159354
|
}));
|
|
159097
|
-
|
|
159355
|
+
logger221.info(
|
|
159098
159356
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
159099
159357
|
);
|
|
159100
159358
|
return ServiceAreaServer2({
|
|
@@ -159116,7 +159374,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
159116
159374
|
landmarkInfo: null
|
|
159117
159375
|
}
|
|
159118
159376
|
}));
|
|
159119
|
-
|
|
159377
|
+
logger221.info(
|
|
159120
159378
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
|
|
159121
159379
|
);
|
|
159122
159380
|
return ServiceAreaServer2({
|
|
@@ -159127,11 +159385,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
159127
159385
|
}
|
|
159128
159386
|
|
|
159129
159387
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
159130
|
-
var
|
|
159388
|
+
var logger222 = Logger.get("VacuumRvcRunModeServer");
|
|
159131
159389
|
function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
|
|
159132
159390
|
const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
159133
159391
|
const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
|
|
159134
|
-
|
|
159392
|
+
logger222.info(
|
|
159135
159393
|
`Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
|
|
159136
159394
|
);
|
|
159137
159395
|
return {
|
|
@@ -159236,14 +159494,14 @@ function mergeBatchData(areas) {
|
|
|
159236
159494
|
function handleCustomServiceAreas(selectedAreas, customAreas, session) {
|
|
159237
159495
|
const matched = selectedAreas.map((areaId) => ({ areaId, area: customAreas[areaId - 1] })).filter((m) => !!m.area);
|
|
159238
159496
|
if (matched.length === 0) {
|
|
159239
|
-
|
|
159497
|
+
logger222.warn(
|
|
159240
159498
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
159241
159499
|
);
|
|
159242
159500
|
return { action: "vacuum.start" };
|
|
159243
159501
|
}
|
|
159244
159502
|
const batchArea = matched.find(({ area }) => area.batchDispatch === true);
|
|
159245
159503
|
if (batchArea) {
|
|
159246
|
-
|
|
159504
|
+
logger222.info(
|
|
159247
159505
|
`Custom service areas (batch): single call for ${matched.length} room(s): ${matched.map(({ area }) => area.name).join(", ")}`
|
|
159248
159506
|
);
|
|
159249
159507
|
session.pendingDispatches = [];
|
|
@@ -159264,7 +159522,7 @@ function handleCustomServiceAreas(selectedAreas, customAreas, session) {
|
|
|
159264
159522
|
}
|
|
159265
159523
|
};
|
|
159266
159524
|
}
|
|
159267
|
-
|
|
159525
|
+
logger222.info(
|
|
159268
159526
|
`Custom service areas: ${matched.length} room(s) queued: ${matched.map(({ area }) => `${area.service} (${area.name})`).join(", ")}`
|
|
159269
159527
|
);
|
|
159270
159528
|
session.pendingDispatches = matched.slice(1).map(({ areaId, area }) => ({
|
|
@@ -159300,7 +159558,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159300
159558
|
VacuumState.paused
|
|
159301
159559
|
];
|
|
159302
159560
|
const isCleaning = cleaningStates.includes(state);
|
|
159303
|
-
|
|
159561
|
+
logger222.debug(
|
|
159304
159562
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
159305
159563
|
);
|
|
159306
159564
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -159334,7 +159592,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159334
159592
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
159335
159593
|
const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
|
|
159336
159594
|
if (haAreaIds.length > 0) {
|
|
159337
|
-
|
|
159595
|
+
logger222.info(
|
|
159338
159596
|
`CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
|
|
159339
159597
|
);
|
|
159340
159598
|
return {
|
|
@@ -159353,7 +159611,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159353
159611
|
}
|
|
159354
159612
|
}
|
|
159355
159613
|
if (matched.length > 0) {
|
|
159356
|
-
|
|
159614
|
+
logger222.info(
|
|
159357
159615
|
`Roborock: ${matched.length} room button(s) queued: ${matched.map((m) => m.entityId).join(", ")}`
|
|
159358
159616
|
);
|
|
159359
159617
|
session.pendingDispatches = matched.slice(1).map(({ areaId, entityId }) => ({
|
|
@@ -159387,14 +159645,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
159387
159645
|
}
|
|
159388
159646
|
}
|
|
159389
159647
|
if (roomIds.length > 0) {
|
|
159390
|
-
|
|
159648
|
+
logger222.info(
|
|
159391
159649
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
159392
159650
|
);
|
|
159393
159651
|
if (isDreameVacuum(attributes8)) {
|
|
159394
159652
|
if (targetMapName) {
|
|
159395
159653
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
159396
159654
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
159397
|
-
|
|
159655
|
+
logger222.info(
|
|
159398
159656
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
159399
159657
|
);
|
|
159400
159658
|
homeAssistant.callAction({
|
|
@@ -159421,7 +159679,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159421
159679
|
}
|
|
159422
159680
|
if (isEcovacsVacuum(attributes8)) {
|
|
159423
159681
|
const roomIdStr = roomIds.join(",");
|
|
159424
|
-
|
|
159682
|
+
logger222.info(
|
|
159425
159683
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
159426
159684
|
);
|
|
159427
159685
|
return {
|
|
@@ -159436,14 +159694,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
159436
159694
|
}
|
|
159437
159695
|
};
|
|
159438
159696
|
}
|
|
159439
|
-
|
|
159697
|
+
logger222.warn(
|
|
159440
159698
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
159441
159699
|
);
|
|
159442
159700
|
}
|
|
159443
159701
|
}
|
|
159444
159702
|
} catch {
|
|
159445
159703
|
}
|
|
159446
|
-
|
|
159704
|
+
logger222.info("Starting regular cleaning (no areas selected)");
|
|
159447
159705
|
return { action: "vacuum.start" };
|
|
159448
159706
|
},
|
|
159449
159707
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -159458,7 +159716,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159458
159716
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
159459
159717
|
const entity = homeAssistant.entity;
|
|
159460
159718
|
const attributes8 = entity.state.attributes;
|
|
159461
|
-
|
|
159719
|
+
logger222.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
159462
159720
|
const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
|
|
159463
159721
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
159464
159722
|
const sorted = [...cleanAreaRooms].sort(
|
|
@@ -159467,7 +159725,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159467
159725
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
159468
159726
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
159469
159727
|
const area = sorted[areaIndex];
|
|
159470
|
-
|
|
159728
|
+
logger222.info(
|
|
159471
159729
|
`cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
|
|
159472
159730
|
);
|
|
159473
159731
|
return {
|
|
@@ -159484,7 +159742,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159484
159742
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
159485
159743
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
159486
159744
|
const area = sorted[areaIndex];
|
|
159487
|
-
|
|
159745
|
+
logger222.info(
|
|
159488
159746
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
159489
159747
|
);
|
|
159490
159748
|
return {
|
|
@@ -159505,7 +159763,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159505
159763
|
}
|
|
159506
159764
|
const rooms = parseVacuumRooms(attributes8);
|
|
159507
159765
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
159508
|
-
|
|
159766
|
+
logger222.info(
|
|
159509
159767
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
159510
159768
|
);
|
|
159511
159769
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -159515,7 +159773,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159515
159773
|
if (room.mapName) {
|
|
159516
159774
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
159517
159775
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
159518
|
-
|
|
159776
|
+
logger222.info(
|
|
159519
159777
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
159520
159778
|
);
|
|
159521
159779
|
homeAssistant.callAction({
|
|
@@ -159524,7 +159782,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159524
159782
|
data: { option: room.mapName }
|
|
159525
159783
|
});
|
|
159526
159784
|
}
|
|
159527
|
-
|
|
159785
|
+
logger222.debug(
|
|
159528
159786
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
159529
159787
|
);
|
|
159530
159788
|
return {
|
|
@@ -159535,7 +159793,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159535
159793
|
};
|
|
159536
159794
|
}
|
|
159537
159795
|
if (isRoborockVacuum(attributes8) || isXiaomiMiotVacuum(attributes8)) {
|
|
159538
|
-
|
|
159796
|
+
logger222.debug(
|
|
159539
159797
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
159540
159798
|
);
|
|
159541
159799
|
return {
|
|
@@ -159548,7 +159806,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159548
159806
|
}
|
|
159549
159807
|
if (isEcovacsVacuum(attributes8)) {
|
|
159550
159808
|
const roomIdStr = String(commandId3);
|
|
159551
|
-
|
|
159809
|
+
logger222.info(
|
|
159552
159810
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
159553
159811
|
);
|
|
159554
159812
|
return {
|
|
@@ -159563,7 +159821,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
159563
159821
|
}
|
|
159564
159822
|
};
|
|
159565
159823
|
}
|
|
159566
|
-
|
|
159824
|
+
logger222.warn(
|
|
159567
159825
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
159568
159826
|
);
|
|
159569
159827
|
}
|
|
@@ -159574,31 +159832,31 @@ function createVacuumRvcRunModeServer(attributes8, includeUnnamedRooms = false,
|
|
|
159574
159832
|
const allRooms = parseVacuumRooms(attributes8, true);
|
|
159575
159833
|
const rooms = includeUnnamedRooms ? allRooms : parseVacuumRooms(attributes8, false);
|
|
159576
159834
|
const filteredCount = allRooms.length - rooms.length;
|
|
159577
|
-
const
|
|
159835
|
+
const supportedModes2 = buildSupportedModes2(
|
|
159578
159836
|
attributes8,
|
|
159579
159837
|
includeUnnamedRooms,
|
|
159580
159838
|
customAreas,
|
|
159581
159839
|
disableRoomModes
|
|
159582
159840
|
);
|
|
159583
|
-
|
|
159584
|
-
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${
|
|
159841
|
+
logger222.info(
|
|
159842
|
+
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes2.length} total modes`
|
|
159585
159843
|
);
|
|
159586
159844
|
if (rooms.length > 0) {
|
|
159587
|
-
|
|
159845
|
+
logger222.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
159588
159846
|
}
|
|
159589
159847
|
if (filteredCount > 0) {
|
|
159590
159848
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
159591
|
-
|
|
159849
|
+
logger222.info(
|
|
159592
159850
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
159593
159851
|
);
|
|
159594
159852
|
}
|
|
159595
159853
|
if (allRooms.length === 0) {
|
|
159596
|
-
|
|
159854
|
+
logger222.debug(
|
|
159597
159855
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes8.rooms)}, segments=${JSON.stringify(attributes8.segments)}, room_list=${attributes8.room_list}`
|
|
159598
159856
|
);
|
|
159599
159857
|
}
|
|
159600
159858
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
159601
|
-
supportedModes,
|
|
159859
|
+
supportedModes: supportedModes2,
|
|
159602
159860
|
currentMode: 0 /* Idle */
|
|
159603
159861
|
});
|
|
159604
159862
|
}
|
|
@@ -159627,7 +159885,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
|
|
|
159627
159885
|
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
159628
159886
|
});
|
|
159629
159887
|
}
|
|
159630
|
-
|
|
159888
|
+
logger222.info(
|
|
159631
159889
|
`Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
|
|
159632
159890
|
);
|
|
159633
159891
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
@@ -159687,7 +159945,7 @@ init_nodejs();
|
|
|
159687
159945
|
|
|
159688
159946
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
159689
159947
|
init_home_assistant_entity_behavior();
|
|
159690
|
-
var
|
|
159948
|
+
var logger223 = Logger.get("RvcCleanModeServerBase");
|
|
159691
159949
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
159692
159950
|
// Pending mode from a recent changeToMode command.
|
|
159693
159951
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -159734,14 +159992,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
159734
159992
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
159735
159993
|
const { newMode } = request;
|
|
159736
159994
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
159737
|
-
|
|
159995
|
+
logger223.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
159738
159996
|
return {
|
|
159739
159997
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
159740
159998
|
statusText: `Unsupported mode: ${newMode}`
|
|
159741
159999
|
};
|
|
159742
160000
|
}
|
|
159743
160001
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
159744
|
-
|
|
160002
|
+
logger223.info(
|
|
159745
160003
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
159746
160004
|
);
|
|
159747
160005
|
this.pendingMode = newMode;
|
|
@@ -159749,7 +160007,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
159749
160007
|
this.state.currentMode = newMode;
|
|
159750
160008
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
159751
160009
|
if (action) {
|
|
159752
|
-
|
|
160010
|
+
logger223.info(
|
|
159753
160011
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
159754
160012
|
);
|
|
159755
160013
|
homeAssistant.callAction(action);
|
|
@@ -159782,7 +160040,7 @@ function RvcCleanModeServer2(config11, initialState) {
|
|
|
159782
160040
|
}
|
|
159783
160041
|
|
|
159784
160042
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
159785
|
-
var
|
|
160043
|
+
var logger224 = Logger.get("VacuumRvcCleanModeServer");
|
|
159786
160044
|
var MODE_VACUUM = 0;
|
|
159787
160045
|
var MODE_VACUUM_AND_MOP = 1;
|
|
159788
160046
|
var MODE_MOP = 2;
|
|
@@ -160052,7 +160310,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
160052
160310
|
const match = availableOptions.find((o) => classifyCleanOption(o) === type);
|
|
160053
160311
|
if (match) return match;
|
|
160054
160312
|
}
|
|
160055
|
-
|
|
160313
|
+
logger224.warn(
|
|
160056
160314
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
160057
160315
|
);
|
|
160058
160316
|
return availableOptions[0];
|
|
@@ -160061,7 +160319,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
160061
160319
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
160062
160320
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
160063
160321
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
160064
|
-
|
|
160322
|
+
logger224.info(
|
|
160065
160323
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
160066
160324
|
);
|
|
160067
160325
|
return {
|
|
@@ -160150,7 +160408,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160150
160408
|
}
|
|
160151
160409
|
}
|
|
160152
160410
|
if (speedMode !== void 0) {
|
|
160153
|
-
|
|
160411
|
+
logger224.debug(
|
|
160154
160412
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
160155
160413
|
);
|
|
160156
160414
|
return speedMode;
|
|
@@ -160171,7 +160429,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160171
160429
|
}
|
|
160172
160430
|
}
|
|
160173
160431
|
if (mopMode !== void 0) {
|
|
160174
|
-
|
|
160432
|
+
logger224.debug(
|
|
160175
160433
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
160176
160434
|
);
|
|
160177
160435
|
return mopMode;
|
|
@@ -160189,14 +160447,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160189
160447
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
160190
160448
|
const vacuumEntityId = homeAssistant.entityId;
|
|
160191
160449
|
const mapping = homeAssistant.state.mapping;
|
|
160192
|
-
|
|
160450
|
+
logger224.info(
|
|
160193
160451
|
`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
160452
|
);
|
|
160195
160453
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
160196
160454
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
160197
160455
|
const mopName = mopIntensityList[mopIndex];
|
|
160198
160456
|
if (!mopName) {
|
|
160199
|
-
|
|
160457
|
+
logger224.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
160200
160458
|
return void 0;
|
|
160201
160459
|
}
|
|
160202
160460
|
if (hasCleanTypes) {
|
|
@@ -160209,18 +160467,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160209
160467
|
mapping.mopIntensityEntity,
|
|
160210
160468
|
agent
|
|
160211
160469
|
);
|
|
160212
|
-
|
|
160470
|
+
logger224.info(
|
|
160213
160471
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
160214
160472
|
);
|
|
160215
160473
|
let option = matchMopIntensityOption(mopName, options);
|
|
160216
160474
|
if (!option && options && mopIndex < options.length) {
|
|
160217
160475
|
option = options[mopIndex];
|
|
160218
|
-
|
|
160476
|
+
logger224.info(
|
|
160219
160477
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
160220
160478
|
);
|
|
160221
160479
|
}
|
|
160222
160480
|
if (option) {
|
|
160223
|
-
|
|
160481
|
+
logger224.info(
|
|
160224
160482
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
160225
160483
|
);
|
|
160226
160484
|
return {
|
|
@@ -160229,11 +160487,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160229
160487
|
target: mapping.mopIntensityEntity
|
|
160230
160488
|
};
|
|
160231
160489
|
}
|
|
160232
|
-
|
|
160490
|
+
logger224.warn(
|
|
160233
160491
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
160234
160492
|
);
|
|
160235
160493
|
} else {
|
|
160236
|
-
|
|
160494
|
+
logger224.warn(
|
|
160237
160495
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
160238
160496
|
);
|
|
160239
160497
|
}
|
|
@@ -160243,7 +160501,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160243
160501
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
160244
160502
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
160245
160503
|
if (!fanSpeedName) {
|
|
160246
|
-
|
|
160504
|
+
logger224.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
160247
160505
|
return void 0;
|
|
160248
160506
|
}
|
|
160249
160507
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -160256,7 +160514,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160256
160514
|
mapping.suctionLevelEntity,
|
|
160257
160515
|
agent
|
|
160258
160516
|
);
|
|
160259
|
-
|
|
160517
|
+
logger224.info(
|
|
160260
160518
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
160261
160519
|
);
|
|
160262
160520
|
let option = matchFanSpeedOption(
|
|
@@ -160266,12 +160524,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160266
160524
|
);
|
|
160267
160525
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
160268
160526
|
option = options[fanSpeedIndex];
|
|
160269
|
-
|
|
160527
|
+
logger224.info(
|
|
160270
160528
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
160271
160529
|
);
|
|
160272
160530
|
}
|
|
160273
160531
|
if (option) {
|
|
160274
|
-
|
|
160532
|
+
logger224.info(
|
|
160275
160533
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
160276
160534
|
);
|
|
160277
160535
|
return {
|
|
@@ -160280,7 +160538,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160280
160538
|
target: mapping.suctionLevelEntity
|
|
160281
160539
|
};
|
|
160282
160540
|
}
|
|
160283
|
-
|
|
160541
|
+
logger224.warn(
|
|
160284
160542
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
160285
160543
|
);
|
|
160286
160544
|
return void 0;
|
|
@@ -160290,7 +160548,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160290
160548
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
160291
160549
|
);
|
|
160292
160550
|
}
|
|
160293
|
-
|
|
160551
|
+
logger224.info(
|
|
160294
160552
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
160295
160553
|
);
|
|
160296
160554
|
return {
|
|
@@ -160300,7 +160558,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160300
160558
|
};
|
|
160301
160559
|
}
|
|
160302
160560
|
if (!hasCleanTypes) {
|
|
160303
|
-
|
|
160561
|
+
logger224.debug(
|
|
160304
160562
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
160305
160563
|
);
|
|
160306
160564
|
return void 0;
|
|
@@ -160312,7 +160570,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160312
160570
|
agent
|
|
160313
160571
|
);
|
|
160314
160572
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
160315
|
-
|
|
160573
|
+
logger224.info(
|
|
160316
160574
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
160317
160575
|
);
|
|
160318
160576
|
return {
|
|
@@ -160324,20 +160582,20 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
160324
160582
|
};
|
|
160325
160583
|
}
|
|
160326
160584
|
function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityList, cleaningModeOptions, customFanSpeedTags) {
|
|
160327
|
-
const
|
|
160585
|
+
const supportedModes2 = buildSupportedModes3(
|
|
160328
160586
|
fanSpeedList,
|
|
160329
160587
|
mopIntensityList,
|
|
160330
160588
|
cleaningModeOptions,
|
|
160331
160589
|
customFanSpeedTags
|
|
160332
160590
|
);
|
|
160333
|
-
|
|
160334
|
-
`Creating VacuumRvcCleanModeServer with ${
|
|
160591
|
+
logger224.info(
|
|
160592
|
+
`Creating VacuumRvcCleanModeServer with ${supportedModes2.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
160335
160593
|
);
|
|
160336
|
-
|
|
160337
|
-
`Modes: ${
|
|
160594
|
+
logger224.info(
|
|
160595
|
+
`Modes: ${supportedModes2.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
160338
160596
|
);
|
|
160339
160597
|
const initialState = {
|
|
160340
|
-
supportedModes,
|
|
160598
|
+
supportedModes: supportedModes2,
|
|
160341
160599
|
currentMode: MODE_VACUUM
|
|
160342
160600
|
};
|
|
160343
160601
|
return RvcCleanModeServer2(
|
|
@@ -160396,141 +160654,7 @@ function resolveMopIntensityList(mopIntensityEntity) {
|
|
|
160396
160654
|
init_dist();
|
|
160397
160655
|
init_esm();
|
|
160398
160656
|
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");
|
|
160657
|
+
var logger225 = Logger.get("VacuumRvcOperationalStateServer");
|
|
160534
160658
|
function isCharging(entity) {
|
|
160535
160659
|
const attrs = entity.attributes;
|
|
160536
160660
|
if (attrs.is_charging === true || attrs.charging === true) return true;
|
|
@@ -160575,16 +160699,16 @@ function mapVacuumOperationalState(entity) {
|
|
|
160575
160699
|
operationalState = RvcOperationalState4.OperationalState.Error;
|
|
160576
160700
|
} else {
|
|
160577
160701
|
if (state.toLowerCase().includes("clean")) {
|
|
160578
|
-
|
|
160702
|
+
logger225.info(
|
|
160579
160703
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
160580
160704
|
);
|
|
160581
160705
|
operationalState = RvcOperationalState4.OperationalState.Running;
|
|
160582
160706
|
} else {
|
|
160583
|
-
|
|
160707
|
+
logger225.info(`Unknown vacuum state "${state}", treating as Stopped`);
|
|
160584
160708
|
operationalState = RvcOperationalState4.OperationalState.Stopped;
|
|
160585
160709
|
}
|
|
160586
160710
|
}
|
|
160587
|
-
|
|
160711
|
+
logger225.debug(
|
|
160588
160712
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState4.OperationalState[operationalState]}`
|
|
160589
160713
|
);
|
|
160590
160714
|
return operationalState;
|
|
@@ -160609,7 +160733,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
160609
160733
|
});
|
|
160610
160734
|
|
|
160611
160735
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
160612
|
-
var
|
|
160736
|
+
var logger226 = Logger.get("VacuumDevice");
|
|
160613
160737
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
160614
160738
|
BasicInformationServer2,
|
|
160615
160739
|
VacuumIdentifyServer,
|
|
@@ -160623,7 +160747,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
160623
160747
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
160624
160748
|
const attributes8 = homeAssistantEntity.entity.state.attributes;
|
|
160625
160749
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
160626
|
-
|
|
160750
|
+
logger226.info(
|
|
160627
160751
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
160628
160752
|
);
|
|
160629
160753
|
const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
|
|
@@ -160636,32 +160760,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
160636
160760
|
)
|
|
160637
160761
|
).set({ homeAssistantEntity });
|
|
160638
160762
|
if (includeOnOff) {
|
|
160639
|
-
|
|
160763
|
+
logger226.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
160640
160764
|
device = device.with(VacuumOnOffServer);
|
|
160641
160765
|
}
|
|
160642
160766
|
device = device.with(VacuumPowerSourceServer);
|
|
160643
160767
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
160644
160768
|
const rooms = parseVacuumRooms(attributes8);
|
|
160645
|
-
|
|
160769
|
+
logger226.info(
|
|
160646
160770
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
|
|
160647
160771
|
);
|
|
160648
160772
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
160649
|
-
|
|
160773
|
+
logger226.info(
|
|
160650
160774
|
`${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
|
|
160651
160775
|
);
|
|
160652
160776
|
device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
|
|
160653
160777
|
} else if (customAreas && customAreas.length > 0) {
|
|
160654
|
-
|
|
160778
|
+
logger226.info(
|
|
160655
160779
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
160656
160780
|
);
|
|
160657
160781
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
160658
160782
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
160659
|
-
|
|
160783
|
+
logger226.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
160660
160784
|
device = device.with(
|
|
160661
160785
|
createVacuumServiceAreaServer(attributes8, roomEntities)
|
|
160662
160786
|
);
|
|
160663
160787
|
} else {
|
|
160664
|
-
|
|
160788
|
+
logger226.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
160665
160789
|
device = device.with(createDefaultServiceAreaServer());
|
|
160666
160790
|
}
|
|
160667
160791
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -160672,7 +160796,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
160672
160796
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
160673
160797
|
);
|
|
160674
160798
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
160675
|
-
|
|
160799
|
+
logger226.info(
|
|
160676
160800
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
160677
160801
|
);
|
|
160678
160802
|
device = device.with(
|
|
@@ -160685,7 +160809,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
160685
160809
|
)
|
|
160686
160810
|
);
|
|
160687
160811
|
} else {
|
|
160688
|
-
|
|
160812
|
+
logger226.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
160689
160813
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
160690
160814
|
}
|
|
160691
160815
|
return device;
|
|
@@ -160851,7 +160975,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
160851
160975
|
);
|
|
160852
160976
|
|
|
160853
160977
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
160854
|
-
var
|
|
160978
|
+
var logger227 = Logger.get("WaterHeaterDevice");
|
|
160855
160979
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
160856
160980
|
BasicInformationServer2,
|
|
160857
160981
|
IdentifyServer2,
|
|
@@ -160867,7 +160991,7 @@ function toMatterTemp2(value) {
|
|
|
160867
160991
|
}
|
|
160868
160992
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
160869
160993
|
const attributes8 = homeAssistantEntity.entity.state.attributes;
|
|
160870
|
-
|
|
160994
|
+
logger227.debug(
|
|
160871
160995
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes8.min_temp}, max_temp=${attributes8.max_temp}`
|
|
160872
160996
|
);
|
|
160873
160997
|
const minLimit = toMatterTemp2(attributes8.min_temp) ?? 0;
|
|
@@ -161015,6 +161139,7 @@ var deviceCtrs = {
|
|
|
161015
161139
|
siren: SirenDevice,
|
|
161016
161140
|
media_player: MediaPlayerDevice,
|
|
161017
161141
|
humidifier: HumidifierDevice,
|
|
161142
|
+
lawn_mower: LawnMowerDevice,
|
|
161018
161143
|
vacuum: VacuumDevice,
|
|
161019
161144
|
valve: ValveDevice,
|
|
161020
161145
|
alarm_control_panel: AlarmControlPanelDevice,
|
|
@@ -161044,6 +161169,7 @@ var matterDeviceTypeFactories = {
|
|
|
161044
161169
|
fan: FanDevice2,
|
|
161045
161170
|
air_purifier: AirPurifierEndpoint,
|
|
161046
161171
|
robot_vacuum_cleaner: (ha) => VacuumDevice(ha),
|
|
161172
|
+
robotic_lawn_mower: (ha) => LawnMowerDevice(ha),
|
|
161047
161173
|
humidifier_dehumidifier: HumidifierDevice,
|
|
161048
161174
|
speaker: SpeakerMediaPlayerDevice,
|
|
161049
161175
|
basic_video_player: VideoPlayerDevice,
|
|
@@ -161077,7 +161203,7 @@ var matterDeviceTypeFactories = {
|
|
|
161077
161203
|
};
|
|
161078
161204
|
|
|
161079
161205
|
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
161080
|
-
var
|
|
161206
|
+
var logger228 = Logger.get("UserComposedEndpoint");
|
|
161081
161207
|
function stripBasicInformation(type) {
|
|
161082
161208
|
const behaviors = { ...type.behaviors };
|
|
161083
161209
|
delete behaviors.bridgedDeviceBasicInformation;
|
|
@@ -161133,7 +161259,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161133
161259
|
{ vacuumOnOff: registry2.isVacuumOnOffEnabled() }
|
|
161134
161260
|
);
|
|
161135
161261
|
if (!primaryType) {
|
|
161136
|
-
|
|
161262
|
+
logger228.warn(
|
|
161137
161263
|
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
161138
161264
|
);
|
|
161139
161265
|
return void 0;
|
|
@@ -161148,7 +161274,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161148
161274
|
if (!sub.entityId) continue;
|
|
161149
161275
|
const subPayload = buildEntityPayload4(registry2, sub.entityId);
|
|
161150
161276
|
if (!subPayload) {
|
|
161151
|
-
|
|
161277
|
+
logger228.warn(
|
|
161152
161278
|
`Cannot find entity state for composed sub-entity ${sub.entityId}`
|
|
161153
161279
|
);
|
|
161154
161280
|
continue;
|
|
@@ -161159,7 +161285,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161159
161285
|
};
|
|
161160
161286
|
const subType = createLegacyEndpointType(subPayload, subMapping);
|
|
161161
161287
|
if (!subType) {
|
|
161162
|
-
|
|
161288
|
+
logger228.warn(
|
|
161163
161289
|
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
161164
161290
|
);
|
|
161165
161291
|
continue;
|
|
@@ -161172,7 +161298,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161172
161298
|
mappedIds.push(sub.entityId);
|
|
161173
161299
|
}
|
|
161174
161300
|
if (parts.length < 2) {
|
|
161175
|
-
|
|
161301
|
+
logger228.warn(
|
|
161176
161302
|
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
161177
161303
|
);
|
|
161178
161304
|
return void 0;
|
|
@@ -161195,7 +161321,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
161195
161321
|
const labels = parts.map(
|
|
161196
161322
|
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
161197
161323
|
).join("+");
|
|
161198
|
-
|
|
161324
|
+
logger228.info(
|
|
161199
161325
|
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
161200
161326
|
);
|
|
161201
161327
|
return endpoint;
|
|
@@ -161283,7 +161409,7 @@ function asStandaloneEndpointType(type) {
|
|
|
161283
161409
|
}
|
|
161284
161410
|
|
|
161285
161411
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
161286
|
-
var
|
|
161412
|
+
var logger229 = Logger.get("LegacyEndpoint");
|
|
161287
161413
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
161288
161414
|
static async create(registry2, entityId, mapping, pluginDomainMappings, standalone = false) {
|
|
161289
161415
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -161293,25 +161419,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161293
161419
|
return;
|
|
161294
161420
|
}
|
|
161295
161421
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
161296
|
-
|
|
161422
|
+
logger229.debug(
|
|
161297
161423
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
161298
161424
|
);
|
|
161299
161425
|
return;
|
|
161300
161426
|
}
|
|
161301
161427
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
161302
|
-
|
|
161428
|
+
logger229.debug(
|
|
161303
161429
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
161304
161430
|
);
|
|
161305
161431
|
return;
|
|
161306
161432
|
}
|
|
161307
161433
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
161308
|
-
|
|
161434
|
+
logger229.debug(
|
|
161309
161435
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
161310
161436
|
);
|
|
161311
161437
|
return;
|
|
161312
161438
|
}
|
|
161313
161439
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
161314
|
-
|
|
161440
|
+
logger229.debug(
|
|
161315
161441
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
161316
161442
|
);
|
|
161317
161443
|
return;
|
|
@@ -161331,7 +161457,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161331
161457
|
humidityEntity: humidityEntityId
|
|
161332
161458
|
};
|
|
161333
161459
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
161334
|
-
|
|
161460
|
+
logger229.debug(
|
|
161335
161461
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
161336
161462
|
);
|
|
161337
161463
|
}
|
|
@@ -161350,7 +161476,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161350
161476
|
pressureEntity: pressureEntityId
|
|
161351
161477
|
};
|
|
161352
161478
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
161353
|
-
|
|
161479
|
+
logger229.debug(
|
|
161354
161480
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
161355
161481
|
);
|
|
161356
161482
|
}
|
|
@@ -161368,7 +161494,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161368
161494
|
batteryEntity: batteryEntityId
|
|
161369
161495
|
};
|
|
161370
161496
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
161371
|
-
|
|
161497
|
+
logger229.debug(
|
|
161372
161498
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
161373
161499
|
);
|
|
161374
161500
|
}
|
|
@@ -161386,7 +161512,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161386
161512
|
powerEntity: powerEntityId
|
|
161387
161513
|
};
|
|
161388
161514
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
161389
|
-
|
|
161515
|
+
logger229.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
161390
161516
|
}
|
|
161391
161517
|
}
|
|
161392
161518
|
}
|
|
@@ -161403,7 +161529,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161403
161529
|
energyEntity: energyEntityId
|
|
161404
161530
|
};
|
|
161405
161531
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
161406
|
-
|
|
161532
|
+
logger229.debug(
|
|
161407
161533
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
161408
161534
|
);
|
|
161409
161535
|
}
|
|
@@ -161419,7 +161545,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161419
161545
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161420
161546
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
161421
161547
|
};
|
|
161422
|
-
|
|
161548
|
+
logger229.info(
|
|
161423
161549
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
161424
161550
|
);
|
|
161425
161551
|
}
|
|
@@ -161429,7 +161555,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161429
161555
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161430
161556
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
161431
161557
|
};
|
|
161432
|
-
|
|
161558
|
+
logger229.info(
|
|
161433
161559
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
161434
161560
|
);
|
|
161435
161561
|
}
|
|
@@ -161439,7 +161565,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161439
161565
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161440
161566
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
161441
161567
|
};
|
|
161442
|
-
|
|
161568
|
+
logger229.info(
|
|
161443
161569
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
161444
161570
|
);
|
|
161445
161571
|
}
|
|
@@ -161449,7 +161575,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161449
161575
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161450
161576
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
161451
161577
|
};
|
|
161452
|
-
|
|
161578
|
+
logger229.info(
|
|
161453
161579
|
`Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
|
|
161454
161580
|
);
|
|
161455
161581
|
}
|
|
@@ -161464,7 +161590,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161464
161590
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
161465
161591
|
cleanAreaRooms
|
|
161466
161592
|
};
|
|
161467
|
-
|
|
161593
|
+
logger229.info(
|
|
161468
161594
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
161469
161595
|
);
|
|
161470
161596
|
}
|
|
@@ -161485,7 +161611,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161485
161611
|
rooms: roomsObj
|
|
161486
161612
|
}
|
|
161487
161613
|
};
|
|
161488
|
-
|
|
161614
|
+
logger229.debug(
|
|
161489
161615
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
161490
161616
|
);
|
|
161491
161617
|
} else {
|
|
@@ -161502,7 +161628,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161502
161628
|
rooms: roomsObj
|
|
161503
161629
|
}
|
|
161504
161630
|
};
|
|
161505
|
-
|
|
161631
|
+
logger229.debug(
|
|
161506
161632
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
161507
161633
|
);
|
|
161508
161634
|
}
|
|
@@ -161511,7 +161637,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161511
161637
|
}
|
|
161512
161638
|
}
|
|
161513
161639
|
if (standalone && ((effectiveMapping?.composedEntities?.length ?? 0) > 0 || effectiveMapping?.climateExposeFan === true)) {
|
|
161514
|
-
|
|
161640
|
+
logger229.warn(
|
|
161515
161641
|
`Composed mappings are not supported in server mode, exposing ${entityId} as a flat standalone endpoint`
|
|
161516
161642
|
);
|
|
161517
161643
|
}
|
|
@@ -161528,7 +161654,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161528
161654
|
if (composed) {
|
|
161529
161655
|
return composed;
|
|
161530
161656
|
}
|
|
161531
|
-
|
|
161657
|
+
logger229.warn(
|
|
161532
161658
|
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
161533
161659
|
);
|
|
161534
161660
|
}
|
|
@@ -161587,7 +161713,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161587
161713
|
if (composed) {
|
|
161588
161714
|
return composed;
|
|
161589
161715
|
}
|
|
161590
|
-
|
|
161716
|
+
logger229.warn(
|
|
161591
161717
|
`Companion fan creation failed for ${entityId}, falling back to standalone`
|
|
161592
161718
|
);
|
|
161593
161719
|
}
|
|
@@ -161654,11 +161780,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
161654
161780
|
}
|
|
161655
161781
|
if (mappedChanged) {
|
|
161656
161782
|
this.pendingMappedChange = true;
|
|
161657
|
-
|
|
161783
|
+
logger229.debug(
|
|
161658
161784
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
161659
161785
|
);
|
|
161660
161786
|
}
|
|
161661
|
-
|
|
161787
|
+
logger229.debug(
|
|
161662
161788
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
161663
161789
|
);
|
|
161664
161790
|
this.lastState = state;
|
|
@@ -161711,7 +161837,7 @@ import {
|
|
|
161711
161837
|
getCollection
|
|
161712
161838
|
} from "home-assistant-js-websocket";
|
|
161713
161839
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
161714
|
-
var
|
|
161840
|
+
var logger230 = Logger.get("SubscribeEntities");
|
|
161715
161841
|
function processEvent(store, updates) {
|
|
161716
161842
|
const state = { ...store.state };
|
|
161717
161843
|
if (updates.a) {
|
|
@@ -161737,7 +161863,7 @@ function processEvent(store, updates) {
|
|
|
161737
161863
|
for (const entityId in updates.c) {
|
|
161738
161864
|
let entityState = state[entityId];
|
|
161739
161865
|
if (!entityState) {
|
|
161740
|
-
|
|
161866
|
+
logger230.warn("Received state update for unknown entity", entityId);
|
|
161741
161867
|
continue;
|
|
161742
161868
|
}
|
|
161743
161869
|
entityState = { ...entityState };
|
|
@@ -161826,7 +161952,7 @@ var subscribeEntities = (conn, onChange, entityIds) => {
|
|
|
161826
161952
|
// src/services/bridges/entity-isolation-service.ts
|
|
161827
161953
|
init_esm();
|
|
161828
161954
|
init_diagnostic_event_bus();
|
|
161829
|
-
var
|
|
161955
|
+
var logger231 = Logger.get("EntityIsolation");
|
|
161830
161956
|
var EntityIsolationServiceImpl = class {
|
|
161831
161957
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
161832
161958
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -161891,13 +162017,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
161891
162017
|
}
|
|
161892
162018
|
const parsed = this.parseEndpointPath(msg);
|
|
161893
162019
|
if (!parsed) {
|
|
161894
|
-
|
|
162020
|
+
logger231.warn("Could not parse entity from error:", msg);
|
|
161895
162021
|
return false;
|
|
161896
162022
|
}
|
|
161897
162023
|
const { bridgeId, entityName } = parsed;
|
|
161898
162024
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
161899
162025
|
if (!callback) {
|
|
161900
|
-
|
|
162026
|
+
logger231.warn(
|
|
161901
162027
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
161902
162028
|
);
|
|
161903
162029
|
return false;
|
|
@@ -161908,7 +162034,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
161908
162034
|
}
|
|
161909
162035
|
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
161910
162036
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
161911
|
-
|
|
162037
|
+
logger231.warn(
|
|
161912
162038
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
161913
162039
|
);
|
|
161914
162040
|
diagnosticEventBus.emit("entity_error", `Entity isolated: ${entityName}`, {
|
|
@@ -161920,7 +162046,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
161920
162046
|
await callback(entityName);
|
|
161921
162047
|
return true;
|
|
161922
162048
|
} catch (e) {
|
|
161923
|
-
|
|
162049
|
+
logger231.error(`Failed to isolate entity ${entityName}:`, e);
|
|
161924
162050
|
return false;
|
|
161925
162051
|
}
|
|
161926
162052
|
}
|
|
@@ -163264,11 +163390,11 @@ function makeWarmStartState(state, now = (/* @__PURE__ */ new Date()).toISOStrin
|
|
|
163264
163390
|
return { ...state, last_updated: now };
|
|
163265
163391
|
}
|
|
163266
163392
|
var ServerModeBridge = class {
|
|
163267
|
-
constructor(
|
|
163393
|
+
constructor(logger234, dataProvider, endpointManager, server) {
|
|
163268
163394
|
this.dataProvider = dataProvider;
|
|
163269
163395
|
this.endpointManager = endpointManager;
|
|
163270
163396
|
this.server = server;
|
|
163271
|
-
this.log =
|
|
163397
|
+
this.log = logger234.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
163272
163398
|
}
|
|
163273
163399
|
dataProvider;
|
|
163274
163400
|
endpointManager;
|
|
@@ -163902,7 +164028,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
163902
164028
|
}
|
|
163903
164029
|
|
|
163904
164030
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
163905
|
-
var
|
|
164031
|
+
var logger232 = Logger.get("ServerModeVacuumEndpoint");
|
|
163906
164032
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
163907
164033
|
static async create(registry2, entityId, mapping) {
|
|
163908
164034
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -163912,7 +164038,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163912
164038
|
return void 0;
|
|
163913
164039
|
}
|
|
163914
164040
|
let effectiveMapping = mapping;
|
|
163915
|
-
|
|
164041
|
+
logger232.info(
|
|
163916
164042
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
163917
164043
|
);
|
|
163918
164044
|
if (entity.device_id) {
|
|
@@ -163927,15 +164053,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163927
164053
|
batteryEntity: batteryEntityId
|
|
163928
164054
|
};
|
|
163929
164055
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
163930
|
-
|
|
164056
|
+
logger232.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
163931
164057
|
} else {
|
|
163932
164058
|
const attrs = state.attributes;
|
|
163933
164059
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
163934
|
-
|
|
164060
|
+
logger232.info(
|
|
163935
164061
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
163936
164062
|
);
|
|
163937
164063
|
} else {
|
|
163938
|
-
|
|
164064
|
+
logger232.warn(
|
|
163939
164065
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
163940
164066
|
);
|
|
163941
164067
|
}
|
|
@@ -163950,7 +164076,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163950
164076
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163951
164077
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
163952
164078
|
};
|
|
163953
|
-
|
|
164079
|
+
logger232.info(
|
|
163954
164080
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
163955
164081
|
);
|
|
163956
164082
|
}
|
|
@@ -163960,7 +164086,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163960
164086
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163961
164087
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
163962
164088
|
};
|
|
163963
|
-
|
|
164089
|
+
logger232.info(
|
|
163964
164090
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
163965
164091
|
);
|
|
163966
164092
|
}
|
|
@@ -163970,7 +164096,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163970
164096
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163971
164097
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
163972
164098
|
};
|
|
163973
|
-
|
|
164099
|
+
logger232.info(
|
|
163974
164100
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
163975
164101
|
);
|
|
163976
164102
|
}
|
|
@@ -163980,7 +164106,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163980
164106
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163981
164107
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
163982
164108
|
};
|
|
163983
|
-
|
|
164109
|
+
logger232.info(
|
|
163984
164110
|
`${entityId}: Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity}`
|
|
163985
164111
|
);
|
|
163986
164112
|
}
|
|
@@ -163995,7 +164121,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
163995
164121
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
163996
164122
|
cleanAreaRooms
|
|
163997
164123
|
};
|
|
163998
|
-
|
|
164124
|
+
logger232.info(
|
|
163999
164125
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
164000
164126
|
);
|
|
164001
164127
|
}
|
|
@@ -164016,7 +164142,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
164016
164142
|
rooms: roomsObj
|
|
164017
164143
|
}
|
|
164018
164144
|
};
|
|
164019
|
-
|
|
164145
|
+
logger232.info(
|
|
164020
164146
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
164021
164147
|
);
|
|
164022
164148
|
} else {
|
|
@@ -164033,14 +164159,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
164033
164159
|
rooms: roomsObj
|
|
164034
164160
|
}
|
|
164035
164161
|
};
|
|
164036
|
-
|
|
164162
|
+
logger232.info(
|
|
164037
164163
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
164038
164164
|
);
|
|
164039
164165
|
}
|
|
164040
164166
|
}
|
|
164041
164167
|
}
|
|
164042
164168
|
} else {
|
|
164043
|
-
|
|
164169
|
+
logger232.warn(`${entityId}: No device_id, cannot auto-assign battery`);
|
|
164044
164170
|
}
|
|
164045
164171
|
const payload = {
|
|
164046
164172
|
entity_id: entityId,
|
|
@@ -164112,11 +164238,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
164112
164238
|
}
|
|
164113
164239
|
if (mappedChanged) {
|
|
164114
164240
|
this.pendingMappedChange = true;
|
|
164115
|
-
|
|
164241
|
+
logger232.debug(
|
|
164116
164242
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
164117
164243
|
);
|
|
164118
164244
|
}
|
|
164119
|
-
|
|
164245
|
+
logger232.debug(
|
|
164120
164246
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
164121
164247
|
);
|
|
164122
164248
|
this.lastState = state;
|
|
@@ -164601,10 +164727,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
164601
164727
|
// src/core/ioc/app-environment.ts
|
|
164602
164728
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
164603
164729
|
constructor(rootEnv, options) {
|
|
164604
|
-
const
|
|
164730
|
+
const logger234 = rootEnv.get(LoggerService);
|
|
164605
164731
|
super({
|
|
164606
164732
|
id: "App",
|
|
164607
|
-
log:
|
|
164733
|
+
log: logger234.get("AppContainer"),
|
|
164608
164734
|
parent: rootEnv
|
|
164609
164735
|
});
|
|
164610
164736
|
this.options = options;
|
|
@@ -164618,8 +164744,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
164618
164744
|
}
|
|
164619
164745
|
construction;
|
|
164620
164746
|
async init() {
|
|
164621
|
-
const
|
|
164622
|
-
this.set(LoggerService,
|
|
164747
|
+
const logger234 = this.get(LoggerService);
|
|
164748
|
+
this.set(LoggerService, logger234);
|
|
164623
164749
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
164624
164750
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
164625
164751
|
this.set(
|
|
@@ -164636,7 +164762,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
164636
164762
|
);
|
|
164637
164763
|
this.set(
|
|
164638
164764
|
HomeAssistantClient,
|
|
164639
|
-
new HomeAssistantClient(
|
|
164765
|
+
new HomeAssistantClient(logger234, this.options.homeAssistant)
|
|
164640
164766
|
);
|
|
164641
164767
|
this.set(
|
|
164642
164768
|
HomeAssistantConfig,
|
|
@@ -164644,7 +164770,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
164644
164770
|
);
|
|
164645
164771
|
this.set(
|
|
164646
164772
|
HomeAssistantActions,
|
|
164647
|
-
new HomeAssistantActions(
|
|
164773
|
+
new HomeAssistantActions(logger234, await this.load(HomeAssistantClient))
|
|
164648
164774
|
);
|
|
164649
164775
|
this.set(
|
|
164650
164776
|
HomeAssistantRegistry,
|
|
@@ -164680,7 +164806,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
164680
164806
|
this.set(
|
|
164681
164807
|
WebApi,
|
|
164682
164808
|
new WebApi(
|
|
164683
|
-
|
|
164809
|
+
logger234,
|
|
164684
164810
|
await this.load(BridgeService),
|
|
164685
164811
|
await this.load(HomeAssistantClient),
|
|
164686
164812
|
await this.load(HomeAssistantRegistry),
|
|
@@ -164705,7 +164831,7 @@ init_esm();
|
|
|
164705
164831
|
init_nodejs();
|
|
164706
164832
|
|
|
164707
164833
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
164708
|
-
var
|
|
164834
|
+
var logger233 = Logger.get("PatchLevelControlTlv");
|
|
164709
164835
|
function patchLevelControlTlv() {
|
|
164710
164836
|
let patched = 0;
|
|
164711
164837
|
const moveToLevelFields = LevelControl3.MoveToLevelRequest.fieldDefinitions;
|
|
@@ -164719,11 +164845,11 @@ function patchLevelControlTlv() {
|
|
|
164719
164845
|
patched++;
|
|
164720
164846
|
}
|
|
164721
164847
|
if (patched > 0) {
|
|
164722
|
-
|
|
164848
|
+
logger233.info(
|
|
164723
164849
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
164724
164850
|
);
|
|
164725
164851
|
} else {
|
|
164726
|
-
|
|
164852
|
+
logger233.warn(
|
|
164727
164853
|
"Failed to patch LevelControl TLV schemas, field definitions not found. Google Home brightness adjustment may not work."
|
|
164728
164854
|
);
|
|
164729
164855
|
}
|
|
@@ -167015,13 +167141,13 @@ export {
|
|
|
167015
167141
|
@matter/main/dist/esm/forwards/behaviors/smoke-co-alarm.js:
|
|
167016
167142
|
@matter/main/dist/esm/forwards/behaviors/operational-state.js:
|
|
167017
167143
|
@matter/main/dist/esm/forwards/clusters/operational-state.js:
|
|
167018
|
-
@matter/main/dist/esm/forwards/behaviors/
|
|
167019
|
-
@matter/main/dist/esm/forwards/
|
|
167144
|
+
@matter/main/dist/esm/forwards/behaviors/rvc-operational-state.js:
|
|
167145
|
+
@matter/main/dist/esm/forwards/clusters/rvc-operational-state.js:
|
|
167020
167146
|
@matter/main/dist/esm/forwards/clusters/mode-base.js:
|
|
167021
167147
|
@matter/main/dist/esm/forwards/clusters/rvc-run-mode.js:
|
|
167148
|
+
@matter/main/dist/esm/forwards/behaviors/color-control.js:
|
|
167149
|
+
@matter/main/dist/esm/forwards/behaviors/pump-configuration-and-control.js:
|
|
167022
167150
|
@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
167151
|
@matter/main/dist/esm/forwards/clusters/level-control.js:
|
|
167026
167152
|
(**
|
|
167027
167153
|
* @license
|