Skip to content

Commit

Permalink
fix: avoids controlling hvac while off
Browse files Browse the repository at this point in the history
  • Loading branch information
= authored and swingerman committed Dec 11, 2024
1 parent 4f02851 commit e05e90e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions custom_components/dual_smart_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,11 @@ async def _async_control_climate(self, time=None, force=False) -> None:
_LOGGER.info("Attempting to control climate, time %s, force %s", time, force)

async with self._temp_lock:

if self.hvac_device.hvac_mode == HVACMode.OFF:
_LOGGER.debug("Climate is off, skipping control")
return

await self.hvac_device.async_control_hvac(time, force)

_LOGGER.info(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_fan_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,12 +743,14 @@ async def test_set_target_temp_cool_fan_off(
hass: HomeAssistant, setup_comp_heat_ac_cool_fan_config # noqa: F811
) -> None:
"""Test if target temperature turn ac off."""
await common.async_set_hvac_mode(hass, HVACMode.COOL)
await hass.async_block_till_done()
calls = setup_switch_dual(hass, common.ENT_FAN, True, True)

setup_sensor(hass, 25)
await hass.async_block_till_done()
await common.async_set_temperature(hass, 30)
assert len(calls) == 2
assert len(calls) == 4

call_switch = calls[0]
assert call_switch.domain == HASS_DOMAIN
Expand Down

0 comments on commit e05e90e

Please sign in to comment.