Fix intelliclima fan turn on behaviour (#183187)

This commit is contained in:
dvdinth
2026-09-28 23:48:26 +02:00
committed by GitHub
parent 906e125cbd
commit defeb45c9f
2 changed files with 27 additions and 3 deletions
+3 -3
View File
@@ -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
+24
View File
@@ -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,