def _validate_sun_event_order(self, events: list[tuple[str, float]]) -> None:
        """Check if the sun events are in the expected order."""
        events = sorted(events, key=lambda x: x[1])
        events_names, _ = zip(*events, strict=True)
        if events_names not in _ALLOWED_ORDERS:
            msg = (
                f"{self.name}: The sun events {events_names} are not in the expected"
                " order. The Adaptive Lighting integration will not work!"
                " This might happen if your sunrise/sunset offset is too large or"
                " your manually set sunrise/sunset time is past/before noon/midnight."
            )
            _LOGGER.error(msg)
            raise ValueError(msg)
Check if the sun events are in the expected order.
webapp/color_and_brightness.py