chrisu/seepark.git
3 years agoowm.py: add comment about needed packages
gregor herrmann [Mon, 6 Aug 2018 12:32:16 +0000 (14:32 +0200)]
owm.py: add comment about needed packages

3 years agopartially merge web branch into master
gregor herrmann [Sun, 5 Aug 2018 18:57:51 +0000 (20:57 +0200)]
partially merge web branch into master

this merges everything except the webapp in the web/ directory

i.e.
- .gitignore update
- seewasser.py: small fix
- add owm.py
- add seeparklib

3 years agomerge change in seewasser.py from web into master
gregor herrmann [Sun, 5 Aug 2018 18:51:54 +0000 (20:51 +0200)]
merge change in seewasser.py from web into master

3 years agoAdd config file command line argument.
Philipp Spitzer [Mon, 11 Jun 2018 18:23:32 +0000 (20:23 +0200)]
Add config file command line argument.

3 years agomake web/README a bit more verbose
gregor herrmann [Sun, 5 Aug 2018 17:27:49 +0000 (19:27 +0200)]
make web/README a bit more verbose

3 years agoresolution in consolidated mode: use <= for time intervals
gregor herrmann [Sun, 5 Aug 2018 17:10:50 +0000 (19:10 +0200)]
resolution in consolidated mode: use <= for time intervals

3 years agofinally drop old "API" with random data
gregor herrmann [Sun, 5 Aug 2018 17:08:30 +0000 (19:08 +0200)]
finally drop old "API" with random data

3 years agochange water (sensor) colours
gregor herrmann [Sun, 5 Aug 2018 16:54:23 +0000 (18:54 +0200)]
change water (sensor) colours

3 years agoupdate regexp for extrating label names
gregor herrmann [Sun, 5 Aug 2018 16:43:01 +0000 (18:43 +0200)]
update regexp for extrating label names

3 years agoupdate sensorids and names
gregor herrmann [Sun, 5 Aug 2018 16:41:26 +0000 (18:41 +0200)]
update sensorids and names

3 years agojs: make points on line chart smaller
gregor herrmann [Fri, 3 Aug 2018 23:09:08 +0000 (01:09 +0200)]
js: make points on line chart smaller

3 years agoxtick format: fix year labels (month year)
gregor herrmann [Thu, 2 Aug 2018 11:27:27 +0000 (13:27 +0200)]
xtick format: fix year labels (month year)

still doesn't make a lot of sense with not enough data

3 years agoformat tooltip names depending on water/air
gregor herrmann [Thu, 2 Aug 2018 11:23:40 +0000 (13:23 +0200)]
format tooltip names depending on water/air

3 years agodo some horribly wrong timezone magic
gregor herrmann [Thu, 2 Aug 2018 11:11:43 +0000 (13:11 +0200)]
do some horribly wrong timezone magic

3 years agowe have air temperature charts!
gregor herrmann [Thu, 2 Aug 2018 11:11:24 +0000 (13:11 +0200)]
we have air temperature charts!

3 years agogeneralize convert_to_c3: sensors and weather have different fields
gregor herrmann [Thu, 2 Aug 2018 10:10:28 +0000 (12:10 +0200)]
generalize convert_to_c3: sensors and weather have different fields

3 years agooops, looks like we made a logic error when refactoring
gregor herrmann [Thu, 2 Aug 2018 09:41:54 +0000 (11:41 +0200)]
oops, looks like we made a logic error when refactoring

3 years agohtml+js: rename stuff to prepare for weather
gregor herrmann [Thu, 2 Aug 2018 09:32:07 +0000 (11:32 +0200)]
html+js: rename stuff to prepare for weather

3 years agoThe air temperature is taken from the database now.
Philipp Spitzer [Wed, 1 Aug 2018 21:12:00 +0000 (23:12 +0200)]
The air temperature is taken from the database now.

3 years agoImplement handling of ill-formatted datetime values in URL.
Philipp Spitzer [Wed, 1 Aug 2018 21:07:03 +0000 (23:07 +0200)]
Implement handling of ill-formatted datetime values in URL.

3 years agoCreate API for openweathermap data.
Philipp Spitzer [Wed, 1 Aug 2018 19:54:39 +0000 (21:54 +0200)]
Create API for openweathermap data.

3 years agoAdd a working SQL example to group measurements into time slots.
Philipp Spitzer [Wed, 1 Aug 2018 19:30:34 +0000 (21:30 +0200)]
Add a working SQL example to group measurements into time slots.

3 years agoIgnore warning about duplicate key when inserting openweathermap data.
Philipp Spitzer [Wed, 1 Aug 2018 19:27:17 +0000 (21:27 +0200)]
Ignore warning about duplicate key when inserting openweathermap data.

3 years agoremove debug print
gregor herrmann [Fri, 27 Jul 2018 22:03:31 +0000 (00:03 +0200)]
remove debug print

3 years agoImplement writing openweathermap data to database.
Philipp Spitzer [Wed, 25 Jul 2018 21:09:52 +0000 (23:09 +0200)]
Implement writing openweathermap data to database.

3 years agoMake script ready for missing visibility information in JSON.
Philipp Spitzer [Wed, 25 Jul 2018 20:03:18 +0000 (22:03 +0200)]
Make script ready for missing visibility information in JSON.

3 years agoPrepare consolidation of data.
Philipp Spitzer [Wed, 18 Jul 2018 21:26:47 +0000 (23:26 +0200)]
Prepare consolidation of data.

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 agoAdd config file command line argument.
Philipp Spitzer [Mon, 11 Jun 2018 18:23:32 +0000 (20:23 +0200)]
Add config file command line argument.

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.