@riddix/hamh 2.1.0-alpha.414 → 2.1.0-alpha.416
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
|
@@ -148435,7 +148435,8 @@ function entityMappingApi(mappingStorage) {
|
|
|
148435
148435
|
energyEntity: body.energyEntity,
|
|
148436
148436
|
suctionLevelEntity: body.suctionLevelEntity,
|
|
148437
148437
|
mopIntensityEntity: body.mopIntensityEntity,
|
|
148438
|
-
customServiceAreas: body.customServiceAreas
|
|
148438
|
+
customServiceAreas: body.customServiceAreas,
|
|
148439
|
+
customFanSpeedTags: body.customFanSpeedTags
|
|
148439
148440
|
};
|
|
148440
148441
|
const config10 = await mappingStorage.setMapping(request);
|
|
148441
148442
|
res.status(200).json(config10);
|
|
@@ -151322,9 +151323,10 @@ var EntityMappingStorage = class extends Service {
|
|
|
151322
151323
|
mopIntensityEntity: request.mopIntensityEntity?.trim() || void 0,
|
|
151323
151324
|
customServiceAreas: request.customServiceAreas?.filter(
|
|
151324
151325
|
(a) => a.name?.trim() && a.service?.trim()
|
|
151325
|
-
) ?? void 0
|
|
151326
|
+
) ?? void 0,
|
|
151327
|
+
customFanSpeedTags: request.customFanSpeedTags && Object.keys(request.customFanSpeedTags).length > 0 ? request.customFanSpeedTags : void 0
|
|
151326
151328
|
};
|
|
151327
|
-
if (!config10.matterDeviceType && !config10.customName && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity && (!config10.customServiceAreas || config10.customServiceAreas.length === 0)) {
|
|
151329
|
+
if (!config10.matterDeviceType && !config10.customName && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !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)) {
|
|
151328
151330
|
bridgeMap.delete(request.entityId);
|
|
151329
151331
|
} else {
|
|
151330
151332
|
bridgeMap.set(request.entityId, config10);
|
|
@@ -172733,8 +172735,8 @@ function buildSupportedModes2(attributes7, includeUnnamedRooms = false, customAr
|
|
|
172733
172735
|
return modes;
|
|
172734
172736
|
}
|
|
172735
172737
|
function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, serviceArea) {
|
|
172736
|
-
serviceArea.state.selectedAreas = [];
|
|
172737
172738
|
const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
|
|
172739
|
+
serviceArea.state.selectedAreas = [];
|
|
172738
172740
|
if (matched.length === 0) {
|
|
172739
172741
|
logger181.warn(
|
|
172740
172742
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
@@ -172783,8 +172785,8 @@ var vacuumRvcRunModeConfig = {
|
|
|
172783
172785
|
start: (_, agent) => {
|
|
172784
172786
|
try {
|
|
172785
172787
|
const serviceArea = agent.get(ServiceAreaBehavior);
|
|
172786
|
-
const selectedAreas = serviceArea.state.selectedAreas;
|
|
172787
|
-
if (selectedAreas
|
|
172788
|
+
const selectedAreas = [...serviceArea.state.selectedAreas];
|
|
172789
|
+
if (selectedAreas.length > 0) {
|
|
172788
172790
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
172789
172791
|
const entity = homeAssistant.entity;
|
|
172790
172792
|
const attributes7 = entity.state.attributes;
|
|
@@ -173200,7 +173202,7 @@ function resolveCleanTypes(cleaningModeOptions) {
|
|
|
173200
173202
|
}
|
|
173201
173203
|
return types;
|
|
173202
173204
|
}
|
|
173203
|
-
function buildSupportedModes3(fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
173205
|
+
function buildSupportedModes3(fanSpeedList, mopIntensityList, cleaningModeOptions, customFanSpeedTags) {
|
|
173204
173206
|
const cleanTypes = resolveCleanTypes(cleaningModeOptions);
|
|
173205
173207
|
const modes = [
|
|
173206
173208
|
{
|
|
@@ -173227,7 +173229,7 @@ function buildSupportedModes3(fanSpeedList, mopIntensityList, cleaningModeOption
|
|
|
173227
173229
|
});
|
|
173228
173230
|
}
|
|
173229
173231
|
if (fanSpeedList && fanSpeedList.length > 0) {
|
|
173230
|
-
modes.push(...buildFanSpeedModes(fanSpeedList));
|
|
173232
|
+
modes.push(...buildFanSpeedModes(fanSpeedList, customFanSpeedTags));
|
|
173231
173233
|
}
|
|
173232
173234
|
const hasMopping = cleanTypes.has(1 /* Mopping */) || cleanTypes.has(2 /* SweepingAndMopping */);
|
|
173233
173235
|
if (hasMopping && mopIntensityList && mopIntensityList.length > 0) {
|
|
@@ -173297,7 +173299,10 @@ var FAN_TAG_PATTERNS = [
|
|
|
173297
173299
|
tag: RvcCleanMode3.ModeTag.Max
|
|
173298
173300
|
}
|
|
173299
173301
|
];
|
|
173300
|
-
function getFanSpeedTag(name) {
|
|
173302
|
+
function getFanSpeedTag(name, customTags) {
|
|
173303
|
+
if (customTags && customTags[name] !== void 0) {
|
|
173304
|
+
return customTags[name];
|
|
173305
|
+
}
|
|
173301
173306
|
const s = name.toLowerCase().trim();
|
|
173302
173307
|
for (const { pattern: pattern2, tag: tag3 } of FAN_TAG_PATTERNS) {
|
|
173303
173308
|
if (pattern2.test(s)) return tag3;
|
|
@@ -173307,9 +173312,9 @@ function getFanSpeedTag(name) {
|
|
|
173307
173312
|
function formatFanSpeedLabel(name) {
|
|
173308
173313
|
return name.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
173309
173314
|
}
|
|
173310
|
-
function buildFanSpeedModes(fanSpeedList) {
|
|
173315
|
+
function buildFanSpeedModes(fanSpeedList, customTags) {
|
|
173311
173316
|
return fanSpeedList.map((name, index) => {
|
|
173312
|
-
const tag3 = getFanSpeedTag(name);
|
|
173317
|
+
const tag3 = getFanSpeedTag(name, customTags);
|
|
173313
173318
|
const modeTags = [
|
|
173314
173319
|
{ value: RvcCleanMode3.ModeTag.Vacuum }
|
|
173315
173320
|
];
|
|
@@ -173491,7 +173496,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
173491
173496
|
target: selectEntityId
|
|
173492
173497
|
};
|
|
173493
173498
|
}
|
|
173494
|
-
function matchFanSpeedOption(name, availableOptions) {
|
|
173499
|
+
function matchFanSpeedOption(name, availableOptions, customTags) {
|
|
173495
173500
|
if (!availableOptions || availableOptions.length === 0) return void 0;
|
|
173496
173501
|
const s = name.toLowerCase();
|
|
173497
173502
|
const exact = availableOptions.find((o) => o.toLowerCase() === s);
|
|
@@ -173500,7 +173505,7 @@ function matchFanSpeedOption(name, availableOptions) {
|
|
|
173500
173505
|
(o) => o.toLowerCase().includes(s) || s.includes(o.toLowerCase())
|
|
173501
173506
|
);
|
|
173502
173507
|
if (contains) return contains;
|
|
173503
|
-
const tag3 = getFanSpeedTag(name);
|
|
173508
|
+
const tag3 = getFanSpeedTag(name, customTags);
|
|
173504
173509
|
if (tag3 !== void 0) {
|
|
173505
173510
|
const group = FAN_TAG_PATTERNS.find((p) => p.tag === tag3);
|
|
173506
173511
|
if (group) {
|
|
@@ -173535,7 +173540,7 @@ function readSelectEntity(entityId, agent) {
|
|
|
173535
173540
|
options: attrs?.options
|
|
173536
173541
|
};
|
|
173537
173542
|
}
|
|
173538
|
-
function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
173543
|
+
function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptions, customFanSpeedTags) {
|
|
173539
173544
|
const hasCleanTypes = !!cleaningModeOptions && cleaningModeOptions.length > 0;
|
|
173540
173545
|
return {
|
|
173541
173546
|
getCurrentMode: (entity, agent) => {
|
|
@@ -173600,13 +173605,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173600
173605
|
}
|
|
173601
173606
|
return cleanTypeToModeId(cleanType);
|
|
173602
173607
|
},
|
|
173603
|
-
getSupportedModes: () => buildSupportedModes3(
|
|
173608
|
+
getSupportedModes: () => buildSupportedModes3(
|
|
173609
|
+
fanSpeedList,
|
|
173610
|
+
mopIntensityList,
|
|
173611
|
+
cleaningModeOptions,
|
|
173612
|
+
customFanSpeedTags
|
|
173613
|
+
),
|
|
173604
173614
|
setCleanMode: (mode, agent) => {
|
|
173605
173615
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
173606
173616
|
const vacuumEntityId = homeAssistant.entityId;
|
|
173607
173617
|
const mapping = homeAssistant.state.mapping;
|
|
173608
173618
|
logger183.info(
|
|
173609
|
-
`setCleanMode(${mode}) for ${vacuumEntityId} \u2014 suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}`
|
|
173619
|
+
`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 ?? {})}`
|
|
173610
173620
|
);
|
|
173611
173621
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
173612
173622
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
@@ -173675,7 +173685,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173675
173685
|
logger183.info(
|
|
173676
173686
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
173677
173687
|
);
|
|
173678
|
-
let option = matchFanSpeedOption(
|
|
173688
|
+
let option = matchFanSpeedOption(
|
|
173689
|
+
fanSpeedName,
|
|
173690
|
+
options,
|
|
173691
|
+
customFanSpeedTags
|
|
173692
|
+
);
|
|
173679
173693
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
173680
173694
|
option = options[fanSpeedIndex];
|
|
173681
173695
|
logger183.info(
|
|
@@ -173735,14 +173749,15 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173735
173749
|
}
|
|
173736
173750
|
};
|
|
173737
173751
|
}
|
|
173738
|
-
function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
173752
|
+
function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityList, cleaningModeOptions, customFanSpeedTags) {
|
|
173739
173753
|
const supportedModes = buildSupportedModes3(
|
|
173740
173754
|
fanSpeedList,
|
|
173741
173755
|
mopIntensityList,
|
|
173742
|
-
cleaningModeOptions
|
|
173756
|
+
cleaningModeOptions,
|
|
173757
|
+
customFanSpeedTags
|
|
173743
173758
|
);
|
|
173744
173759
|
logger183.info(
|
|
173745
|
-
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])})`
|
|
173760
|
+
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
173746
173761
|
);
|
|
173747
173762
|
logger183.info(
|
|
173748
173763
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
@@ -173752,7 +173767,12 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
173752
173767
|
currentMode: MODE_VACUUM
|
|
173753
173768
|
};
|
|
173754
173769
|
return RvcCleanModeServer2(
|
|
173755
|
-
createCleanModeConfig(
|
|
173770
|
+
createCleanModeConfig(
|
|
173771
|
+
fanSpeedList,
|
|
173772
|
+
mopIntensityList,
|
|
173773
|
+
cleaningModeOptions,
|
|
173774
|
+
customFanSpeedTags
|
|
173775
|
+
),
|
|
173756
173776
|
initialState
|
|
173757
173777
|
);
|
|
173758
173778
|
}
|
|
@@ -174067,7 +174087,8 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
174067
174087
|
attributes7,
|
|
174068
174088
|
fanSpeedList,
|
|
174069
174089
|
mopIntensityList,
|
|
174070
|
-
cleaningModeOptions
|
|
174090
|
+
cleaningModeOptions,
|
|
174091
|
+
homeAssistantEntity.mapping?.customFanSpeedTags
|
|
174071
174092
|
)
|
|
174072
174093
|
);
|
|
174073
174094
|
} else {
|
|
@@ -176137,7 +176158,8 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
176137
176158
|
attributes7,
|
|
176138
176159
|
fanSpeedList,
|
|
176139
176160
|
mopIntensityList,
|
|
176140
|
-
cleaningModeOptions
|
|
176161
|
+
cleaningModeOptions,
|
|
176162
|
+
homeAssistantEntity.mapping?.customFanSpeedTags
|
|
176141
176163
|
)
|
|
176142
176164
|
);
|
|
176143
176165
|
} else {
|