@riddix/hamh 2.1.0-alpha.551 → 2.1.0-alpha.553
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
|
@@ -148699,6 +148699,7 @@ function entityMappingApi(mappingStorage) {
|
|
|
148699
148699
|
mopIntensityEntity: body.mopIntensityEntity,
|
|
148700
148700
|
customServiceAreas: body.customServiceAreas,
|
|
148701
148701
|
customFanSpeedTags: body.customFanSpeedTags,
|
|
148702
|
+
currentRoomEntity: body.currentRoomEntity,
|
|
148702
148703
|
valetudoIdentifier: body.valetudoIdentifier,
|
|
148703
148704
|
coverSwapOpenClose: body.coverSwapOpenClose,
|
|
148704
148705
|
composedEntities: body.composedEntities
|
|
@@ -152885,11 +152886,12 @@ var EntityMappingStorage = class extends Service {
|
|
|
152885
152886
|
(a) => a.name?.trim() && a.service?.trim()
|
|
152886
152887
|
) ?? void 0,
|
|
152887
152888
|
customFanSpeedTags: request.customFanSpeedTags && Object.keys(request.customFanSpeedTags).length > 0 ? request.customFanSpeedTags : void 0,
|
|
152889
|
+
currentRoomEntity: request.currentRoomEntity?.trim() || void 0,
|
|
152888
152890
|
valetudoIdentifier: request.valetudoIdentifier?.trim() || void 0,
|
|
152889
152891
|
coverSwapOpenClose: request.coverSwapOpenClose || void 0,
|
|
152890
152892
|
composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
|
|
152891
152893
|
};
|
|
152892
|
-
if (!config10.matterDeviceType && !config10.customName && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.temperatureEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity && (!config10.customServiceAreas || config10.customServiceAreas.length === 0) && (!config10.customFanSpeedTags || Object.keys(config10.customFanSpeedTags).length === 0) && !config10.valetudoIdentifier && !config10.coverSwapOpenClose && (!config10.composedEntities || config10.composedEntities.length === 0)) {
|
|
152894
|
+
if (!config10.matterDeviceType && !config10.customName && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.temperatureEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity && (!config10.customServiceAreas || config10.customServiceAreas.length === 0) && (!config10.customFanSpeedTags || Object.keys(config10.customFanSpeedTags).length === 0) && !config10.currentRoomEntity && !config10.valetudoIdentifier && !config10.coverSwapOpenClose && (!config10.composedEntities || config10.composedEntities.length === 0)) {
|
|
152893
152895
|
bridgeMap.delete(request.entityId);
|
|
152894
152896
|
} else {
|
|
152895
152897
|
bridgeMap.set(request.entityId, config10);
|
|
@@ -175690,6 +175692,11 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175690
175692
|
completedAreas = /* @__PURE__ */ new Set();
|
|
175691
175693
|
/** Last known currentArea — used to detect room transitions */
|
|
175692
175694
|
lastCurrentArea = null;
|
|
175695
|
+
/** Snapshot of selectedAreas taken when cleaning starts.
|
|
175696
|
+
* The start handler clears serviceArea.state.selectedAreas after
|
|
175697
|
+
* dispatching the HA action to prevent re-dispatch, but progress
|
|
175698
|
+
* tracking needs the original list for the entire cleaning session. */
|
|
175699
|
+
activeAreas = [];
|
|
175693
175700
|
async initialize() {
|
|
175694
175701
|
await super.initialize();
|
|
175695
175702
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -175711,16 +175718,13 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175711
175718
|
});
|
|
175712
175719
|
if (previousMode !== newMode) {
|
|
175713
175720
|
if (newMode === 0 /* Idle */) {
|
|
175721
|
+
this.trySetCurrentArea(null);
|
|
175714
175722
|
this.completedAreas.clear();
|
|
175715
175723
|
this.lastCurrentArea = null;
|
|
175716
|
-
this.
|
|
175724
|
+
this.activeAreas = [];
|
|
175717
175725
|
} else if (newMode === 1 /* Cleaning */) {
|
|
175718
|
-
|
|
175719
|
-
|
|
175720
|
-
if (serviceArea.state.selectedAreas?.length > 0 && serviceArea.state.currentArea === null) {
|
|
175721
|
-
this.trySetCurrentArea(serviceArea.state.selectedAreas[0]);
|
|
175722
|
-
}
|
|
175723
|
-
} catch {
|
|
175726
|
+
if (this.activeAreas.length > 0 && this.lastCurrentArea === null) {
|
|
175727
|
+
this.trySetCurrentArea(this.activeAreas[0]);
|
|
175724
175728
|
}
|
|
175725
175729
|
}
|
|
175726
175730
|
}
|
|
@@ -175740,14 +175744,13 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175740
175744
|
const stateProvider = this.agent.env.get(EntityStateProvider);
|
|
175741
175745
|
const roomState = stateProvider.getState(currentRoomEntityId);
|
|
175742
175746
|
if (!roomState || !roomState.state) return;
|
|
175747
|
+
if (this.activeAreas.length === 0) return;
|
|
175743
175748
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175744
|
-
const selectedAreas = serviceArea.state.selectedAreas;
|
|
175745
|
-
if (!selectedAreas || selectedAreas.length === 0) return;
|
|
175746
175749
|
const segmentId = roomState.attributes?.segment_id;
|
|
175747
175750
|
const roomName = roomState.state;
|
|
175748
175751
|
let matchedAreaId = null;
|
|
175749
175752
|
if (segmentId != null) {
|
|
175750
|
-
if (
|
|
175753
|
+
if (this.activeAreas.includes(segmentId)) {
|
|
175751
175754
|
matchedAreaId = segmentId;
|
|
175752
175755
|
}
|
|
175753
175756
|
}
|
|
@@ -175755,7 +175758,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175755
175758
|
const area = serviceArea.state.supportedAreas.find(
|
|
175756
175759
|
(a) => a.areaInfo.locationInfo?.locationName?.toLowerCase() === roomName.toLowerCase()
|
|
175757
175760
|
);
|
|
175758
|
-
if (area &&
|
|
175761
|
+
if (area && this.activeAreas.includes(area.areaId)) {
|
|
175759
175762
|
matchedAreaId = area.areaId;
|
|
175760
175763
|
}
|
|
175761
175764
|
}
|
|
@@ -175794,21 +175797,20 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175794
175797
|
* - null: mark all areas as Completed (cleaning done)
|
|
175795
175798
|
* - areaId: mark that area as Operating, others as Pending
|
|
175796
175799
|
*
|
|
175797
|
-
*
|
|
175798
|
-
*
|
|
175799
|
-
*
|
|
175800
|
+
* Uses the activeAreas snapshot (plain number array) instead of
|
|
175801
|
+
* managed state entries, which avoids infinite recursion in
|
|
175802
|
+
* matter.js property getters during transaction pre-commit.
|
|
175800
175803
|
*/
|
|
175801
175804
|
updateProgress(serviceArea, areaId) {
|
|
175805
|
+
if (this.activeAreas.length === 0) return;
|
|
175802
175806
|
const state = serviceArea.state;
|
|
175803
|
-
const selectedAreas = serviceArea.state.selectedAreas;
|
|
175804
|
-
if (!selectedAreas || selectedAreas.length === 0) return;
|
|
175805
175807
|
if (areaId === null) {
|
|
175806
|
-
state.progress =
|
|
175808
|
+
state.progress = this.activeAreas.map((id) => ({
|
|
175807
175809
|
areaId: id,
|
|
175808
175810
|
status: ServiceArea3.OperationalStatus.Completed
|
|
175809
175811
|
}));
|
|
175810
175812
|
} else {
|
|
175811
|
-
state.progress =
|
|
175813
|
+
state.progress = this.activeAreas.map((id) => ({
|
|
175812
175814
|
areaId: id,
|
|
175813
175815
|
status: id === areaId ? ServiceArea3.OperationalStatus.Operating : this.completedAreas.has(id) ? ServiceArea3.OperationalStatus.Completed : ServiceArea3.OperationalStatus.Pending
|
|
175814
175816
|
}));
|
|
@@ -175844,7 +175846,8 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175844
175846
|
try {
|
|
175845
175847
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175846
175848
|
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
175847
|
-
this.
|
|
175849
|
+
this.activeAreas = [...serviceArea.state.selectedAreas];
|
|
175850
|
+
this.trySetCurrentArea(this.activeAreas[0]);
|
|
175848
175851
|
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
175849
175852
|
this.state.currentMode = newMode;
|
|
175850
175853
|
return {
|
|
@@ -175855,7 +175858,9 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175855
175858
|
} catch {
|
|
175856
175859
|
}
|
|
175857
175860
|
if (this.state.config.cleanRoom) {
|
|
175858
|
-
this.
|
|
175861
|
+
const areaId = this.findAreaIdForMode(newMode);
|
|
175862
|
+
this.activeAreas = areaId !== null ? [areaId] : [];
|
|
175863
|
+
this.trySetCurrentArea(areaId);
|
|
175859
175864
|
homeAssistant.callAction(
|
|
175860
175865
|
this.state.config.cleanRoom(newMode, this.agent)
|
|
175861
175866
|
);
|
|
@@ -175871,7 +175876,8 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
175871
175876
|
try {
|
|
175872
175877
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
175873
175878
|
if (serviceArea.state.selectedAreas?.length > 0) {
|
|
175874
|
-
this.
|
|
175879
|
+
this.activeAreas = [...serviceArea.state.selectedAreas];
|
|
175880
|
+
this.trySetCurrentArea(this.activeAreas[0]);
|
|
175875
175881
|
}
|
|
175876
175882
|
} catch {
|
|
175877
175883
|
}
|