@riddix/hamh 2.1.0-alpha.538 → 2.1.0-alpha.539
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/backend/cli.js
CHANGED
|
@@ -1743,8 +1743,8 @@ var init_Cancelable = __esm({
|
|
|
1743
1743
|
};
|
|
1744
1744
|
return result;
|
|
1745
1745
|
}
|
|
1746
|
-
static set logger(
|
|
1747
|
-
this.#logger =
|
|
1746
|
+
static set logger(logger205) {
|
|
1747
|
+
this.#logger = logger205;
|
|
1748
1748
|
}
|
|
1749
1749
|
static get logger() {
|
|
1750
1750
|
return this.#logger;
|
|
@@ -3422,13 +3422,13 @@ var init_Logger = __esm({
|
|
|
3422
3422
|
*
|
|
3423
3423
|
* @deprecated use {@link destinations}
|
|
3424
3424
|
*/
|
|
3425
|
-
static addLogger(identifier,
|
|
3425
|
+
static addLogger(identifier, logger205, options) {
|
|
3426
3426
|
if (identifier in this.destinations) {
|
|
3427
3427
|
throw new ImplementationError(`Logger "${identifier}" already exists`);
|
|
3428
3428
|
}
|
|
3429
3429
|
const dest = LogDestination({ name: identifier });
|
|
3430
3430
|
const legacy = adaptDestinationToLegacy(dest);
|
|
3431
|
-
legacy.log =
|
|
3431
|
+
legacy.log = logger205;
|
|
3432
3432
|
if (options?.defaultLogLevel !== void 0) {
|
|
3433
3433
|
legacy.defaultLogLevel = options.defaultLogLevel;
|
|
3434
3434
|
}
|
|
@@ -5538,8 +5538,8 @@ function Construction(subject, initializer) {
|
|
|
5538
5538
|
}
|
|
5539
5539
|
}
|
|
5540
5540
|
function unhandledError(...args) {
|
|
5541
|
-
const
|
|
5542
|
-
|
|
5541
|
+
const logger205 = Logger.get(subject.constructor.name);
|
|
5542
|
+
logger205.error(...args);
|
|
5543
5543
|
}
|
|
5544
5544
|
function createErrorHandler(name) {
|
|
5545
5545
|
return (e) => {
|
|
@@ -135998,11 +135998,11 @@ var init_Api = __esm({
|
|
|
135998
135998
|
}
|
|
135999
135999
|
Api2.resourceFor = resourceFor;
|
|
136000
136000
|
function log(level, facility, id, ...message) {
|
|
136001
|
-
let
|
|
136002
|
-
if (!
|
|
136003
|
-
loggers.set(facility,
|
|
136001
|
+
let logger205 = loggers.get(facility);
|
|
136002
|
+
if (!logger205) {
|
|
136003
|
+
loggers.set(facility, logger205 = Logger.get(facility));
|
|
136004
136004
|
}
|
|
136005
|
-
|
|
136005
|
+
logger205[level](Diagnostic.via(id || "(anon)"), message);
|
|
136006
136006
|
}
|
|
136007
136007
|
Api2.log = log;
|
|
136008
136008
|
function logRequest(facility, id, method, target) {
|
|
@@ -147221,10 +147221,10 @@ var init_home_assistant_actions = __esm({
|
|
|
147221
147221
|
circuitBreakerResetMs: 3e4
|
|
147222
147222
|
};
|
|
147223
147223
|
HomeAssistantActions = class extends Service {
|
|
147224
|
-
constructor(
|
|
147224
|
+
constructor(logger205, client, config10) {
|
|
147225
147225
|
super("HomeAssistantActions");
|
|
147226
147226
|
this.client = client;
|
|
147227
|
-
this.log =
|
|
147227
|
+
this.log = logger205.get(this);
|
|
147228
147228
|
this.config = { ...defaultConfig, ...config10 };
|
|
147229
147229
|
this.circuitBreaker = new CircuitBreaker(
|
|
147230
147230
|
this.config.circuitBreakerThreshold,
|
|
@@ -147596,10 +147596,10 @@ var DiagnosticService = class {
|
|
|
147596
147596
|
};
|
|
147597
147597
|
|
|
147598
147598
|
// src/api/access-log.ts
|
|
147599
|
-
function accessLogger(
|
|
147599
|
+
function accessLogger(logger205) {
|
|
147600
147600
|
return (req, res, next) => {
|
|
147601
147601
|
res.on("finish", () => {
|
|
147602
|
-
|
|
147602
|
+
logger205.debug(
|
|
147603
147603
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
147604
147604
|
);
|
|
147605
147605
|
});
|
|
@@ -151268,7 +151268,7 @@ var WebSocketApi = class {
|
|
|
151268
151268
|
|
|
151269
151269
|
// src/api/web-api.ts
|
|
151270
151270
|
var WebApi = class extends Service {
|
|
151271
|
-
constructor(
|
|
151271
|
+
constructor(logger205, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
|
|
151272
151272
|
super("WebApi");
|
|
151273
151273
|
this.bridgeService = bridgeService;
|
|
151274
151274
|
this.haClient = haClient;
|
|
@@ -151279,8 +151279,8 @@ var WebApi = class extends Service {
|
|
|
151279
151279
|
this.settingsStorage = settingsStorage;
|
|
151280
151280
|
this.backupService = backupService;
|
|
151281
151281
|
this.props = props;
|
|
151282
|
-
this.logger =
|
|
151283
|
-
this.log =
|
|
151282
|
+
this.logger = logger205;
|
|
151283
|
+
this.log = logger205.get(this);
|
|
151284
151284
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
151285
151285
|
this.startTime = Date.now();
|
|
151286
151286
|
this.wsApi = new WebSocketApi(
|
|
@@ -151724,12 +151724,12 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
151724
151724
|
|
|
151725
151725
|
// src/core/app/storage.ts
|
|
151726
151726
|
function storage(environment, options) {
|
|
151727
|
-
const
|
|
151727
|
+
const logger205 = environment.get(LoggerService).get("CustomStorage");
|
|
151728
151728
|
const location2 = resolveStorageLocation(options.location);
|
|
151729
151729
|
fs8.mkdirSync(location2, { recursive: true });
|
|
151730
151730
|
const storageService = environment.get(StorageService);
|
|
151731
151731
|
storageService.location = location2;
|
|
151732
|
-
storageService.factory = (ns) => new CustomStorage(
|
|
151732
|
+
storageService.factory = (ns) => new CustomStorage(logger205, path8.resolve(location2, ns));
|
|
151733
151733
|
}
|
|
151734
151734
|
function resolveStorageLocation(storageLocation) {
|
|
151735
151735
|
const homedir = os4.homedir();
|
|
@@ -152281,10 +152281,10 @@ import {
|
|
|
152281
152281
|
getConfig
|
|
152282
152282
|
} from "home-assistant-js-websocket";
|
|
152283
152283
|
var HomeAssistantClient = class extends Service {
|
|
152284
|
-
constructor(
|
|
152284
|
+
constructor(logger205, options) {
|
|
152285
152285
|
super("HomeAssistantClient");
|
|
152286
152286
|
this.options = options;
|
|
152287
|
-
this.log =
|
|
152287
|
+
this.log = logger205.get(this);
|
|
152288
152288
|
}
|
|
152289
152289
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
152290
152290
|
_connection;
|
|
@@ -167069,10 +167069,10 @@ function ensureCommissioningConfig(server) {
|
|
|
167069
167069
|
var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
167070
167070
|
var DEAD_SESSION_TIMEOUT_MS = 6e4;
|
|
167071
167071
|
var Bridge = class {
|
|
167072
|
-
constructor(env,
|
|
167072
|
+
constructor(env, logger205, dataProvider, endpointManager) {
|
|
167073
167073
|
this.dataProvider = dataProvider;
|
|
167074
167074
|
this.endpointManager = endpointManager;
|
|
167075
|
-
this.log =
|
|
167075
|
+
this.log = logger205.get(`Bridge / ${dataProvider.id}`);
|
|
167076
167076
|
this.server = new BridgeServerNode(
|
|
167077
167077
|
env,
|
|
167078
167078
|
this.dataProvider,
|
|
@@ -175639,6 +175639,9 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
175639
175639
|
}
|
|
175640
175640
|
};
|
|
175641
175641
|
|
|
175642
|
+
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
175643
|
+
init_esm();
|
|
175644
|
+
|
|
175642
175645
|
// ../../node_modules/.pnpm/@matter+main@0.16.10/node_modules/@matter/main/dist/esm/forwards/clusters/mode-base.js
|
|
175643
175646
|
init_nodejs();
|
|
175644
175647
|
init_mode_base();
|
|
@@ -175649,6 +175652,7 @@ init_rvc_run_mode();
|
|
|
175649
175652
|
|
|
175650
175653
|
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
175651
175654
|
init_home_assistant_entity_behavior();
|
|
175655
|
+
var logger189 = Logger.get("RvcRunModeServer");
|
|
175652
175656
|
var ROOM_MODE_BASE = 100;
|
|
175653
175657
|
function isRoomMode(mode) {
|
|
175654
175658
|
return mode >= ROOM_MODE_BASE;
|
|
@@ -175664,13 +175668,49 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175664
175668
|
if (!entity.state) {
|
|
175665
175669
|
return;
|
|
175666
175670
|
}
|
|
175671
|
+
const previousMode = this.state.currentMode;
|
|
175672
|
+
const newMode = this.state.config.getCurrentMode(entity.state, this.agent);
|
|
175667
175673
|
applyPatchState(this.state, {
|
|
175668
|
-
currentMode:
|
|
175674
|
+
currentMode: newMode,
|
|
175669
175675
|
supportedModes: this.state.config.getSupportedModes(
|
|
175670
175676
|
entity.state,
|
|
175671
175677
|
this.agent
|
|
175672
175678
|
)
|
|
175673
175679
|
});
|
|
175680
|
+
if (previousMode !== newMode && newMode === 0 /* Idle */) {
|
|
175681
|
+
this.trySetCurrentArea(null);
|
|
175682
|
+
}
|
|
175683
|
+
}
|
|
175684
|
+
/**
|
|
175685
|
+
* Safely update ServiceArea.currentArea.
|
|
175686
|
+
* No-op if ServiceArea is not available on this endpoint.
|
|
175687
|
+
*/
|
|
175688
|
+
trySetCurrentArea(areaId) {
|
|
175689
|
+
try {
|
|
175690
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175691
|
+
if (serviceArea.state.currentArea !== areaId) {
|
|
175692
|
+
serviceArea.state.currentArea = areaId;
|
|
175693
|
+
logger189.debug(`currentArea set to ${areaId}`);
|
|
175694
|
+
}
|
|
175695
|
+
} catch {
|
|
175696
|
+
}
|
|
175697
|
+
}
|
|
175698
|
+
/**
|
|
175699
|
+
* Find the ServiceArea area ID that corresponds to a run mode value
|
|
175700
|
+
* by matching the mode label to the area location name.
|
|
175701
|
+
*/
|
|
175702
|
+
findAreaIdForMode(mode) {
|
|
175703
|
+
try {
|
|
175704
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175705
|
+
const modeEntry = this.state.supportedModes.find((m) => m.mode === mode);
|
|
175706
|
+
if (!modeEntry) return null;
|
|
175707
|
+
const area = serviceArea.state.supportedAreas.find(
|
|
175708
|
+
(a) => a.areaInfo.locationInfo?.locationName === modeEntry.label
|
|
175709
|
+
);
|
|
175710
|
+
return area?.areaId ?? null;
|
|
175711
|
+
} catch {
|
|
175712
|
+
return null;
|
|
175713
|
+
}
|
|
175674
175714
|
}
|
|
175675
175715
|
changeToMode(request) {
|
|
175676
175716
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -175685,6 +175725,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175685
175725
|
try {
|
|
175686
175726
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175687
175727
|
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
175728
|
+
this.trySetCurrentArea(serviceArea.state.selectedAreas[0]);
|
|
175688
175729
|
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
175689
175730
|
return {
|
|
175690
175731
|
status: ModeBase3.ModeChangeStatus.Success,
|
|
@@ -175694,6 +175735,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175694
175735
|
} catch {
|
|
175695
175736
|
}
|
|
175696
175737
|
if (this.state.config.cleanRoom) {
|
|
175738
|
+
this.trySetCurrentArea(this.findAreaIdForMode(newMode));
|
|
175697
175739
|
homeAssistant.callAction(
|
|
175698
175740
|
this.state.config.cleanRoom(newMode, this.agent)
|
|
175699
175741
|
);
|
|
@@ -175704,10 +175746,19 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175704
175746
|
}
|
|
175705
175747
|
}
|
|
175706
175748
|
switch (newMode) {
|
|
175707
|
-
case 1 /* Cleaning */:
|
|
175749
|
+
case 1 /* Cleaning */: {
|
|
175750
|
+
try {
|
|
175751
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175752
|
+
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
175753
|
+
this.trySetCurrentArea(serviceArea.state.selectedAreas[0]);
|
|
175754
|
+
}
|
|
175755
|
+
} catch {
|
|
175756
|
+
}
|
|
175708
175757
|
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
175709
175758
|
break;
|
|
175759
|
+
}
|
|
175710
175760
|
case 0 /* Idle */:
|
|
175761
|
+
this.trySetCurrentArea(null);
|
|
175711
175762
|
homeAssistant.callAction(
|
|
175712
175763
|
this.state.config.returnToBase(void 0, this.agent)
|
|
175713
175764
|
);
|
|
@@ -175924,11 +175975,11 @@ init_esm();
|
|
|
175924
175975
|
|
|
175925
175976
|
// src/matter/behaviors/service-area-server.ts
|
|
175926
175977
|
init_esm();
|
|
175927
|
-
var
|
|
175978
|
+
var logger190 = Logger.get("ServiceAreaServer");
|
|
175928
175979
|
var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
175929
175980
|
selectAreas(request) {
|
|
175930
175981
|
const { newAreas } = request;
|
|
175931
|
-
|
|
175982
|
+
logger190.info(
|
|
175932
175983
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
175933
175984
|
);
|
|
175934
175985
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -175937,14 +175988,14 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
|
175937
175988
|
(id) => !supportedAreaIds.includes(id)
|
|
175938
175989
|
);
|
|
175939
175990
|
if (invalidAreas.length > 0) {
|
|
175940
|
-
|
|
175991
|
+
logger190.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
175941
175992
|
return {
|
|
175942
175993
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
175943
175994
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
175944
175995
|
};
|
|
175945
175996
|
}
|
|
175946
175997
|
this.state.selectedAreas = uniqueAreas;
|
|
175947
|
-
|
|
175998
|
+
logger190.info(
|
|
175948
175999
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
175949
176000
|
);
|
|
175950
176001
|
return {
|
|
@@ -175965,7 +176016,7 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
|
175965
176016
|
ServiceAreaServerBase2.State = State;
|
|
175966
176017
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
175967
176018
|
function ServiceAreaServer2(initialState) {
|
|
175968
|
-
|
|
176019
|
+
logger190.info(
|
|
175969
176020
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
175970
176021
|
);
|
|
175971
176022
|
return ServiceAreaServerBase.set({
|
|
@@ -175978,7 +176029,7 @@ var ServiceAreaWithMaps = ServiceAreaBehavior.with(ServiceArea3.Feature.Maps);
|
|
|
175978
176029
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
175979
176030
|
selectAreas(request) {
|
|
175980
176031
|
const { newAreas } = request;
|
|
175981
|
-
|
|
176032
|
+
logger190.info(
|
|
175982
176033
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
175983
176034
|
);
|
|
175984
176035
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -175987,14 +176038,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
|
175987
176038
|
(id) => !supportedAreaIds.includes(id)
|
|
175988
176039
|
);
|
|
175989
176040
|
if (invalidAreas.length > 0) {
|
|
175990
|
-
|
|
176041
|
+
logger190.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
175991
176042
|
return {
|
|
175992
176043
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
175993
176044
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
175994
176045
|
};
|
|
175995
176046
|
}
|
|
175996
176047
|
this.state.selectedAreas = uniqueAreas;
|
|
175997
|
-
|
|
176048
|
+
logger190.info(
|
|
175998
176049
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
175999
176050
|
);
|
|
176000
176051
|
return {
|
|
@@ -176015,14 +176066,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
|
176015
176066
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
176016
176067
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
176017
176068
|
function ServiceAreaServerWithMaps(initialState) {
|
|
176018
|
-
|
|
176069
|
+
logger190.info(
|
|
176019
176070
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
176020
176071
|
);
|
|
176021
176072
|
for (const map of initialState.supportedMaps) {
|
|
176022
176073
|
const areaCount = initialState.supportedAreas.filter(
|
|
176023
176074
|
(a) => a.mapId === map.mapId
|
|
176024
176075
|
).length;
|
|
176025
|
-
|
|
176076
|
+
logger190.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
176026
176077
|
}
|
|
176027
176078
|
return ServiceAreaServerWithMapsBase.set({
|
|
176028
176079
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -176033,7 +176084,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
176033
176084
|
}
|
|
176034
176085
|
|
|
176035
176086
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
176036
|
-
var
|
|
176087
|
+
var logger191 = Logger.get("VacuumServiceAreaServer");
|
|
176037
176088
|
function toAreaId(roomId) {
|
|
176038
176089
|
if (typeof roomId === "number") {
|
|
176039
176090
|
return roomId;
|
|
@@ -176112,13 +176163,13 @@ function createVacuumServiceAreaServer(attributes7, roomEntities, includeUnnamed
|
|
|
176112
176163
|
let rooms;
|
|
176113
176164
|
if (roomEntities && roomEntities.length > 0) {
|
|
176114
176165
|
rooms = buttonEntitiesToRooms(roomEntities, attributes7);
|
|
176115
|
-
|
|
176166
|
+
logger191.info(
|
|
176116
176167
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
176117
176168
|
);
|
|
176118
176169
|
} else {
|
|
176119
176170
|
rooms = parseVacuumRooms(attributes7, includeUnnamedRooms);
|
|
176120
176171
|
if (rooms.length > 0) {
|
|
176121
|
-
|
|
176172
|
+
logger191.info(
|
|
176122
176173
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
176123
176174
|
);
|
|
176124
176175
|
}
|
|
@@ -176172,7 +176223,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
176172
176223
|
landmarkInfo: null
|
|
176173
176224
|
}
|
|
176174
176225
|
}));
|
|
176175
|
-
|
|
176226
|
+
logger191.info(
|
|
176176
176227
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
176177
176228
|
);
|
|
176178
176229
|
return ServiceAreaServer2({
|
|
@@ -176194,7 +176245,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
176194
176245
|
landmarkInfo: null
|
|
176195
176246
|
}
|
|
176196
176247
|
}));
|
|
176197
|
-
|
|
176248
|
+
logger191.info(
|
|
176198
176249
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
|
|
176199
176250
|
);
|
|
176200
176251
|
return ServiceAreaServer2({
|
|
@@ -176205,11 +176256,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
176205
176256
|
}
|
|
176206
176257
|
|
|
176207
176258
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
176208
|
-
var
|
|
176259
|
+
var logger192 = Logger.get("VacuumRvcRunModeServer");
|
|
176209
176260
|
function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
|
|
176210
176261
|
const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
176211
176262
|
const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
|
|
176212
|
-
|
|
176263
|
+
logger192.info(
|
|
176213
176264
|
`Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
|
|
176214
176265
|
);
|
|
176215
176266
|
return {
|
|
@@ -176271,12 +176322,12 @@ function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, ser
|
|
|
176271
176322
|
const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
|
|
176272
176323
|
serviceArea.state.selectedAreas = [];
|
|
176273
176324
|
if (matched.length === 0) {
|
|
176274
|
-
|
|
176325
|
+
logger192.warn(
|
|
176275
176326
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
176276
176327
|
);
|
|
176277
176328
|
return { action: "vacuum.start" };
|
|
176278
176329
|
}
|
|
176279
|
-
|
|
176330
|
+
logger192.info(
|
|
176280
176331
|
`Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
|
|
176281
176332
|
);
|
|
176282
176333
|
for (let i = 1; i < matched.length; i++) {
|
|
@@ -176315,7 +176366,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176315
176366
|
VacuumState.mop_cleaning
|
|
176316
176367
|
];
|
|
176317
176368
|
const isCleaning = cleaningStates.includes(state);
|
|
176318
|
-
|
|
176369
|
+
logger192.debug(
|
|
176319
176370
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
176320
176371
|
);
|
|
176321
176372
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -176347,7 +176398,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176347
176398
|
const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
|
|
176348
176399
|
serviceArea.state.selectedAreas = [];
|
|
176349
176400
|
if (haAreaIds.length > 0) {
|
|
176350
|
-
|
|
176401
|
+
logger192.info(
|
|
176351
176402
|
`CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
|
|
176352
176403
|
);
|
|
176353
176404
|
return {
|
|
@@ -176368,7 +176419,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176368
176419
|
}
|
|
176369
176420
|
}
|
|
176370
176421
|
if (buttonEntityIds.length > 0) {
|
|
176371
|
-
|
|
176422
|
+
logger192.info(
|
|
176372
176423
|
`Roborock: Pressing button entities for selected rooms: ${buttonEntityIds.join(", ")}`
|
|
176373
176424
|
);
|
|
176374
176425
|
serviceArea.state.selectedAreas = [];
|
|
@@ -176406,7 +176457,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176406
176457
|
}
|
|
176407
176458
|
}
|
|
176408
176459
|
if (roomIds.length > 0) {
|
|
176409
|
-
|
|
176460
|
+
logger192.info(
|
|
176410
176461
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
176411
176462
|
);
|
|
176412
176463
|
serviceArea.state.selectedAreas = [];
|
|
@@ -176414,7 +176465,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176414
176465
|
if (targetMapName) {
|
|
176415
176466
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
176416
176467
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
176417
|
-
|
|
176468
|
+
logger192.info(
|
|
176418
176469
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
176419
176470
|
);
|
|
176420
176471
|
homeAssistant.callAction({
|
|
@@ -176441,7 +176492,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176441
176492
|
}
|
|
176442
176493
|
if (isEcovacsVacuum(attributes7)) {
|
|
176443
176494
|
const roomIdStr = roomIds.join(",");
|
|
176444
|
-
|
|
176495
|
+
logger192.info(
|
|
176445
176496
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
176446
176497
|
);
|
|
176447
176498
|
return {
|
|
@@ -176456,14 +176507,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
176456
176507
|
}
|
|
176457
176508
|
};
|
|
176458
176509
|
}
|
|
176459
|
-
|
|
176510
|
+
logger192.warn(
|
|
176460
176511
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
176461
176512
|
);
|
|
176462
176513
|
}
|
|
176463
176514
|
}
|
|
176464
176515
|
} catch {
|
|
176465
176516
|
}
|
|
176466
|
-
|
|
176517
|
+
logger192.info("Starting regular cleaning (no areas selected)");
|
|
176467
176518
|
return { action: "vacuum.start" };
|
|
176468
176519
|
},
|
|
176469
176520
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -176478,7 +176529,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176478
176529
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
176479
176530
|
const entity = homeAssistant.entity;
|
|
176480
176531
|
const attributes7 = entity.state.attributes;
|
|
176481
|
-
|
|
176532
|
+
logger192.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
176482
176533
|
const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
|
|
176483
176534
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
176484
176535
|
const sorted = [...cleanAreaRooms].sort(
|
|
@@ -176487,7 +176538,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176487
176538
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
176488
176539
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
176489
176540
|
const area = sorted[areaIndex];
|
|
176490
|
-
|
|
176541
|
+
logger192.info(
|
|
176491
176542
|
`cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
|
|
176492
176543
|
);
|
|
176493
176544
|
return {
|
|
@@ -176504,7 +176555,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176504
176555
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
176505
176556
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
176506
176557
|
const area = sorted[areaIndex];
|
|
176507
|
-
|
|
176558
|
+
logger192.info(
|
|
176508
176559
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
176509
176560
|
);
|
|
176510
176561
|
return {
|
|
@@ -176525,7 +176576,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176525
176576
|
}
|
|
176526
176577
|
const rooms = parseVacuumRooms(attributes7);
|
|
176527
176578
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
176528
|
-
|
|
176579
|
+
logger192.info(
|
|
176529
176580
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
176530
176581
|
);
|
|
176531
176582
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -176535,7 +176586,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176535
176586
|
if (room.mapName) {
|
|
176536
176587
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
176537
176588
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
176538
|
-
|
|
176589
|
+
logger192.info(
|
|
176539
176590
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
176540
176591
|
);
|
|
176541
176592
|
homeAssistant.callAction({
|
|
@@ -176544,7 +176595,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176544
176595
|
data: { option: room.mapName }
|
|
176545
176596
|
});
|
|
176546
176597
|
}
|
|
176547
|
-
|
|
176598
|
+
logger192.debug(
|
|
176548
176599
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
176549
176600
|
);
|
|
176550
176601
|
return {
|
|
@@ -176555,7 +176606,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176555
176606
|
};
|
|
176556
176607
|
}
|
|
176557
176608
|
if (isRoborockVacuum(attributes7) || isXiaomiMiotVacuum(attributes7)) {
|
|
176558
|
-
|
|
176609
|
+
logger192.debug(
|
|
176559
176610
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
176560
176611
|
);
|
|
176561
176612
|
return {
|
|
@@ -176568,7 +176619,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176568
176619
|
}
|
|
176569
176620
|
if (isEcovacsVacuum(attributes7)) {
|
|
176570
176621
|
const roomIdStr = String(commandId3);
|
|
176571
|
-
|
|
176622
|
+
logger192.info(
|
|
176572
176623
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
176573
176624
|
);
|
|
176574
176625
|
return {
|
|
@@ -176583,7 +176634,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176583
176634
|
}
|
|
176584
176635
|
};
|
|
176585
176636
|
}
|
|
176586
|
-
|
|
176637
|
+
logger192.warn(
|
|
176587
176638
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
176588
176639
|
);
|
|
176589
176640
|
}
|
|
@@ -176599,20 +176650,20 @@ function createVacuumRvcRunModeServer(attributes7, includeUnnamedRooms = false,
|
|
|
176599
176650
|
includeUnnamedRooms,
|
|
176600
176651
|
customAreas
|
|
176601
176652
|
);
|
|
176602
|
-
|
|
176653
|
+
logger192.info(
|
|
176603
176654
|
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
|
|
176604
176655
|
);
|
|
176605
176656
|
if (rooms.length > 0) {
|
|
176606
|
-
|
|
176657
|
+
logger192.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
176607
176658
|
}
|
|
176608
176659
|
if (filteredCount > 0) {
|
|
176609
176660
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
176610
|
-
|
|
176661
|
+
logger192.info(
|
|
176611
176662
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
176612
176663
|
);
|
|
176613
176664
|
}
|
|
176614
176665
|
if (allRooms.length === 0) {
|
|
176615
|
-
|
|
176666
|
+
logger192.debug(
|
|
176616
176667
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes7.rooms)}, segments=${JSON.stringify(attributes7.segments)}, room_list=${attributes7.room_list}`
|
|
176617
176668
|
);
|
|
176618
176669
|
}
|
|
@@ -176646,7 +176697,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
|
|
|
176646
176697
|
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
176647
176698
|
});
|
|
176648
176699
|
}
|
|
176649
|
-
|
|
176700
|
+
logger192.info(
|
|
176650
176701
|
`Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
|
|
176651
176702
|
);
|
|
176652
176703
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
@@ -176707,7 +176758,7 @@ init_rvc_clean_mode();
|
|
|
176707
176758
|
|
|
176708
176759
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
176709
176760
|
init_home_assistant_entity_behavior();
|
|
176710
|
-
var
|
|
176761
|
+
var logger193 = Logger.get("RvcCleanModeServerBase");
|
|
176711
176762
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
176712
176763
|
// Pending mode from a recent changeToMode command.
|
|
176713
176764
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -176750,14 +176801,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
176750
176801
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
176751
176802
|
const { newMode } = request;
|
|
176752
176803
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
176753
|
-
|
|
176804
|
+
logger193.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
176754
176805
|
return {
|
|
176755
176806
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
176756
176807
|
statusText: `Unsupported mode: ${newMode}`
|
|
176757
176808
|
};
|
|
176758
176809
|
}
|
|
176759
176810
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
176760
|
-
|
|
176811
|
+
logger193.info(
|
|
176761
176812
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
176762
176813
|
);
|
|
176763
176814
|
this.pendingMode = newMode;
|
|
@@ -176765,7 +176816,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
176765
176816
|
this.state.currentMode = newMode;
|
|
176766
176817
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
176767
176818
|
if (action) {
|
|
176768
|
-
|
|
176819
|
+
logger193.info(
|
|
176769
176820
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
176770
176821
|
);
|
|
176771
176822
|
homeAssistant.callAction(action);
|
|
@@ -176798,7 +176849,7 @@ function RvcCleanModeServer2(config10, initialState) {
|
|
|
176798
176849
|
}
|
|
176799
176850
|
|
|
176800
176851
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
176801
|
-
var
|
|
176852
|
+
var logger194 = Logger.get("VacuumRvcCleanModeServer");
|
|
176802
176853
|
var MODE_VACUUM = 0;
|
|
176803
176854
|
var MODE_VACUUM_AND_MOP = 1;
|
|
176804
176855
|
var MODE_MOP = 2;
|
|
@@ -177097,7 +177148,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
177097
177148
|
if (match) return match;
|
|
177098
177149
|
}
|
|
177099
177150
|
}
|
|
177100
|
-
|
|
177151
|
+
logger194.warn(
|
|
177101
177152
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
177102
177153
|
);
|
|
177103
177154
|
return aliases[0];
|
|
@@ -177106,7 +177157,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
177106
177157
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
177107
177158
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
177108
177159
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
177109
|
-
|
|
177160
|
+
logger194.info(
|
|
177110
177161
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
177111
177162
|
);
|
|
177112
177163
|
return {
|
|
@@ -177195,7 +177246,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177195
177246
|
}
|
|
177196
177247
|
}
|
|
177197
177248
|
if (speedMode !== void 0) {
|
|
177198
|
-
|
|
177249
|
+
logger194.debug(
|
|
177199
177250
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
177200
177251
|
);
|
|
177201
177252
|
return speedMode;
|
|
@@ -177216,7 +177267,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177216
177267
|
}
|
|
177217
177268
|
}
|
|
177218
177269
|
if (mopMode !== void 0) {
|
|
177219
|
-
|
|
177270
|
+
logger194.debug(
|
|
177220
177271
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
177221
177272
|
);
|
|
177222
177273
|
return mopMode;
|
|
@@ -177234,14 +177285,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177234
177285
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
177235
177286
|
const vacuumEntityId = homeAssistant.entityId;
|
|
177236
177287
|
const mapping = homeAssistant.state.mapping;
|
|
177237
|
-
|
|
177288
|
+
logger194.info(
|
|
177238
177289
|
`setCleanMode(${mode}) for ${vacuumEntityId} \u2014 suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})}`
|
|
177239
177290
|
);
|
|
177240
177291
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
177241
177292
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
177242
177293
|
const mopName = mopIntensityList[mopIndex];
|
|
177243
177294
|
if (!mopName) {
|
|
177244
|
-
|
|
177295
|
+
logger194.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
177245
177296
|
return void 0;
|
|
177246
177297
|
}
|
|
177247
177298
|
if (hasCleanTypes) {
|
|
@@ -177254,18 +177305,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177254
177305
|
mapping.mopIntensityEntity,
|
|
177255
177306
|
agent
|
|
177256
177307
|
);
|
|
177257
|
-
|
|
177308
|
+
logger194.info(
|
|
177258
177309
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
177259
177310
|
);
|
|
177260
177311
|
let option = matchMopIntensityOption(mopName, options);
|
|
177261
177312
|
if (!option && options && mopIndex < options.length) {
|
|
177262
177313
|
option = options[mopIndex];
|
|
177263
|
-
|
|
177314
|
+
logger194.info(
|
|
177264
177315
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
177265
177316
|
);
|
|
177266
177317
|
}
|
|
177267
177318
|
if (option) {
|
|
177268
|
-
|
|
177319
|
+
logger194.info(
|
|
177269
177320
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
177270
177321
|
);
|
|
177271
177322
|
return {
|
|
@@ -177274,11 +177325,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177274
177325
|
target: mapping.mopIntensityEntity
|
|
177275
177326
|
};
|
|
177276
177327
|
}
|
|
177277
|
-
|
|
177328
|
+
logger194.warn(
|
|
177278
177329
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
177279
177330
|
);
|
|
177280
177331
|
} else {
|
|
177281
|
-
|
|
177332
|
+
logger194.warn(
|
|
177282
177333
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
177283
177334
|
);
|
|
177284
177335
|
}
|
|
@@ -177288,7 +177339,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177288
177339
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
177289
177340
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
177290
177341
|
if (!fanSpeedName) {
|
|
177291
|
-
|
|
177342
|
+
logger194.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
177292
177343
|
return void 0;
|
|
177293
177344
|
}
|
|
177294
177345
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -177301,7 +177352,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177301
177352
|
mapping.suctionLevelEntity,
|
|
177302
177353
|
agent
|
|
177303
177354
|
);
|
|
177304
|
-
|
|
177355
|
+
logger194.info(
|
|
177305
177356
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
177306
177357
|
);
|
|
177307
177358
|
let option = matchFanSpeedOption(
|
|
@@ -177311,12 +177362,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177311
177362
|
);
|
|
177312
177363
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
177313
177364
|
option = options[fanSpeedIndex];
|
|
177314
|
-
|
|
177365
|
+
logger194.info(
|
|
177315
177366
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
177316
177367
|
);
|
|
177317
177368
|
}
|
|
177318
177369
|
if (option) {
|
|
177319
|
-
|
|
177370
|
+
logger194.info(
|
|
177320
177371
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
177321
177372
|
);
|
|
177322
177373
|
return {
|
|
@@ -177325,7 +177376,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177325
177376
|
target: mapping.suctionLevelEntity
|
|
177326
177377
|
};
|
|
177327
177378
|
}
|
|
177328
|
-
|
|
177379
|
+
logger194.warn(
|
|
177329
177380
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
177330
177381
|
);
|
|
177331
177382
|
return void 0;
|
|
@@ -177335,7 +177386,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177335
177386
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
177336
177387
|
);
|
|
177337
177388
|
}
|
|
177338
|
-
|
|
177389
|
+
logger194.info(
|
|
177339
177390
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
177340
177391
|
);
|
|
177341
177392
|
return {
|
|
@@ -177345,7 +177396,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177345
177396
|
};
|
|
177346
177397
|
}
|
|
177347
177398
|
if (!hasCleanTypes) {
|
|
177348
|
-
|
|
177399
|
+
logger194.debug(
|
|
177349
177400
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
177350
177401
|
);
|
|
177351
177402
|
return void 0;
|
|
@@ -177357,7 +177408,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177357
177408
|
agent
|
|
177358
177409
|
);
|
|
177359
177410
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
177360
|
-
|
|
177411
|
+
logger194.info(
|
|
177361
177412
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
177362
177413
|
);
|
|
177363
177414
|
return {
|
|
@@ -177375,10 +177426,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
177375
177426
|
cleaningModeOptions,
|
|
177376
177427
|
customFanSpeedTags
|
|
177377
177428
|
);
|
|
177378
|
-
|
|
177429
|
+
logger194.info(
|
|
177379
177430
|
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
177380
177431
|
);
|
|
177381
|
-
|
|
177432
|
+
logger194.info(
|
|
177382
177433
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
177383
177434
|
);
|
|
177384
177435
|
const initialState = {
|
|
@@ -177456,7 +177507,7 @@ init_rvc_operational_state();
|
|
|
177456
177507
|
init_home_assistant_entity_behavior();
|
|
177457
177508
|
var OperationalState4 = RvcOperationalState3.OperationalState;
|
|
177458
177509
|
var ErrorState = RvcOperationalState3.ErrorState;
|
|
177459
|
-
var
|
|
177510
|
+
var logger195 = Logger.get("RvcOperationalStateServer");
|
|
177460
177511
|
var activeStates = /* @__PURE__ */ new Set([
|
|
177461
177512
|
OperationalState4.Running,
|
|
177462
177513
|
OperationalState4.SeekingCharger
|
|
@@ -177498,7 +177549,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
177498
177549
|
}
|
|
177499
177550
|
});
|
|
177500
177551
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
177501
|
-
|
|
177552
|
+
logger195.info(
|
|
177502
177553
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
177503
177554
|
);
|
|
177504
177555
|
try {
|
|
@@ -177511,7 +177562,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
177511
177562
|
this.context
|
|
177512
177563
|
);
|
|
177513
177564
|
} catch (e) {
|
|
177514
|
-
|
|
177565
|
+
logger195.debug("Failed to emit operationCompletion event:", e);
|
|
177515
177566
|
}
|
|
177516
177567
|
}
|
|
177517
177568
|
}
|
|
@@ -177546,7 +177597,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
177546
177597
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
177547
177598
|
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
177548
177599
|
} else {
|
|
177549
|
-
|
|
177600
|
+
logger195.warn("GoHome command received but no goHome action configured");
|
|
177550
177601
|
}
|
|
177551
177602
|
return {
|
|
177552
177603
|
commandResponseState: {
|
|
@@ -177566,7 +177617,7 @@ function RvcOperationalStateServer2(config10) {
|
|
|
177566
177617
|
}
|
|
177567
177618
|
|
|
177568
177619
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
|
|
177569
|
-
var
|
|
177620
|
+
var logger196 = Logger.get("VacuumRvcOperationalStateServer");
|
|
177570
177621
|
function isCharging(entity) {
|
|
177571
177622
|
const attrs = entity.attributes;
|
|
177572
177623
|
if (attrs.battery_icon?.includes("charging")) return true;
|
|
@@ -177608,16 +177659,16 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
177608
177659
|
operationalState = RvcOperationalState3.OperationalState.Error;
|
|
177609
177660
|
} else {
|
|
177610
177661
|
if (state.toLowerCase().includes("clean")) {
|
|
177611
|
-
|
|
177662
|
+
logger196.info(
|
|
177612
177663
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
177613
177664
|
);
|
|
177614
177665
|
operationalState = RvcOperationalState3.OperationalState.Running;
|
|
177615
177666
|
} else {
|
|
177616
|
-
|
|
177667
|
+
logger196.info(`Unknown vacuum state "${state}", treating as Paused`);
|
|
177617
177668
|
operationalState = RvcOperationalState3.OperationalState.Paused;
|
|
177618
177669
|
}
|
|
177619
177670
|
}
|
|
177620
|
-
|
|
177671
|
+
logger196.debug(
|
|
177621
177672
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
|
|
177622
177673
|
);
|
|
177623
177674
|
return operationalState;
|
|
@@ -177638,7 +177689,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
177638
177689
|
});
|
|
177639
177690
|
|
|
177640
177691
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
177641
|
-
var
|
|
177692
|
+
var logger197 = Logger.get("VacuumDevice");
|
|
177642
177693
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
177643
177694
|
BasicInformationServer2,
|
|
177644
177695
|
VacuumIdentifyServer,
|
|
@@ -177652,7 +177703,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
177652
177703
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
177653
177704
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
177654
177705
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
177655
|
-
|
|
177706
|
+
logger197.info(
|
|
177656
177707
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
177657
177708
|
);
|
|
177658
177709
|
const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
|
|
@@ -177664,32 +177715,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
177664
177715
|
)
|
|
177665
177716
|
).set({ homeAssistantEntity });
|
|
177666
177717
|
if (includeOnOff) {
|
|
177667
|
-
|
|
177718
|
+
logger197.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
177668
177719
|
device = device.with(VacuumOnOffServer);
|
|
177669
177720
|
}
|
|
177670
177721
|
device = device.with(VacuumPowerSourceServer);
|
|
177671
177722
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
177672
177723
|
const rooms = parseVacuumRooms(attributes7);
|
|
177673
|
-
|
|
177724
|
+
logger197.info(
|
|
177674
177725
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
|
|
177675
177726
|
);
|
|
177676
177727
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
177677
|
-
|
|
177728
|
+
logger197.info(
|
|
177678
177729
|
`${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
|
|
177679
177730
|
);
|
|
177680
177731
|
device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
|
|
177681
177732
|
} else if (customAreas && customAreas.length > 0) {
|
|
177682
|
-
|
|
177733
|
+
logger197.info(
|
|
177683
177734
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
177684
177735
|
);
|
|
177685
177736
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
177686
177737
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
177687
|
-
|
|
177738
|
+
logger197.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
177688
177739
|
device = device.with(
|
|
177689
177740
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
177690
177741
|
);
|
|
177691
177742
|
} else {
|
|
177692
|
-
|
|
177743
|
+
logger197.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
177693
177744
|
device = device.with(createDefaultServiceAreaServer());
|
|
177694
177745
|
}
|
|
177695
177746
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -177700,7 +177751,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
177700
177751
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
177701
177752
|
);
|
|
177702
177753
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
177703
|
-
|
|
177754
|
+
logger197.info(
|
|
177704
177755
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
177705
177756
|
);
|
|
177706
177757
|
device = device.with(
|
|
@@ -177713,7 +177764,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
177713
177764
|
)
|
|
177714
177765
|
);
|
|
177715
177766
|
} else {
|
|
177716
|
-
|
|
177767
|
+
logger197.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
177717
177768
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
177718
177769
|
}
|
|
177719
177770
|
return device;
|
|
@@ -177879,7 +177930,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
177879
177930
|
);
|
|
177880
177931
|
|
|
177881
177932
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
177882
|
-
var
|
|
177933
|
+
var logger198 = Logger.get("WaterHeaterDevice");
|
|
177883
177934
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
177884
177935
|
BasicInformationServer2,
|
|
177885
177936
|
IdentifyServer2,
|
|
@@ -177895,7 +177946,7 @@ function toMatterTemp2(value) {
|
|
|
177895
177946
|
}
|
|
177896
177947
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
177897
177948
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
177898
|
-
|
|
177949
|
+
logger198.debug(
|
|
177899
177950
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes7.min_temp}, max_temp=${attributes7.max_temp}`
|
|
177900
177951
|
);
|
|
177901
177952
|
const minLimit = toMatterTemp2(attributes7.min_temp) ?? 0;
|
|
@@ -178108,7 +178159,7 @@ var matterDeviceTypeFactories = {
|
|
|
178108
178159
|
};
|
|
178109
178160
|
|
|
178110
178161
|
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
178111
|
-
var
|
|
178162
|
+
var logger199 = Logger.get("UserComposedEndpoint");
|
|
178112
178163
|
function createEndpointId4(entityId, customName) {
|
|
178113
178164
|
const baseName = customName || entityId;
|
|
178114
178165
|
return baseName.replace(/\./g, "_").replace(/\s+/g, "_");
|
|
@@ -178159,7 +178210,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178159
178210
|
{ vacuumOnOff: registry2.isVacuumOnOffEnabled() }
|
|
178160
178211
|
);
|
|
178161
178212
|
if (!primaryType) {
|
|
178162
|
-
|
|
178213
|
+
logger199.warn(
|
|
178163
178214
|
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
178164
178215
|
);
|
|
178165
178216
|
return void 0;
|
|
@@ -178174,7 +178225,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178174
178225
|
if (!sub.entityId) continue;
|
|
178175
178226
|
const subPayload = buildEntityPayload3(registry2, sub.entityId);
|
|
178176
178227
|
if (!subPayload) {
|
|
178177
|
-
|
|
178228
|
+
logger199.warn(
|
|
178178
178229
|
`Cannot find entity state for composed sub-entity ${sub.entityId}`
|
|
178179
178230
|
);
|
|
178180
178231
|
continue;
|
|
@@ -178185,7 +178236,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178185
178236
|
};
|
|
178186
178237
|
const subType = createLegacyEndpointType(subPayload, subMapping);
|
|
178187
178238
|
if (!subType) {
|
|
178188
|
-
|
|
178239
|
+
logger199.warn(
|
|
178189
178240
|
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
178190
178241
|
);
|
|
178191
178242
|
continue;
|
|
@@ -178198,7 +178249,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178198
178249
|
mappedIds.push(sub.entityId);
|
|
178199
178250
|
}
|
|
178200
178251
|
if (parts.length < 2) {
|
|
178201
|
-
|
|
178252
|
+
logger199.warn(
|
|
178202
178253
|
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
178203
178254
|
);
|
|
178204
178255
|
return void 0;
|
|
@@ -178221,7 +178272,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178221
178272
|
const labels = parts.map(
|
|
178222
178273
|
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
178223
178274
|
).join("+");
|
|
178224
|
-
|
|
178275
|
+
logger199.info(
|
|
178225
178276
|
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
178226
178277
|
);
|
|
178227
178278
|
return endpoint;
|
|
@@ -178290,7 +178341,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178290
178341
|
};
|
|
178291
178342
|
|
|
178292
178343
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
178293
|
-
var
|
|
178344
|
+
var logger200 = Logger.get("LegacyEndpoint");
|
|
178294
178345
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
178295
178346
|
static async create(registry2, entityId, mapping, pluginDomainMappings) {
|
|
178296
178347
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -178300,25 +178351,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178300
178351
|
return;
|
|
178301
178352
|
}
|
|
178302
178353
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
178303
|
-
|
|
178354
|
+
logger200.debug(
|
|
178304
178355
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
178305
178356
|
);
|
|
178306
178357
|
return;
|
|
178307
178358
|
}
|
|
178308
178359
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
178309
|
-
|
|
178360
|
+
logger200.debug(
|
|
178310
178361
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
178311
178362
|
);
|
|
178312
178363
|
return;
|
|
178313
178364
|
}
|
|
178314
178365
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
178315
|
-
|
|
178366
|
+
logger200.debug(
|
|
178316
178367
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
178317
178368
|
);
|
|
178318
178369
|
return;
|
|
178319
178370
|
}
|
|
178320
178371
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
178321
|
-
|
|
178372
|
+
logger200.debug(
|
|
178322
178373
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
178323
178374
|
);
|
|
178324
178375
|
return;
|
|
@@ -178338,7 +178389,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178338
178389
|
humidityEntity: humidityEntityId
|
|
178339
178390
|
};
|
|
178340
178391
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
178341
|
-
|
|
178392
|
+
logger200.debug(
|
|
178342
178393
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
178343
178394
|
);
|
|
178344
178395
|
}
|
|
@@ -178357,7 +178408,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178357
178408
|
pressureEntity: pressureEntityId
|
|
178358
178409
|
};
|
|
178359
178410
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
178360
|
-
|
|
178411
|
+
logger200.debug(
|
|
178361
178412
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
178362
178413
|
);
|
|
178363
178414
|
}
|
|
@@ -178375,7 +178426,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178375
178426
|
batteryEntity: batteryEntityId
|
|
178376
178427
|
};
|
|
178377
178428
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
178378
|
-
|
|
178429
|
+
logger200.debug(
|
|
178379
178430
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
178380
178431
|
);
|
|
178381
178432
|
}
|
|
@@ -178393,7 +178444,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178393
178444
|
powerEntity: powerEntityId
|
|
178394
178445
|
};
|
|
178395
178446
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
178396
|
-
|
|
178447
|
+
logger200.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
178397
178448
|
}
|
|
178398
178449
|
}
|
|
178399
178450
|
}
|
|
@@ -178410,7 +178461,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178410
178461
|
energyEntity: energyEntityId
|
|
178411
178462
|
};
|
|
178412
178463
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
178413
|
-
|
|
178464
|
+
logger200.debug(
|
|
178414
178465
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
178415
178466
|
);
|
|
178416
178467
|
}
|
|
@@ -178426,7 +178477,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178426
178477
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178427
178478
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
178428
178479
|
};
|
|
178429
|
-
|
|
178480
|
+
logger200.debug(
|
|
178430
178481
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
178431
178482
|
);
|
|
178432
178483
|
}
|
|
@@ -178436,7 +178487,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178436
178487
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178437
178488
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
178438
178489
|
};
|
|
178439
|
-
|
|
178490
|
+
logger200.debug(
|
|
178440
178491
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
178441
178492
|
);
|
|
178442
178493
|
}
|
|
@@ -178446,7 +178497,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178446
178497
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178447
178498
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
178448
178499
|
};
|
|
178449
|
-
|
|
178500
|
+
logger200.debug(
|
|
178450
178501
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
178451
178502
|
);
|
|
178452
178503
|
}
|
|
@@ -178461,7 +178512,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178461
178512
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178462
178513
|
cleanAreaRooms
|
|
178463
178514
|
};
|
|
178464
|
-
|
|
178515
|
+
logger200.debug(
|
|
178465
178516
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
178466
178517
|
);
|
|
178467
178518
|
}
|
|
@@ -178482,7 +178533,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178482
178533
|
rooms: roomsObj
|
|
178483
178534
|
}
|
|
178484
178535
|
};
|
|
178485
|
-
|
|
178536
|
+
logger200.debug(
|
|
178486
178537
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
178487
178538
|
);
|
|
178488
178539
|
} else {
|
|
@@ -178499,7 +178550,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178499
178550
|
rooms: roomsObj
|
|
178500
178551
|
}
|
|
178501
178552
|
};
|
|
178502
|
-
|
|
178553
|
+
logger200.debug(
|
|
178503
178554
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
178504
178555
|
);
|
|
178505
178556
|
}
|
|
@@ -178520,7 +178571,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178520
178571
|
if (composed) {
|
|
178521
178572
|
return composed;
|
|
178522
178573
|
}
|
|
178523
|
-
|
|
178574
|
+
logger200.warn(
|
|
178524
178575
|
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
178525
178576
|
);
|
|
178526
178577
|
}
|
|
@@ -178620,11 +178671,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178620
178671
|
}
|
|
178621
178672
|
if (mappedChanged) {
|
|
178622
178673
|
this.pendingMappedChange = true;
|
|
178623
|
-
|
|
178674
|
+
logger200.debug(
|
|
178624
178675
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
178625
178676
|
);
|
|
178626
178677
|
}
|
|
178627
|
-
|
|
178678
|
+
logger200.debug(
|
|
178628
178679
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
178629
178680
|
);
|
|
178630
178681
|
this.lastState = state;
|
|
@@ -178668,7 +178719,7 @@ import {
|
|
|
178668
178719
|
getCollection
|
|
178669
178720
|
} from "home-assistant-js-websocket";
|
|
178670
178721
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
178671
|
-
var
|
|
178722
|
+
var logger201 = Logger.get("SubscribeEntities");
|
|
178672
178723
|
function processEvent(store, updates) {
|
|
178673
178724
|
const state = { ...store.state };
|
|
178674
178725
|
if (updates.a) {
|
|
@@ -178694,7 +178745,7 @@ function processEvent(store, updates) {
|
|
|
178694
178745
|
for (const entityId in updates.c) {
|
|
178695
178746
|
let entityState = state[entityId];
|
|
178696
178747
|
if (!entityState) {
|
|
178697
|
-
|
|
178748
|
+
logger201.warn("Received state update for unknown entity", entityId);
|
|
178698
178749
|
continue;
|
|
178699
178750
|
}
|
|
178700
178751
|
entityState = { ...entityState };
|
|
@@ -178764,7 +178815,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
|
|
|
178764
178815
|
|
|
178765
178816
|
// src/services/bridges/entity-isolation-service.ts
|
|
178766
178817
|
init_esm();
|
|
178767
|
-
var
|
|
178818
|
+
var logger202 = Logger.get("EntityIsolation");
|
|
178768
178819
|
var EntityIsolationServiceImpl = class {
|
|
178769
178820
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
178770
178821
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -178829,13 +178880,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
178829
178880
|
}
|
|
178830
178881
|
const parsed = this.parseEndpointPath(msg);
|
|
178831
178882
|
if (!parsed) {
|
|
178832
|
-
|
|
178883
|
+
logger202.warn("Could not parse entity from error:", msg);
|
|
178833
178884
|
return false;
|
|
178834
178885
|
}
|
|
178835
178886
|
const { bridgeId, entityName } = parsed;
|
|
178836
178887
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
178837
178888
|
if (!callback) {
|
|
178838
|
-
|
|
178889
|
+
logger202.warn(
|
|
178839
178890
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
178840
178891
|
);
|
|
178841
178892
|
return false;
|
|
@@ -178846,14 +178897,14 @@ var EntityIsolationServiceImpl = class {
|
|
|
178846
178897
|
}
|
|
178847
178898
|
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
178848
178899
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
178849
|
-
|
|
178900
|
+
logger202.warn(
|
|
178850
178901
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
178851
178902
|
);
|
|
178852
178903
|
try {
|
|
178853
178904
|
await callback(entityName);
|
|
178854
178905
|
return true;
|
|
178855
178906
|
} catch (e) {
|
|
178856
|
-
|
|
178907
|
+
logger202.error(`Failed to isolate entity ${entityName}:`, e);
|
|
178857
178908
|
return false;
|
|
178858
178909
|
}
|
|
178859
178910
|
}
|
|
@@ -180035,11 +180086,11 @@ init_dist();
|
|
|
180035
180086
|
var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
|
|
180036
180087
|
var DEAD_SESSION_TIMEOUT_MS2 = 6e4;
|
|
180037
180088
|
var ServerModeBridge = class {
|
|
180038
|
-
constructor(
|
|
180089
|
+
constructor(logger205, dataProvider, endpointManager, server) {
|
|
180039
180090
|
this.dataProvider = dataProvider;
|
|
180040
180091
|
this.endpointManager = endpointManager;
|
|
180041
180092
|
this.server = server;
|
|
180042
|
-
this.log =
|
|
180093
|
+
this.log = logger205.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
180043
180094
|
}
|
|
180044
180095
|
log;
|
|
180045
180096
|
status = {
|
|
@@ -180548,7 +180599,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
180548
180599
|
}
|
|
180549
180600
|
|
|
180550
180601
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
180551
|
-
var
|
|
180602
|
+
var logger203 = Logger.get("ServerModeVacuumEndpoint");
|
|
180552
180603
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
180553
180604
|
static async create(registry2, entityId, mapping) {
|
|
180554
180605
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -180558,7 +180609,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180558
180609
|
return void 0;
|
|
180559
180610
|
}
|
|
180560
180611
|
let effectiveMapping = mapping;
|
|
180561
|
-
|
|
180612
|
+
logger203.info(
|
|
180562
180613
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
180563
180614
|
);
|
|
180564
180615
|
if (entity.device_id) {
|
|
@@ -180573,15 +180624,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180573
180624
|
batteryEntity: batteryEntityId
|
|
180574
180625
|
};
|
|
180575
180626
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
180576
|
-
|
|
180627
|
+
logger203.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
180577
180628
|
} else {
|
|
180578
180629
|
const attrs = state.attributes;
|
|
180579
180630
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
180580
|
-
|
|
180631
|
+
logger203.info(
|
|
180581
180632
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
180582
180633
|
);
|
|
180583
180634
|
} else {
|
|
180584
|
-
|
|
180635
|
+
logger203.warn(
|
|
180585
180636
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
180586
180637
|
);
|
|
180587
180638
|
}
|
|
@@ -180596,7 +180647,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180596
180647
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180597
180648
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
180598
180649
|
};
|
|
180599
|
-
|
|
180650
|
+
logger203.info(
|
|
180600
180651
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
180601
180652
|
);
|
|
180602
180653
|
}
|
|
@@ -180606,7 +180657,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180606
180657
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180607
180658
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
180608
180659
|
};
|
|
180609
|
-
|
|
180660
|
+
logger203.info(
|
|
180610
180661
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
180611
180662
|
);
|
|
180612
180663
|
}
|
|
@@ -180616,7 +180667,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180616
180667
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180617
180668
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
180618
180669
|
};
|
|
180619
|
-
|
|
180670
|
+
logger203.info(
|
|
180620
180671
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
180621
180672
|
);
|
|
180622
180673
|
}
|
|
@@ -180631,7 +180682,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180631
180682
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180632
180683
|
cleanAreaRooms
|
|
180633
180684
|
};
|
|
180634
|
-
|
|
180685
|
+
logger203.info(
|
|
180635
180686
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
180636
180687
|
);
|
|
180637
180688
|
}
|
|
@@ -180652,7 +180703,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180652
180703
|
rooms: roomsObj
|
|
180653
180704
|
}
|
|
180654
180705
|
};
|
|
180655
|
-
|
|
180706
|
+
logger203.info(
|
|
180656
180707
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
180657
180708
|
);
|
|
180658
180709
|
} else {
|
|
@@ -180669,14 +180720,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180669
180720
|
rooms: roomsObj
|
|
180670
180721
|
}
|
|
180671
180722
|
};
|
|
180672
|
-
|
|
180723
|
+
logger203.info(
|
|
180673
180724
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
180674
180725
|
);
|
|
180675
180726
|
}
|
|
180676
180727
|
}
|
|
180677
180728
|
}
|
|
180678
180729
|
} else {
|
|
180679
|
-
|
|
180730
|
+
logger203.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
|
|
180680
180731
|
}
|
|
180681
180732
|
const payload = {
|
|
180682
180733
|
entity_id: entityId,
|
|
@@ -180740,11 +180791,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180740
180791
|
}
|
|
180741
180792
|
if (mappedChanged) {
|
|
180742
180793
|
this.pendingMappedChange = true;
|
|
180743
|
-
|
|
180794
|
+
logger203.debug(
|
|
180744
180795
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
180745
180796
|
);
|
|
180746
180797
|
}
|
|
180747
|
-
|
|
180798
|
+
logger203.debug(
|
|
180748
180799
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
180749
180800
|
);
|
|
180750
180801
|
this.lastState = state;
|
|
@@ -181158,10 +181209,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
181158
181209
|
// src/core/ioc/app-environment.ts
|
|
181159
181210
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
181160
181211
|
constructor(rootEnv, options) {
|
|
181161
|
-
const
|
|
181212
|
+
const logger205 = rootEnv.get(LoggerService);
|
|
181162
181213
|
super({
|
|
181163
181214
|
id: "App",
|
|
181164
|
-
log:
|
|
181215
|
+
log: logger205.get("AppContainer"),
|
|
181165
181216
|
parent: rootEnv
|
|
181166
181217
|
});
|
|
181167
181218
|
this.options = options;
|
|
@@ -181174,8 +181225,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
181174
181225
|
}
|
|
181175
181226
|
construction;
|
|
181176
181227
|
async init() {
|
|
181177
|
-
const
|
|
181178
|
-
this.set(LoggerService,
|
|
181228
|
+
const logger205 = this.get(LoggerService);
|
|
181229
|
+
this.set(LoggerService, logger205);
|
|
181179
181230
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
181180
181231
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
181181
181232
|
this.set(
|
|
@@ -181192,7 +181243,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
181192
181243
|
);
|
|
181193
181244
|
this.set(
|
|
181194
181245
|
HomeAssistantClient,
|
|
181195
|
-
new HomeAssistantClient(
|
|
181246
|
+
new HomeAssistantClient(logger205, this.options.homeAssistant)
|
|
181196
181247
|
);
|
|
181197
181248
|
this.set(
|
|
181198
181249
|
HomeAssistantConfig,
|
|
@@ -181200,7 +181251,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
181200
181251
|
);
|
|
181201
181252
|
this.set(
|
|
181202
181253
|
HomeAssistantActions,
|
|
181203
|
-
new HomeAssistantActions(
|
|
181254
|
+
new HomeAssistantActions(logger205, await this.load(HomeAssistantClient))
|
|
181204
181255
|
);
|
|
181205
181256
|
this.set(
|
|
181206
181257
|
HomeAssistantRegistry,
|
|
@@ -181236,7 +181287,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
181236
181287
|
this.set(
|
|
181237
181288
|
WebApi,
|
|
181238
181289
|
new WebApi(
|
|
181239
|
-
|
|
181290
|
+
logger205,
|
|
181240
181291
|
await this.load(BridgeService),
|
|
181241
181292
|
await this.load(HomeAssistantClient),
|
|
181242
181293
|
await this.load(HomeAssistantRegistry),
|
|
@@ -181262,7 +181313,7 @@ init_nodejs();
|
|
|
181262
181313
|
init_level_control();
|
|
181263
181314
|
|
|
181264
181315
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
181265
|
-
var
|
|
181316
|
+
var logger204 = Logger.get("PatchLevelControlTlv");
|
|
181266
181317
|
function patchLevelControlTlv() {
|
|
181267
181318
|
let patched = 0;
|
|
181268
181319
|
const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
|
|
@@ -181276,11 +181327,11 @@ function patchLevelControlTlv() {
|
|
|
181276
181327
|
patched++;
|
|
181277
181328
|
}
|
|
181278
181329
|
if (patched > 0) {
|
|
181279
|
-
|
|
181330
|
+
logger204.info(
|
|
181280
181331
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
181281
181332
|
);
|
|
181282
181333
|
} else {
|
|
181283
|
-
|
|
181334
|
+
logger204.warn(
|
|
181284
181335
|
"Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
|
|
181285
181336
|
);
|
|
181286
181337
|
}
|