---
updatedAt: 2025-08-01T19:38:45.000Z
agentTools:
  projectIndex: https://synaccess-pdus.readme.io/llms.txt
---

# Serial Port Scripting

*The following examples use Ubuntu 18.04 Linux OS and the USB-Serial COM Port on SynLink Controller*
*Device file is identified as /dev/ttyUSB0 with `dmesg`*

Get tty configuration:

`stty -F /dev/ttyUSB0`

<br />
Change baud rate:

`stty -F /dev/ttyUSB0 115200`

<br />
Write to Serial Port:

`echo "system status" > /dev/ttyUSB0`

<br />
Read from Serial Port:

`cat /dev/ttyUSB0`

<br />

## Set Outlet Off

*Configure tty with appropriate configurations beforehand*

Identify outlet ID beforehand by printing list of outlets: `system outlet status`

Requires pre login to be able to issue commands.

```shell
user@host:~$ echo "system outlet set outlet_state 1-100001 OFF" > /dev/ttyUSB0
```

or

```shell
user@host:~$ sudo sh -c "echo 'system outlet set outlet_state 1-100001 OFF' >> /dev/ttyUSB0"
```