def _remove_redundant_attributes(
    service_data: ServiceData,
    state: State,
) -> ServiceData:
    """Filter service data by removing attributes that already equal the given state.

    Removes all attributes from service call data whose values are already present
    in the target entity's state.
    """
    return {
        k: v
        for k, v in service_data.items()
        if k not in state.attributes or v != state.attributes[k]
    }
Filter service data by removing attributes that already equal the given state.

    Removes all attributes from service call data whose values are already present
    in the target entity's state.
    
custom_components/adaptive_lighting/adaptation_utils.py