code: public function setFanMode($mode, $serial_number = NULL) {
          $duty_cycle = NULL;
          $timer = NULL;
          if (is_array($mode)) {
              $modes = $mode;
              $mode = $modes[0];
              if (count($modes) > 1) {
                  if ($mode == FAN_MODE_MINUTES_PER_HOUR) {
                      $duty_cycle = (int) $modes[1];
                  } else {
                      $timer = (int) $modes[1];
                  }
              } else {
                  throw new Exception("setFanMode(array \$mode[, ...]) needs at least a mode and a value in the \$mode array.");
              }
          } elseif (!is_string($mode)) {
              throw new Exception("setFanMode() can only take a string or an array as it's first parameter.");
          }
          return $this->_setFanMode($mode, $duty_cycle, $timer, $serial_number);
      }
docs: Set the thermostat-controlled fan mode.
  
  @param string|array $mode          One of the following constants: FAN_MODE_AUTO, FAN_MODE_ON, FAN_MODE_EVERY_DAY_ON or FAN_MODE_EVERY_DAY_OFF.
  @param string       $serial_number The thermostat serial number. Defaults to the first device of the account.
  
  @return stdClass|bool The object returned by the API call, or FALSE on error.
  
  @throws Exception