Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions roborock/devices/traits/b01/q7/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ async def set_do_not_disturb(self, enabled: bool, begin_time: int, end_time: int
},
)

async def set_button_lights(self, enabled: bool) -> None:
"""Enable or disable the button/panel lights."""
await self.set_prop(RoborockB01Props.LIGHT_MODE, int(enabled))

async def start_clean(self) -> None:
"""Start cleaning."""
await self.send(
Expand Down
20 changes: 20 additions & 0 deletions tests/devices/traits/b01/q7/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,26 @@ async def test_q7_api_set_do_not_disturb_invalid_time(
assert len(fake_channel.published_commands) == 0


@pytest.mark.parametrize(
("enabled", "expected_code"),
[(True, 1), (False, 0)],
)
Comment thread
ximex marked this conversation as resolved.
async def test_q7_api_set_button_lights(
enabled: bool,
expected_code: int,
q7_api: Q7PropertiesApi,
fake_channel: FakeQ7Channel,
):
"""Test toggling the button/panel lights."""
fake_channel.response_queue.append({"result": "ok"})
await q7_api.set_button_lights(enabled)

assert len(fake_channel.published_commands) == 1
command, params = fake_channel.published_commands[0]
assert command == RoborockB01Q7Methods.SET_PROP
assert params == {RoborockB01Props.LIGHT_MODE: expected_code}


@pytest.mark.parametrize(
("mode", "expected_code"),
[
Expand Down
Loading