@riddix/hamh 2.1.0-alpha.585 → 2.1.0-alpha.586

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.
@@ -168725,6 +168725,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
168725
168725
  // Track last non-zero fan speed for restore on turn-on (#225)
168726
168726
  lastNonZeroPercent = 0;
168727
168727
  lastNonZeroSpeed = 0;
168728
+ lastIsAutoMode = false;
168728
168729
  async initialize() {
168729
168730
  if (this.features.multiSpeed) {
168730
168731
  if (this.state.speedMax == null || this.state.speedMax < minSpeedMax) {
@@ -168836,6 +168837,7 @@ var FanControlServerBase = class extends FeaturedBase5 {
168836
168837
  if (percentage > 0) {
168837
168838
  this.lastNonZeroPercent = percentage;
168838
168839
  this.lastNonZeroSpeed = speed;
168840
+ this.lastIsAutoMode = config10.isInAutoMode(entity.state, this.agent);
168839
168841
  }
168840
168842
  try {
168841
168843
  applyPatchState(this.state, {
@@ -168902,6 +168904,9 @@ var FanControlServerBase = class extends FeaturedBase5 {
168902
168904
  if (speed == null) {
168903
168905
  return;
168904
168906
  }
168907
+ if (speed === 0 && (this.state.percentSetting ?? 0) > 0) {
168908
+ return;
168909
+ }
168905
168910
  this.agent.asLocalActor(() => {
168906
168911
  const percentage = Math.floor(speed / this.state.speedMax * 100);
168907
168912
  this.applyPercentageAction(percentage);
@@ -169050,6 +169055,18 @@ var FanControlServerBase = class extends FeaturedBase5 {
169050
169055
  } catch {
169051
169056
  }
169052
169057
  });
169058
+ const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
169059
+ if (homeAssistant.isAvailable) {
169060
+ if (this.lastIsAutoMode) {
169061
+ homeAssistant.callAction(
169062
+ this.state.config.setAutoMode(void 0, this.agent)
169063
+ );
169064
+ } else {
169065
+ homeAssistant.callAction(
169066
+ this.state.config.turnOn(this.lastNonZeroPercent, this.agent)
169067
+ );
169068
+ }
169069
+ }
169053
169070
  }
169054
169071
  }
169055
169072
  // Cross-cluster sync: keep OnOff in sync with FanControl per Matter spec