chrisu/seepark.git
3 years agoSplit function select_sensordata().
Philipp Spitzer [Wed, 18 Jul 2018 20:56:00 +0000 (22:56 +0200)]
Split function select_sensordata().

3 years agoMove to_dict to JSONEncoder.
Philipp Spitzer [Wed, 18 Jul 2018 20:24:06 +0000 (22:24 +0200)]
Move to_dict to JSONEncoder.

3 years agobrown paper bag commit: always test after changing variable names
gregor herrmann [Thu, 5 Jul 2018 18:38:02 +0000 (20:38 +0200)]
brown paper bag commit: always test after changing variable names

(and rebase/fixup commits)

3 years agofirst rather simple implementation of to_dict() for our Sensors object
gregor herrmann [Thu, 5 Jul 2018 18:19:20 +0000 (20:19 +0200)]
first rather simple implementation of to_dict() for our Sensors object

3 years agoread main(water)sensor from ini file
gregor herrmann [Thu, 5 Jul 2018 17:37:59 +0000 (19:37 +0200)]
read main(water)sensor from ini file

[temperature]
mainsensor=0316a21383ff

3 years agotry to be a bit more clever in finding our libraries
gregor herrmann [Thu, 5 Jul 2018 17:28:21 +0000 (19:28 +0200)]
try to be a bit more clever in finding our libraries

appending '..' to sys.path only works when seepark_web.py is started from
its directory, otherwise we get:

flask.cli.NoAppException: While importing "seepark_web", an ImportError was raised:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/flask/cli.py", line 235, in locate_app
    __import__(module_name)
  File "/home/gregoa/src/toastfreeware/seepark/web/seepark_web.py", line 14, in <module>
    from seeparklib.openweathermap import openweathermap_json, OpenWeatherMapError
ModuleNotFoundError: No module named 'seeparklib'

3 years agoREADME: add python3-flask-sqlalchemy
gregor herrmann [Thu, 5 Jul 2018 17:19:57 +0000 (19:19 +0200)]
README: add python3-flask-sqlalchemy

(which depends on python3-flask and python3-sqlalchemy)

3 years agoStart to use sqlalchemy (not all API calls work).
Philipp Spitzer [Wed, 4 Jul 2018 22:04:06 +0000 (00:04 +0200)]
Start to use sqlalchemy (not all API calls work).

3 years agoUse defaultdict to simplify code.
Philipp Spitzer [Wed, 4 Jul 2018 19:18:11 +0000 (21:18 +0200)]
Use defaultdict to simplify code.

3 years agoMove formatting water temperature/time to template.
Philipp Spitzer [Wed, 4 Jul 2018 19:09:13 +0000 (21:09 +0200)]
Move formatting water temperature/time to template.

3 years agoFormat air temperature and time values in template.
Philipp Spitzer [Wed, 4 Jul 2018 19:06:26 +0000 (21:06 +0200)]
Format air temperature and time values in template.

3 years agoAdd command lin eparameter --debug.
Philipp Spitzer [Wed, 4 Jul 2018 18:41:36 +0000 (20:41 +0200)]
Add command lin eparameter --debug.

3 years agoUse seeparklib.openweathermap.
Philipp Spitzer [Wed, 4 Jul 2018 18:38:09 +0000 (20:38 +0200)]
Use seeparklib.openweathermap.

3 years agoUse openweathermap module in web app.
Philipp Spitzer [Wed, 4 Jul 2018 18:33:27 +0000 (20:33 +0200)]
Use openweathermap module in web app.

3 years agoCreate dedicated package seeparklib and add openweathermap module.
Philipp Spitzer [Wed, 4 Jul 2018 18:33:09 +0000 (20:33 +0200)]
Create dedicated package seeparklib and add openweathermap module.

3 years agohtml template: refresh page every 5 minutes; and don't cache
gregor herrmann [Sat, 23 Jun 2018 11:59:29 +0000 (13:59 +0200)]
html template: refresh page every 5 minutes; and don't cache

3 years agoshow current/most recent air/water temperature on top of page
gregor herrmann [Sat, 16 Jun 2018 17:56:35 +0000 (19:56 +0200)]
show current/most recent air/water temperature on top of page

