From 1d7498378e58b4836b41159c127a50d9c35453c3 Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 31 May 2023 08:26:39 -0400 Subject: [PATCH] Add Status indicator light switch to Roborock (#93842) add status indicator light switch --- homeassistant/components/roborock/strings.json | 3 +++ homeassistant/components/roborock/switch.py | 13 ++++++++++++- tests/components/roborock/test_switch.py | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/roborock/strings.json b/homeassistant/components/roborock/strings.json index 17b9b12cab7..1a65b636dfc 100644 --- a/homeassistant/components/roborock/strings.json +++ b/homeassistant/components/roborock/strings.json @@ -100,6 +100,9 @@ "switch": { "child_lock": { "name": "Child lock" + }, + "status_indicator": { + "name": "Status indicator light" } }, "vacuum": { diff --git a/homeassistant/components/roborock/switch.py b/homeassistant/components/roborock/switch.py index 0af07af4de5..6971ff9d900 100644 --- a/homeassistant/components/roborock/switch.py +++ b/homeassistant/components/roborock/switch.py @@ -50,7 +50,18 @@ SWITCH_DESCRIPTIONS: list[RoborockSwitchDescription] = [ translation_key="child_lock", icon="mdi:account-lock", entity_category=EntityCategory.CONFIG, - ) + ), + RoborockSwitchDescription( + set_command=lambda entity, value: entity.send( + RoborockCommand.SET_FLOW_LED_STATUS, {"status": 1 if value else 0} + ), + get_value=lambda data: data.send(RoborockCommand.GET_FLOW_LED_STATUS), + evaluate_value=lambda data: data["status"] == 1, + key="status_indicator", + translation_key="status_indicator", + icon="mdi:alarm-light-outline", + entity_category=EntityCategory.CONFIG, + ), ] diff --git a/tests/components/roborock/test_switch.py b/tests/components/roborock/test_switch.py index 153ddbd8293..276c2758da4 100644 --- a/tests/components/roborock/test_switch.py +++ b/tests/components/roborock/test_switch.py @@ -15,6 +15,7 @@ from tests.common import MockConfigEntry ("entity_id"), [ ("switch.roborock_s7_maxv_child_lock"), + ("switch.roborock_s7_maxv_status_indicator_light"), ], ) async def test_update_success(