Skip to content

Commit

Permalink
Merge pull request #332 from PeteRager/remove-aux-heat
Browse files Browse the repository at this point in the history
remove aux heat
  • Loading branch information
PeteRager authored Aug 2, 2024
2 parents 2a43151 + 29768f9 commit d76e0c0
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 149 deletions.
48 changes: 0 additions & 48 deletions custom_components/lennoxs30/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ def supported_features(self):
):
mask |= ClimateEntityFeature.TARGET_HUMIDITY

if self._zone.emergencyHeatingOption or self._system.has_emergency_heat():
mask |= ClimateEntityFeature.AUX_HEAT

_LOGGER.debug("climate:supported_features name [%s] support_flags [%d]", self._myname, SUPPORT_FLAGS)
return mask

Expand Down Expand Up @@ -600,51 +597,6 @@ def fan_modes(self):
return []
return FAN_MODES

@property
def is_aux_heat(self) -> bool | None:
if self.is_zone_disabled:
return None
res = self._zone.systemMode == LENNOX_HVAC_EMERGENCY_HEAT
return res

def _create_aux_heat_issue(self, service: str):
_LOGGER.warning(
"climate.%s is deprecated and will be removed in version 2024.10 learn more https://github.com/PeteRager/lennoxs30/blob/master/docs/aux_heat.md", service
)


async def async_turn_aux_heat_on(self):
"""Turn auxiliary heater on."""
_LOGGER.info("climate:async_turn_aux_heat_on zone [%s]", self._myname)
self._create_aux_heat_issue("turn_aux_heat_on")
if self.is_zone_disabled:
raise HomeAssistantError(f"Unable to turn_aux_heat_on mode as zone [{self._myname}] is disabled")
try:
await self._zone.setHVACMode(LENNOX_HVAC_EMERGENCY_HEAT)
await self.async_trigger_fast_poll()
except S30Exception as ex:
raise HomeAssistantError(f"turn_aux_heat_on [{self._myname}] [{ex.as_string()}]") from ex
except Exception as ex:
raise HomeAssistantError(
f"turn_aux_heat_on unexpected exception, please log issue, [{self._myname}] exception [{ex}]"
) from ex

async def async_turn_aux_heat_off(self):
_LOGGER.info("climate:async_turn_aux_heat_off zone [%s]", self._myname)
self._create_aux_heat_issue("turn_aux_heat_off")
# When Aux is turned off, we will revert the zone to Heat Mode.
if self.is_zone_disabled:
raise HomeAssistantError(f"Unable to turn_aux_heat_on mode as zone [{self._myname}] is disabled")
try:
await self._zone.setHVACMode(LENNOX_HVAC_HEAT)
await self.async_trigger_fast_poll()
except S30Exception as ex:
raise HomeAssistantError(f"turn_aux_heat_off [{self._myname}] [{ex.as_string()}]") from ex
except Exception as ex:
raise HomeAssistantError(
f"turn_aux_heat_off unexpected exception, please log issue, [{self._myname}] exception [{ex}]"
) from ex

async def async_set_temperature(self, **kwargs):
"""Set new target temperature"""
if self.is_zone_disabled:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/lennoxs30/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"issue_tracker" : "https://github.com/PeteRager/lennoxs30/issues",
"quality_scale": "platinum",
"requirements": ["lennoxs30api==0.2.15"],
"version": "2024.6.1"
"version": "2024.8.0"
}
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "Lennox S30,E30,M30",
"render_readme": true,
"hide_default_branch": true,
"homeassistant": "2023.12.0"
"homeassistant": "2024.6.0"
}
99 changes: 0 additions & 99 deletions tests/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,29 +743,9 @@ async def test_climate_supported_features(hass, manager_mz: Manager):
c._zone.humidificationOption = False
feat = c.supported_features
assert feat & ClimateEntityFeature.TARGET_HUMIDITY == 0

assert feat & ClimateEntityFeature.AUX_HEAT == 0
assert feat & ClimateEntityFeature.PRESET_MODE != 0
assert feat & ClimateEntityFeature.FAN_MODE != 0

c._zone.emergencyHeatingOption = False
with patch.object(system, "has_emergency_heat") as has_emergency_heat:
has_emergency_heat.return_value = True
feat = c.supported_features
assert feat & ClimateEntityFeature.AUX_HEAT != 0