3 years agoremove debug rest
gregor herrmann [Sat, 16 Jun 2018 17:17:03 +0000 (19:17 +0200)]
remove debug rest

3 years agowe can have wind without degrees (only speed)
gregor herrmann [Fri, 15 Jun 2018 17:17:12 +0000 (19:17 +0200)]
we can have wind without degrees (only speed)

3 years agoformat x tick values (datetime) differently according to interval
gregor herrmann [Thu, 14 Jun 2018 22:12:41 +0000 (00:12 +0200)]
format x tick values (datetime) differently according to interval

format strings picked a bit randomly for now, following the temperature
charts at https://info.comodo.priv.at/webcam/

might make more sense and fun with real values …

3 years agoaesthetic sugar: set width of charts to 80% of parent
gregor herrmann [Thu, 14 Jun 2018 21:24:58 +0000 (23:24 +0200)]
aesthetic sugar: set width of charts to 80% of parent

3 years agoreplace 1 chart+buttons with 4 charts
gregor herrmann [Thu, 14 Jun 2018 21:03:41 +0000 (23:03 +0200)]
replace 1 chart+buttons with 4 charts

3 years agoowm.py: import sys
gregor herrmann [Wed, 13 Jun 2018 17:34:02 +0000 (19:34 +0200)]
owm.py: import sys

used in sys.exit() in an error case

3 years agoseepark_web.js: print temperature in y axis with 1 decimal place
gregor herrmann [Wed, 13 Jun 2018 17:14:06 +0000 (19:14 +0200)]
seepark_web.js: print temperature in y axis with 1 decimal place

otherwise we hav 21, 21.5, 22, 22.5 ...

3 years agoseepark_web.js: use our new sensors API instead of the random data
gregor herrmann [Wed, 13 Jun 2018 17:09:30 +0000 (19:09 +0200)]
seepark_web.js: use our new sensors API instead of the random data

3 years agoadd format argument to sensors API
gregor herrmann [Wed, 13 Jun 2018 16:30:56 +0000 (18:30 +0200)]
add format argument to sensors API

with "c3" option for delivering data in the format c3.js expects

3 years agofix indentation. or actually logic: mode handling after the sql query
gregor herrmann [Wed, 13 Jun 2018 15:58:56 +0000 (17:58 +0200)]
fix indentation. or actually logic: mode handling after the sql query

3 years agowrap csv filenames in os.path.expanduser()
gregor herrmann [Wed, 13 Jun 2018 14:40:20 +0000 (16:40 +0200)]
wrap csv filenames in os.path.expanduser()

to allow ~ in filenames in ini file

3 years agosensor API: rename '/api/<version>/sensor/<sensor_id>'
gregor herrmann [Tue, 12 Jun 2018 19:39:39 +0000 (21:39 +0200)]
sensor API: rename '/api/<version>/sensor/<sensor_id>'

into '/api/<version>/sensor/id/<sensor_id>' and add
'/api/<version>/sensor/type/<sensor_type>'.

factor out the actual query for both into a function.

3 years agoadd mode=<full|consolidated> request argument to sensor endpoint
gregor herrmann [Tue, 12 Jun 2018 17:44:58 +0000 (19:44 +0200)]
add mode=<full|consolidated> request argument to sensor endpoint

the idea is to calculate the resolution of the returned data, i.e. increase
the interval between measurements for creating charts for larger timespans

TODO: the actual filtering

3 years agoadd more needed python3 modules to README
gregor herrmann [Tue, 12 Jun 2018 17:43:54 +0000 (19:43 +0200)]
add more needed python3 modules to README

3 years agoUpdate .gitignore.
Philipp Spitzer [Mon, 11 Jun 2018 21:59:25 +0000 (23:59 +0200)]
Update .gitignore.

3 years agoAdd begin and end parameters to sensor endpoint.
Philipp Spitzer [Mon, 11 Jun 2018 21:57:16 +0000 (23:57 +0200)]
Add begin and end parameters to sensor endpoint.

3 years agoAdd /api/<version>/sensor/<sensor_id>.
Philipp Spitzer [Mon, 11 Jun 2018 21:12:08 +0000 (23:12 +0200)]
Add /api/<version>/sensor/<sensor_id>.

