Fix KNX climate.set_hvac_mode
not turning on
(#119012)
This commit is contained in:
parent
de3a0841d8
commit
31b44b7846
2 changed files with 10 additions and 5 deletions
|
@ -283,16 +283,13 @@ class KNXClimate(KnxEntity, ClimateEntity):
|
|||
)
|
||||
if knx_controller_mode in self._device.mode.controller_modes:
|
||||
await self._device.mode.set_controller_mode(knx_controller_mode)
|
||||
self.async_write_ha_state()
|
||||
return
|
||||
|
||||
if self._device.supports_on_off:
|
||||
if hvac_mode == HVACMode.OFF:
|
||||
await self._device.turn_off()
|
||||
elif not self._device.is_on:
|
||||
# for default hvac mode, otherwise above would have triggered
|
||||
await self._device.turn_on()
|
||||
self.async_write_ha_state()
|
||||
self.async_write_ha_state()
|
||||
|
||||
@property
|
||||
def preset_mode(self) -> str | None:
|
||||
|
|
|
@ -128,6 +128,7 @@ async def test_climate_on_off(
|
|||
blocking=True,
|
||||
)
|
||||
await knx.assert_write(on_off_ga, 0)
|
||||
assert hass.states.get("climate.test").state == "off"
|
||||
|
||||
# set hvac mode to heat
|
||||
await hass.services.async_call(
|
||||
|
@ -137,10 +138,11 @@ async def test_climate_on_off(
|
|||
blocking=True,
|
||||
)
|
||||
if heat_cool_ga:
|
||||
# only set new hvac_mode without changing on/off - actuator shall handle that
|
||||
await knx.assert_write(heat_cool_ga, 1)
|
||||
await knx.assert_write(on_off_ga, 1)
|
||||
else:
|
||||
await knx.assert_write(on_off_ga, 1)
|
||||
assert hass.states.get("climate.test").state == "heat"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("on_off_ga", [None, "4/4/4"])
|
||||
|
@ -190,6 +192,9 @@ async def test_climate_hvac_mode(
|
|||
blocking=True,
|
||||
)
|
||||
await knx.assert_write(controller_mode_ga, (0x06,))
|
||||
if on_off_ga:
|
||||
await knx.assert_write(on_off_ga, 0)
|
||||
assert hass.states.get("climate.test").state == "off"
|
||||
|
||||
# set hvac to non default mode
|
||||
await hass.services.async_call(
|
||||
|
@ -199,6 +204,9 @@ async def test_climate_hvac_mode(
|
|||
blocking=True,
|
||||
)
|
||||
await knx.assert_write(controller_mode_ga, (0x03,))
|
||||
if on_off_ga:
|
||||
await knx.assert_write(on_off_ga, 1)
|
||||
assert hass.states.get("climate.test").state == "cool"
|
||||
|
||||
# turn off
|
||||
await hass.services.async_call(
|
||||
|
|
Loading…
Add table
Reference in a new issue