Add LightEffectModule for dynamic light effects on SMART bulbs (#887)

Support the `light_effect` module which allows setting the effect to Off
or Party or Relax. Uses the new `Feature.Type.Choice`. Does not
currently allow editing of effects.
This commit is contained in:
Steven B
2024-05-02 15:31:12 +01:00
committed by GitHub
parent 5ef81f4669
commit 5b486074e2
8 changed files with 217 additions and 77 deletions

View File

@@ -689,6 +689,17 @@ async def test_feature(mocker, runner):
assert res.exit_code == 0
async def test_features_all(discovery_mock, mocker, runner):
"""Test feature command on all fixtures."""
res = await runner.invoke(
cli,
["--host", "127.0.0.123", "--debug", "feature"],
catch_exceptions=False,
)
assert "== Features ==" in res.output
assert res.exit_code == 0
async def test_feature_single(mocker, runner):
"""Test feature command returning single value."""
dummy_device = await get_device_for_fixture_protocol(
@@ -736,7 +747,7 @@ async def test_feature_set(mocker, runner):
)
led_setter.assert_called_with(True)
assert "Setting led to True" in res.output
assert "Changing led from False to True" in res.output
assert res.exit_code == 0
@@ -762,14 +773,14 @@ async def test_feature_set_child(mocker, runner):
"--child",
child_id,
"state",
"False",
"True",
],
catch_exceptions=False,
)
get_child_device.assert_called()
setter.assert_called_with(False)
setter.assert_called_with(True)
assert f"Targeting child device {child_id}"
assert "Setting state to False" in res.output
assert "Changing state from False to True" in res.output
assert res.exit_code == 0