From 418e7e2d04d7b4bcd93bd69457090172533a1b21 Mon Sep 17 00:00:00 2001 From: Hagen Fritsch Date: Wed, 27 Nov 2019 22:01:10 +0100 Subject: [PATCH] STYJ02YM: Add support to switch button LEDs on/off --- miio/viomivacuum.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/miio/viomivacuum.py b/miio/viomivacuum.py index 0e07a043b..0c0653a21 100644 --- a/miio/viomivacuum.py +++ b/miio/viomivacuum.py @@ -34,6 +34,11 @@ class ViomiLanguage(Enum): EN = 2 # English +class ViomiLedState(Enum): + Off = 0 + On = 1 + + class ViomiVacuumStatus: def __init__(self, data): # ["run_state","mode","err_state","battary_life","box_type","mop_type","s_time","s_area", @@ -213,3 +218,10 @@ def set_dnd(self, disable: bool, start_hr: int, start_min: int, end_hr: int, end def set_language(self, language: ViomiLanguage): """Set the device's audio language.""" return self.send("set_language", [language.value]) + + @command( + click.argument('state', type=EnumType(ViomiLedState, False)) + ) + def led(self, state: ViomiLedState): + """Switch the button leds on or off.""" + return self.send("set_light", [state.value])