Exemplo n.º 1
0
 async def async_set_led_brightness(self, brightness: str) -> None:
     """Set the led brightness."""
     if await self._try_command(
             "Setting the led brightness of the miio device failed.",
             self._device.set_led_brightness,
             AirpurifierMiotLedBrightness(LED_BRIGHTNESS_MAP[brightness]),
     ):
         self._current_led_brightness = LED_BRIGHTNESS_MAP[brightness]
         self.async_write_ha_state()
Exemplo n.º 2
0
    async def async_set_led_brightness(self, brightness: int = 2):
        """Set the led brightness."""
        if self._device_features & FEATURE_SET_LED_BRIGHTNESS == 0:
            return

        await self._try_command(
            "Setting the led brightness of the miio device failed.",
            self._device.set_led_brightness,
            AirpurifierMiotLedBrightness(brightness),
        )