Sending emails from the LI-6800

Printable PDF: Sending emails from the LI-6800

(LI-6800_Sending-Emails_20000.pdf)

Download this content as a pdf.

Depending on the nature of your LI-6800 application, there may be times when your instrument is running an experiment where you are not able to connect to the same network and view VNC nor access files via Finder (macOS) or File Explorer (Windows). While there may be more sophisticated ways of accessing data from the LI-6800 on a remote network, here is a tech tip describing how you can have your LI-6800 email you copies of your active log file at some user-specified frequency.

Note: Sending emails from an LI-6800 connected to a network, as described here, requires an email address from the Gmail™ email service. Since you need to allow the account to send emails from a non-secure app (such as the LI-6800), we recommend that you create a Gmail™ account for this purpose, and configure it as shown in Figure 1‑1.

Figure 1‑1. Make sure Allow less secure apps: is set to ON.

To accomplish the task of sending emails from the LI-6800 at a user specified frequency, we will be using background programs (BPs). To learn more about what background programs are and how to use them, refer to the LI-6800 instruction manual and a short video:

Note: As configured here, the email functionality only works when added as a step to an autologging BP, since it is dependent on a parent BP to tell it when to stop sending copies of the log file. The sending of emails will stop when the autologging BP is done or prematurely terminated.

The background programs used to send emails will consist of two python scripts as individual files. One file (email_file_thread.py) is what is called a non-BP thread, which means (1) it does not contain the BP module and (2) it gets called by a BP. It contains Python’s email module. The other file (EmailFile.py) is a BP that calls the non-BP thread just mentioned. This second part will show up as a GROUP in your BP Build window under Library GROUPs (see Figure 1‑2).

Figure 1‑2. EmailFile in the GROUPs library. From here it can be added to any BP that is used to log data.

Download and installation

To import the two email-related Python files from the LI-COR website to an LI-6800, follow the steps below:

  1. Download the files using this link: licor.app.boxenterprise.net/s/0i1v6tpd9r3okqphpwfjdn6touagedom
  2. Extract the files from the folder.
  3. Copy email_file_thread.py into the LI-6800 home/licor/resources/lib directory using USB or Finder/File Explorer.
  4. Copy EmailFile.py into the LI-6800 home/licor/resources/groups directory using USB or Finder/File Explorer.
  5. Make sure you have the latest version of Bluestem software (2.0.04 as of September 2021). Update your instrument if needed. Update packages will be available from: licor.com/env/support/LI-6800/software.html.

Note: Regardless of whether the instrument needed an update or not, restart the LI-6800 to fully load the Python files into their new directories.

Making it work

The GROUP EmailFile can be added to an existing BP or a new BP. To add EmailFile to an already existing auto program, see the example below.

Example: A user wants the LI-6800 to autolog for 24 hours while the user is not on site. During those 24 hours, the LI-6800 should send a copy of the LI-6800 plain text data file every hour so the user can make sure the data still looks good. Therefore, the LI-6800 needs to be connected to the internet so that it can access the Gmail™ server. To log data, open a log file and use the AutoLog.py under apps > basic. To add the EmailFile GROUP, follow the steps below:

Go to Programs > BP Builder and open the AutoLog.py background program so that it can be edited (see Figure 1‑3).

Figure 1‑3. Highlight the program you want to modify and tap Open BP.

Add the GROUP(True, ‘EmailFile’) to an appropriate spot in the program (see Figure 1‑4).

Figure 1‑4. Add the GROUP(True, ‘EmailFile’) into the program by tapping Insert. The exact placement does not matter for this AutoLog.py as long as it is before the LOOP(...) statement. If you have a long wait statement however, prior to when the actual logging starts, you would want to make sure to add the GROUP(True, ‘EmailFile’) prior to the WAIT().

Save the program under a new file name and/or go to the Start menu and tap Start (see Figure 1‑5).

Figure 1‑5. Tap Start to initiate the program.

When the AutoLog.py background program is started, it will first prompt for autolog settings (see Figure 1‑6).

Figure 1‑6. Add total time in minutes and the log interval.

After tapping Continue it will prompt for email settings (see Figure 1‑7).

Figure 1‑7. As mentioned earlier, the sender email will need to be a Gmail™ account, the receiver email will be whatever email address you want your files sent to. The program will copy the text log file and send it as an attachment in the email.

After tapping Continue on the email settings page (Figure 1‑7), the autolog will start and the LI-6800 will email a new copy of the file 2021-04-23-1251_logdata every 60 minutes until the auto log is completed or terminated early (canceled by the user, batteries died, etc.).