@riddix/hamh 2.1.0-alpha.372 → 2.1.0-alpha.373
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
|
@@ -172466,7 +172466,18 @@ function isFanSpeedMode(mode) {
|
|
|
172466
172466
|
function isMopIntensityMode(mode) {
|
|
172467
172467
|
return mode >= MOP_INTENSITY_MODE_BASE;
|
|
172468
172468
|
}
|
|
172469
|
-
function
|
|
172469
|
+
function resolveCleanTypes(cleaningModeOptions) {
|
|
172470
|
+
if (!cleaningModeOptions || cleaningModeOptions.length === 0) {
|
|
172471
|
+
return /* @__PURE__ */ new Set();
|
|
172472
|
+
}
|
|
172473
|
+
const types = /* @__PURE__ */ new Set();
|
|
172474
|
+
for (const option of cleaningModeOptions) {
|
|
172475
|
+
types.add(parseCleanType(option));
|
|
172476
|
+
}
|
|
172477
|
+
return types;
|
|
172478
|
+
}
|
|
172479
|
+
function buildSupportedModes3(fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
172480
|
+
const cleanTypes = resolveCleanTypes(cleaningModeOptions);
|
|
172470
172481
|
const modes = [
|
|
172471
172482
|
{
|
|
172472
172483
|
label: "Vacuum",
|
|
@@ -172474,30 +172485,31 @@ function buildSupportedModes3(fanSpeedList, mopIntensityList, includeCleanTypes
|
|
|
172474
172485
|
modeTags: [{ value: RvcCleanMode3.ModeTag.Vacuum }]
|
|
172475
172486
|
}
|
|
172476
172487
|
];
|
|
172477
|
-
if (
|
|
172478
|
-
modes.push(
|
|
172479
|
-
|
|
172480
|
-
|
|
172481
|
-
|
|
172482
|
-
|
|
172483
|
-
|
|
172484
|
-
|
|
172485
|
-
|
|
172486
|
-
|
|
172487
|
-
|
|
172488
|
-
|
|
172489
|
-
|
|
172490
|
-
|
|
172491
|
-
}
|
|
172492
|
-
);
|
|
172488
|
+
if (cleanTypes.has(2 /* SweepingAndMopping */)) {
|
|
172489
|
+
modes.push({
|
|
172490
|
+
label: "Vacuum & Mop",
|
|
172491
|
+
mode: MODE_VACUUM_AND_MOP,
|
|
172492
|
+
modeTags: [
|
|
172493
|
+
{ value: RvcCleanMode3.ModeTag.Vacuum },
|
|
172494
|
+
{ value: RvcCleanMode3.ModeTag.Mop }
|
|
172495
|
+
]
|
|
172496
|
+
});
|
|
172497
|
+
}
|
|
172498
|
+
if (cleanTypes.has(1 /* Mopping */)) {
|
|
172499
|
+
modes.push({
|
|
172500
|
+
label: "Mop",
|
|
172501
|
+
mode: MODE_MOP,
|
|
172502
|
+
modeTags: [{ value: RvcCleanMode3.ModeTag.Mop }]
|
|
172503
|
+
});
|
|
172493
172504
|
}
|
|
172494
172505
|
if (fanSpeedList && fanSpeedList.length > 0) {
|
|
172495
172506
|
modes.push(...buildFanSpeedModes(fanSpeedList));
|
|
172496
172507
|
}
|
|
172497
|
-
|
|
172508
|
+
const hasMopping = cleanTypes.has(1 /* Mopping */) || cleanTypes.has(2 /* SweepingAndMopping */);
|
|
172509
|
+
if (hasMopping && mopIntensityList && mopIntensityList.length > 0) {
|
|
172498
172510
|
modes.push(...buildMopIntensityModes(mopIntensityList));
|
|
172499
172511
|
}
|
|
172500
|
-
if (
|
|
172512
|
+
if (cleanTypes.has(3 /* MoppingAfterSweeping */)) {
|
|
172501
172513
|
modes.push({
|
|
172502
172514
|
label: "Vacuum Then Mop",
|
|
172503
172515
|
mode: MODE_VACUUM_THEN_MOP,
|
|
@@ -172799,12 +172811,13 @@ function readSelectEntity(entityId, agent) {
|
|
|
172799
172811
|
options: attrs?.options
|
|
172800
172812
|
};
|
|
172801
172813
|
}
|
|
172802
|
-
function createCleanModeConfig(fanSpeedList, mopIntensityList,
|
|
172814
|
+
function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
172815
|
+
const hasCleanTypes = !!cleaningModeOptions && cleaningModeOptions.length > 0;
|
|
172803
172816
|
return {
|
|
172804
172817
|
getCurrentMode: (entity, agent) => {
|
|
172805
172818
|
const attributes7 = entity.attributes;
|
|
172806
172819
|
let cleanType = 0 /* Sweeping */;
|
|
172807
|
-
if (
|
|
172820
|
+
if (hasCleanTypes) {
|
|
172808
172821
|
if (attributes7.cleaning_mode) {
|
|
172809
172822
|
cleanType = parseCleanType(attributes7.cleaning_mode);
|
|
172810
172823
|
} else {
|
|
@@ -172863,7 +172876,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, includeCleanTypes
|
|
|
172863
172876
|
}
|
|
172864
172877
|
return cleanTypeToModeId(cleanType);
|
|
172865
172878
|
},
|
|
172866
|
-
getSupportedModes: () => buildSupportedModes3(fanSpeedList, mopIntensityList,
|
|
172879
|
+
getSupportedModes: () => buildSupportedModes3(fanSpeedList, mopIntensityList, cleaningModeOptions),
|
|
172867
172880
|
setCleanMode: (mode, agent) => {
|
|
172868
172881
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
172869
172882
|
const vacuumEntityId = homeAssistant.entityId;
|
|
@@ -172878,7 +172891,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, includeCleanTypes
|
|
|
172878
172891
|
logger182.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
172879
172892
|
return void 0;
|
|
172880
172893
|
}
|
|
172881
|
-
if (
|
|
172894
|
+
if (hasCleanTypes) {
|
|
172882
172895
|
homeAssistant.callAction(
|
|
172883
172896
|
buildCleaningModeAction(1 /* Mopping */, agent)
|
|
172884
172897
|
);
|
|
@@ -172926,7 +172939,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, includeCleanTypes
|
|
|
172926
172939
|
return void 0;
|
|
172927
172940
|
}
|
|
172928
172941
|
if (mapping?.suctionLevelEntity) {
|
|
172929
|
-
if (
|
|
172942
|
+
if (hasCleanTypes) {
|
|
172930
172943
|
homeAssistant.callAction(
|
|
172931
172944
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
172932
172945
|
);
|
|
@@ -172960,7 +172973,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, includeCleanTypes
|
|
|
172960
172973
|
);
|
|
172961
172974
|
return void 0;
|
|
172962
172975
|
}
|
|
172963
|
-
if (
|
|
172976
|
+
if (hasCleanTypes) {
|
|
172964
172977
|
homeAssistant.callAction(
|
|
172965
172978
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
172966
172979
|
);
|
|
@@ -172974,7 +172987,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, includeCleanTypes
|
|
|
172974
172987
|
target: vacuumEntityId
|
|
172975
172988
|
};
|
|
172976
172989
|
}
|
|
172977
|
-
if (!
|
|
172990
|
+
if (!hasCleanTypes) {
|
|
172978
172991
|
logger182.debug(
|
|
172979
172992
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
172980
172993
|
);
|
|
@@ -172998,14 +173011,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, includeCleanTypes
|
|
|
172998
173011
|
}
|
|
172999
173012
|
};
|
|
173000
173013
|
}
|
|
173001
|
-
function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityList,
|
|
173014
|
+
function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
173002
173015
|
const supportedModes = buildSupportedModes3(
|
|
173003
173016
|
fanSpeedList,
|
|
173004
173017
|
mopIntensityList,
|
|
173005
|
-
|
|
173018
|
+
cleaningModeOptions
|
|
173006
173019
|
);
|
|
173007
173020
|
logger182.info(
|
|
173008
|
-
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])},
|
|
173021
|
+
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])})`
|
|
173009
173022
|
);
|
|
173010
173023
|
logger182.info(
|
|
173011
173024
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
@@ -173015,7 +173028,7 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
173015
173028
|
currentMode: MODE_VACUUM
|
|
173016
173029
|
};
|
|
173017
173030
|
return RvcCleanModeServer2(
|
|
173018
|
-
createCleanModeConfig(fanSpeedList, mopIntensityList,
|
|
173031
|
+
createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptions),
|
|
173019
173032
|
initialState
|
|
173020
173033
|
);
|
|
173021
173034
|
}
|
|
@@ -173260,7 +173273,7 @@ var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
|
173260
173273
|
HomeAssistantEntityBehavior,
|
|
173261
173274
|
VacuumRvcOperationalStateServer
|
|
173262
173275
|
);
|
|
173263
|
-
function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters = false) {
|
|
173276
|
+
function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters = false, cleaningModeOptions) {
|
|
173264
173277
|
if (homeAssistantEntity.entity.state === void 0) {
|
|
173265
173278
|
return void 0;
|
|
173266
173279
|
}
|
|
@@ -173301,7 +173314,6 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
173301
173314
|
} else {
|
|
173302
173315
|
logger185.info(`${entityId}: Skipping ServiceArea (minimal clusters mode)`);
|
|
173303
173316
|
}
|
|
173304
|
-
const hasCleaningModeEntity = !!homeAssistantEntity.mapping?.cleaningModeEntity;
|
|
173305
173317
|
const fanSpeedList = resolveFanSpeedList(
|
|
173306
173318
|
attributes7,
|
|
173307
173319
|
homeAssistantEntity.mapping?.suctionLevelEntity
|
|
@@ -173309,17 +173321,16 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
173309
173321
|
const mopIntensityList = resolveMopIntensityList(
|
|
173310
173322
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
173311
173323
|
);
|
|
173312
|
-
|
|
173313
|
-
if (hasCleanTypes || fanSpeedList || mopIntensityList) {
|
|
173324
|
+
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
173314
173325
|
logger185.info(
|
|
173315
|
-
`${entityId}: Adding RvcCleanMode (multi-mode,
|
|
173326
|
+
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
173316
173327
|
);
|
|
173317
173328
|
device = device.with(
|
|
173318
173329
|
createVacuumRvcCleanModeServer(
|
|
173319
173330
|
attributes7,
|
|
173320
173331
|
fanSpeedList,
|
|
173321
173332
|
mopIntensityList,
|
|
173322
|
-
|
|
173333
|
+
cleaningModeOptions
|
|
173323
173334
|
)
|
|
173324
173335
|
);
|
|
173325
173336
|
} else {
|
|
@@ -173530,7 +173541,8 @@ function createLegacyEndpointType(entity, mapping, areaName, options) {
|
|
|
173530
173541
|
type = VacuumDevice(
|
|
173531
173542
|
{ entity, customName, mapping },
|
|
173532
173543
|
options?.vacuumOnOff,
|
|
173533
|
-
options?.vacuumMinimalClusters
|
|
173544
|
+
options?.vacuumMinimalClusters,
|
|
173545
|
+
options?.cleaningModeOptions
|
|
173534
173546
|
);
|
|
173535
173547
|
} else {
|
|
173536
173548
|
const factory = deviceCtrs[domain];
|
|
@@ -173870,10 +173882,27 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
173870
173882
|
registry: entity,
|
|
173871
173883
|
deviceRegistry
|
|
173872
173884
|
};
|
|
173885
|
+
let cleaningModeOptions;
|
|
173886
|
+
if (entityId.startsWith("vacuum.")) {
|
|
173887
|
+
if (effectiveMapping?.cleaningModeEntity) {
|
|
173888
|
+
const cmState = registry2.initialState(
|
|
173889
|
+
effectiveMapping.cleaningModeEntity
|
|
173890
|
+
);
|
|
173891
|
+
cleaningModeOptions = cmState?.attributes?.options;
|
|
173892
|
+
} else if (supportsCleaningModes(state.attributes)) {
|
|
173893
|
+
cleaningModeOptions = [
|
|
173894
|
+
"vacuum",
|
|
173895
|
+
"mop",
|
|
173896
|
+
"vacuum_and_mop",
|
|
173897
|
+
"vacuum_then_mop"
|
|
173898
|
+
];
|
|
173899
|
+
}
|
|
173900
|
+
}
|
|
173873
173901
|
const areaName = registry2.getAreaName(entityId);
|
|
173874
173902
|
const type = createLegacyEndpointType(payload, effectiveMapping, areaName, {
|
|
173875
173903
|
vacuumOnOff: registry2.isVacuumOnOffEnabled(),
|
|
173876
|
-
vacuumMinimalClusters: registry2.isVacuumMinimalClustersEnabled()
|
|
173904
|
+
vacuumMinimalClusters: registry2.isVacuumMinimalClustersEnabled(),
|
|
173905
|
+
cleaningModeOptions
|
|
173877
173906
|
});
|
|
173878
173907
|
if (!type) {
|
|
173879
173908
|
return;
|
|
@@ -175196,7 +175225,7 @@ var ServerModeVacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
|
175196
175225
|
HomeAssistantEntityBehavior,
|
|
175197
175226
|
VacuumRvcOperationalStateServer
|
|
175198
175227
|
);
|
|
175199
|
-
function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters = false) {
|
|
175228
|
+
function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters = false, cleaningModeOptions) {
|
|
175200
175229
|
if (homeAssistantEntity.entity.state === void 0) {
|
|
175201
175230
|
return void 0;
|
|
175202
175231
|
}
|
|
@@ -175222,7 +175251,6 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
175222
175251
|
} else if (!minimalClusters) {
|
|
175223
175252
|
device = device.with(createDefaultServiceAreaServer());
|
|
175224
175253
|
}
|
|
175225
|
-
const hasCleaningModeEntity = !!homeAssistantEntity.mapping?.cleaningModeEntity;
|
|
175226
175254
|
const fanSpeedList = resolveFanSpeedList(
|
|
175227
175255
|
attributes7,
|
|
175228
175256
|
homeAssistantEntity.mapping?.suctionLevelEntity
|
|
@@ -175230,14 +175258,13 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
175230
175258
|
const mopIntensityList = resolveMopIntensityList(
|
|
175231
175259
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
175232
175260
|
);
|
|
175233
|
-
|
|
175234
|
-
if (hasCleanTypes || fanSpeedList || mopIntensityList) {
|
|
175261
|
+
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
175235
175262
|
device = device.with(
|
|
175236
175263
|
createVacuumRvcCleanModeServer(
|
|
175237
175264
|
attributes7,
|
|
175238
175265
|
fanSpeedList,
|
|
175239
175266
|
mopIntensityList,
|
|
175240
|
-
|
|
175267
|
+
cleaningModeOptions
|
|
175241
175268
|
)
|
|
175242
175269
|
);
|
|
175243
175270
|
} else {
|
|
@@ -175361,6 +175388,21 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
175361
175388
|
registry: entity,
|
|
175362
175389
|
deviceRegistry
|
|
175363
175390
|
};
|
|
175391
|
+
const vacAttrsForClean = state.attributes;
|
|
175392
|
+
let cleaningModeOptions;
|
|
175393
|
+
if (effectiveMapping?.cleaningModeEntity) {
|
|
175394
|
+
const cmState = registry2.initialState(
|
|
175395
|
+
effectiveMapping.cleaningModeEntity
|
|
175396
|
+
);
|
|
175397
|
+
cleaningModeOptions = cmState?.attributes?.options;
|
|
175398
|
+
} else if (supportsCleaningModes(vacAttrsForClean)) {
|
|
175399
|
+
cleaningModeOptions = [
|
|
175400
|
+
"vacuum",
|
|
175401
|
+
"mop",
|
|
175402
|
+
"vacuum_and_mop",
|
|
175403
|
+
"vacuum_then_mop"
|
|
175404
|
+
];
|
|
175405
|
+
}
|
|
175364
175406
|
const customName = effectiveMapping?.customName;
|
|
175365
175407
|
const endpointType = ServerModeVacuumDevice(
|
|
175366
175408
|
{
|
|
@@ -175369,7 +175411,8 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
175369
175411
|
mapping: effectiveMapping
|
|
175370
175412
|
},
|
|
175371
175413
|
registry2.isServerModeVacuumOnOffEnabled(),
|
|
175372
|
-
registry2.isVacuumMinimalClustersEnabled()
|
|
175414
|
+
registry2.isVacuumMinimalClustersEnabled(),
|
|
175415
|
+
cleaningModeOptions
|
|
175373
175416
|
);
|
|
175374
175417
|
if (!endpointType) {
|
|
175375
175418
|
return void 0;
|