code: public function getDeviceSchedule($serial_number = NULL) {
          $this->prepareForGet();
          $serial_number = $this->getDefaultSerial($serial_number);
          $schedule_days = $this->last_status->schedule->{$serial_number}->days;
  
          $schedule = array();
          foreach ((array)$schedule_days as $day => $scheduled_events) {
              $events = array();
              foreach ($scheduled_events as $scheduled_event) {
                  if ($scheduled_event->entry_type == 'setpoint') {
                      $events[(int)$scheduled_event->time] = (object) array(
                         'time' => $scheduled_event->time/60, // in minutes
                         'target_temperature' => $scheduled_event->type == 'RANGE' ? array($this->temperatureInUserScale((float)$scheduled_event->{'temp-min'}), $this->temperatureInUserScale((float)$scheduled_event->{'temp-max'})) : $this->temperatureInUserScale((float) $scheduled_event->temp),
                         'mode' => $scheduled_event->type == 'HEAT' ? TARGET_TEMP_MODE_HEAT : ($scheduled_event->type == 'COOL' ? TARGET_TEMP_MODE_COOL : TARGET_TEMP_MODE_RANGE)
                      );
                  }
              }
              if (!empty($events)) {
                  ksort($events);
                  $schedule[(int) $day] = array_values($events);
              }
          }
  
          ksort($schedule);
          $sorted_schedule = array();
          foreach ($schedule as $day => $events) {
              $sorted_schedule[$this->days_maps[(int) $day]] = $events;
          }
  
          return $sorted_schedule;
      }
docs: Get the schedule details for the specified device.
  
  @param string $serial_number The device (thermostat or protect) serial number. Defaults to the first device of the account.
  
  @return array Returns as array, one element for each day of the week for which there has at least one scheduled event.
  Array keys are a textual representation of a day, three letters, as returned by `date('D')`.
  Array values are arrays of scheduled temperatures, including a time (in minutes after midnight),
  and a mode (one of the TARGET_TEMP_MODE_* defines).