3 years agoAdd API to view sensors.
Philipp Spitzer [Mon, 11 Jun 2018 20:55:23 +0000 (22:55 +0200)]
Add API to view sensors.

3 years agoImplement writing CSV.
Philipp Spitzer [Mon, 11 Jun 2018 19:01:41 +0000 (21:01 +0200)]
Implement writing CSV.

3 years agoScript takes config file from command line now.
Philipp Spitzer [Mon, 11 Jun 2018 18:19:49 +0000 (20:19 +0200)]
Script takes config file from command line now.

3 years agoMake use of dict consistent.
Philipp Spitzer [Mon, 11 Jun 2018 18:10:57 +0000 (20:10 +0200)]
Make use of dict consistent.

3 years agoMerge branch 'web' into owm
gregor herrmann [Sun, 10 Jun 2018 00:10:23 +0000 (02:10 +0200)]
Merge branch 'web' into owm

3 years agomaybe we want different shades of blue for the water termperatures
gregor herrmann [Sun, 10 Jun 2018 00:09:52 +0000 (02:09 +0200)]
maybe we want different shades of blue for the water termperatures

3 years agoowm.py: add rain/precipitation data
gregor herrmann [Sat, 9 Jun 2018 13:06:44 +0000 (15:06 +0200)]
owm.py: add rain/precipitation data

they are only in the api response when OWM has rain data

good test station: 3688451
https://openweathermap.org/city/3688451
Buenaventura, CO

3 years agoowm.py: handle missing wind degrees/direction
gregor herrmann [Fri, 8 Jun 2018 21:58:28 +0000 (23:58 +0200)]
owm.py: handle missing wind degrees/direction

3 years agoadd an openweathermap widget to the webpage
gregor herrmann [Fri, 8 Jun 2018 21:51:18 +0000 (23:51 +0200)]
add an openweathermap widget to the webpage

more of a gimmick ...

the api key is read from the ini file passed via SEEPARKINI
(and not via flask's config mechanism as this expects a python file)

fun fact: the api key will appear in the javaescript in the page anyway

3 years agoadd owm.py: get weather data from openweathermap
gregor herrmann [Fri, 8 Jun 2018 19:04:56 +0000 (21:04 +0200)]
add owm.py: get weather data from openweathermap

this script can replace wetter.at.pl:

perl:   2018-06-08;19:00;   05:21   ;21:09   ;21   ;0 mm/h;7km/h O     ;stark bewölkt      ;93
python: 2018-06-08;20:20:00;05:20:24;21:10:53;17.13;      ;2.6km/h O   ;Überwiegend bewölkt;75

and can be extended to write to the mysql database and a csv file like
seewasser.py

(and probably parts of seewasser.py could be extracted as common functions)

owm.py needs an api key from openweathermap and some config; cf. the
comments ath the top

questions:
- is precipitation really missing from json and available in xml?
- the str() casting at the end looks ugly

3 years agotooltip: 2 decimal places are enough
gregor herrmann [Mon, 4 Jun 2018 20:20:13 +0000 (22:20 +0200)]
tooltip: 2 decimal places are enough

3 years agonext attempt with the reload-on-zoom function. not yet working, esp. one doesn't...
gregor herrmann [Mon, 4 Jun 2018 19:46:56 +0000 (21:46 +0200)]
next attempt with the reload-on-zoom function. not yet working, esp. one doesn't get "out"

3 years agoadd buttons for day/week/month/year, + css and a js function
gregor herrmann [Mon, 4 Jun 2018 19:46:16 +0000 (21:46 +0200)]
add buttons for day/week/month/year, + css and a js function

3 years agoadd prototype for data loading function in zoom change
gregor herrmann [Mon, 4 Jun 2018 17:45:15 +0000 (19:45 +0200)]
add prototype for data loading function in zoom change

3 years agotemplate: add mobile friendly meta directive
gregor herrmann [Mon, 4 Jun 2018 17:44:43 +0000 (19:44 +0200)]
template: add mobile friendly meta directive

3 years agopass timespan (in days) to our /data route via GET
gregor herrmann [Mon, 4 Jun 2018 16:43:27 +0000 (18:43 +0200)]
pass timespan (in days) to our /data route via GET

3 years agofinally use random data but change granularity in dependenc of timespan
gregor herrmann [Mon, 4 Jun 2018 16:28:02 +0000 (18:28 +0200)]
finally use random data but change granularity in dependenc of timespan

timespan should come from GET later

3 years agorename hello() to index()
gregor herrmann [Mon, 4 Jun 2018 16:13:32 +0000 (18:13 +0200)]
rename hello() to index()

3 years agogenerate random data. commented out as it kills every browser.
gregor herrmann [Sun, 3 Jun 2018 15:35:09 +0000 (17:35 +0200)]
generate random data. commented out as it kills every browser.

3 years agoupdate regions
gregor herrmann [Sun, 3 Jun 2018 14:41:30 +0000 (16:41 +0200)]
update regions

boiling starts at 100°. and don't leave "empty" areas in between.

3 years agoadd temperature regions with colour coding
gregor herrmann [Sat, 2 Jun 2018 00:59:26 +0000 (02:59 +0200)]
add temperature regions with colour coding

3 years agoshow y grid
gregor herrmann [Sat, 2 Jun 2018 00:49:33 +0000 (02:49 +0200)]
show y grid

3 years agoturn off transitions
gregor herrmann [Sat, 2 Jun 2018 00:47:20 +0000 (02:47 +0200)]
turn off transitions

and change title

3 years agoshow more ° signs (in tooltip values and y axis)
gregor herrmann [Sat, 2 Jun 2018 00:40:36 +0000 (02:40 +0200)]
show more ° signs (in tooltip values and y axis)

3 years agox-ticks: don't show seconds, and rotate labels (multiline doesn't seem to work)
gregor herrmann [Sat, 2 Jun 2018 00:34:40 +0000 (02:34 +0200)]
x-ticks: don't show seconds, and rotate labels (multiline doesn't seem to work)

