@riddix/hamh 2.1.0-alpha.415 → 2.1.0-alpha.417
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);
|
|
@@ -165805,15 +165807,16 @@ var FanControlServerBase = class extends FeaturedBase3 {
|
|
|
165805
165807
|
}
|
|
165806
165808
|
const fanModeSequence = this.getFanModeSequence();
|
|
165807
165809
|
const fanMode = config10.isInAutoMode(entity.state, this.agent) ? FanMode.create(FanControl3.FanMode.Auto, fanModeSequence) : FanMode.fromSpeedPercent(percentage, fanModeSequence);
|
|
165810
|
+
const isOff = percentage === 0;
|
|
165808
165811
|
try {
|
|
165809
165812
|
applyPatchState(this.state, {
|
|
165810
|
-
percentSetting: percentage,
|
|
165813
|
+
...isOff ? {} : { percentSetting: percentage },
|
|
165811
165814
|
percentCurrent: percentage,
|
|
165812
165815
|
fanMode: fanMode.mode,
|
|
165813
165816
|
fanModeSequence,
|
|
165814
165817
|
...this.features.multiSpeed ? {
|
|
165815
165818
|
speedMax,
|
|
165816
|
-
speedSetting: speed,
|
|
165819
|
+
...isOff ? {} : { speedSetting: speed },
|
|
165817
165820
|
speedCurrent: speed
|
|
165818
165821
|
} : {},
|
|
165819
165822
|
...this.features.airflowDirection ? {
|
|
@@ -173200,7 +173203,7 @@ function resolveCleanTypes(cleaningModeOptions) {
|
|
|
173200
173203
|
}
|
|
173201
173204
|
return types;
|
|
173202
173205
|
}
|
|
173203
|
-
function buildSupportedModes3(fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
173206
|
+
function buildSupportedModes3(fanSpeedList, mopIntensityList, cleaningModeOptions, customFanSpeedTags) {
|
|
173204
173207
|
const cleanTypes = resolveCleanTypes(cleaningModeOptions);
|
|
173205
173208
|
const modes = [
|
|
173206
173209
|
{
|
|
@@ -173227,7 +173230,7 @@ function buildSupportedModes3(fanSpeedList, mopIntensityList, cleaningModeOption
|
|
|
173227
173230
|
});
|
|
173228
173231
|
}
|
|
173229
173232
|
if (fanSpeedList && fanSpeedList.length > 0) {
|
|
173230
|
-
modes.push(...buildFanSpeedModes(fanSpeedList));
|
|
173233
|
+
modes.push(...buildFanSpeedModes(fanSpeedList, customFanSpeedTags));
|
|
173231
173234
|
}
|
|
173232
173235
|
const hasMopping = cleanTypes.has(1 /* Mopping */) || cleanTypes.has(2 /* SweepingAndMopping */);
|
|
173233
173236
|
if (hasMopping && mopIntensityList && mopIntensityList.length > 0) {
|
|
@@ -173297,7 +173300,10 @@ var FAN_TAG_PATTERNS = [
|
|
|
173297
173300
|
tag: RvcCleanMode3.ModeTag.Max
|
|
173298
173301
|
}
|
|
173299
173302
|
];
|
|
173300
|
-
function getFanSpeedTag(name) {
|
|
173303
|
+
function getFanSpeedTag(name, customTags) {
|
|
173304
|
+
if (customTags && customTags[name] !== void 0) {
|
|
173305
|
+
return customTags[name];
|
|
173306
|
+
}
|
|
173301
173307
|
const s = name.toLowerCase().trim();
|
|
173302
173308
|
for (const { pattern: pattern2, tag: tag3 } of FAN_TAG_PATTERNS) {
|
|
173303
173309
|
if (pattern2.test(s)) return tag3;
|
|
@@ -173307,9 +173313,9 @@ function getFanSpeedTag(name) {
|
|
|
173307
173313
|
function formatFanSpeedLabel(name) {
|
|
173308
173314
|
return name.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
173309
173315
|
}
|
|
173310
|
-
function buildFanSpeedModes(fanSpeedList) {
|
|
173316
|
+
function buildFanSpeedModes(fanSpeedList, customTags) {
|
|
173311
173317
|
return fanSpeedList.map((name, index) => {
|
|
173312
|
-
const tag3 = getFanSpeedTag(name);
|
|
173318
|
+
const tag3 = getFanSpeedTag(name, customTags);
|
|
173313
173319
|
const modeTags = [
|
|
173314
173320
|
{ value: RvcCleanMode3.ModeTag.Vacuum }
|
|
173315
173321
|
];
|
|
@@ -173491,7 +173497,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
173491
173497
|
target: selectEntityId
|
|
173492
173498
|
};
|
|
173493
173499
|
}
|
|
173494
|
-
function matchFanSpeedOption(name, availableOptions) {
|
|
173500
|
+
function matchFanSpeedOption(name, availableOptions, customTags) {
|
|
173495
173501
|
if (!availableOptions || availableOptions.length === 0) return void 0;
|
|
173496
173502
|
const s = name.toLowerCase();
|
|
173497
173503
|
const exact = availableOptions.find((o) => o.toLowerCase() === s);
|
|
@@ -173500,7 +173506,7 @@ function matchFanSpeedOption(name, availableOptions) {
|
|
|
173500
173506
|
(o) => o.toLowerCase().includes(s) || s.includes(o.toLowerCase())
|
|
173501
173507
|
);
|
|
173502
173508
|
if (contains) return contains;
|
|
173503
|
-
const tag3 = getFanSpeedTag(name);
|
|
173509
|
+
const tag3 = getFanSpeedTag(name, customTags);
|
|
173504
173510
|
if (tag3 !== void 0) {
|
|
173505
173511
|
const group = FAN_TAG_PATTERNS.find((p) => p.tag === tag3);
|
|
173506
173512
|
if (group) {
|
|
@@ -173535,7 +173541,7 @@ function readSelectEntity(entityId, agent) {
|
|
|
173535
173541
|
options: attrs?.options
|
|
173536
173542
|
};
|
|
173537
173543
|
}
|
|
173538
|
-
function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
173544
|
+
function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptions, customFanSpeedTags) {
|
|
173539
173545
|
const hasCleanTypes = !!cleaningModeOptions && cleaningModeOptions.length > 0;
|
|
173540
173546
|
return {
|
|
173541
173547
|
getCurrentMode: (entity, agent) => {
|
|
@@ -173600,13 +173606,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173600
173606
|
}
|
|
173601
173607
|
return cleanTypeToModeId(cleanType);
|
|
173602
173608
|
},
|
|
173603
|
-
getSupportedModes: () => buildSupportedModes3(
|
|
173609
|
+
getSupportedModes: () => buildSupportedModes3(
|
|
173610
|
+
fanSpeedList,
|
|
173611
|
+
mopIntensityList,
|
|
173612
|
+
cleaningModeOptions,
|
|
173613
|
+
customFanSpeedTags
|
|
173614
|
+
),
|
|
173604
173615
|
setCleanMode: (mode, agent) => {
|
|
173605
173616
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
173606
173617
|
const vacuumEntityId = homeAssistant.entityId;
|
|
173607
173618
|
const mapping = homeAssistant.state.mapping;
|
|
173608
173619
|
logger183.info(
|
|
173609
|
-
`setCleanMode(${mode}) for ${vacuumEntityId} \u2014 suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}`
|
|
173620
|
+
`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
173621
|
);
|
|
173611
173622
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
173612
173623
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
@@ -173675,7 +173686,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173675
173686
|
logger183.info(
|
|
173676
173687
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
173677
173688
|
);
|
|
173678
|
-
let option = matchFanSpeedOption(
|
|
173689
|
+
let option = matchFanSpeedOption(
|
|
173690
|
+
fanSpeedName,
|
|
173691
|
+
options,
|
|
173692
|
+
customFanSpeedTags
|
|
173693
|
+
);
|
|
173679
173694
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
173680
173695
|
option = options[fanSpeedIndex];
|
|
173681
173696
|
logger183.info(
|
|
@@ -173735,14 +173750,15 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173735
173750
|
}
|
|
173736
173751
|
};
|
|
173737
173752
|
}
|
|
173738
|
-
function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityList, cleaningModeOptions) {
|
|
173753
|
+
function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityList, cleaningModeOptions, customFanSpeedTags) {
|
|
173739
173754
|
const supportedModes = buildSupportedModes3(
|
|
173740
173755
|
fanSpeedList,
|
|
173741
173756
|
mopIntensityList,
|
|
173742
|
-
cleaningModeOptions
|
|
173757
|
+
cleaningModeOptions,
|
|
173758
|
+
customFanSpeedTags
|
|
173743
173759
|
);
|
|
173744
173760
|
logger183.info(
|
|
173745
|
-
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])})`
|
|
173761
|
+
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
173746
173762
|
);
|
|
173747
173763
|
logger183.info(
|
|
173748
173764
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
@@ -173752,7 +173768,12 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
173752
173768
|
currentMode: MODE_VACUUM
|
|
173753
173769
|
};
|
|
173754
173770
|
return RvcCleanModeServer2(
|
|
173755
|
-
createCleanModeConfig(
|
|
173771
|
+
createCleanModeConfig(
|
|
173772
|
+
fanSpeedList,
|
|
173773
|
+
mopIntensityList,
|
|
173774
|
+
cleaningModeOptions,
|
|
173775
|
+
customFanSpeedTags
|
|
173776
|
+
),
|
|
173756
173777
|
initialState
|
|
173757
173778
|
);
|
|
173758
173779
|
}
|
|
@@ -174067,7 +174088,8 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
174067
174088
|
attributes7,
|
|
174068
174089
|
fanSpeedList,
|
|
174069
174090
|
mopIntensityList,
|
|
174070
|
-
cleaningModeOptions
|
|
174091
|
+
cleaningModeOptions,
|
|
174092
|
+
homeAssistantEntity.mapping?.customFanSpeedTags
|
|
174071
174093
|
)
|
|
174072
174094
|
);
|
|
174073
174095
|
} else {
|
|
@@ -176137,7 +176159,8 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
176137
176159
|
attributes7,
|
|
176138
176160
|
fanSpeedList,
|
|
176139
176161
|
mopIntensityList,
|
|
176140
|
-
cleaningModeOptions
|
|
176162
|
+
cleaningModeOptions,
|
|
176163
|
+
homeAssistantEntity.mapping?.customFanSpeedTags
|
|
176141
176164
|
)
|
|
176142
176165
|
);
|
|
176143
176166
|
} else {
|