@riddix/hamh 2.1.0-alpha.704 → 2.1.0-alpha.706

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.
@@ -126210,6 +126210,7 @@ function entityMappingApi(mappingStorage) {
126210
126210
  disableClimateOnOff: body.disableClimateOnOff,
126211
126211
  disableClimateFanControl: body.disableClimateFanControl,
126212
126212
  climateKeepModeOnIdle: body.climateKeepModeOnIdle,
126213
+ climateExposeFan: body.climateExposeFan,
126213
126214
  composedEntities: body.composedEntities
126214
126215
  };
126215
126216
  const config11 = await mappingStorage.setMapping(request);
@@ -126676,7 +126677,8 @@ function configToProfileEntry(config11) {
126676
126677
  coverSliderDebounceMs: config11.coverSliderDebounceMs,
126677
126678
  disableClimateOnOff: config11.disableClimateOnOff,
126678
126679
  disableClimateFanControl: config11.disableClimateFanControl,
126679
- climateKeepModeOnIdle: config11.climateKeepModeOnIdle
126680
+ climateKeepModeOnIdle: config11.climateKeepModeOnIdle,
126681
+ climateExposeFan: config11.climateExposeFan
126680
126682
  };
126681
126683
  }
126682
126684
  function mappingProfileApi(mappingStorage) {
@@ -126801,7 +126803,8 @@ function mappingProfileApi(mappingStorage) {
126801
126803
  coverSliderDebounceMs: entry.coverSliderDebounceMs,
126802
126804
  disableClimateOnOff: entry.disableClimateOnOff,
126803
126805
  disableClimateFanControl: entry.disableClimateFanControl,
126804
- climateKeepModeOnIdle: entry.climateKeepModeOnIdle
126806
+ climateKeepModeOnIdle: entry.climateKeepModeOnIdle,
126807
+ climateExposeFan: entry.climateExposeFan
126805
126808
  });
126806
126809
  applied++;
126807
126810
  } catch (e) {
@@ -130737,9 +130740,10 @@ var EntityMappingStorage = class extends Service {
130737
130740
  disableClimateOnOff: request.disableClimateOnOff || void 0,
130738
130741
  disableClimateFanControl: request.disableClimateFanControl || void 0,
130739
130742
  climateKeepModeOnIdle: request.climateKeepModeOnIdle || void 0,
130743
+ climateExposeFan: request.climateExposeFan || void 0,
130740
130744
  composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
130741
130745
  };
130742
- 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.composedEntities || config11.composedEntities.length === 0)) {
130746
+ 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.composedEntities || config11.composedEntities.length === 0)) {
130743
130747
  bridgeMap.delete(request.entityId);
130744
130748
  } else {
130745
130749
  bridgeMap.set(request.entityId, config11);
@@ -148777,6 +148781,65 @@ function _autoSupported(sequence) {
148777
148781
  }
148778
148782
  }
148779
148783
 
148784
+ // src/utils/converters/fan-mode-order.ts
148785
+ var SPEED_RANK = {
148786
+ quiet: 0,
148787
+ silent: 0,
148788
+ sleep: 0,
148789
+ eco: 0,
148790
+ mute: 0,
148791
+ min: 0,
148792
+ minimum: 0,
148793
+ low: 1,
148794
+ lo: 1,
148795
+ slow: 1,
148796
+ weak: 1,
148797
+ light: 1,
148798
+ mediumlow: 2,
148799
+ midlow: 2,
148800
+ medium: 3,
148801
+ mid: 3,
148802
+ med: 3,
148803
+ normal: 3,
148804
+ moderate: 3,
148805
+ standard: 3,
148806
+ mediumhigh: 4,
148807
+ midhigh: 4,
148808
+ high: 5,
148809
+ hi: 5,
148810
+ fast: 5,
148811
+ strong: 6,
148812
+ powerful: 6,
148813
+ power: 6,
148814
+ focus: 6,
148815
+ turbo: 7,
148816
+ max: 7,
148817
+ maximum: 7,
148818
+ boost: 7,
148819
+ jet: 7
148820
+ };
148821
+ function rankOf(token) {
148822
+ const key = token.toLowerCase().replace(/[ _-]/g, "");
148823
+ if (key in SPEED_RANK) {
148824
+ return SPEED_RANK[key];
148825
+ }
148826
+ const level = key.match(/^level(\d+)$/);
148827
+ if (level) {
148828
+ return Number(level[1]);
148829
+ }
148830
+ if (/^\d+$/.test(key)) {
148831
+ return Number(key);
148832
+ }
148833
+ return void 0;
148834
+ }
148835
+ function toAscendingSpeedPresets(presets) {
148836
+ const ranks = presets.map(rankOf);
148837
+ if (ranks.some((rank) => rank === void 0)) {
148838
+ return presets.slice();
148839
+ }
148840
+ return presets.map((value, index) => ({ value, index, rank: ranks[index] })).sort((a, b) => a.rank - b.rank || a.index - b.index).map((entry) => entry.value);
148841
+ }
148842
+
148780
148843
  // src/utils/converters/fan-speed.ts
148781
148844
  var FanSpeed = class _FanSpeed {
148782
148845
  constructor(currentSpeed, maxSpeed) {
@@ -149198,8 +149261,8 @@ var FanControlServerBase = class extends FeaturedBase5 {
149198
149261
  );
149199
149262
  speed = percentage === 0 ? 0 : Math.max(1, Math.ceil(speedMax * (percentage / 100)));
149200
149263
  } else {
149201
- const speedPresets = presetModes.filter(
149202
- (m) => m.toLowerCase() !== "auto"
149264
+ const speedPresets = toAscendingSpeedPresets(
149265
+ presetModes.filter((m) => m.toLowerCase() !== "auto")
149203
149266
  );
149204
149267
  speedMax = Math.max(
149205
149268
  minSpeedMax,
@@ -149356,8 +149419,8 @@ var FanControlServerBase = class extends FeaturedBase5 {
149356
149419
  homeAssistant.callAction(config11.turnOn(clampedPercentage, this.agent));
149357
149420
  } else {
149358
149421
  const presetModes = config11.getPresetModes(homeAssistant.entity.state, this.agent) ?? [];
149359
- const speedPresets = presetModes.filter(
149360
- (m) => m.toLowerCase() !== "auto"
149422
+ const speedPresets = toAscendingSpeedPresets(
149423
+ presetModes.filter((m) => m.toLowerCase() !== "auto")
149361
149424
  );
149362
149425
  if (speedPresets.length > 0) {
149363
149426
  const presetIndex = Math.min(