- A very simple REST application written using Python and the Flask framework.
- Can be depolyed to Heroku's free-tier
- Can be connected to TheThingsNetwork via
HTTP Integration
to receive, store and visualize sensor data.
-
Receives incoming JSON data as
POST
on the/data
endpoint.POST
ed data is parsed and the relevant info is persisted to PostgreSQL DB.POST
s are secured via anAPI_KEY
. UnauthorizedPOST
s will be rejected with a401
-
Retrevies stored records as JSON via
GET
on the/db
endpoint. A (optional) count of records to retrieve maybe specified. Eg:GET
on/db/15
will return 15 latest records (if available) whereas a simpleGET
on/db
will return the latest record -
Data in DB can be visualized as a line graph via the
/viz
endpoint.
A live instance is hosted and hooked up to receive a stream of LoRaWAN messages from TTN (one message exepected every 5 mins). Messages themselves are sent from out from a LoPy board.
-
Once the instance is up, navigate to Heroku's Dashboard -> Your Application Name -> Settings and take note of the generated environment variable named
API_KEY
-
Follow TTN documentation and add a new
HTTP Integration
. Use your heroku's URL followed by/data
for the URL field -
Ensure that the
Custom Header Name
is set tox-api-key
andCustom Header Value
is set to match the generatedAPI_KEY
-
Wait for some data to arrive. If everything is setup correctly, it'll show up on the homepage
Details in customizing.md
Hook-up to TTN for testingAuto-refresh homepageTimestamps for requestsImplement GET on the endpointSave data to DBAdd/db
Endpoint for fetching data from DBVisualization of data (charts and stuff)Simple API Key auth forPOST
ing data to/data
Upgrade to new data formatUpgrade to chart.js ver 2.xPlot multi-line chartGet rid of cache + prep socketio (local machine)Pretty printing of requests on homepage using socketioSeparate chart for each endnode's data- Add fectching via parameters (
by max count, by timestamp, by Hardware ID) - DB housekeeping (rotate out old data so that it stays under 10k rows limit)
- Add a "live" chart (chart data as it is
POST
ed) using socketio