UnsignedArduino / Uno-LCD-Terminal-Daemon

A daemon for the Uno LCD Terminal!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uno-LCD-Terminal-Daemon

A daemon for the Uno LCD Terminal!

The daemon will create an icon in the notification area (incorrectly known as the "system tray") and will show the status and allow you to quit the program!

Picture of the Uno LCD Terminal Daemon icon in the notification area

It is hot pluggable, so you can unplug and replug your Uno LCD Terminal back in all you want! (As long as the serial port name stays the same) It's also happy being started on system startup.

The Uno LCD Terminal with the daemon running

Hardware

See the README.md for the Uno LCD Terminal for instructions and details.

Software

Installation

  1. Clone this repo.
  2. Create virtual environment if desired.
  3. Install dependencies in requirements.txt.

Running

Run main.py.

This is my batch file (.bat file on Windows) which I set to auto start on Windows:

REM Go to the E: drive
E:

REM Change directories to the "Uno LCD Terminal Daemon" directory
cd "Uno LCD Terminal Daemon"

REM Run main.py with pythonw (the binary in venv\Scripts\ will respect the virtual environment) 
"venv\Scripts\pythonw" main.py -c -p COM8 -o "time" -o "cpu" -o "memory" -o "disk" -o "network"

Command line arguments

Help

Run with -h or --help to view the help:

usage: main.py [-h] [-lp] [-lo] [-c] [-p PORT] [-u INTERVAL] [-r INTERVAL]
               [-o NAME] [-d]

Daemon for the Uno LCD Terminal.

optional arguments:
  -h, --help            show this help message and exit
  -lp, --list-ports     List serial ports and exit.
  -lo, --list-outputs   List function outputs and exit.
  -c, --connect         Connect to an Uno LCD Terminal.
  -p PORT, --port PORT  A port to connect to. Required if connecting with -c
                        or --connect. Can be a path or an index from -l or
                        --list-ports.
  -u INTERVAL, --update-interval INTERVAL
                        The update interval for the Uno LCD Terminal in float
                        seconds. Required if connecting with -c or --connect.
                        Defaults to 1.0.
  -r INTERVAL, --change-interval INTERVAL
                        The change interval for the Uno LCD Terminal in
                        integer seconds. Required if connecting with -c or
                        --connect. Defaults to 1.
  -o NAME, --output NAME
                        The outputs you want to use. At least one is required
                        if connecting with -c or --connect. Can be specified
                        multiple times.
  -d, --debug           Whether to show debug output or not.

Example commands:

List all serial ports:

main.py -lp

Example output on Windows:

2022-04-01 21:42:27,946 - __main__ - INFO - Listing connected serial ports
2022-04-01 21:42:27,956 - __main__ - INFO - 1/6: COM1 - Communications Port (COM1)
2022-04-01 21:42:27,957 - __main__ - INFO - 2/6: COM14 - Standard Serial over Bluetooth link (COM14)      
2022-04-01 21:42:27,957 - __main__ - INFO - 3/6: COM15 - Standard Serial over Bluetooth link (COM15)      
2022-04-01 21:42:27,957 - __main__ - INFO - 4/6: COM18 - USB Serial Device (COM18)
2022-04-01 21:42:27,957 - __main__ - INFO - 5/6: COM3 - Intel(R) Active Management Technology - SOL (COM3)
2022-04-01 21:42:27,957 - __main__ - INFO - 6/6: COM8 - Arduino Uno (COM8)

List all output functions: (they generate text to send to the Terminal)

main.py -lo

Example output on Windows:

2022-04-01 21:43:22,217 - __main__ - INFO - Listing output functions
2022-04-01 21:43:22,217 - __main__ - INFO - 1 / 5: time - Shows the date and time.
2022-04-01 21:43:22,217 - __main__ - INFO - 2 / 5: cpu - Shows the CPU utilization
2022-04-01 21:43:22,217 - __main__ - INFO - 3 / 5: memory - Shows the memory utilization
2022-04-01 21:43:22,217 - __main__ - INFO - 4 / 5: disk - Shows the disk IO counters
2022-04-01 21:43:22,217 - __main__ - INFO - 5 / 5: network - Shows the network IO counters

Connect to COM8 and use the output functions time, cpu, memory, disk, and network:

main.py -c -p COM8 -o "time" -o "cpu" -o "memory" -o "disk" -o "network"

Note that doing this needs a supported desktop. (sorry hardcore command line users - you can go back earlier in time to use an older version that does not use an icon)

According to the Qt 5 docs:

The QSystemTrayIcon class can be used on the following platforms:

Example output on Windows:

2022-04-01 21:43:41,550 - __main__ - INFO - Connecting to COM8
2022-04-01 21:43:41,663 - uno_lcd_terminal - INFO - Connected!

About

A daemon for the Uno LCD Terminal!


Languages

Language:Python 100.0%