Fix All tests ok
This commit is contained in:
@@ -81,6 +81,8 @@ class ThermostatOverSwitch(BaseThermostat[UnderlyingSwitch]):
|
|||||||
max_on_percent=self._max_on_percent,
|
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)
|
lst_switches = config_entry.get(CONF_UNDERLYING_LIST)
|
||||||
self._lst_vswitch_on = config_entry.get(CONF_VSWITCH_ON_CMD_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, [])
|
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
|
self._should_relaunch_control_heating = False
|
||||||
|
|
||||||
@overrides
|
@overrides
|
||||||
|
|||||||
@@ -280,7 +280,11 @@ class UnderlyingSwitch(UnderlyingEntity):
|
|||||||
# return (self.is_inversed and not real_state) or (
|
# return (self.is_inversed and not real_state) or (
|
||||||
# not self.is_inversed and real_state
|
# 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):
|
async def _keep_alive_callback(self):
|
||||||
"""Keep alive: Turn on if already turned on, turn off if already turned off."""
|
"""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]]'")
|
raise ValueError(f"Invalid input format: {vswitch}. Must be conform to 'command[/argument[:value]]'")
|
||||||
|
|
||||||
else:
|
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:
|
if value is None:
|
||||||
value = STATE_ON if take_on else STATE_OFF
|
value = STATE_ON if take_on else STATE_OFF
|
||||||
|
|||||||
@@ -624,6 +624,7 @@ async def test_security_over_climate(
|
|||||||
assert entity._saved_preset_mode == "none"
|
assert entity._saved_preset_mode == "none"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("expected_lingering_timers", [True])
|
||||||
async def test_migration_security_safety(
|
async def test_migration_security_safety(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
skip_hass_states_is_state,
|
skip_hass_states_is_state,
|
||||||
|
|||||||
Reference in New Issue
Block a user