Fix bond fans without defined max_speed (#38382)
This commit is contained in:
1 parent
00a4bcff3d
commit
a00aa6740e
3 files changed
+22
-4
No files matched your search
@@ -49,9 +49,11 @@ async def setup_platform(
|
||||
hass: core.HomeAssistant,
|
||||
platform: str,
|
||||
discovered_device: Dict[str, Any],
|
||||
*,
|
||||
bond_device_id: str = "bond-device-id",
|
||||
props: Dict[str, Any] = None,
|
||||
bond_version: Dict[str, Any] = None,
|
||||
props: Dict[str, Any] = None,
|
||||
state: Dict[str, Any] = None,
|
||||
):
|
||||
"""Set up the specified Bond platform."""
|
||||
mock_entry = MockConfigEntry(
|
||||
@@ -65,9 +67,11 @@ async def setup_platform(
|
||||
return_value=[bond_device_id]
|
||||
), patch_bond_device(
|
||||
return_value=discovered_device
|
||||
), patch_bond_device_state(), patch_bond_device_properties(
|
||||
), patch_bond_device_properties(
|
||||
return_value=props
|
||||
), patch_bond_device_state():
|
||||
), patch_bond_device_state(
|
||||
return_value=state
|
||||
):
|
||||
assert await async_setup_component(hass, BOND_DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
@@ -96,6 +96,20 @@ async def test_non_standard_speed_list(hass: core.HomeAssistant):
|
||||
)
|
||||
|
||||
|
||||
async def test_fan_speed_with_no_max_seed(hass: core.HomeAssistant):
|
||||
"""Tests that fans without max speed (increase/decrease controls) map speed to HA standard."""
|
||||
await setup_platform(
|
||||
hass,
|
||||
FAN_DOMAIN,
|
||||
ceiling_fan("name-1"),
|
||||
bond_device_id="test-device-id",
|
||||
props={"no": "max_speed"},
|
||||
state={"power": 1, "speed": 14},
|
||||
)
|
||||
|
||||
assert hass.states.get("fan.name_1").attributes["speed"] == fan.SPEED_HIGH
|
||||
|
||||
|
||||
async def test_turn_on_fan_with_speed(hass: core.HomeAssistant):
|
||||
"""Tests that turn on command delegates to set speed API."""
|
||||
await setup_platform(
|
||||
|
||||
Reference in new issue
Block a user