Fix All tests ok

This commit is contained in:
Jean-Marc Collin
2025-02-02 18:41:10 +00:00
parent 85e6b40e66
commit d4072ee8f8
3 changed files with 9 additions and 3 deletions

View File

@@ -81,6 +81,8 @@ class ThermostatOverSwitch(BaseThermostat[UnderlyingSwitch]):
max_on_percent=self._max_on_percent,
)
self._is_inversed = config_entry.get(CONF_INVERSE_SWITCH) is True
lst_switches = config_entry.get(CONF_UNDERLYING_LIST)
self._lst_vswitch_on = config_entry.get(CONF_VSWITCH_ON_CMD_LIST, [])
self._lst_vswitch_off = config_entry.get(CONF_VSWITCH_OFF_CMD_LIST, [])
@@ -101,7 +103,6 @@ class ThermostatOverSwitch(BaseThermostat[UnderlyingSwitch]):
)
)
self._is_inversed = config_entry.get(CONF_INVERSE_SWITCH) is True
self._should_relaunch_control_heating = False
@overrides

View File

@@ -280,7 +280,11 @@ class UnderlyingSwitch(UnderlyingEntity):
# return (self.is_inversed and not real_state) or (
# not self.is_inversed and real_state
# )
return self._hass.states.is_state(self._entity_id, self._on_command.get("state"))
is_on = self._hass.states.is_state(self._entity_id, self._on_command.get("state"))
if self.is_inversed:
return not is_on
return is_on
async def _keep_alive_callback(self):
"""Keep alive: Turn on if already turned on, turn off if already turned off."""
@@ -329,7 +333,7 @@ class UnderlyingSwitch(UnderlyingEntity):
raise ValueError(f"Invalid input format: {vswitch}. Must be conform to 'command[/argument[:value]]'")
else:
command = SERVICE_TURN_ON if use_on and not self.is_inversed else SERVICE_TURN_OFF
command = SERVICE_TURN_ON if take_on else SERVICE_TURN_OFF
if value is None:
value = STATE_ON if take_on else STATE_OFF

View File

@@ -624,6 +624,7 @@ async def test_security_over_climate(
assert entity._saved_preset_mode == "none"
@pytest.mark.parametrize("expected_lingering_timers", [True])
async def test_migration_security_safety(
hass: HomeAssistant,
skip_hass_states_is_state,