'Turn on RGB or RGBW child device.'

def _turn_on_rgb_and_w(self, hex_template, **kwargs):

    rgb = self._rgb
    white = self._white
    hex_color = self._values.get(self.value_type)
    new_rgb = kwargs.get(ATTR_RGB_COLOR)
    new_white = kwargs.get(ATTR_WHITE_VALUE)
    if ((new_rgb is None) and (new_white is None)):
        return
    if (new_rgb is not None):
        rgb = list(new_rgb)
    if (rgb is None):
        return
    if (hex_template == '%02x%02x%02x%02x'):
        if (new_white is not None):
            rgb.append(new_white)
        elif (white is not None):
            rgb.append(white)
        else:
            _LOGGER.error('White    value    is    not    updated    for    RGBW    light')
            return
    hex_color = (hex_template % tuple(rgb))
    if (len(rgb) > 3):
        white = rgb.pop()
    self.gateway.set_child_value(self.node_id, self.child_id, self.value_type, hex_color)
    if self.gateway.optimistic:
        self._rgb = rgb
        self._white = white
        if hex_color:
            self._values[self.value_type] = hex_color
        self.schedule_update_ha_state()
