@_cmd
def set_flash(self, flash) -> None:
    'Activate flash.'
    if flash:
        from yeelight import RGBTransition, SleepTransition, Flow, BulbException
        if (self._bulb.last_properties['color_mode'] != 1):
            _LOGGER.error('Flash supported currently only in RGB mode.')
            return
        transition = int(self.config[CONF_TRANSITION])
        if (flash == FLASH_LONG):
            count = 1
            duration = (transition * 5)
        if (flash == FLASH_SHORT):
            count = 1
            duration = (transition * 2)
        (red, green, blue) = color_util.color_hs_to_RGB(*self._hs)
        transitions = list()
        transitions.append(RGBTransition(255, 0, 0, brightness=10, duration=duration))
        transitions.append(SleepTransition(duration=transition))
        transitions.append(RGBTransition(red, green, blue, brightness=self.brightness, duration=duration))
        flow = Flow(count=count, transitions=transitions)
        try:
            self._bulb.start_flow(flow)
        except BulbException as ex:
            _LOGGER.error('Unable to set flash: %s', ex)
Activate flash.
@_cmd
def set_flash(self, flash) -> None:
    
    if flash:
        from yeelight import RGBTransition, SleepTransition, Flow, BulbException
        if (self._bulb.last_properties['color_mode'] != 1):
            _LOGGER.error('Flash supported currently only in RGB mode.')
            return
        transition = int(self.config[CONF_TRANSITION])
        if (flash == FLASH_LONG):
            count = 1
            duration = (transition * 5)
        if (flash == FLASH_SHORT):
            count = 1
            duration = (transition * 2)
        (red, green, blue) = color_util.color_hs_to_RGB(*self._hs)
        transitions = list()
        transitions.append(RGBTransition(255, 0, 0, brightness=10, duration=duration))
        transitions.append(SleepTransition(duration=transition))
        transitions.append(RGBTransition(red, green, blue, brightness=self.brightness, duration=duration))
        flow = Flow(count=count, transitions=transitions)
        try:
            self._bulb.start_flow(flow)
        except BulbException as ex:
            _LOGGER.error('Unable to set flash: %s', ex)