Thanks for all of the responses. I have extensive home built legacy automation stuff here that is all custom written for mariadb, then visualized with Grafana.
I have just written a very basic/simple python script to pull data and store via maria, please see the attached:
import requests, time
from bs4 import BeautifulSoup
import mysql.connector
while True:
url_to_scrape = 'http://iotawatt/query?select=[Input_0.volts,Input_0.hz,MainPowerPhase1.watts,MainPowerPhase2.watts,AdditionPhase1.watts,AdditionPhase2.watts,ShopSubPhase1.watts,ShopSubPhase2.watts,FrontArray1.watts,FrontArray2.watts,LivingRoomHVAC.watts,DravensPC.watts,MomsOffice.watts,usedwatts.watts]&begin=s-10s&end=s-5s&group=5s&format=csv&header=no'
plain_html_text = requests.get(url_to_scrape)
soup = BeautifulSoup(plain_html_text.text, "html.parser")
x = soup.prettify()
y = x.strip('\n')
y = y.split(", ")
print(y)
if y[0] != "null":
mydb = mysql.connector.connect(
host="192.168.2.41",
user="ha",
password="blabblah",
database="homeautomation"
)
mycursor = mydb.cursor()
sql = "INSERT INTO iotawatt1(voltage, hertz, mainsphase1, mainsphase2, additionphase1, additionphase2, shopsubphase1, shopsubphase2, frontarray1, frontarray2, livingroomhvac, dravenspc, momsoffice, usedwatts) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
val = (y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7], y[8], y[9], y[10], y[11], y[12], y[13])
mycursor.execute(sql, val)
mydb.commit()
mydb.close()
print("Success")
time.sleep(5)
I will continue to improve this, just wanted to create a very basic shell to see how hard/often I could hit the API.