1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Alexa fan preset_mode support (#50466)

* fan preset_modes

* process preset mode updates from alexa correctly

* add tests

* codecov patch additional tests
This commit is contained in:
Jan Bouwhuis
2021-05-31 20:58:01 +02:00
committed by GitHub
parent 0e7c2cddf7
commit 7403ba1e81
6 changed files with 189 additions and 6 deletions

View File

@@ -400,6 +400,48 @@ async def test_report_fan_speed_state(hass):
properties.assert_equal("Alexa.RangeController", "rangeValue", 3)
async def test_report_fan_preset_mode(hass):
"""Test ModeController reports fan preset_mode correctly."""
hass.states.async_set(
"fan.preset_mode",
"eco",
{
"friendly_name": "eco enabled fan",
"supported_features": 8,
"preset_mode": "eco",
"preset_modes": ["eco", "smart", "whoosh"],
},
)
properties = await reported_properties(hass, "fan.preset_mode")
properties.assert_equal("Alexa.ModeController", "mode", "preset_mode.eco")
hass.states.async_set(
"fan.preset_mode",
"smart",
{
"friendly_name": "smart enabled fan",
"supported_features": 8,
"preset_mode": "smart",
"preset_modes": ["eco", "smart", "whoosh"],
},
)
properties = await reported_properties(hass, "fan.preset_mode")
properties.assert_equal("Alexa.ModeController", "mode", "preset_mode.smart")
hass.states.async_set(
"fan.preset_mode",
"whoosh",
{
"friendly_name": "whoosh enabled fan",
"supported_features": 8,
"preset_mode": "whoosh",
"preset_modes": ["eco", "smart", "whoosh"],
},
)
properties = await reported_properties(hass, "fan.preset_mode")
properties.assert_equal("Alexa.ModeController", "mode", "preset_mode.whoosh")
async def test_report_fan_oscillating(hass):
"""Test ToggleController reports fan oscillating correctly."""
hass.states.async_set(