I want to get my TED and Envoy data into MariaDB. dont know how or what I am going to use it for yet, but I know I will use it. Just need to learn more.
I used PHPMyAdmin to create a database, I called it House, I then created 2 tables one called TED and one called ENPHASE and gave a new user call house full access to it.
I then created a shell script for TED to get data into it:
#lets get in the right directory
#remove old csv
#Now we get the data we need and get it into a number
RAW=$(lynx -dump http://ted6000/stats.htm | grep '(W)' | sed -r 's/s+//g'| cut -d":" -f2)
#make it kW and put it in a file I can use for other things
/usr/bin/echo "scale=3; $RAW/1000" | bc -l >> TED.csv
#Import data the csv file name has to be the same name and case as the table you are importing to.
mysqlimport --local -u house --password=password House --columns=KW TED.csv
##And the one for the Envoy:
#remove old stuff
#Get the data ready for a csv for MariaDB
lynx -dump http://solar.hohenfels.com/production?locale=en | grep ly > kw.txt
# The Enphase Envoy uses Kilowatts (kW) and Watts (W). So a little creativity is required: If I find kW, clean it up, add the date and dump it in the CSV. If I dont find kW then clean it up and put it in a text file called kw2.txt. If it is not kW then it has to be W. when not producing it shows 0W
if grep -q 'kW' "kw.txt"; then
cat kw.txt | sed 's/[A-Za-z,]*//g' | sed -r 's/s+//g' >> ENPHASE.csv
cat kw.txt | sed 's/[A-Za-z,]*//g' | sed -r 's/s+//g' > kw2.txt
# Make the kw2.txt file a variable
# Do some math and get our variable into kW and dump it in the CSV.
/usr/bin/echo "scale=3; $KW2/1000" | bc -l >> ENPHASE.csv
#Import data file name has to be the same name and case as the table you are importing to.
mysqlimport --local -u house --password=password House --columns=KW ENPHASE.csv
I now have my MariaDB populating with date from my TED and Enphase Envoy