def _identify_lighting_type(
    service_data: ServiceData,
) -> Literal["brightness", "color", "both"]:
    """Extract the 'which' attribute from the service data."""
    has_brightness = ATTR_BRIGHTNESS in service_data
    has_color = any(attr in service_data for attr in COLOR_ATTRS)
    if has_brightness and has_color:
        return "both"
    if has_brightness:
        return "brightness"
    if has_color:
        return "color"
    msg = f"Invalid service_data, no brightness or color attributes found: {service_data=}"
    raise NoColorOrBrightnessInServiceDataError(msg)
Extract the 'which' attribute from the service data.
custom_components/adaptive_lighting/adaptation_utils.py