@riddix/hamh 2.1.0-alpha.538 → 2.1.0-alpha.540
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,59 @@ 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) {
|
|
175681
|
+
if (newMode === 0 /* Idle */) {
|
|
175682
|
+
this.trySetCurrentArea(null);
|
|
175683
|
+
} else if (newMode === 1 /* Cleaning */) {
|
|
175684
|
+
try {
|
|
175685
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175686
|
+
if (serviceArea.state.selectedAreas?.length > 0 && serviceArea.state.currentArea === null) {
|
|
175687
|
+
this.trySetCurrentArea(serviceArea.state.selectedAreas[0]);
|
|
175688
|
+
}
|
|
175689
|
+
} catch {
|
|
175690
|
+
}
|
|
175691
|
+
}
|
|
175692
|
+
}
|
|
175693
|
+
}
|
|
175694
|
+
/**
|
|
175695
|
+
* Safely update ServiceArea.currentArea.
|
|
175696
|
+
* No-op if ServiceArea is not available on this endpoint.
|
|
175697
|
+
*/
|
|
175698
|
+
trySetCurrentArea(areaId) {
|
|
175699
|
+
try {
|
|
175700
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175701
|
+
if (serviceArea.state.currentArea !== areaId) {
|
|
175702
|
+
serviceArea.state.currentArea = areaId;
|
|
175703
|
+
logger189.debug(`currentArea set to ${areaId}`);
|
|
175704
|
+
}
|
|
175705
|
+
} catch {
|
|
175706
|
+
}
|
|
175707
|
+
}
|
|
175708
|
+
/**
|
|
175709
|
+
* Find the ServiceArea area ID that corresponds to a run mode value
|
|
175710
|
+
* by matching the mode label to the area location name.
|
|
175711
|
+
*/
|
|
175712
|
+
findAreaIdForMode(mode) {
|
|
175713
|
+
try {
|
|
175714
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175715
|
+
const modeEntry = this.state.supportedModes.find((m) => m.mode === mode);
|
|
175716
|
+
if (!modeEntry) return null;
|
|
175717
|
+
const area = serviceArea.state.supportedAreas.find(
|
|
175718
|
+
(a) => a.areaInfo.locationInfo?.locationName === modeEntry.label
|
|
175719
|
+
);
|
|
175720
|
+
return area?.areaId ?? null;
|
|
175721
|
+
} catch {
|
|
175722
|
+
return null;
|
|
175723
|
+
}
|
|
175674
175724
|
}
|
|
175675
175725
|
changeToMode(request) {
|
|
175676
175726
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -175685,7 +175735,9 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175685
175735
|
try {
|
|
175686
175736
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175687
175737
|
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
175738
|
+
this.trySetCurrentArea(serviceArea.state.selectedAreas[0]);
|
|
175688
175739
|
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
175740
|
+
this.state.currentMode = newMode;
|
|
175689
175741
|
return {
|
|
175690
175742
|
status: ModeBase3.ModeChangeStatus.Success,
|
|
175691
175743
|
statusText: "Starting room cleaning"
|
|
@@ -175694,9 +175746,11 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175694
175746
|
} catch {
|
|
175695
175747
|
}
|
|
175696
175748
|
if (this.state.config.cleanRoom) {
|
|
175749
|
+
this.trySetCurrentArea(this.findAreaIdForMode(newMode));
|
|
175697
175750
|
homeAssistant.callAction(
|
|
175698
175751
|
this.state.config.cleanRoom(newMode, this.agent)
|
|
175699
175752
|
);
|
|
175753
|
+
this.state.currentMode = newMode;
|
|
175700
175754
|
return {
|
|
175701
175755
|
status: ModeBase3.ModeChangeStatus.Success,
|
|
175702
175756
|
statusText: "Starting room cleaning"
|
|
@@ -175704,10 +175758,19 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175704
175758
|
}
|
|
175705
175759
|
}
|
|
175706
175760
|
switch (newMode) {
|
|
175707
|
-
case 1 /* Cleaning */:
|
|
175761
|
+
case 1 /* Cleaning */: {
|
|
175762
|
+
try {
|
|
175763
|
+
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175764
|
+
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
175765
|
+
this.trySetCurrentArea(serviceArea.state.selectedAreas[0]);
|
|
175766
|
+
}
|
|
175767
|
+
} catch {
|
|
175768
|
+
}
|
|
175708
175769
|
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
175709
175770
|
break;
|
|
175771
|
+
}
|
|
175710
175772
|
case 0 /* Idle */:
|
|
175773
|
+
this.trySetCurrentArea(null);
|
|
175711
175774
|
homeAssistant.callAction(
|
|
175712
175775
|
this.state.config.returnToBase(void 0, this.agent)
|
|
175713
175776
|
);
|
|
@@ -175716,6 +175779,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175716
175779
|
homeAssistant.callAction(this.state.config.pause(void 0, this.agent));
|
|
175717
175780
|
break;
|
|
175718
175781
|
}
|
|
175782
|
+
this.state.currentMode = newMode;
|
|
175719
175783
|
return {
|
|
175720
175784
|
status: ModeBase3.ModeChangeStatus.Success,
|
|
175721
175785
|
statusText: "Successfully switched mode"
|
|
@@ -175924,11 +175988,11 @@ init_esm();
|
|
|
175924
175988
|
|
|
175925
175989
|
// src/matter/behaviors/service-area-server.ts
|
|
175926
175990
|
init_esm();
|
|
175927
|
-
var
|
|
175991
|
+
var logger190 = Logger.get("ServiceAreaServer");
|
|
175928
175992
|
var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
175929
175993
|
selectAreas(request) {
|
|
175930
175994
|
const { newAreas } = request;
|
|
175931
|
-
|
|
175995
|
+
logger190.info(
|
|
175932
175996
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
175933
175997
|
);
|
|
175934
175998
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -175937,14 +176001,14 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
|
175937
176001
|
(id) => !supportedAreaIds.includes(id)
|
|
175938
176002
|
);
|
|
175939
176003
|
if (invalidAreas.length > 0) {
|
|
175940
|
-
|
|
176004
|
+
logger190.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
175941
176005
|
return {
|
|
175942
176006
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
175943
176007
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
175944
176008
|
};
|
|
175945
176009
|
}
|
|
175946
176010
|
this.state.selectedAreas = uniqueAreas;
|
|
175947
|
-
|
|
176011
|
+
logger190.info(
|
|
175948
176012
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
175949
176013
|
);
|
|
175950
176014
|
return {
|
|
@@ -175965,7 +176029,7 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
|
175965
176029
|
ServiceAreaServerBase2.State = State;
|
|
175966
176030
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
175967
176031
|
function ServiceAreaServer2(initialState) {
|
|
175968
|
-
|
|
176032
|
+
logger190.info(
|
|
175969
176033
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
175970
176034
|
);
|
|
175971
176035
|
return ServiceAreaServerBase.set({
|
|
@@ -175978,7 +176042,7 @@ var ServiceAreaWithMaps = ServiceAreaBehavior.with(ServiceArea3.Feature.Maps);
|
|
|
175978
176042
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
175979
176043
|
selectAreas(request) {
|
|
175980
176044
|
const { newAreas } = request;
|
|
175981
|
-
|
|
176045
|
+
logger190.info(
|
|
175982
176046
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
175983
176047
|
);
|
|
175984
176048
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -175987,14 +176051,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
|
175987
176051
|
(id) => !supportedAreaIds.includes(id)
|
|
175988
176052
|
);
|
|
175989
176053
|
if (invalidAreas.length > 0) {
|
|
175990
|
-
|
|
176054
|
+
logger190.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
175991
176055
|
return {
|
|
175992
176056
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
175993
176057
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
175994
176058
|
};
|
|
175995
176059
|
}
|
|
175996
176060
|
this.state.selectedAreas = uniqueAreas;
|
|
175997
|
-
|
|
176061
|
+
logger190.info(
|
|
175998
176062
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
175999
176063
|
);
|
|
176000
176064
|
return {
|
|
@@ -176015,14 +176079,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
|
176015
176079
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
176016
176080
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
176017
176081
|
function ServiceAreaServerWithMaps(initialState) {
|
|
176018
|
-
|
|
176082
|
+
logger190.info(
|
|
176019
176083
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
176020
176084
|
);
|
|
176021
176085
|
for (const map of initialState.supportedMaps) {
|
|
176022
176086
|
const areaCount = initialState.supportedAreas.filter(
|
|
176023
176087
|
(a) => a.mapId === map.mapId
|
|
176024
176088
|
).length;
|
|
176025
|
-
|
|
176089
|
+
logger190.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
176026
176090
|
}
|
|
176027
176091
|
return ServiceAreaServerWithMapsBase.set({
|
|
176028
176092
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -176033,7 +176097,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
176033
176097
|
}
|
|
176034
176098
|
|
|
176035
176099
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
176036
|
-
var
|
|
176100
|
+
var logger191 = Logger.get("VacuumServiceAreaServer");
|
|
176037
176101
|
function toAreaId(roomId) {
|
|
176038
176102
|
if (typeof roomId === "number") {
|
|
176039
176103
|
return roomId;
|
|
@@ -176112,13 +176176,13 @@ function createVacuumServiceAreaServer(attributes7, roomEntities, includeUnnamed
|
|
|
176112
176176
|
let rooms;
|
|
176113
176177
|
if (roomEntities && roomEntities.length > 0) {
|
|
176114
176178
|
rooms = buttonEntitiesToRooms(roomEntities, attributes7);
|
|
176115
|
-
|
|
176179
|
+
logger191.info(
|
|
176116
176180
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
176117
176181
|
);
|
|
176118
176182
|
} else {
|
|
176119
176183
|
rooms = parseVacuumRooms(attributes7, includeUnnamedRooms);
|
|
176120
176184
|
if (rooms.length > 0) {
|
|
176121
|
-
|
|
176185
|
+
logger191.info(
|
|
176122
176186
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
176123
176187
|
);
|
|
176124
176188
|
}
|
|
@@ -176172,7 +176236,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
176172
176236
|
landmarkInfo: null
|
|
176173
176237
|
}
|
|
176174
176238
|
}));
|
|
176175
|
-
|
|
176239
|
+
logger191.info(
|
|
176176
176240
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
176177
176241
|
);
|
|
176178
176242
|
return ServiceAreaServer2({
|
|
@@ -176194,7 +176258,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
176194
176258
|
landmarkInfo: null
|
|
176195
176259
|
}
|
|
176196
176260
|
}));
|
|
176197
|
-
|
|
176261
|
+
logger191.info(
|
|
176198
176262
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
|
|
176199
176263
|
);
|
|
176200
176264
|
return ServiceAreaServer2({
|
|
@@ -176205,11 +176269,11 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
176205
176269
|
}
|
|
176206
176270
|
|
|
176207
176271
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
176208
|
-
var
|
|
176272
|
+
var logger192 = Logger.get("VacuumRvcRunModeServer");
|
|
176209
176273
|
function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
|
|
176210
176274
|
const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
176211
176275
|
const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
|
|
176212
|
-
|
|
176276
|
+
logger192.info(
|
|
176213
176277
|
`Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
|
|
176214
176278
|
);
|
|
176215
176279
|
return {
|
|
@@ -176271,12 +176335,12 @@ function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, ser
|
|
|
176271
176335
|
const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
|
|
176272
176336
|
serviceArea.state.selectedAreas = [];
|
|
176273
176337
|
if (matched.length === 0) {
|
|
176274
|
-
|
|
176338
|
+
logger192.warn(
|
|
176275
176339
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
176276
176340
|
);
|
|
176277
176341
|
return { action: "vacuum.start" };
|
|
176278
176342
|
}
|
|
176279
|
-
|
|
176343
|
+
logger192.info(
|
|
176280
176344
|
`Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
|
|
176281
176345
|
);
|
|
176282
176346
|
for (let i = 1; i < matched.length; i++) {
|
|
@@ -176315,7 +176379,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176315
176379
|
VacuumState.mop_cleaning
|
|
176316
176380
|
];
|
|
176317
176381
|
const isCleaning = cleaningStates.includes(state);
|
|
176318
|
-
|
|
176382
|
+
logger192.debug(
|
|
176319
176383
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
176320
176384
|
);
|
|
176321
176385
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -176347,7 +176411,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176347
176411
|
const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
|
|
176348
176412
|
serviceArea.state.selectedAreas = [];
|
|
176349
176413
|
if (haAreaIds.length > 0) {
|
|
176350
|
-
|
|
176414
|
+
logger192.info(
|
|
176351
176415
|
`CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`
|
|
176352
176416
|
);
|
|
176353
176417
|
return {
|
|
@@ -176368,7 +176432,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176368
176432
|
}
|
|
176369
176433
|
}
|
|
176370
176434
|
if (buttonEntityIds.length > 0) {
|
|
176371
|
-
|
|
176435
|
+
logger192.info(
|
|
176372
176436
|
`Roborock: Pressing button entities for selected rooms: ${buttonEntityIds.join(", ")}`
|
|
176373
176437
|
);
|
|
176374
176438
|
serviceArea.state.selectedAreas = [];
|
|
@@ -176406,7 +176470,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176406
176470
|
}
|
|
176407
176471
|
}
|
|
176408
176472
|
if (roomIds.length > 0) {
|
|
176409
|
-
|
|
176473
|
+
logger192.info(
|
|
176410
176474
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
176411
176475
|
);
|
|
176412
176476
|
serviceArea.state.selectedAreas = [];
|
|
@@ -176414,7 +176478,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176414
176478
|
if (targetMapName) {
|
|
176415
176479
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
176416
176480
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
176417
|
-
|
|
176481
|
+
logger192.info(
|
|
176418
176482
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
176419
176483
|
);
|
|
176420
176484
|
homeAssistant.callAction({
|
|
@@ -176441,7 +176505,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176441
176505
|
}
|
|
176442
176506
|
if (isEcovacsVacuum(attributes7)) {
|
|
176443
176507
|
const roomIdStr = roomIds.join(",");
|
|
176444
|
-
|
|
176508
|
+
logger192.info(
|
|
176445
176509
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
176446
176510
|
);
|
|
176447
176511
|
return {
|
|
@@ -176456,14 +176520,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
176456
176520
|
}
|
|
176457
176521
|
};
|
|
176458
176522
|
}
|
|
176459
|
-
|
|
176523
|
+
logger192.warn(
|
|
176460
176524
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
176461
176525
|
);
|
|
176462
176526
|
}
|
|
176463
176527
|
}
|
|
176464
176528
|
} catch {
|
|
176465
176529
|
}
|
|
176466
|
-
|
|
176530
|
+
logger192.info("Starting regular cleaning (no areas selected)");
|
|
176467
176531
|
return { action: "vacuum.start" };
|
|
176468
176532
|
},
|
|
176469
176533
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -176478,7 +176542,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176478
176542
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
176479
176543
|
const entity = homeAssistant.entity;
|
|
176480
176544
|
const attributes7 = entity.state.attributes;
|
|
176481
|
-
|
|
176545
|
+
logger192.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
176482
176546
|
const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
|
|
176483
176547
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
176484
176548
|
const sorted = [...cleanAreaRooms].sort(
|
|
@@ -176487,7 +176551,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176487
176551
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
176488
176552
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
176489
176553
|
const area = sorted[areaIndex];
|
|
176490
|
-
|
|
176554
|
+
logger192.info(
|
|
176491
176555
|
`cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
|
|
176492
176556
|
);
|
|
176493
176557
|
return {
|
|
@@ -176504,7 +176568,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176504
176568
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
176505
176569
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
176506
176570
|
const area = sorted[areaIndex];
|
|
176507
|
-
|
|
176571
|
+
logger192.info(
|
|
176508
176572
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
176509
176573
|
);
|
|
176510
176574
|
return {
|
|
@@ -176525,7 +176589,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176525
176589
|
}
|
|
176526
176590
|
const rooms = parseVacuumRooms(attributes7);
|
|
176527
176591
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
176528
|
-
|
|
176592
|
+
logger192.info(
|
|
176529
176593
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
176530
176594
|
);
|
|
176531
176595
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -176535,7 +176599,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176535
176599
|
if (room.mapName) {
|
|
176536
176600
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
176537
176601
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
176538
|
-
|
|
176602
|
+
logger192.info(
|
|
176539
176603
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
176540
176604
|
);
|
|
176541
176605
|
homeAssistant.callAction({
|
|
@@ -176544,7 +176608,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176544
176608
|
data: { option: room.mapName }
|
|
176545
176609
|
});
|
|
176546
176610
|
}
|
|
176547
|
-
|
|
176611
|
+
logger192.debug(
|
|
176548
176612
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
176549
176613
|
);
|
|
176550
176614
|
return {
|
|
@@ -176555,7 +176619,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176555
176619
|
};
|
|
176556
176620
|
}
|
|
176557
176621
|
if (isRoborockVacuum(attributes7) || isXiaomiMiotVacuum(attributes7)) {
|
|
176558
|
-
|
|
176622
|
+
logger192.debug(
|
|
176559
176623
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
176560
176624
|
);
|
|
176561
176625
|
return {
|
|
@@ -176568,7 +176632,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176568
176632
|
}
|
|
176569
176633
|
if (isEcovacsVacuum(attributes7)) {
|
|
176570
176634
|
const roomIdStr = String(commandId3);
|
|
176571
|
-
|
|
176635
|
+
logger192.info(
|
|
176572
176636
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
176573
176637
|
);
|
|
176574
176638
|
return {
|
|
@@ -176583,7 +176647,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
176583
176647
|
}
|
|
176584
176648
|
};
|
|
176585
176649
|
}
|
|
176586
|
-
|
|
176650
|
+
logger192.warn(
|
|
176587
176651
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
176588
176652
|
);
|
|
176589
176653
|
}
|
|
@@ -176599,20 +176663,20 @@ function createVacuumRvcRunModeServer(attributes7, includeUnnamedRooms = false,
|
|
|
176599
176663
|
includeUnnamedRooms,
|
|
176600
176664
|
customAreas
|
|
176601
176665
|
);
|
|
176602
|
-
|
|
176666
|
+
logger192.info(
|
|
176603
176667
|
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
|
|
176604
176668
|
);
|
|
176605
176669
|
if (rooms.length > 0) {
|
|
176606
|
-
|
|
176670
|
+
logger192.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
176607
176671
|
}
|
|
176608
176672
|
if (filteredCount > 0) {
|
|
176609
176673
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
176610
|
-
|
|
176674
|
+
logger192.info(
|
|
176611
176675
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
176612
176676
|
);
|
|
176613
176677
|
}
|
|
176614
176678
|
if (allRooms.length === 0) {
|
|
176615
|
-
|
|
176679
|
+
logger192.debug(
|
|
176616
176680
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes7.rooms)}, segments=${JSON.stringify(attributes7.segments)}, room_list=${attributes7.room_list}`
|
|
176617
176681
|
);
|
|
176618
176682
|
}
|
|
@@ -176646,7 +176710,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
|
|
|
176646
176710
|
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
176647
176711
|
});
|
|
176648
176712
|
}
|
|
176649
|
-
|
|
176713
|
+
logger192.info(
|
|
176650
176714
|
`Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
|
|
176651
176715
|
);
|
|
176652
176716
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
@@ -176707,7 +176771,7 @@ init_rvc_clean_mode();
|
|
|
176707
176771
|
|
|
176708
176772
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
176709
176773
|
init_home_assistant_entity_behavior();
|
|
176710
|
-
var
|
|
176774
|
+
var logger193 = Logger.get("RvcCleanModeServerBase");
|
|
176711
176775
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
176712
176776
|
// Pending mode from a recent changeToMode command.
|
|
176713
176777
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -176750,14 +176814,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
176750
176814
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
176751
176815
|
const { newMode } = request;
|
|
176752
176816
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
176753
|
-
|
|
176817
|
+
logger193.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
176754
176818
|
return {
|
|
176755
176819
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
176756
176820
|
statusText: `Unsupported mode: ${newMode}`
|
|
176757
176821
|
};
|
|
176758
176822
|
}
|
|
176759
176823
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
176760
|
-
|
|
176824
|
+
logger193.info(
|
|
176761
176825
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
176762
176826
|
);
|
|
176763
176827
|
this.pendingMode = newMode;
|
|
@@ -176765,7 +176829,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
176765
176829
|
this.state.currentMode = newMode;
|
|
176766
176830
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
176767
176831
|
if (action) {
|
|
176768
|
-
|
|
176832
|
+
logger193.info(
|
|
176769
176833
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
176770
176834
|
);
|
|
176771
176835
|
homeAssistant.callAction(action);
|
|
@@ -176798,7 +176862,7 @@ function RvcCleanModeServer2(config10, initialState) {
|
|
|
176798
176862
|
}
|
|
176799
176863
|
|
|
176800
176864
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
176801
|
-
var
|
|
176865
|
+
var logger194 = Logger.get("VacuumRvcCleanModeServer");
|
|
176802
176866
|
var MODE_VACUUM = 0;
|
|
176803
176867
|
var MODE_VACUUM_AND_MOP = 1;
|
|
176804
176868
|
var MODE_MOP = 2;
|
|
@@ -177097,7 +177161,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
177097
177161
|
if (match) return match;
|
|
177098
177162
|
}
|
|
177099
177163
|
}
|
|
177100
|
-
|
|
177164
|
+
logger194.warn(
|
|
177101
177165
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
177102
177166
|
);
|
|
177103
177167
|
return aliases[0];
|
|
@@ -177106,7 +177170,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
177106
177170
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
177107
177171
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
177108
177172
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
177109
|
-
|
|
177173
|
+
logger194.info(
|
|
177110
177174
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
177111
177175
|
);
|
|
177112
177176
|
return {
|
|
@@ -177195,7 +177259,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177195
177259
|
}
|
|
177196
177260
|
}
|
|
177197
177261
|
if (speedMode !== void 0) {
|
|
177198
|
-
|
|
177262
|
+
logger194.debug(
|
|
177199
177263
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
177200
177264
|
);
|
|
177201
177265
|
return speedMode;
|
|
@@ -177216,7 +177280,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177216
177280
|
}
|
|
177217
177281
|
}
|
|
177218
177282
|
if (mopMode !== void 0) {
|
|
177219
|
-
|
|
177283
|
+
logger194.debug(
|
|
177220
177284
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
177221
177285
|
);
|
|
177222
177286
|
return mopMode;
|
|
@@ -177234,14 +177298,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177234
177298
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
177235
177299
|
const vacuumEntityId = homeAssistant.entityId;
|
|
177236
177300
|
const mapping = homeAssistant.state.mapping;
|
|
177237
|
-
|
|
177301
|
+
logger194.info(
|
|
177238
177302
|
`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
177303
|
);
|
|
177240
177304
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
177241
177305
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
177242
177306
|
const mopName = mopIntensityList[mopIndex];
|
|
177243
177307
|
if (!mopName) {
|
|
177244
|
-
|
|
177308
|
+
logger194.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
177245
177309
|
return void 0;
|
|
177246
177310
|
}
|
|
177247
177311
|
if (hasCleanTypes) {
|
|
@@ -177254,18 +177318,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177254
177318
|
mapping.mopIntensityEntity,
|
|
177255
177319
|
agent
|
|
177256
177320
|
);
|
|
177257
|
-
|
|
177321
|
+
logger194.info(
|
|
177258
177322
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
177259
177323
|
);
|
|
177260
177324
|
let option = matchMopIntensityOption(mopName, options);
|
|
177261
177325
|
if (!option && options && mopIndex < options.length) {
|
|
177262
177326
|
option = options[mopIndex];
|
|
177263
|
-
|
|
177327
|
+
logger194.info(
|
|
177264
177328
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
177265
177329
|
);
|
|
177266
177330
|
}
|
|
177267
177331
|
if (option) {
|
|
177268
|
-
|
|
177332
|
+
logger194.info(
|
|
177269
177333
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
177270
177334
|
);
|
|
177271
177335
|
return {
|
|
@@ -177274,11 +177338,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177274
177338
|
target: mapping.mopIntensityEntity
|
|
177275
177339
|
};
|
|
177276
177340
|
}
|
|
177277
|
-
|
|
177341
|
+
logger194.warn(
|
|
177278
177342
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
177279
177343
|
);
|
|
177280
177344
|
} else {
|
|
177281
|
-
|
|
177345
|
+
logger194.warn(
|
|
177282
177346
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
177283
177347
|
);
|
|
177284
177348
|
}
|
|
@@ -177288,7 +177352,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177288
177352
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
177289
177353
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
177290
177354
|
if (!fanSpeedName) {
|
|
177291
|
-
|
|
177355
|
+
logger194.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
177292
177356
|
return void 0;
|
|
177293
177357
|
}
|
|
177294
177358
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -177301,7 +177365,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177301
177365
|
mapping.suctionLevelEntity,
|
|
177302
177366
|
agent
|
|
177303
177367
|
);
|
|
177304
|
-
|
|
177368
|
+
logger194.info(
|
|
177305
177369
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
177306
177370
|
);
|
|
177307
177371
|
let option = matchFanSpeedOption(
|
|
@@ -177311,12 +177375,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177311
177375
|
);
|
|
177312
177376
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
177313
177377
|
option = options[fanSpeedIndex];
|
|
177314
|
-
|
|
177378
|
+
logger194.info(
|
|
177315
177379
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
177316
177380
|
);
|
|
177317
177381
|
}
|
|
177318
177382
|
if (option) {
|
|
177319
|
-
|
|
177383
|
+
logger194.info(
|
|
177320
177384
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
177321
177385
|
);
|
|
177322
177386
|
return {
|
|
@@ -177325,7 +177389,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177325
177389
|
target: mapping.suctionLevelEntity
|
|
177326
177390
|
};
|
|
177327
177391
|
}
|
|
177328
|
-
|
|
177392
|
+
logger194.warn(
|
|
177329
177393
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
177330
177394
|
);
|
|
177331
177395
|
return void 0;
|
|
@@ -177335,7 +177399,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177335
177399
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
177336
177400
|
);
|
|
177337
177401
|
}
|
|
177338
|
-
|
|
177402
|
+
logger194.info(
|
|
177339
177403
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
177340
177404
|
);
|
|
177341
177405
|
return {
|
|
@@ -177345,7 +177409,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177345
177409
|
};
|
|
177346
177410
|
}
|
|
177347
177411
|
if (!hasCleanTypes) {
|
|
177348
|
-
|
|
177412
|
+
logger194.debug(
|
|
177349
177413
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
177350
177414
|
);
|
|
177351
177415
|
return void 0;
|
|
@@ -177357,7 +177421,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
177357
177421
|
agent
|
|
177358
177422
|
);
|
|
177359
177423
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
177360
|
-
|
|
177424
|
+
logger194.info(
|
|
177361
177425
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
177362
177426
|
);
|
|
177363
177427
|
return {
|
|
@@ -177375,10 +177439,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
177375
177439
|
cleaningModeOptions,
|
|
177376
177440
|
customFanSpeedTags
|
|
177377
177441
|
);
|
|
177378
|
-
|
|
177442
|
+
logger194.info(
|
|
177379
177443
|
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
177380
177444
|
);
|
|
177381
|
-
|
|
177445
|
+
logger194.info(
|
|
177382
177446
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
177383
177447
|
);
|
|
177384
177448
|
const initialState = {
|
|
@@ -177456,7 +177520,7 @@ init_rvc_operational_state();
|
|
|
177456
177520
|
init_home_assistant_entity_behavior();
|
|
177457
177521
|
var OperationalState4 = RvcOperationalState3.OperationalState;
|
|
177458
177522
|
var ErrorState = RvcOperationalState3.ErrorState;
|
|
177459
|
-
var
|
|
177523
|
+
var logger195 = Logger.get("RvcOperationalStateServer");
|
|
177460
177524
|
var activeStates = /* @__PURE__ */ new Set([
|
|
177461
177525
|
OperationalState4.Running,
|
|
177462
177526
|
OperationalState4.SeekingCharger
|
|
@@ -177498,7 +177562,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
177498
177562
|
}
|
|
177499
177563
|
});
|
|
177500
177564
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
177501
|
-
|
|
177565
|
+
logger195.info(
|
|
177502
177566
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
177503
177567
|
);
|
|
177504
177568
|
try {
|
|
@@ -177511,7 +177575,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
177511
177575
|
this.context
|
|
177512
177576
|
);
|
|
177513
177577
|
} catch (e) {
|
|
177514
|
-
|
|
177578
|
+
logger195.debug("Failed to emit operationCompletion event:", e);
|
|
177515
177579
|
}
|
|
177516
177580
|
}
|
|
177517
177581
|
}
|
|
@@ -177546,7 +177610,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
177546
177610
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
177547
177611
|
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
177548
177612
|
} else {
|
|
177549
|
-
|
|
177613
|
+
logger195.warn("GoHome command received but no goHome action configured");
|
|
177550
177614
|
}
|
|
177551
177615
|
return {
|
|
177552
177616
|
commandResponseState: {
|
|
@@ -177566,7 +177630,7 @@ function RvcOperationalStateServer2(config10) {
|
|
|
177566
177630
|
}
|
|
177567
177631
|
|
|
177568
177632
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
|
|
177569
|
-
var
|
|
177633
|
+
var logger196 = Logger.get("VacuumRvcOperationalStateServer");
|
|
177570
177634
|
function isCharging(entity) {
|
|
177571
177635
|
const attrs = entity.attributes;
|
|
177572
177636
|
if (attrs.battery_icon?.includes("charging")) return true;
|
|
@@ -177608,16 +177672,16 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
177608
177672
|
operationalState = RvcOperationalState3.OperationalState.Error;
|
|
177609
177673
|
} else {
|
|
177610
177674
|
if (state.toLowerCase().includes("clean")) {
|
|
177611
|
-
|
|
177675
|
+
logger196.info(
|
|
177612
177676
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
177613
177677
|
);
|
|
177614
177678
|
operationalState = RvcOperationalState3.OperationalState.Running;
|
|
177615
177679
|
} else {
|
|
177616
|
-
|
|
177680
|
+
logger196.info(`Unknown vacuum state "${state}", treating as Paused`);
|
|
177617
177681
|
operationalState = RvcOperationalState3.OperationalState.Paused;
|
|
177618
177682
|
}
|
|
177619
177683
|
}
|
|
177620
|
-
|
|
177684
|
+
logger196.debug(
|
|
177621
177685
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
|
|
177622
177686
|
);
|
|
177623
177687
|
return operationalState;
|
|
@@ -177638,7 +177702,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
177638
177702
|
});
|
|
177639
177703
|
|
|
177640
177704
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
177641
|
-
var
|
|
177705
|
+
var logger197 = Logger.get("VacuumDevice");
|
|
177642
177706
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
177643
177707
|
BasicInformationServer2,
|
|
177644
177708
|
VacuumIdentifyServer,
|
|
@@ -177652,7 +177716,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
177652
177716
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
177653
177717
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
177654
177718
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
177655
|
-
|
|
177719
|
+
logger197.info(
|
|
177656
177720
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
177657
177721
|
);
|
|
177658
177722
|
const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
|
|
@@ -177664,32 +177728,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
177664
177728
|
)
|
|
177665
177729
|
).set({ homeAssistantEntity });
|
|
177666
177730
|
if (includeOnOff) {
|
|
177667
|
-
|
|
177731
|
+
logger197.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
177668
177732
|
device = device.with(VacuumOnOffServer);
|
|
177669
177733
|
}
|
|
177670
177734
|
device = device.with(VacuumPowerSourceServer);
|
|
177671
177735
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
177672
177736
|
const rooms = parseVacuumRooms(attributes7);
|
|
177673
|
-
|
|
177737
|
+
logger197.info(
|
|
177674
177738
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
|
|
177675
177739
|
);
|
|
177676
177740
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
177677
|
-
|
|
177741
|
+
logger197.info(
|
|
177678
177742
|
`${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
|
|
177679
177743
|
);
|
|
177680
177744
|
device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
|
|
177681
177745
|
} else if (customAreas && customAreas.length > 0) {
|
|
177682
|
-
|
|
177746
|
+
logger197.info(
|
|
177683
177747
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
177684
177748
|
);
|
|
177685
177749
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
177686
177750
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
177687
|
-
|
|
177751
|
+
logger197.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
177688
177752
|
device = device.with(
|
|
177689
177753
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
177690
177754
|
);
|
|
177691
177755
|
} else {
|
|
177692
|
-
|
|
177756
|
+
logger197.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
177693
177757
|
device = device.with(createDefaultServiceAreaServer());
|
|
177694
177758
|
}
|
|
177695
177759
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -177700,7 +177764,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
177700
177764
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
177701
177765
|
);
|
|
177702
177766
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
177703
|
-
|
|
177767
|
+
logger197.info(
|
|
177704
177768
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
177705
177769
|
);
|
|
177706
177770
|
device = device.with(
|
|
@@ -177713,7 +177777,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
177713
177777
|
)
|
|
177714
177778
|
);
|
|
177715
177779
|
} else {
|
|
177716
|
-
|
|
177780
|
+
logger197.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
177717
177781
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
177718
177782
|
}
|
|
177719
177783
|
return device;
|
|
@@ -177879,7 +177943,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
177879
177943
|
);
|
|
177880
177944
|
|
|
177881
177945
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
177882
|
-
var
|
|
177946
|
+
var logger198 = Logger.get("WaterHeaterDevice");
|
|
177883
177947
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
177884
177948
|
BasicInformationServer2,
|
|
177885
177949
|
IdentifyServer2,
|
|
@@ -177895,7 +177959,7 @@ function toMatterTemp2(value) {
|
|
|
177895
177959
|
}
|
|
177896
177960
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
177897
177961
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
177898
|
-
|
|
177962
|
+
logger198.debug(
|
|
177899
177963
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes7.min_temp}, max_temp=${attributes7.max_temp}`
|
|
177900
177964
|
);
|
|
177901
177965
|
const minLimit = toMatterTemp2(attributes7.min_temp) ?? 0;
|
|
@@ -178108,7 +178172,7 @@ var matterDeviceTypeFactories = {
|
|
|
178108
178172
|
};
|
|
178109
178173
|
|
|
178110
178174
|
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
178111
|
-
var
|
|
178175
|
+
var logger199 = Logger.get("UserComposedEndpoint");
|
|
178112
178176
|
function createEndpointId4(entityId, customName) {
|
|
178113
178177
|
const baseName = customName || entityId;
|
|
178114
178178
|
return baseName.replace(/\./g, "_").replace(/\s+/g, "_");
|
|
@@ -178159,7 +178223,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178159
178223
|
{ vacuumOnOff: registry2.isVacuumOnOffEnabled() }
|
|
178160
178224
|
);
|
|
178161
178225
|
if (!primaryType) {
|
|
178162
|
-
|
|
178226
|
+
logger199.warn(
|
|
178163
178227
|
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
178164
178228
|
);
|
|
178165
178229
|
return void 0;
|
|
@@ -178174,7 +178238,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178174
178238
|
if (!sub.entityId) continue;
|
|
178175
178239
|
const subPayload = buildEntityPayload3(registry2, sub.entityId);
|
|
178176
178240
|
if (!subPayload) {
|
|
178177
|
-
|
|
178241
|
+
logger199.warn(
|
|
178178
178242
|
`Cannot find entity state for composed sub-entity ${sub.entityId}`
|
|
178179
178243
|
);
|
|
178180
178244
|
continue;
|
|
@@ -178185,7 +178249,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178185
178249
|
};
|
|
178186
178250
|
const subType = createLegacyEndpointType(subPayload, subMapping);
|
|
178187
178251
|
if (!subType) {
|
|
178188
|
-
|
|
178252
|
+
logger199.warn(
|
|
178189
178253
|
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
178190
178254
|
);
|
|
178191
178255
|
continue;
|
|
@@ -178198,7 +178262,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178198
178262
|
mappedIds.push(sub.entityId);
|
|
178199
178263
|
}
|
|
178200
178264
|
if (parts.length < 2) {
|
|
178201
|
-
|
|
178265
|
+
logger199.warn(
|
|
178202
178266
|
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
178203
178267
|
);
|
|
178204
178268
|
return void 0;
|
|
@@ -178221,7 +178285,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178221
178285
|
const labels = parts.map(
|
|
178222
178286
|
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
178223
178287
|
).join("+");
|
|
178224
|
-
|
|
178288
|
+
logger199.info(
|
|
178225
178289
|
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
178226
178290
|
);
|
|
178227
178291
|
return endpoint;
|
|
@@ -178290,7 +178354,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
178290
178354
|
};
|
|
178291
178355
|
|
|
178292
178356
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
178293
|
-
var
|
|
178357
|
+
var logger200 = Logger.get("LegacyEndpoint");
|
|
178294
178358
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
178295
178359
|
static async create(registry2, entityId, mapping, pluginDomainMappings) {
|
|
178296
178360
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -178300,25 +178364,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178300
178364
|
return;
|
|
178301
178365
|
}
|
|
178302
178366
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
178303
|
-
|
|
178367
|
+
logger200.debug(
|
|
178304
178368
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
178305
178369
|
);
|
|
178306
178370
|
return;
|
|
178307
178371
|
}
|
|
178308
178372
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
178309
|
-
|
|
178373
|
+
logger200.debug(
|
|
178310
178374
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
178311
178375
|
);
|
|
178312
178376
|
return;
|
|
178313
178377
|
}
|
|
178314
178378
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
178315
|
-
|
|
178379
|
+
logger200.debug(
|
|
178316
178380
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
178317
178381
|
);
|
|
178318
178382
|
return;
|
|
178319
178383
|
}
|
|
178320
178384
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
178321
|
-
|
|
178385
|
+
logger200.debug(
|
|
178322
178386
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
178323
178387
|
);
|
|
178324
178388
|
return;
|
|
@@ -178338,7 +178402,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178338
178402
|
humidityEntity: humidityEntityId
|
|
178339
178403
|
};
|
|
178340
178404
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
178341
|
-
|
|
178405
|
+
logger200.debug(
|
|
178342
178406
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
178343
178407
|
);
|
|
178344
178408
|
}
|
|
@@ -178357,7 +178421,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178357
178421
|
pressureEntity: pressureEntityId
|
|
178358
178422
|
};
|
|
178359
178423
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
178360
|
-
|
|
178424
|
+
logger200.debug(
|
|
178361
178425
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
178362
178426
|
);
|
|
178363
178427
|
}
|
|
@@ -178375,7 +178439,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178375
178439
|
batteryEntity: batteryEntityId
|
|
178376
178440
|
};
|
|
178377
178441
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
178378
|
-
|
|
178442
|
+
logger200.debug(
|
|
178379
178443
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
178380
178444
|
);
|
|
178381
178445
|
}
|
|
@@ -178393,7 +178457,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178393
178457
|
powerEntity: powerEntityId
|
|
178394
178458
|
};
|
|
178395
178459
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
178396
|
-
|
|
178460
|
+
logger200.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
178397
178461
|
}
|
|
178398
178462
|
}
|
|
178399
178463
|
}
|
|
@@ -178410,7 +178474,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178410
178474
|
energyEntity: energyEntityId
|
|
178411
178475
|
};
|
|
178412
178476
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
178413
|
-
|
|
178477
|
+
logger200.debug(
|
|
178414
178478
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
178415
178479
|
);
|
|
178416
178480
|
}
|
|
@@ -178426,7 +178490,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178426
178490
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178427
178491
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
178428
178492
|
};
|
|
178429
|
-
|
|
178493
|
+
logger200.debug(
|
|
178430
178494
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
178431
178495
|
);
|
|
178432
178496
|
}
|
|
@@ -178436,7 +178500,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178436
178500
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178437
178501
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
178438
178502
|
};
|
|
178439
|
-
|
|
178503
|
+
logger200.debug(
|
|
178440
178504
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
178441
178505
|
);
|
|
178442
178506
|
}
|
|
@@ -178446,7 +178510,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178446
178510
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178447
178511
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
178448
178512
|
};
|
|
178449
|
-
|
|
178513
|
+
logger200.debug(
|
|
178450
178514
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
178451
178515
|
);
|
|
178452
178516
|
}
|
|
@@ -178461,7 +178525,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178461
178525
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178462
178526
|
cleanAreaRooms
|
|
178463
178527
|
};
|
|
178464
|
-
|
|
178528
|
+
logger200.debug(
|
|
178465
178529
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
178466
178530
|
);
|
|
178467
178531
|
}
|
|
@@ -178482,7 +178546,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178482
178546
|
rooms: roomsObj
|
|
178483
178547
|
}
|
|
178484
178548
|
};
|
|
178485
|
-
|
|
178549
|
+
logger200.debug(
|
|
178486
178550
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
178487
178551
|
);
|
|
178488
178552
|
} else {
|
|
@@ -178499,7 +178563,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178499
178563
|
rooms: roomsObj
|
|
178500
178564
|
}
|
|
178501
178565
|
};
|
|
178502
|
-
|
|
178566
|
+
logger200.debug(
|
|
178503
178567
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
178504
178568
|
);
|
|
178505
178569
|
}
|
|
@@ -178520,7 +178584,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178520
178584
|
if (composed) {
|
|
178521
178585
|
return composed;
|
|
178522
178586
|
}
|
|
178523
|
-
|
|
178587
|
+
logger200.warn(
|
|
178524
178588
|
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
178525
178589
|
);
|
|
178526
178590
|
}
|
|
@@ -178620,11 +178684,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178620
178684
|
}
|
|
178621
178685
|
if (mappedChanged) {
|
|
178622
178686
|
this.pendingMappedChange = true;
|
|
178623
|
-
|
|
178687
|
+
logger200.debug(
|
|
178624
178688
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
178625
178689
|
);
|
|
178626
178690
|
}
|
|
178627
|
-
|
|
178691
|
+
logger200.debug(
|
|
178628
178692
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
178629
178693
|
);
|
|
178630
178694
|
this.lastState = state;
|
|
@@ -178668,7 +178732,7 @@ import {
|
|
|
178668
178732
|
getCollection
|
|
178669
178733
|
} from "home-assistant-js-websocket";
|
|
178670
178734
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
178671
|
-
var
|
|
178735
|
+
var logger201 = Logger.get("SubscribeEntities");
|
|
178672
178736
|
function processEvent(store, updates) {
|
|
178673
178737
|
const state = { ...store.state };
|
|
178674
178738
|
if (updates.a) {
|
|
@@ -178694,7 +178758,7 @@ function processEvent(store, updates) {
|
|
|
178694
178758
|
for (const entityId in updates.c) {
|
|
178695
178759
|
let entityState = state[entityId];
|
|
178696
178760
|
if (!entityState) {
|
|
178697
|
-
|
|
178761
|
+
logger201.warn("Received state update for unknown entity", entityId);
|
|
178698
178762
|
continue;
|
|
178699
178763
|
}
|
|
178700
178764
|
entityState = { ...entityState };
|
|
@@ -178764,7 +178828,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
|
|
|
178764
178828
|
|
|
178765
178829
|
// src/services/bridges/entity-isolation-service.ts
|
|
178766
178830
|
init_esm();
|
|
178767
|
-
var
|
|
178831
|
+
var logger202 = Logger.get("EntityIsolation");
|
|
178768
178832
|
var EntityIsolationServiceImpl = class {
|
|
178769
178833
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
178770
178834
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -178829,13 +178893,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
178829
178893
|
}
|
|
178830
178894
|
const parsed = this.parseEndpointPath(msg);
|
|
178831
178895
|
if (!parsed) {
|
|
178832
|
-
|
|
178896
|
+
logger202.warn("Could not parse entity from error:", msg);
|
|
178833
178897
|
return false;
|
|
178834
178898
|
}
|
|
178835
178899
|
const { bridgeId, entityName } = parsed;
|
|
178836
178900
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
178837
178901
|
if (!callback) {
|
|
178838
|
-
|
|
178902
|
+
logger202.warn(
|
|
178839
178903
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
178840
178904
|
);
|
|
178841
178905
|
return false;
|
|
@@ -178846,14 +178910,14 @@ var EntityIsolationServiceImpl = class {
|
|
|
178846
178910
|
}
|
|
178847
178911
|
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
178848
178912
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
178849
|
-
|
|
178913
|
+
logger202.warn(
|
|
178850
178914
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
178851
178915
|
);
|
|
178852
178916
|
try {
|
|
178853
178917
|
await callback(entityName);
|
|
178854
178918
|
return true;
|
|
178855
178919
|
} catch (e) {
|
|
178856
|
-
|
|
178920
|
+
logger202.error(`Failed to isolate entity ${entityName}:`, e);
|
|
178857
178921
|
return false;
|
|
178858
178922
|
}
|
|
178859
178923
|
}
|
|
@@ -180035,11 +180099,11 @@ init_dist();
|
|
|
180035
180099
|
var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
|
|
180036
180100
|
var DEAD_SESSION_TIMEOUT_MS2 = 6e4;
|
|
180037
180101
|
var ServerModeBridge = class {
|
|
180038
|
-
constructor(
|
|
180102
|
+
constructor(logger205, dataProvider, endpointManager, server) {
|
|
180039
180103
|
this.dataProvider = dataProvider;
|
|
180040
180104
|
this.endpointManager = endpointManager;
|
|
180041
180105
|
this.server = server;
|
|
180042
|
-
this.log =
|
|
180106
|
+
this.log = logger205.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
180043
180107
|
}
|
|
180044
180108
|
log;
|
|
180045
180109
|
status = {
|
|
@@ -180548,7 +180612,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
180548
180612
|
}
|
|
180549
180613
|
|
|
180550
180614
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
180551
|
-
var
|
|
180615
|
+
var logger203 = Logger.get("ServerModeVacuumEndpoint");
|
|
180552
180616
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
180553
180617
|
static async create(registry2, entityId, mapping) {
|
|
180554
180618
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -180558,7 +180622,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180558
180622
|
return void 0;
|
|
180559
180623
|
}
|
|
180560
180624
|
let effectiveMapping = mapping;
|
|
180561
|
-
|
|
180625
|
+
logger203.info(
|
|
180562
180626
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
180563
180627
|
);
|
|
180564
180628
|
if (entity.device_id) {
|
|
@@ -180573,15 +180637,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180573
180637
|
batteryEntity: batteryEntityId
|
|
180574
180638
|
};
|
|
180575
180639
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
180576
|
-
|
|
180640
|
+
logger203.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
180577
180641
|
} else {
|
|
180578
180642
|
const attrs = state.attributes;
|
|
180579
180643
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
180580
|
-
|
|
180644
|
+
logger203.info(
|
|
180581
180645
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
180582
180646
|
);
|
|
180583
180647
|
} else {
|
|
180584
|
-
|
|
180648
|
+
logger203.warn(
|
|
180585
180649
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
180586
180650
|
);
|
|
180587
180651
|
}
|
|
@@ -180596,7 +180660,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180596
180660
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180597
180661
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
180598
180662
|
};
|
|
180599
|
-
|
|
180663
|
+
logger203.info(
|
|
180600
180664
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
180601
180665
|
);
|
|
180602
180666
|
}
|
|
@@ -180606,7 +180670,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180606
180670
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180607
180671
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
180608
180672
|
};
|
|
180609
|
-
|
|
180673
|
+
logger203.info(
|
|
180610
180674
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
180611
180675
|
);
|
|
180612
180676
|
}
|
|
@@ -180616,7 +180680,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180616
180680
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180617
180681
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
180618
180682
|
};
|
|
180619
|
-
|
|
180683
|
+
logger203.info(
|
|
180620
180684
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
180621
180685
|
);
|
|
180622
180686
|
}
|
|
@@ -180631,7 +180695,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180631
180695
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180632
180696
|
cleanAreaRooms
|
|
180633
180697
|
};
|
|
180634
|
-
|
|
180698
|
+
logger203.info(
|
|
180635
180699
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
180636
180700
|
);
|
|
180637
180701
|
}
|
|
@@ -180652,7 +180716,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180652
180716
|
rooms: roomsObj
|
|
180653
180717
|
}
|
|
180654
180718
|
};
|
|
180655
|
-
|
|
180719
|
+
logger203.info(
|
|
180656
180720
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
180657
180721
|
);
|
|
180658
180722
|
} else {
|
|
@@ -180669,14 +180733,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180669
180733
|
rooms: roomsObj
|
|
180670
180734
|
}
|
|
180671
180735
|
};
|
|
180672
|
-
|
|
180736
|
+
logger203.info(
|
|
180673
180737
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
180674
180738
|
);
|
|
180675
180739
|
}
|
|
180676
180740
|
}
|
|
180677
180741
|
}
|
|
180678
180742
|
} else {
|
|
180679
|
-
|
|
180743
|
+
logger203.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
|
|
180680
180744
|
}
|
|
180681
180745
|
const payload = {
|
|
180682
180746
|
entity_id: entityId,
|
|
@@ -180740,11 +180804,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180740
180804
|
}
|
|
180741
180805
|
if (mappedChanged) {
|
|
180742
180806
|
this.pendingMappedChange = true;
|
|
180743
|
-
|
|
180807
|
+
logger203.debug(
|
|
180744
180808
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
180745
180809
|
);
|
|
180746
180810
|
}
|
|
180747
|
-
|
|
180811
|
+
logger203.debug(
|
|
180748
180812
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
180749
180813
|
);
|
|
180750
180814
|
this.lastState = state;
|
|
@@ -181158,10 +181222,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
181158
181222
|
// src/core/ioc/app-environment.ts
|
|
181159
181223
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
181160
181224
|
constructor(rootEnv, options) {
|
|
181161
|
-
const
|
|
181225
|
+
const logger205 = rootEnv.get(LoggerService);
|
|
181162
181226
|
super({
|
|
181163
181227
|
id: "App",
|
|
181164
|
-
log:
|
|
181228
|
+
log: logger205.get("AppContainer"),
|
|
181165
181229
|
parent: rootEnv
|
|
181166
181230
|
});
|
|
181167
181231
|
this.options = options;
|
|
@@ -181174,8 +181238,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
181174
181238
|
}
|
|
181175
181239
|
construction;
|
|
181176
181240
|
async init() {
|
|
181177
|
-
const
|
|
181178
|
-
this.set(LoggerService,
|
|
181241
|
+
const logger205 = this.get(LoggerService);
|
|
181242
|
+
this.set(LoggerService, logger205);
|
|
181179
181243
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
181180
181244
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
181181
181245
|
this.set(
|
|
@@ -181192,7 +181256,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
181192
181256
|
);
|
|
181193
181257
|
this.set(
|
|
181194
181258
|
HomeAssistantClient,
|
|
181195
|
-
new HomeAssistantClient(
|
|
181259
|
+
new HomeAssistantClient(logger205, this.options.homeAssistant)
|
|
181196
181260
|
);
|
|
181197
181261
|
this.set(
|
|
181198
181262
|
HomeAssistantConfig,
|
|
@@ -181200,7 +181264,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
181200
181264
|
);
|
|
181201
181265
|
this.set(
|
|
181202
181266
|
HomeAssistantActions,
|
|
181203
|
-
new HomeAssistantActions(
|
|
181267
|
+
new HomeAssistantActions(logger205, await this.load(HomeAssistantClient))
|
|
181204
181268
|
);
|
|
181205
181269
|
this.set(
|
|
181206
181270
|
HomeAssistantRegistry,
|
|
@@ -181236,7 +181300,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
181236
181300
|
this.set(
|
|
181237
181301
|
WebApi,
|
|
181238
181302
|
new WebApi(
|
|
181239
|
-
|
|
181303
|
+
logger205,
|
|
181240
181304
|
await this.load(BridgeService),
|
|
181241
181305
|
await this.load(HomeAssistantClient),
|
|
181242
181306
|
await this.load(HomeAssistantRegistry),
|
|
@@ -181262,7 +181326,7 @@ init_nodejs();
|
|
|
181262
181326
|
init_level_control();
|
|
181263
181327
|
|
|
181264
181328
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
181265
|
-
var
|
|
181329
|
+
var logger204 = Logger.get("PatchLevelControlTlv");
|
|
181266
181330
|
function patchLevelControlTlv() {
|
|
181267
181331
|
let patched = 0;
|
|
181268
181332
|
const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
|
|
@@ -181276,11 +181340,11 @@ function patchLevelControlTlv() {
|
|
|
181276
181340
|
patched++;
|
|
181277
181341
|
}
|
|
181278
181342
|
if (patched > 0) {
|
|
181279
|
-
|
|
181343
|
+
logger204.info(
|
|
181280
181344
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
181281
181345
|
);
|
|
181282
181346
|
} else {
|
|
181283
|
-
|
|
181347
|
+
logger204.warn(
|
|
181284
181348
|
"Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
|
|
181285
181349
|
);
|
|
181286
181350
|
}
|