c._zone.emergencyHeatingOption = True
with patch.object(system, "has_emergency_heat") as has_emergency_heat:
has_emergency_heat.return_value = False
feat = c.supported_features
assert feat & ClimateEntityFeature.AUX_HEAT != 0

c._zone.emergencyHeatingOption = False
with patch.object(system, "has_emergency_heat") as has_emergency_heat:
has_emergency_heat.return_value = False
feat = c.supported_features
assert feat & ClimateEntityFeature.AUX_HEAT == 0

zone1: lennox_zone = system.zone_list[1]
c1 = S30Climate(hass, manager, system, zone1)
feat = c1.supported_features
Expand Down Expand Up @@ -1216,85 +1196,6 @@ async def test_climate_fan_modes(hass, manager_mz: Manager):
assert len(modes) == 0


@pytest.mark.asyncio
async def test_climate_is_aux_heat(hass, manager_mz: Manager):
manager = manager_mz
system: lennox_system = manager.api.system_list[0]
manager.is_metric = False
zone: lennox_zone = system.zone_list[1]
c = S30Climate(hass, manager, system, zone)
assert c.is_aux_heat is False
zone.systemMode = LENNOX_HVAC_EMERGENCY_HEAT
assert c.is_aux_heat is True
system.zoningMode = LENNOX_ZONING_MODE_CENTRAL
assert c.is_aux_heat is None


@pytest.mark.asyncio
async def test_climate_turn_aux_heat_on(hass, manager_mz: Manager, caplog):
manager = manager_mz
system: lennox_system = manager.api.system_list[0]
manager.is_metric = False
zone: lennox_zone = system.zone_list[1]
c = S30Climate(hass, manager, system, zone)
zone.systemMode = LENNOX_HVAC_HEAT

with caplog.at_level(logging.WARNING):
with patch.object(zone, "setHVACMode") as setHVACMode:
caplog.clear()
await c.async_turn_aux_heat_on()
assert setHVACMode.call_count == 1
assert setHVACMode.await_args[0][0] == LENNOX_HVAC_EMERGENCY_HEAT
assert "turn_aux_heat_on is deprecated and will be removed in version 2024.10" in caplog.text

await conf_test_exception_handling(zone, "setHVACMode", c, c.async_turn_aux_heat_on)

system.zoningMode = LENNOX_ZONING_MODE_CENTRAL
with caplog.at_level(logging.ERROR):
with patch.object(zone, "setHVACMode") as setHVACMode:
caplog.clear()
ex: HomeAssistantError = None
try:
await c.async_turn_aux_heat_on()
except HomeAssistantError as err:
ex = err
assert setHVACMode.call_count == 0
assert ex is not None
assert "disabled" in str(ex)


@pytest.mark.asyncio
async def test_climate_turn_aux_heat_off(hass, manager_mz: Manager, caplog):
manager = manager_mz
system: lennox_system = manager.api.system_list[0]
manager.is_metric = False
zone: lennox_zone = system.zone_list[1]
c = S30Climate(hass, manager, system, zone)
zone.systemMode = LENNOX_HVAC_HEAT

with caplog.at_level(logging.WARNING):
with patch.object(zone, "setHVACMode") as setHVACMode:
caplog.clear()
await c.async_turn_aux_heat_off()
assert setHVACMode.call_count == 1
assert setHVACMode.await_args[0][0] == LENNOX_HVAC_HEAT
assert "turn_aux_heat_off is deprecated and will be removed in version 2024.10" in caplog.text

await conf_test_exception_handling(zone, "setHVACMode", c, c.async_turn_aux_heat_off)

system.zoningMode = LENNOX_ZONING_MODE_CENTRAL
with caplog.at_level(logging.ERROR):
with patch.object(zone, "setHVACMode") as setHVACMode:
caplog.clear()
ex: HomeAssistantError = None
try:
await c.async_turn_aux_heat_off()
except HomeAssistantError as err:
ex = err
assert ex is not None
assert "disabled" in str(ex)


@pytest.mark.asyncio
async def test_climate_set_fan_mode(hass, manager_mz: Manager, caplog):
manager = manager_mz
Expand Down

0 comments on commit d76e0c0

Please sign in to comment.