@riddix/hamh 2.1.0-alpha.725 → 2.1.0-alpha.727
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
|
@@ -126207,6 +126207,7 @@ function entityMappingApi(mappingStorage) {
|
|
|
126207
126207
|
customServiceAreas: body.customServiceAreas,
|
|
126208
126208
|
customFanSpeedTags: body.customFanSpeedTags,
|
|
126209
126209
|
currentRoomEntity: body.currentRoomEntity,
|
|
126210
|
+
cleanedAreaEntity: body.cleanedAreaEntity,
|
|
126210
126211
|
valetudoIdentifier: body.valetudoIdentifier,
|
|
126211
126212
|
coverSwapOpenClose: body.coverSwapOpenClose,
|
|
126212
126213
|
coverSliderDebounceMs: body.coverSliderDebounceMs,
|
|
@@ -130826,6 +130827,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
130826
130827
|
) ?? void 0,
|
|
130827
130828
|
customFanSpeedTags: request.customFanSpeedTags && Object.keys(request.customFanSpeedTags).length > 0 ? request.customFanSpeedTags : void 0,
|
|
130828
130829
|
currentRoomEntity: request.currentRoomEntity?.trim() || void 0,
|
|
130830
|
+
cleanedAreaEntity: request.cleanedAreaEntity?.trim() || void 0,
|
|
130829
130831
|
valetudoIdentifier: request.valetudoIdentifier?.trim() || void 0,
|
|
130830
130832
|
coverSwapOpenClose: request.coverSwapOpenClose || void 0,
|
|
130831
130833
|
coverSliderDebounceMs: sanitizeDebounceMs(request.coverSliderDebounceMs),
|
|
@@ -130836,7 +130838,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
130836
130838
|
climateAutoMode: request.climateAutoMode || void 0,
|
|
130837
130839
|
composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
|
|
130838
130840
|
};
|
|
130839
|
-
if (!config11.matterDeviceType && !config11.customName && !config11.customProductName && !config11.customVendorName && !config11.customSerialNumber && config11.customVendorId === void 0 && config11.disabled !== true && !config11.filterLifeEntity && !config11.cleaningModeEntity && !config11.temperatureEntity && !config11.humidityEntity && !config11.batteryEntity && !config11.roomEntities && !config11.disableLockPin && !config11.powerEntity && !config11.energyEntity && !config11.pressureEntity && !config11.suctionLevelEntity && !config11.mopIntensityEntity && (!config11.customServiceAreas || config11.customServiceAreas.length === 0) && (!config11.customFanSpeedTags || Object.keys(config11.customFanSpeedTags).length === 0) && !config11.currentRoomEntity && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverSliderDebounceMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
|
|
130841
|
+
if (!config11.matterDeviceType && !config11.customName && !config11.customProductName && !config11.customVendorName && !config11.customSerialNumber && config11.customVendorId === void 0 && config11.disabled !== true && !config11.filterLifeEntity && !config11.cleaningModeEntity && !config11.temperatureEntity && !config11.humidityEntity && !config11.batteryEntity && !config11.roomEntities && !config11.disableLockPin && !config11.powerEntity && !config11.energyEntity && !config11.pressureEntity && !config11.suctionLevelEntity && !config11.mopIntensityEntity && (!config11.customServiceAreas || config11.customServiceAreas.length === 0) && (!config11.customFanSpeedTags || Object.keys(config11.customFanSpeedTags).length === 0) && !config11.currentRoomEntity && !config11.cleanedAreaEntity && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverSliderDebounceMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
|
|
130840
130842
|
bridgeMap.delete(request.entityId);
|
|
130841
130843
|
} else {
|
|
130842
130844
|
bridgeMap.set(request.entityId, config11);
|
|
@@ -153803,6 +153805,15 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
153803
153805
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
153804
153806
|
);
|
|
153805
153807
|
}
|
|
153808
|
+
if (!this.features.hueSaturation) {
|
|
153809
|
+
const hsState = this.state;
|
|
153810
|
+
if (hsState.currentHue != null) {
|
|
153811
|
+
hsState.currentHue = void 0;
|
|
153812
|
+
}
|
|
153813
|
+
if (hsState.currentSaturation != null) {
|
|
153814
|
+
hsState.currentSaturation = void 0;
|
|
153815
|
+
}
|
|
153816
|
+
}
|
|
153806
153817
|
if (this.features.hueSaturation) {
|
|
153807
153818
|
if (this.state.currentHue == null) {
|
|
153808
153819
|
this.state.currentHue = 0;
|
|
@@ -157453,6 +157464,27 @@ init_nodejs();
|
|
|
157453
157464
|
|
|
157454
157465
|
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
157455
157466
|
init_home_assistant_entity_behavior();
|
|
157467
|
+
|
|
157468
|
+
// src/matter/behaviors/infer-cleaned-area-progress.ts
|
|
157469
|
+
function inferCleanedAreaProgress(cleanedSqm, orderedAreas) {
|
|
157470
|
+
if (orderedAreas.length === 0) {
|
|
157471
|
+
return { currentArea: null, completed: [] };
|
|
157472
|
+
}
|
|
157473
|
+
const cleaned = Number.isFinite(cleanedSqm) ? Math.max(0, cleanedSqm) : 0;
|
|
157474
|
+
let cumulative = 0;
|
|
157475
|
+
const completed = [];
|
|
157476
|
+
for (const area of orderedAreas) {
|
|
157477
|
+
const size = Number.isFinite(area.sizeSqm) ? Math.max(0, area.sizeSqm) : 0;
|
|
157478
|
+
cumulative += size;
|
|
157479
|
+
if (cleaned < cumulative) {
|
|
157480
|
+
return { currentArea: area.areaId, completed };
|
|
157481
|
+
}
|
|
157482
|
+
completed.push(area.areaId);
|
|
157483
|
+
}
|
|
157484
|
+
return { currentArea: null, completed };
|
|
157485
|
+
}
|
|
157486
|
+
|
|
157487
|
+
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
157456
157488
|
var logger215 = Logger.get("RvcRunModeServer");
|
|
157457
157489
|
var ROOM_MODE_BASE = 100;
|
|
157458
157490
|
function isRoomMode(mode) {
|
|
@@ -157468,7 +157500,8 @@ function getSession(endpoint) {
|
|
|
157468
157500
|
activeAreas: [],
|
|
157469
157501
|
loggedShortCircuits: /* @__PURE__ */ new Set(),
|
|
157470
157502
|
observedCleaning: false,
|
|
157471
|
-
pendingDispatches: []
|
|
157503
|
+
pendingDispatches: [],
|
|
157504
|
+
cleanedAreaBaseline: null
|
|
157472
157505
|
};
|
|
157473
157506
|
cleaningSessions.set(endpoint, session);
|
|
157474
157507
|
}
|
|
@@ -157561,7 +157594,12 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157561
157594
|
}
|
|
157562
157595
|
}
|
|
157563
157596
|
if (newMode === 1 /* Cleaning */) {
|
|
157564
|
-
this.
|
|
157597
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
157598
|
+
if (mapping?.currentRoomEntity) {
|
|
157599
|
+
this.updateCurrentRoomFromSensor();
|
|
157600
|
+
} else if (mapping?.cleanedAreaEntity) {
|
|
157601
|
+
this.updateCurrentRoomFromCleanedArea();
|
|
157602
|
+
}
|
|
157565
157603
|
}
|
|
157566
157604
|
}
|
|
157567
157605
|
/**
|
|
@@ -157651,6 +157689,80 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157651
157689
|
}
|
|
157652
157690
|
}
|
|
157653
157691
|
}
|
|
157692
|
+
/** Read the cumulative cleaned-area sensor (m2), or null if not configured. */
|
|
157693
|
+
readCleanedAreaSqm() {
|
|
157694
|
+
try {
|
|
157695
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
157696
|
+
const entityId = mapping?.cleanedAreaEntity;
|
|
157697
|
+
if (!entityId) {
|
|
157698
|
+
return null;
|
|
157699
|
+
}
|
|
157700
|
+
return this.agent.env.get(EntityStateProvider).getNumericState(entityId);
|
|
157701
|
+
} catch {
|
|
157702
|
+
return null;
|
|
157703
|
+
}
|
|
157704
|
+
}
|
|
157705
|
+
/**
|
|
157706
|
+
* For batch vacuums that report cumulative cleaned area but not the current
|
|
157707
|
+
* room, infer currentArea + progress from the cleaned area and the per-room
|
|
157708
|
+
* sizeSqm. Display-only and batch-only; skipped unless every selected area
|
|
157709
|
+
* has a size. The currentRoom sensor path takes priority (#368).
|
|
157710
|
+
*/
|
|
157711
|
+
updateCurrentRoomFromCleanedArea() {
|
|
157712
|
+
try {
|
|
157713
|
+
const s = getSession(this.endpoint);
|
|
157714
|
+
if (s.pendingDispatches.length > 0 || s.activeAreas.length === 0) {
|
|
157715
|
+
return;
|
|
157716
|
+
}
|
|
157717
|
+
const mapping = this.agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
157718
|
+
const entityId = mapping?.cleanedAreaEntity;
|
|
157719
|
+
if (!entityId) {
|
|
157720
|
+
return;
|
|
157721
|
+
}
|
|
157722
|
+
const raw = this.agent.env.get(EntityStateProvider).getNumericState(entityId);
|
|
157723
|
+
if (raw == null) {
|
|
157724
|
+
this.logShortCircuitOnce(
|
|
157725
|
+
"no-cleaned-area-state",
|
|
157726
|
+
`cleanedArea sensor: no numeric state for ${entityId}`
|
|
157727
|
+
);
|
|
157728
|
+
return;
|
|
157729
|
+
}
|
|
157730
|
+
const customAreas = mapping?.customServiceAreas;
|
|
157731
|
+
const ordered = [];
|
|
157732
|
+
for (const areaId of s.activeAreas) {
|
|
157733
|
+
const size = customAreas?.[areaId - 1]?.sizeSqm;
|
|
157734
|
+
if (typeof size !== "number" || !Number.isFinite(size) || size <= 0) {
|
|
157735
|
+
this.logShortCircuitOnce(
|
|
157736
|
+
"no-sizes",
|
|
157737
|
+
"cleanedArea sensor: not every selected area has a sizeSqm"
|
|
157738
|
+
);
|
|
157739
|
+
return;
|
|
157740
|
+
}
|
|
157741
|
+
ordered.push({ areaId, sizeSqm: size });
|
|
157742
|
+
}
|
|
157743
|
+
if (s.cleanedAreaBaseline == null || raw < s.cleanedAreaBaseline) {
|
|
157744
|
+
s.cleanedAreaBaseline = raw;
|
|
157745
|
+
}
|
|
157746
|
+
const cleaned = Math.max(0, raw - s.cleanedAreaBaseline);
|
|
157747
|
+
const { currentArea, completed } = inferCleanedAreaProgress(
|
|
157748
|
+
cleaned,
|
|
157749
|
+
ordered
|
|
157750
|
+
);
|
|
157751
|
+
for (const id of completed) {
|
|
157752
|
+
s.completedAreas.add(id);
|
|
157753
|
+
}
|
|
157754
|
+
if (currentArea === s.lastCurrentArea) {
|
|
157755
|
+
return;
|
|
157756
|
+
}
|
|
157757
|
+
s.lastCurrentArea = currentArea;
|
|
157758
|
+
this.trySetCurrentArea(currentArea);
|
|
157759
|
+
} catch (e) {
|
|
157760
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
157761
|
+
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
157762
|
+
logger215.warn(`cleanedArea room update failed: ${msg}`);
|
|
157763
|
+
}
|
|
157764
|
+
}
|
|
157765
|
+
}
|
|
157654
157766
|
/**
|
|
157655
157767
|
* Safely update ServiceArea.currentArea and progress.
|
|
157656
157768
|
* When areaId is set, marks it as Operating in progress.
|
|
@@ -157745,6 +157857,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157745
157857
|
s.lastCurrentArea = null;
|
|
157746
157858
|
s.loggedShortCircuits.clear();
|
|
157747
157859
|
s.pendingDispatches = [];
|
|
157860
|
+
s.cleanedAreaBaseline = this.readCleanedAreaSqm();
|
|
157748
157861
|
this.trySetCurrentArea(s.activeAreas[0]);
|
|
157749
157862
|
homeAssistant.callAction(this.state.config.start(void 0, this.agent));
|
|
157750
157863
|
this.state.currentMode = newMode;
|
|
@@ -157783,6 +157896,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157783
157896
|
s.lastCurrentArea = null;
|
|
157784
157897
|
s.loggedShortCircuits.clear();
|
|
157785
157898
|
s.pendingDispatches = [];
|
|
157899
|
+
s.cleanedAreaBaseline = this.readCleanedAreaSqm();
|
|
157786
157900
|
this.trySetCurrentArea(s.activeAreas[0]);
|
|
157787
157901
|
}
|
|
157788
157902
|
} catch {
|
|
@@ -157798,6 +157912,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
157798
157912
|
s.loggedShortCircuits.clear();
|
|
157799
157913
|
s.pendingDispatches = [];
|
|
157800
157914
|
s.observedCleaning = false;
|
|
157915
|
+
s.cleanedAreaBaseline = null;
|
|
157801
157916
|
homeAssistant.callAction(
|
|
157802
157917
|
this.state.config.returnToBase(void 0, this.agent)
|
|
157803
157918
|
);
|