@riddix/hamh 2.1.0-alpha.821 → 2.1.0-alpha.823

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.
@@ -161811,6 +161811,20 @@ function getCoverDebounce(endpoint) {
161811
161811
  }
161812
161812
  return st;
161813
161813
  }
161814
+ function clearPendingLift(st) {
161815
+ if (st.liftTimer) {
161816
+ clearTimeout(st.liftTimer);
161817
+ st.liftTimer = null;
161818
+ }
161819
+ st.pendingLift = null;
161820
+ }
161821
+ function clearPendingTilt(st) {
161822
+ if (st.tiltTimer) {
161823
+ clearTimeout(st.tiltTimer);
161824
+ st.tiltTimer = null;
161825
+ }
161826
+ st.pendingTilt = null;
161827
+ }
161814
161828
  var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedBase6 {
161815
161829
  // Written and read within one synchronous command (upOrOpen fires lift then
161816
161830
  // tilt on the same instance), so these stay as instance fields (#246).
@@ -161836,14 +161850,8 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
161836
161850
  async [Symbol.asyncDispose]() {
161837
161851
  const st = coverDebounce.get(this.endpoint);
161838
161852
  if (st) {
161839
- if (st.liftTimer) {
161840
- clearTimeout(st.liftTimer);
161841
- }
161842
- if (st.tiltTimer) {
161843
- clearTimeout(st.tiltTimer);
161844
- }
161845
- st.pendingLift = null;
161846
- st.pendingTilt = null;
161853
+ clearPendingLift(st);
161854
+ clearPendingTilt(st);
161847
161855
  coverDebounce.delete(this.endpoint);
161848
161856
  }
161849
161857
  await super[Symbol.asyncDispose]();
@@ -162008,16 +162016,21 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
162008
162016
  }
162009
162017
  }
162010
162018
  handleStopMovement() {
162019
+ const st = getCoverDebounce(this.endpoint);
162020
+ clearPendingLift(st);
162021
+ clearPendingTilt(st);
162011
162022
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
162012
162023
  homeAssistant.callAction(this.state.config.stopCover(void 0, this.agent));
162013
162024
  }
162014
162025
  handleLiftOpen() {
162026
+ clearPendingLift(getCoverDebounce(this.endpoint));
162015
162027
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
162016
162028
  const action = this.state.config.openCoverLift(void 0, this.agent);
162017
162029
  logger216.info(`handleLiftOpen: calling action=${action.action}`);
162018
162030
  homeAssistant.callAction(action);
162019
162031
  }
162020
162032
  handleLiftClose() {
162033
+ clearPendingLift(getCoverDebounce(this.endpoint));
162021
162034
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
162022
162035
  const action = this.state.config.closeCoverLift(void 0, this.agent);
162023
162036
  logger216.info(`handleLiftClose: calling action=${action.action}`);
@@ -162063,12 +162076,18 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
162063
162076
  }, debounceMs);
162064
162077
  }
162065
162078
  handleTiltOpen() {
162079
+ const st = getCoverDebounce(this.endpoint);
162080
+ clearPendingTilt(st);
162081
+ if (st.pendingLift?.action.action.includes("tilt")) clearPendingLift(st);
162066
162082
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
162067
162083
  homeAssistant.callAction(
162068
162084
  this.state.config.openCoverTilt(void 0, this.agent)
162069
162085
  );
162070
162086
  }
162071
162087
  handleTiltClose() {
162088
+ const st = getCoverDebounce(this.endpoint);
162089
+ clearPendingTilt(st);
162090
+ if (st.pendingLift?.action.action.includes("tilt")) clearPendingLift(st);
162072
162091
  const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
162073
162092
  homeAssistant.callAction(
162074
162093
  this.state.config.closeCoverTilt(void 0, this.agent)