ESPShell for Arduino :: Automation

[ На русском ] ↔ [ English ]

COMMANDS AFFECTING THE ESPSHELL INTERFACE

There are cases when ESPShell is controlled by another piece of software; that is, it is not a human who issues commands and reads ESPShell responses. When it is a Human↔Machine interface, we usually expect the Machine to echo our input back. That's why we see what we're typing in our terminal program and why we can edit our command line. For a Machine↔Machine interface, we don't want any echo, as it would interfere with ESPShell's output the Machine would need to filter out its own input.

ESPShell handles this in the same way as modems do: A modem is an example of both a Human↔Machine interface (e.g., AT commands typed in a terminal) and a Machine↔Machine interface (e.g., your Windows driver talking to the modem). In modems, input echo can be enabled or disabled with AT commands ("ATE1" and "ATE0""). In ESPShell, the "echo on" and "echo off" commands provide the same functionality.

All ESPShell output starts with a "%" symbol, which makes it easy to filter and parse if needed.

The table below lists commands that affect the ESPShell interface and may be useful for automated shell access. These commands do not appear in the general command list (shown with "?" or "help") as they are rarely used and intentionally hidden.

SettingsMeaning

history [on|off]

Enables or disables command history.

By default, command history is enabled and can be accessed by pressing the ↑ and ↓ arrow keys (note: this doesn't work in the Arduino Serial Monitor). ESPShell stores up to 20 recent commands in its history buffer. The buffer size can be adjusted by editing the espshell.h file (see the "Compile-time settings" section at the top of espshell.h).

The "history" command without arguments displays the current state:

  esp32#>history
  % History is enabled
  esp32#>

The default value is "enabled". Disabling command history also clears all memory used for storing history entries.

colors [on|off|auto]

Enables or disables ANSI terminal colors.

If you're using terminal software like PuTTY or TeraTerm, it's recommended to set this option to "on". For simpler terminals like the Arduino Serial Monitor, it must be set to "off", otherwise your screen may be flooded with unreadable sequences like: 1;36]m ]]J 7]m etc.

The default value is "auto". In this mode, ESPShell tries to detect the terminal type and automatically enable or disable colors. Detection is based on received input: any keystrokes with lower keycodes (never sent by the Arduino Serial Monitor) trigger color mode ON.

Use "colors off" if your terminal doesn't support colors but ESPShell mistakenly enables them.

Running this command without arguments displays the current color mode:

    esp32#>colors
    % Color is "auto"
    esp32#>

echo [on|off|silent]

Enables or disables shell output and user input echo.

By default, everything typed by the user is echoed back by ESPShell. This behavior can be controlled using the "echo" command. Executing this command without arguments shows the current echo state:

  esp32#>echo
  % Echo is "on"
  esp32#>

echo off: Disables ESPShell from printing its prompt and from echoing user input. Input is still processed, but not displayed. This command only affects input echo; it does not suppress command output or shell output (e.g., error messages).

This is equivalent to the "ATE0" command in modems. Even with echo off, features like line editing and history still work theyre just not visible.

echo on: Enables input echo. This is the default behavior and is equivalent to the "ATE1" modem command.

echo silent: Completely disables all ESPShell output to the terminal.

  • No error messages will be displayed.
  • User input is not echoed back.
  • Input is processed, and commands are executed, but nothing is printed.
This mode is useful when you don't want ESPShell to interfere with the sketch's output. The sketch retains full control over the serial interface, while ESPShell remains silent.

tty NUMBER

Changes ESPShell's input source to a different UART.

The default input is UART0 (or USB-CDC), but this can be changed using the "tty" command. This is useful in automation scenarios where shell control is handed over to another user (e.g., connected to UART1). With this command you can "give" control, but you can't "take" it back to regain control, the new user must run "tty 0" on UART1.

  esp32#>tty 1
  % See you there

The UART you're switching to must be initialized; otherwise, the command will fail.

  esp32#>tty 1
  % UART1 is down. Use command "up" to initialize it
  esp32#>

NUMBER is the target UART number (03 depending on the ESP32 model), or 99 to switch to the USB-CDC interface (e.g., available on ESP32-S3).