for anyone who has a micro GTI made by WVC
this bash script is based on the serial sniffer interceptty. you can edit it for what ever needs you want send data MQTT, OEM, or influxdb… etc
once you compile interceptty for your OS just use this as command line for it
interceptty -s ‘ispeed 9600 ospeed 9600’ -l /dev/ttyUSB0 /dev/ttyDUMMY -f hex > ser-data
create a WCV.ini file with the list of your inverters
and then run this script running from the same dir
#!/bin/bash
filename='WVC.ini'
for (( ; ; ))
do
while read line; do # reads ini file for inverter list
> ser-data
sleep .4
H1="$(echo $line | cut -c1-2 )"
H2="$(echo $line | cut -c3-4 )"
Payload="$(echo \\xf2\\x--\\x--\\x--\\x--\\x$H1\\x$H2\\x65)"
echo -en ${Payload} > /dev/ttyDUMMY
sleep .4
OUTPUT="$(cat ser-data | sed 's/<.*//' | sed 's/>//' | sed 's/0x//' | sed -E ':a ; $!N ; s/\n\s+/ / ; ta ; P ; D' | tr -d '[:blank:]' | sed '/^$/d' | sed -nr '/^.{34,34}$/p')"
sleep .8
######Convert Hex to temp #########
TEMP="$(echo $OUTPUT | cut -c33-34)"
TDEC="$(echo $(( 16#$TEMP )))"
MQttT="$(cat 1200lookup |grep -o TMP$TDEC.* | cut -f2- -d: | sed 's/[^0-9]*//g')"
if [ $MQttT -eq 86 ]; then
echo " no input from inverter " $line
else
echo "Inverter " $line\
echo "Temp " $MQttT
fi
######Convert Hex to VAC #########
TEMP="$(echo $OUTPUT | cut -c29-32 | tac -rs .. | echo $(tr -d '\n') )" #converts to little endian
TDEC="$(echo $(( 16#$TEMP )))" # converts HEX to DEC
MQttVAC="$(cat 1200lookup |grep -m 1 -o VAC$TDEC.* | cut -f2- -d: | sed 's/[^.0-9]*//g')" # Looks up Data from table
echo "VAC " $MQttVAC
######Convert Hex to AAC #########
TEMP="$(echo $OUTPUT | cut -c25-28 | tac -rs .. | echo $(tr -d '\n') )"
TDEC="$(echo $(( 16#$TEMP )))"
MQttAAC="$(cat 1200lookup |grep -m 1 -o AACA$TDEC.* | cut -f2- -d: | sed 's/[^.0-9]*//g')" # change AACA to AACB if using 220V version
echo "AAC " $MQttAAC
######Convert Hex to VDC #########
TEMP="$(echo $OUTPUT | cut -c21-24 | tac -rs .. | echo $(tr -d '\n') )"
TDEC="$(echo $(( 16#$TEMP )))"
MQttVDC="$(cat 1200lookup |grep -m 1 -o VDC$TDEC.* | cut -f2- -d: | sed 's/[^.0-9]*//g')"
echo "VDC " $MQttVDC
######Convert Hex to VAC #########
TEMP="$(echo $OUTPUT | cut -c17-20 | tac -rs .. | echo $(tr -d '\n') )"
TDEC="$(echo $(( 16#$TEMP )))"
MQttADC="$(cat 1200lookup |grep -m 1 -o ADC$TDEC.* | cut -f2- -d: | sed 's/[^.0-9]*//g')"
echo "ADC " $MQttADC
#Enter process here to send to database if you like or at the end of each category
done < $filename
done
`
you will need to edit the payload to match your modem ID the sticker on the back of the modem just enter it in as it reads after xf2 ie: \\xf2\\x–\\x–\\x–\\x–\\x$H1\\x$H2\\x65
Payload="$(echo \\xf2\\x--\\x--\\x--\\x--\\x$H1\\x$H2\\x65)"
it also needs the lookup table I edited down from the full table to only the inverters I used 1200wcv… you can extract what ever version of wcv inverter you use… if using the 220 volt version for AAC you need to change AACA$TDEC to AACB$TDEC or edit the script to check voltage output to automatically select ie voltage over 150 = AACB
MQttAAC="$(cat 1200lookup |grep -m 1 -o AACA$TDEC.* | cut -f2- -d: | sed 's/[^.0-9]*//g')"
lookup.tar.gz (265.0 KB)
do not send data too quickly otherwise it will loose connection adjust sleep to work best for your situation if it fails you can set up periodical restarts of interceptty to reestablish connection or an if statement using xf8/x–/x–/x–/x–/xff/xff/x6b (x-- being your modem id) if you get no reply then do an interceptty restart to force a new connection to the device serial. you can also set it up to talk to multiple modems ans panel grouping ( but I also did not include that)
depending on your WVC inverter you can adjust inverter output to act as gti limiter or turn off inverts remotely but i did not include it as I am not 100% sure of the call required. and I did not want people complaining they disabled their inverter not knowing how to get it reconnected