3 years agox-ticks: turn off magic optimization
gregor herrmann [Sat, 2 Jun 2018 00:28:50 +0000 (02:28 +0200)]
x-ticks: turn off magic optimization

3 years agoformat tooltip texts
gregor herrmann [Sat, 2 Jun 2018 00:22:25 +0000 (02:22 +0200)]
format tooltip texts

(pretty useless but hey)

3 years agouse realistic datetime values (i.e. '%Y-%m-%d %H:%M:%S')
gregor herrmann [Sat, 2 Jun 2018 00:04:04 +0000 (02:04 +0200)]
use realistic datetime values (i.e. '%Y-%m-%d %H:%M:%S')

3 years agouse sensor_id and sensor_name from database
gregor herrmann [Fri, 1 Jun 2018 23:50:51 +0000 (01:50 +0200)]
use sensor_id and sensor_name from database

3 years agovalid HTML5 and some text changes
gregor herrmann [Wed, 30 May 2018 23:55:33 +0000 (01:55 +0200)]
valid HTML5 and some text changes

3 years agoadd minimal README
gregor herrmann [Wed, 30 May 2018 23:48:02 +0000 (01:48 +0200)]
add minimal README

3 years agoadd title to chart
gregor herrmann [Wed, 30 May 2018 22:58:41 +0000 (00:58 +0200)]
add title to chart

3 years agoIgnore .pyc files.
Philipp Spitzer [Wed, 30 May 2018 22:05:54 +0000 (00:05 +0200)]
Ignore .pyc files.

3 years agoEnable zoom.
Philipp Spitzer [Wed, 30 May 2018 22:04:53 +0000 (00:04 +0200)]
Enable zoom.

3 years agoAdd more test data.
Philipp Spitzer [Wed, 30 May 2018 22:04:28 +0000 (00:04 +0200)]
Add more test data.

3 years agoAdd y label.
Philipp Spitzer [Wed, 30 May 2018 21:45:59 +0000 (23:45 +0200)]
Add y label.

3 years agoUse user-friendly names for labels.
Philipp Spitzer [Wed, 30 May 2018 21:42:53 +0000 (23:42 +0200)]
Use user-friendly names for labels.

3 years agoIgnore vim .swp files.
Philipp Spitzer [Wed, 30 May 2018 21:40:28 +0000 (23:40 +0200)]
Ignore vim .swp files.

