From defeb45c9f9bf89deddbacbb752c9ff50720a072 Mon Sep 17 00:00:00 2001 From: dvdinth <43087214+dvdinth@users.noreply.github.com> Date: Mon, 28 Sep 2026 23:48:26 +0200 Subject: [PATCH] Fix intelliclima fan turn on behaviour (#183187) --- homeassistant/components/intelliclima/fan.py | 6 ++--- tests/components/intelliclima/test_fan.py | 24 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/intelliclima/fan.py b/homeassistant/components/intelliclima/fan.py index 969d97cbefed..8eb949a21d5c 100644 --- a/homeassistant/components/intelliclima/fan.py +++ b/homeassistant/components/intelliclima/fan.py @@ -140,10 +140,10 @@ class IntelliClimaVMCFan(IntelliClimaECOEntity, FanEntity): """Set mode and speed. If percentage is None, it first defaults to the respective property. - If that is also None, then percentage defaults to 25 (sleep) + If that is None or 0, then percentage defaults to 25 (sleep) """ - percentage = self.percentage if percentage is None else percentage - percentage = 25 if percentage is None else percentage + if percentage is None: + percentage = self.percentage or 25 if preset_mode == "auto": # auto is a special case with special mode and speed setting diff --git a/tests/components/intelliclima/test_fan.py b/tests/components/intelliclima/test_fan.py index 924aca1f81c3..ac70b94672ec 100644 --- a/tests/components/intelliclima/test_fan.py +++ b/tests/components/intelliclima/test_fan.py @@ -4,6 +4,7 @@ from collections.abc import AsyncGenerator from unittest.mock import AsyncMock, patch from pyintelliclima.const import FanMode, FanSpeed +from pyintelliclima.intelliclima_types import IntelliClimaDevices import pytest from syrupy.assertion import SnapshotAssertion @@ -196,6 +197,29 @@ async def test_fan_turn_on_defaulting_behavior( mock_cloud_interface.ecocomfort.turn_off.assert_not_awaited() +async def test_fan_turn_on_when_off_without_percentage( + hass: HomeAssistant, + mock_cloud_interface: AsyncMock, + single_eco_device: IntelliClimaDevices, +) -> None: + """turn_on without percentage on an off fan turns it on at sleep speed.""" + eco = single_eco_device.ecocomfort2_devices["56789"] + eco.mode_set = FanMode.off + eco.speed_set = FanSpeed.off + + await hass.services.async_call( + FAN_DOMAIN, + SERVICE_TURN_ON, + {ATTR_ENTITY_ID: FAN_ENTITY_ID}, + blocking=True, + ) + + mock_cloud_interface.ecocomfort.set_mode_speed.assert_awaited_once_with( + "11223344", FanMode.alternate, FanSpeed.sleep + ) + mock_cloud_interface.ecocomfort.turn_off.assert_not_awaited() + + async def test_fan_turn_on_defaulting_behavior_auto_preset( hass: HomeAssistant, mock_cloud_interface: AsyncMock,