@riddix/hamh 2.1.0-alpha.642 → 2.1.0-alpha.644

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.
@@ -171796,20 +171796,34 @@ var config4 = {
171796
171796
  if (hasCooling && !hasHeating) {
171797
171797
  return Thermostat3.SystemMode.Cool;
171798
171798
  }
171799
+ const homeAssistant = agent.get(HomeAssistantEntityBehavior);
171800
+ const entityId = homeAssistant.entityId;
171799
171801
  const action = attributes4(entity).hvac_action;
171800
171802
  if (action === ClimateHvacAction.cooling) {
171803
+ lastHvacDirection.set(entityId, "cooling");
171801
171804
  return Thermostat3.SystemMode.Cool;
171802
171805
  }
171803
171806
  if (action === ClimateHvacAction.heating) {
171807
+ lastHvacDirection.set(entityId, "heating");
171804
171808
  return Thermostat3.SystemMode.Heat;
171805
171809
  }
171810
+ const remembered = lastHvacDirection.get(entityId);
171811
+ if (remembered) {
171812
+ return remembered === "cooling" ? Thermostat3.SystemMode.Cool : Thermostat3.SystemMode.Heat;
171813
+ }
171806
171814
  const current = attributes4(entity).current_temperature;
171807
171815
  const target = attributes4(entity).temperature;
171808
171816
  if (typeof current === "number" && typeof target === "number") {
171809
- if (current > target) return Thermostat3.SystemMode.Cool;
171810
- if (current < target) return Thermostat3.SystemMode.Heat;
171817
+ if (current > target) {
171818
+ lastHvacDirection.set(entityId, "cooling");
171819
+ return Thermostat3.SystemMode.Cool;
171820
+ }
171821
+ if (current < target) {
171822
+ lastHvacDirection.set(entityId, "heating");
171823
+ return Thermostat3.SystemMode.Heat;
171824
+ }
171811
171825
  }
171812
- return Thermostat3.SystemMode.Heat;
171826
+ return Thermostat3.SystemMode.Cool;
171813
171827
  }
171814
171828
  return systemMode;
171815
171829
  },