Fix KNX climate.set_hvac_mode
not turning on
(#119012)
This commit is contained in:
parent
7219a4fa98
commit
a7429e5f50
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:
|
if knx_controller_mode in self._device.mode.controller_modes:
|
||||||
await self._device.mode.set_controller_mode(knx_controller_mode)
|
await self._device.mode.set_controller_mode(knx_controller_mode)
|
||||||
self.async_write_ha_state()
|
|
||||||
return
|
|
||||||
|
|
||||||
if self._device.supports_on_off:
|
if self._device.supports_on_off:
|
||||||
if hvac_mode == HVACMode.OFF:
|
if hvac_mode == HVACMode.OFF:
|
||||||
await self._device.turn_off()
|
await self._device.turn_off()
|
||||||
elif not self._device.is_on:
|
elif not self._device.is_on:
|
||||||
# for default hvac mode, otherwise above would have triggered
|
|
||||||
await self._device.turn_on()
|
await self._device.turn_on()
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def preset_mode(self) -> str | None:
|
def preset_mode(self) -> str | None:
|
||||||
|
|
|
@ -128,6 +128,7 @@ async def test_climate_on_off(
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
await knx.assert_write(on_off_ga, 0)
|
await knx.assert_write(on_off_ga, 0)
|
||||||
|
assert hass.states.get("climate.test").state == "off"
|
||||||
|
|
||||||
# set hvac mode to heat
|
# set hvac mode to heat
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
|
@ -137,10 +138,11 @@ async def test_climate_on_off(
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
if heat_cool_ga:
|
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(heat_cool_ga, 1)
|
||||||
|
await knx.assert_write(on_off_ga, 1)
|
||||||
else:
|
else:
|
||||||
await knx.assert_write(on_off_ga, 1)
|
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"])
|
@pytest.mark.parametrize("on_off_ga", [None, "4/4/4"])
|
||||||
|
@ -190,6 +192,9 @@ async def test_climate_hvac_mode(
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
await knx.assert_write(controller_mode_ga, (0x06,))
|
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
|
# set hvac to non default mode
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
|
@ -199,6 +204,9 @@ async def test_climate_hvac_mode(
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
await knx.assert_write(controller_mode_ga, (0x03,))
|
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
|
# turn off
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue