Skip to content

Commit d26173e

Browse files
ximexclaudeallenporterLash-L
authored
feat(q7): add set_button_lights trait method (#843)
* feat(q7): add set_button_light trait method Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(q7): rename set_button_light to set_button_lights The setting toggles multiple button lights, so the plural name matches what the app calls it ("Button Lights"), as agreed in review. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Allen Porter <allen.porter@gmail.com> Co-authored-by: Luke Lashley <conway220@gmail.com>
1 parent 6397ace commit d26173e

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎roborock/devices/traits/b01/q7/__init__.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ async def set_do_not_disturb(self, enabled: bool, begin_time: int, end_time: int
164164
},
165165
)
166166

167+
async def set_button_lights(self, enabled: bool) -> None:
168+
"""Enable or disable the button/panel lights."""
169+
await self.set_prop(RoborockB01Props.LIGHT_MODE, int(enabled))
170+
167171
async def start_clean(self) -> None:
168172
"""Start cleaning."""
169173
await self.send(

‎tests/devices/traits/b01/q7/test_init.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,26 @@ async def test_q7_api_set_do_not_disturb_invalid_time(
236236
assert len(fake_channel.published_commands) == 0
237237

238238

239+
@pytest.mark.parametrize(
240+
("enabled", "expected_code"),
241+
[(True, 1), (False, 0)],
242+
)
243+
async def test_q7_api_set_button_lights(
244+
enabled: bool,
245+
expected_code: int,
246+
q7_api: Q7PropertiesApi,
247+
fake_channel: FakeQ7Channel,
248+
):
249+
"""Test toggling the button/panel lights."""
250+
fake_channel.response_queue.append({"result": "ok"})
251+
await q7_api.set_button_lights(enabled)
252+
253+
assert len(fake_channel.published_commands) == 1
254+
command, params = fake_channel.published_commands[0]
255+
assert command == RoborockB01Q7Methods.SET_PROP
256+
assert params == {RoborockB01Props.LIGHT_MODE: expected_code}
257+
258+
239259
@pytest.mark.parametrize(
240260
("mode", "expected_code"),
241261
[

0 commit comments

Comments
 (0)