-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/ulfwin/weatherstation
- Loading branch information
Showing
5 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
*.uwc | ||
*.swp | ||
*.png | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pylab as pl | ||
import mysqlRetrieve as sql | ||
|
||
h = 5 | ||
ts = range(0,h*60*60,60) | ||
|
||
i = 0.25e-3 | ||
C = 2.5 | ||
v0 = 3.3 | ||
Vb = [ -i*t/C+v0 for t in ts ] | ||
|
||
#pl.figure() | ||
#pl.plot(ts,Vb) | ||
#deviceData = pl.array(sql.getAll('Scope_Level')) | ||
deviceData = pl.array(sql.getAll('Battery_Level')) | ||
pl.plot(deviceData[:,0], deviceData[:,1], '.-') | ||
pl.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Script to retrieve and plot mysql data | ||
# | ||
# NOTE! To connect to remote mysql server with ssh tunneling, execute the | ||
# following in a separate command window: | ||
# | ||
# ssh -L 3306:127.0.0.1:3306 <user>@<server> | ||
|
||
import MySQLdb | ||
|
||
def getAll(table): | ||
conn = MySQLdb.connect(host='127.0.0.1', user='root', passwd='Hejsan12', db='openhab') | ||
|
||
with conn: | ||
cur = conn.cursor() | ||
# Find out link between item and table name | ||
cur.execute("SELECT * FROM Items") | ||
tablesInv = cur.fetchall() | ||
# Inverse table and make it a dict | ||
tableDict = {v: k for k, v in tablesInv} | ||
# Get requested table | ||
cur.execute("SELECT * FROM Item%i" %tableDict[table]) | ||
return cur.fetchall() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters