From 43e32956f670f86ea2f52c1718b2d13e40328df6 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 30 Mar 2017 18:50:30 +0000 Subject: [PATCH] first commit --- html/index.html | 11 +++++++++++ js/main.js | 4 ++++ piTherm.py | 43 +++++++++++++++++++++++++++++++++++++++++++ temperatures.db | Bin 0 -> 12288 bytes 4 files changed, 58 insertions(+) create mode 100644 html/index.html create mode 100644 js/main.js create mode 100755 piTherm.py create mode 100644 temperatures.db diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..62f27cd --- /dev/null +++ b/html/index.html @@ -0,0 +1,11 @@ + + + + + Temperature chez les Moumou + + + +

Will est cool

+ + diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..65e53a3 --- /dev/null +++ b/js/main.js @@ -0,0 +1,4 @@ +console.log(6*3); +console.log(6/3); +console.log(6+3); +console.log(6-3); diff --git a/piTherm.py b/piTherm.py new file mode 100755 index 0000000..d26990f --- /dev/null +++ b/piTherm.py @@ -0,0 +1,43 @@ +import os +import glob +import time +import sqlite3 + +# Module to load +os.system('sudo modprobe w1-gpio') +os.system('sudo modprobe w1-therm') + +# Min to pause +m = 10 + +# Start DB connection +conn = sqlite3.connect('temperatures.db') +c = conn.cursor() + +# Getting the device file +w1_dir = '/sys/bus/w1/devices/' +thermFile = glob.glob(w1_dir + '28*')[0] + '/w1_slave' + +# extract the temperature value +while True: + with open(thermFile) as f: + line = f.readlines() + accept = line[0].split(' ')[-1] + if (accept[0:3] == 'YES'): + # get the value + tp = line[1].split(' ')[-1] + d = str(float(tp[2:7])/1000.0) + + # write in the table + querry = 'INSERT INTO RECORDS VALUES (current_timestamp,' + querry += str(d) + querry += ',\'D1\');' + print(querry) + c.execute(querry) + # Save (commit) the changes on the DB + conn.commit() + time.sleep(60*m) + + +# We close the connection if we are done with it. +conn.close() diff --git a/temperatures.db b/temperatures.db new file mode 100644 index 0000000000000000000000000000000000000000..29f560ab4007e8feb1bb789cc3183580787c276f GIT binary patch literal 12288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