def remaining_time(self):
        """Return the remaining time before the timer expires."""
        if self.start_time is not None:
            elapsed_time = (dt_util.utcnow() - self.start_time).total_seconds()
            return max(0, self.delay - elapsed_time)
        return 0
Return the remaining time before the timer expires.
custom_components/adaptive_lighting/switch.py