I use an exec node to execute a command that queries UPS system status and returns textual data as shown in the command line snippet below. I want to display this output in the dashboard just as it is, or with two columns where the left column contains the attribute and the right column contains the corresponding value. Unfortunately, the exec node strips out whitespace and newlines or the output could easily be displayed in a UI template node. Is there a way to run a linux command and capture the unmolested output? I suppose this could be done with a custom function.
Here is the invocation and output for the apcaccess command. I can pipe the output to appropriate linux commands to format as needed (running on a Pi), such as sed or awk I guess. It just seems like a lot of effort to start with the format I already want in linux and perform a bunch of steps to get back to it in the node-red dashboard.
I am looking for the obvious "easy button" solution I have missed.
pi@NetMon:~/netmon/logs $ apcaccess -f /etc/apcupsd/apcupsd.upsCOMMS.conf
APC : 001,036,0869
DATE : 2021-03-01 22:30:48 -0500
HOSTNAME : NetMon
VERSION : 3.14.14 (31 May 2016) debian
UPSNAME : upsCOMMS
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2021-03-01 17:39:52 -0500
MODEL : J25B AV UPS
STATUS : ONLINE
LINEV : 124.0 Volts
LOADPCT : 3.0 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 116.5 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 96.0 Volts
HITRANS : 136.0 Volts
ALARMDEL : No alarm
BATTV : 27.0 Volts
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : QB1048332151
BATTDATE : 2010-11-26
NOMINV : 120 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 865 Watts
FIRMWARE : 873.P2 .D USB FW:P2
END APC : 2021-03-01 22:31:36 -0500
pi@NetMon:~/netmon/logs $