Compare commits
2 Commits
6.4.0
...
6.4.1.beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6fb7487d5 | ||
|
|
0f585be0c9 |
@@ -1654,11 +1654,20 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
|||||||
|
|
||||||
if not long_enough:
|
if not long_enough:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Motion delay condition is not satisfied. Check motion sensor state"
|
"Motion delay condition is not satisfied (the sensor have change its state during the delay). Check motion sensor state"
|
||||||
)
|
)
|
||||||
# Get sensor current state
|
# Get sensor current state
|
||||||
motion_state = self.hass.states.get(self._motion_sensor_entity_id)
|
motion_state = self.hass.states.get(self._motion_sensor_entity_id)
|
||||||
if motion_state == new_state.state and new_state.state == STATE_ON:
|
_LOGGER.debug(
|
||||||
|
"%s - motion_state=%s, new_state.state=%s",
|
||||||
|
self,
|
||||||
|
motion_state.state,
|
||||||
|
new_state.state,
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
motion_state.state == new_state.state
|
||||||
|
and new_state.state == STATE_ON
|
||||||
|
):
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"%s - the motion sensor is finally 'on' after the delay", self
|
"%s - the motion sensor is finally 'on' after the delay", self
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -228,17 +228,18 @@ class ThermostatOverClimate(BaseThermostat[UnderlyingClimate]):
|
|||||||
and self.auto_regulation_use_device_temp
|
and self.auto_regulation_use_device_temp
|
||||||
# and we have access to the device temp
|
# and we have access to the device temp
|
||||||
and (device_temp := under.underlying_current_temperature) is not None
|
and (device_temp := under.underlying_current_temperature) is not None
|
||||||
|
# issue 467 - always apply offset. TODO removes this if ok
|
||||||
# and target is not reach (ie we need regulation)
|
# and target is not reach (ie we need regulation)
|
||||||
and (
|
# and (
|
||||||
(
|
# (
|
||||||
self.hvac_mode == HVACMode.COOL
|
# self.hvac_mode == HVACMode.COOL
|
||||||
and self.target_temperature < self.current_temperature
|
# and self.target_temperature < self.current_temperature
|
||||||
)
|
# )
|
||||||
or (
|
# or (
|
||||||
self.hvac_mode == HVACMode.HEAT
|
# self.hvac_mode == HVACMode.HEAT
|
||||||
and self.target_temperature > self.current_temperature
|
# and self.target_temperature > self.current_temperature
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
):
|
):
|
||||||
offset_temp = device_temp - self.current_temperature
|
offset_temp = device_temp - self.current_temperature
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,12 @@ async def test_movement_management_time_not_enough(
|
|||||||
return_value=False,
|
return_value=False,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.helpers.condition.state", return_value=False
|
"homeassistant.helpers.condition.state", return_value=False
|
||||||
) as mock_condition:
|
) as mock_condition, patch(
|
||||||
|
"homeassistant.core.StateMachine.get",
|
||||||
|
return_value=State(
|
||||||
|
entity_id="binary_sensor.mock_motion_sensor", state=STATE_OFF
|
||||||
|
),
|
||||||
|
):
|
||||||
event_timestamp = now - timedelta(minutes=4)
|
event_timestamp = now - timedelta(minutes=4)
|
||||||
try_condition = await send_motion_change_event(entity, True, False, event_timestamp)
|
try_condition = await send_motion_change_event(entity, True, False, event_timestamp)
|
||||||
|
|
||||||
@@ -156,7 +161,12 @@ async def test_movement_management_time_not_enough(
|
|||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_device_active, patch(
|
) as mock_device_active, patch(
|
||||||
"homeassistant.helpers.condition.state", return_value=False
|
"homeassistant.helpers.condition.state", return_value=False
|
||||||
) as mock_condition:
|
) as mock_condition, patch(
|
||||||
|
"homeassistant.core.StateMachine.get",
|
||||||
|
return_value=State(
|
||||||
|
entity_id="binary_sensor.mock_motion_sensor", state=STATE_OFF
|
||||||
|
),
|
||||||
|
):
|
||||||
event_timestamp = now - timedelta(minutes=2)
|
event_timestamp = now - timedelta(minutes=2)
|
||||||
try_condition = await send_motion_change_event(entity, False, True, event_timestamp)
|
try_condition = await send_motion_change_event(entity, False, True, event_timestamp)
|
||||||
|
|
||||||
@@ -685,7 +695,10 @@ async def test_movement_management_with_stop_during_condition_last_state_on(
|
|||||||
"custom_components.versatile_thermostat.underlyings.UnderlyingSwitch.is_device_active",
|
"custom_components.versatile_thermostat.underlyings.UnderlyingSwitch.is_device_active",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
), patch("homeassistant.helpers.condition.state", return_value=False), patch(
|
), patch("homeassistant.helpers.condition.state", return_value=False), patch(
|
||||||
"homeassistant.core.StateMachine.get", return_value=STATE_OFF
|
"homeassistant.core.StateMachine.get",
|
||||||
|
return_value=State(
|
||||||
|
entity_id="binary_sensor.mock_motion_sensor", state=STATE_OFF
|
||||||
|
),
|
||||||
):
|
):
|
||||||
event_timestamp = now - timedelta(minutes=5)
|
event_timestamp = now - timedelta(minutes=5)
|
||||||
try_condition1 = await send_motion_change_event(
|
try_condition1 = await send_motion_change_event(
|
||||||
@@ -705,7 +718,10 @@ async def test_movement_management_with_stop_during_condition_last_state_on(
|
|||||||
"custom_components.versatile_thermostat.underlyings.UnderlyingSwitch.is_device_active",
|
"custom_components.versatile_thermostat.underlyings.UnderlyingSwitch.is_device_active",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
), patch("homeassistant.helpers.condition.state", return_value=False), patch(
|
), patch("homeassistant.helpers.condition.state", return_value=False), patch(
|
||||||
"homeassistant.core.StateMachine.get", return_value=STATE_ON
|
"homeassistant.core.StateMachine.get",
|
||||||
|
return_value=State(
|
||||||
|
entity_id="binary_sensor.mock_motion_sensor", state=STATE_ON
|
||||||
|
),
|
||||||
):
|
):
|
||||||
event_timestamp = now - timedelta(minutes=5)
|
event_timestamp = now - timedelta(minutes=5)
|
||||||
try_condition1 = await send_motion_change_event(
|
try_condition1 = await send_motion_change_event(
|
||||||
|
|||||||
Reference in New Issue
Block a user