3 years agoThe chart now shows the test data.
Philipp Spitzer [Wed, 30 May 2018 21:39:28 +0000 (23:39 +0200)]
The chart now shows the test data.

3 years agoThe flask app now provides test data.
Philipp Spitzer [Wed, 30 May 2018 21:39:13 +0000 (23:39 +0200)]
The flask app now provides test data.

3 years agoSwitch to D3 version 5.4.0.
Philipp Spitzer [Wed, 30 May 2018 21:38:40 +0000 (23:38 +0200)]
Switch to D3 version 5.4.0.

3 years agoUse example .js code from http://c3js.org.
Philipp Spitzer [Wed, 30 May 2018 19:26:33 +0000 (21:26 +0200)]
Use example .js code from http://c3js.org.

3 years agoHello world flask project.
Philipp Spitzer [Wed, 30 May 2018 19:10:43 +0000 (21:10 +0200)]
Hello world flask project.

Start development server with
FLASK_APP=seepark_web.py FLASK_DEBUG=1 flask run

3 years agoCopied .js und .css files from C3 project (https://github.com/c3js/c3) version 0...
Philipp Spitzer [Wed, 30 May 2018 19:08:45 +0000 (21:08 +0200)]
Copied .js und .css files from C3 project (https://github.com/c3js/c3) version 0.6.1.

3 years agoD3 library version 4.12.0 downloaded from github.com.
Philipp Spitzer [Wed, 30 May 2018 19:03:12 +0000 (21:03 +0200)]
D3 library version 4.12.0 downloaded from github.com.

3 years agoLeserlicher Name in die csv geschrieben
Chrisu Jähnl [Thu, 10 May 2018 21:25:31 +0000 (21:25 +0000)]
Leserlicher Name in die csv geschrieben

3 years agoAnpassungen für mysql Datenbankfelder
Chrisu Jähnl [Thu, 10 May 2018 21:12:56 +0000 (21:12 +0000)]
Anpassungen für mysql Datenbankfelder

3 years agoSchreiben in die Datenbank, Anpassung der Werte. Auf gut Deutsch ;-)
Chrisu Jähnl [Thu, 10 May 2018 20:46:26 +0000 (20:46 +0000)]
Schreiben in die Datenbank, Anpassung der Werte. Auf gut Deutsch ;-)

3 years agoguard (debug) output with if 0/1
gregor herrmann [Thu, 10 May 2018 19:10:31 +0000 (21:10 +0200)]
guard (debug) output with if 0/1

3 years agohandle encoding. maybe.
gregor herrmann [Thu, 10 May 2018 19:10:24 +0000 (21:10 +0200)]
handle encoding. maybe.

3 years agoadd wetter.at.pl
gregor herrmann [Thu, 10 May 2018 18:56:51 +0000 (20:56 +0200)]
add wetter.at.pl

perl script to scrape weather data for obsteig from wetter.at

3 years agoadd .gitignore
Chrisu Jähnl [Thu, 10 May 2018 17:18:39 +0000 (17:18 +0000)]
add .gitignore

4 years agoAlle 5 Sensoren
Chrisu Jähnl [Sat, 27 May 2017 22:01:15 +0000 (00:01 +0200)]
Alle 5 Sensoren

4 years agoFunktion geschaffen
Chrisu Jähnl [Sat, 27 May 2017 21:45:09 +0000 (23:45 +0200)]
Funktion geschaffen

4 years agoAusgabe in csv datei
Chrisu Jähnl [Sat, 27 May 2017 21:32:42 +0000 (23:32 +0200)]
Ausgabe in csv datei

4 years agoAbfrage yesno
Chrisu Jähnl [Sat, 27 May 2017 21:17:12 +0000 (23:17 +0200)]
Abfrage yesno

4 years agoParsen mit Regex: YES|NO und Temperatur
Chrisu Jähnl [Sat, 27 May 2017 21:13:25 +0000 (23:13 +0200)]
Parsen mit Regex: YES|NO und Temperatur

4 years ago1. Proof of concept
Chrisu Jähnl [Sat, 27 May 2017 20:50:22 +0000 (22:50 +0200)]
1. Proof of concept