Add Status indicator light switch to Roborock (#93842)

add status indicator light switch
This commit is contained in:
Luke 2023-05-31 08:26:39 -04:00 committed by GitHub
parent 676b6ab706
commit 1d7498378e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -100,6 +100,9 @@
"switch": {
"child_lock": {
"name": "Child lock"
},
"status_indicator": {
"name": "Status indicator light"
}
},
"vacuum": {

View file

@ -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,
),
]

View file

@ -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(