This is a type while thinking log.
Ive already installed SQL lite on the Pi so for the time being thats what ill use - this may change in the future but will do for now.
Things I have - Data set every 15minutes from the Hotwater heater
- Battery Voltage
- Ambient Temp
- Tank Temp
- Booster Temp
- Inlet Temp
Each value is published to its own MQTT Topic.
- HOME/SOLAR/WATER/BATTERY
- HOME/SOLAR/WATER/TEMP/AMBIENT
- HOME/SOLAR/WATER/TEMP/TANK
- HOME/SOLAR/WATER/TEMP/BOOSTER
- HOME/SOLAR/WATER/TEMP/INLET
What I need now is a way to read the values published and store them in a database and include the time they are stored.
I am planing to use a python script to do the dirty work.
It needs to know when new data is written to each topic and write it to the DB.
My data base needs
Date Time Battery_Voltage Ambient_Temp Tank_Temp Booster_Temp Inlet_Temp
I created a db solarwater.db
then created the table
BEGIN; CREATE TABLE Hotwater (tdate DATE, ttime TIME, Battery NUMERIC, Ambient NUMERIC, Tank NUMERIC, Booster NUMERIC, Inlet NUMERIC); COMMIT;
Now to get Python to read the Topics and populate the DB
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.