Terminate Add AC mode and fix remove_thermostat sync

This commit is contained in:
Jean-Marc Collin
2023-07-22 17:05:54 +02:00
parent 31d862acab
commit c4fc976007
4 changed files with 44 additions and 30 deletions

View File

@@ -127,7 +127,7 @@ class UnderlyingEntity:
"""Set the target temperature"""
return
async def remove_entity(self):
def remove_entity(self):
"""Remove the underlying entity"""
return
@@ -228,7 +228,7 @@ class UnderlyingSwitch(UnderlyingEntity):
if self._async_cancel_cycle is not None:
if force:
_LOGGER.debug("%s - we force a new cycle", self)
await self._cancel_cycle()
self._cancel_cycle()
else:
_LOGGER.debug(
"%s - A previous cycle is alredy running and no force -> waits for its end",
@@ -258,7 +258,7 @@ class UnderlyingSwitch(UnderlyingEntity):
else:
_LOGGER.debug("%s - nothing to do", self)
async def _cancel_cycle(self):
def _cancel_cycle(self):
"""Cancel the cycle"""
if self._async_cancel_cycle:
self._async_cancel_cycle()
@@ -368,9 +368,9 @@ class UnderlyingSwitch(UnderlyingEntity):
# increment energy at the end of the cycle
self._thermostat.incremente_energy()
async def remove_entity(self):
"""Remove the entity"""
await self._cancel_cycle()
def remove_entity(self):
"""Remove the entity after stopping its cycle"""
self._cancel_cycle()
class UnderlyingClimate(UnderlyingEntity):
@@ -618,4 +618,4 @@ class UnderlyingClimate(UnderlyingEntity):
"""Turn auxiliary heater on."""
if not self.is_initialized:
return None
return self._underlying_climate.turn_aux_heat_off()
return self._underlying_climate.turn_aux_heat_off()