Last active
August 29, 2015 14:05
-
-
Save lidio601/6e72b99bb7c915a41ba9 to your computer and use it in GitHub Desktop.
This set of scripts are used to query the Aurora Inverter of a Solar Plant via the serial2lan network device. Here I use <socat> to establish the connection to the network serial2network converter. Then I use the local virtual serial port to query the inverter by the aurora open-source terminal application.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Downloads the alert queue from the inverter | |
# to a local text file | |
logfile="`dirname $0`/alert.log" | |
cmd="/root/aurora_monitor/aurora_socat.sh" | |
date >>$logfile | |
$cmd -a 2 -A 2>>$logfile | grep -v "No Alarm" | grep -v ^$ >>$logfile 2>>$logfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cmd="/root/aurora_monitor/aurora_socat.sh" | |
$cmd -a 2 -Y 8 -d 0 -D -3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aurora Inverter monitor by terminal shell scripting | |
# | |
# SOCAT | |
# | |
# http://www.lowlevel.cz/log/cats/english/Socat%20and%20serial%20port%20over%20TCP-IP.html | |
# http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=7828&start=25 | |
# http://archlinuxarm.org/forum/viewtopic.php?f=29&t=2660&start=30 | |
# http://stackoverflow.com/questions/22624653/create-a-virtual-serial-port-connection-over-tcp | |
# | |
# AURORA DATA | |
# | |
# http://www.curtronics.com/Solar/AuroraData.html | |
# http://auroramonitor.sourceforge.net/ | |
# | |
# Solar monitor projects | |
# | |
# http://www.123solar.org/metern/ | |
# http://solar.breedveld.net/indexcomparison.php | |
# http://www.monkeysandgorillas.com/index.php/2013/10/24/raspberry-pi-setup-to-monitor-aurora-pvi-5000-solar-inverter-part-3/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cmd="/root/aurora_monitor/aurora_socat.sh" | |
$cmd -a 2 --calc-value=0.25:euro -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Aurora command wrapper: | |
# | |
# this script establish the connection | |
# to the network serial2ethernet device | |
# via the <socat> program. | |
# then call the <aurora> program by passing | |
# the command-line arguments. | |
# after that, the program quit the socat connection. | |
SER2COM_IP="192.168.0.6" | |
SER2COM_PORT="1470" | |
SER2COM_DEV="solar" | |
SER2COM_DEBUG="0" | |
AURORAMON_PARAMS="$1" | |
if [ -z "$AURORAMON_PARAMS" ]; then | |
AURORAMON_PARAMS="-a 2 -Y 8 -w 25 -M 5 -e" | |
else | |
AURORAMON_PARAMS="$1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12" | |
fi | |
socat="/usr/bin/socat" | |
aurora="/usr/sbin/aurora" | |
if [ "$SER2COM_DEBUG" -ne "0" ]; then | |
SER2COM_DEBUG="-d -d -d " | |
else | |
SER2COM_DEBUG="" | |
fi | |
# http://stackoverflow.com/questions/3114741/generating-a-csv-list-from-linux-ps | |
socat_pid="`ps -o \"%p,%a\" | grep socat | grep \"$SER2COM_IP\" | cut -d\",\" -f1`" | |
if [ ! -z "$socat_pid" ]; then | |
kill $socat_pid >/dev/null 2>/dev/null | |
fi | |
$socat $SER2COM_DEBUG PTY,link=/dev/$SER2COM_DEV,nonblock,waitlock=/var/run/$SER2COM_PORT.lock tcp:$SER2$ | |
sleep 2 | |
#exit 0 | |
#if [ -s /dev/$SER2COM_DEV ]; then | |
$aurora $AURORAMON_PARAMS /dev/$SER2COM_DEV | |
#echo "$aurora $AURORAMON_PARAMS /dev/$SER2COM_DEV" | |
#fi | |
# http://stackoverflow.com/questions/3114741/generating-a-csv-list-from-linux-ps | |
socat_pid="`ps -o \"%p,%a\" | grep socat | grep \"$SER2COM_IP\" | cut -d\",\" -f1`" | |
if [ ! -z "$socat_pid" ]; then | |
kill $socat_pid >/dev/null 2>/dev/null | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cmd="/root/aurora_monitor/aurora_socat.sh" | |
$cmd -a 2 -t | |
sleep 1 | |
$cmd -a 2 -s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment