@riddix/hamh 2.1.0-alpha.503 → 2.1.0-alpha.504

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.
@@ -175848,6 +175848,26 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
175848
175848
 
175849
175849
  // src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
175850
175850
  var logger191 = Logger.get("VacuumRvcRunModeServer");
175851
+ function buildValetudoSegmentAction(vacuumEntityId, segmentIds) {
175852
+ const identifier = vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
175853
+ const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
175854
+ logger191.info(
175855
+ `Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
175856
+ );
175857
+ return {
175858
+ action: "mqtt.publish",
175859
+ target: false,
175860
+ data: {
175861
+ topic,
175862
+ payload: JSON.stringify({
175863
+ action: "start_segment_action",
175864
+ segment_ids: segmentIds.map(String),
175865
+ iterations: 1,
175866
+ customOrder: true
175867
+ })
175868
+ }
175869
+ };
175870
+ }
175851
175871
  function buildSupportedModes2(attributes7, includeUnnamedRooms = false, customAreas) {
175852
175872
  const modes = [
175853
175873
  {
@@ -176006,6 +176026,11 @@ var vacuumRvcRunModeConfig = {
176006
176026
  };
176007
176027
  }
176008
176028
  }
176029
+ const vacuumEntityId = homeAssistant.entityId;
176030
+ if (vacuumEntityId.startsWith("vacuum.valetudo_")) {
176031
+ serviceArea.state.selectedAreas = [];
176032
+ return buildValetudoSegmentAction(vacuumEntityId, selectedAreas);
176033
+ }
176009
176034
  const rooms = parseVacuumRooms(attributes7);
176010
176035
  const roomIds = [];
176011
176036
  let targetMapName;
@@ -176023,25 +176048,6 @@ var vacuumRvcRunModeConfig = {
176023
176048
  `Starting cleaning with selected areas: ${roomIds.join(", ")}`
176024
176049
  );
176025
176050
  serviceArea.state.selectedAreas = [];
176026
- const vacuumEntityId = homeAssistant.entityId;
176027
- if (vacuumEntityId.startsWith("vacuum.valetudo_")) {
176028
- const identifier = vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
176029
- logger191.info(
176030
- `Valetudo vacuum: Using mqtt.publish segment_cleanup for rooms: ${roomIds.join(", ")}`
176031
- );
176032
- return {
176033
- action: "mqtt.publish",
176034
- target: false,
176035
- data: {
176036
- topic: `valetudo/${identifier}/MapSegmentationCapability/clean/set`,
176037
- payload: JSON.stringify({
176038
- segment_ids: roomIds.map(String),
176039
- iterations: 1,
176040
- customOrder: true
176041
- })
176042
- }
176043
- };
176044
- }
176045
176051
  if (isDreameVacuum(attributes7)) {
176046
176052
  if (targetMapName) {
176047
176053
  const vacName = vacuumEntityId.replace("vacuum.", "");
@@ -176146,6 +176152,11 @@ var vacuumRvcRunModeConfig = {
176146
176152
  };
176147
176153
  }
176148
176154
  }
176155
+ const vacuumEntityId = entity.entity_id;
176156
+ if (vacuumEntityId.startsWith("vacuum.valetudo_")) {
176157
+ const segmentId = getRoomIdFromMode(roomMode);
176158
+ return buildValetudoSegmentAction(vacuumEntityId, [segmentId]);
176159
+ }
176149
176160
  const rooms = parseVacuumRooms(attributes7);
176150
176161
  const numericIdFromMode = getRoomIdFromMode(roomMode);
176151
176162
  logger191.info(
@@ -176154,25 +176165,6 @@ var vacuumRvcRunModeConfig = {
176154
176165
  const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
176155
176166
  if (room) {
176156
176167
  const commandId3 = room.originalId ?? room.id;
176157
- const vacuumEntityId = entity.entity_id;
176158
- if (vacuumEntityId.startsWith("vacuum.valetudo_")) {
176159
- const identifier = vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
176160
- logger191.info(
176161
- `Valetudo vacuum: Using mqtt.publish segment_cleanup for room ${room.name} (id: ${commandId3})`
176162
- );
176163
- return {
176164
- action: "mqtt.publish",
176165
- target: false,
176166
- data: {
176167
- topic: `valetudo/${identifier}/MapSegmentationCapability/clean/set`,
176168
- payload: JSON.stringify({
176169
- segment_ids: [String(commandId3)],
176170
- iterations: 1,
176171
- customOrder: true
176172
- })
176173
- }
176174
- };
176175
- }
176176
176168
  if (isDreameVacuum(attributes7)) {
176177
176169
  if (room.mapName) {
176178
176170
  const vacuumName = vacuumEntityId.replace("vacuum.", "");