issue with ac and mouvement detection (#471)
* Update base_thermostat.py issue with ac and mouvement detection * issue ac with detection mouvement modif class find_preset_temps for preset activity
This commit is contained in:
@@ -1377,11 +1377,19 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
|||||||
if preset_mode == PRESET_POWER:
|
if preset_mode == PRESET_POWER:
|
||||||
return self._power_temp
|
return self._power_temp
|
||||||
if preset_mode == PRESET_ACTIVITY:
|
if preset_mode == PRESET_ACTIVITY:
|
||||||
motion_preset = (
|
if self._ac_mode and self._hvac_mode == HVACMode.COOL:
|
||||||
self._motion_preset
|
motion_preset = (
|
||||||
if self._motion_state == STATE_ON
|
self._motion_preset + PRESET_AC_SUFFIX
|
||||||
else self._no_motion_preset
|
if self._motion_state == STATE_ON
|
||||||
)
|
else self._no_motion_preset + PRESET_AC_SUFFIX
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
motion_preset = (
|
||||||
|
self._motion_preset
|
||||||
|
if self._motion_state == STATE_ON
|
||||||
|
else self._no_motion_preset
|
||||||
|
)
|
||||||
|
|
||||||
if motion_preset in self._presets:
|
if motion_preset in self._presets:
|
||||||
return self._presets[motion_preset]
|
return self._presets[motion_preset]
|
||||||
else:
|
else:
|
||||||
@@ -1646,6 +1654,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
|||||||
_LOGGER.debug("%s - Motion delay condition is satisfied", self)
|
_LOGGER.debug("%s - Motion delay condition is satisfied", self)
|
||||||
self._motion_state = new_state.state
|
self._motion_state = new_state.state
|
||||||
if self._attr_preset_mode == PRESET_ACTIVITY:
|
if self._attr_preset_mode == PRESET_ACTIVITY:
|
||||||
|
|
||||||
new_preset = (
|
new_preset = (
|
||||||
self._motion_preset
|
self._motion_preset
|
||||||
if self._motion_state == STATE_ON
|
if self._motion_state == STATE_ON
|
||||||
@@ -1658,6 +1667,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
|||||||
)
|
)
|
||||||
# We do not change the preset which is kept to ACTIVITY but only the target_temperature
|
# We do not change the preset which is kept to ACTIVITY but only the target_temperature
|
||||||
# We take the presence into account
|
# We take the presence into account
|
||||||
|
|
||||||
await self._async_internal_set_temperature(
|
await self._async_internal_set_temperature(
|
||||||
self.find_preset_temp(new_preset)
|
self.find_preset_temp(new_preset)
|
||||||
)
|
)
|
||||||
@@ -1895,17 +1905,24 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
|||||||
or self._attr_preset_mode != PRESET_ACTIVITY
|
or self._attr_preset_mode != PRESET_ACTIVITY
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
new_preset = (
|
||||||
|
self._motion_preset
|
||||||
|
if self._motion_state == STATE_ON
|
||||||
|
else self._no_motion_preset
|
||||||
|
)
|
||||||
|
_LOGGER.info(
|
||||||
|
"%s - Motion condition have changes. New preset temp will be %s",
|
||||||
|
self,
|
||||||
|
new_preset,
|
||||||
|
)
|
||||||
|
# We do not change the preset which is kept to ACTIVITY but only the target_temperature
|
||||||
|
# We take the presence into account
|
||||||
|
|
||||||
await self._async_internal_set_temperature(
|
await self._async_internal_set_temperature(
|
||||||
self._presets.get(
|
self.find_preset_temp(new_preset)
|
||||||
(
|
|
||||||
self._motion_preset
|
|
||||||
if self._motion_state == STATE_ON
|
|
||||||
else self._no_motion_preset
|
|
||||||
),
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"%s - regarding motion, target_temp have been set to %.2f",
|
"%s - regarding motion, target_temp have been set to %.2f",
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user