public function getNextScheduledEvent($serial_number = NULL) {
        $schedule = $this->getDeviceSchedule($serial_number);
        $next_event = FALSE;
        $time = date('H') * 60 + date('i');
        for ($i = 0, $day = date('D'); $i++ < 7; $day = date('D', strtotime("+ $i days"))) {
            if (isset($schedule[$day])) {
                foreach ($schedule[$day] as $event) {
                    if ($event->time > $time) {
                        return $event;
                    }
                }
            }
            $time = 0;
        }
        return $next_event;
    }