Close

Createing the Database

A project log for Solar water heater monitor

Monitor and log temperature of wood fire boosted Solar hot water heater

saabmanSaabman 10/17/2016 at 10:240 Comments

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

Each value is published to its own MQTT Topic.

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