From 454ebe99359cc22fcff74625320024a7b5353045 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Fri, 30 Oct 2020 16:21:09 -0500 Subject: examples --- web/index.html | 26 ++++++++++++++++++++++---- web/style.css | 17 +++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) (limited to 'web') diff --git a/web/index.html b/web/index.html index fbbbf1c..59e3aeb 100644 --- a/web/index.html +++ b/web/index.html @@ -81,25 +81,43 @@ Device history older than two years will automatically be deleted.

-Homie data is written to the database with each [node] as one [field]. +Homie data is written to the database with each node corresponding to one field. All of the additional information that is represented within the homie hierarchy is stored as tags.

-EXAMPLE CURL +The following example will return all of the recorded "temperature" measurements within the last one day using curl.

+

+curl -G 'mosquitto.chem.wisc.edu:8086/query?pretty=true' --data-urlencode "db=homie" --data-urlencode "q=SELECT \"value\" FROM \"temperature\" WHERE time > now() - 1d"
+
+
+

-EXAMPLE PYTHON +The following example will return all of the recorded "temperature" measurements within the last one day using Python. You will need the influxdb Python package.

+

+import influxdb
+
+client = influxdb.InfluxDBClient(host="mosquitto.chem.wisc.edu",
+                                 database="homie")
+
+result = c.query("SELECT value FROM temperature WHERE time > now() - 1d")
+
+
+

-RECOMMEND GRAFANA +We have also set-up a grafana appliance with this database as a source. +Check it out at grafana.chem.wisc.edu.


+source +                                                        CC0: no copyright

diff --git a/web/style.css b/web/style.css index 4e33ceb..d109581 100644 --- a/web/style.css +++ b/web/style.css @@ -16,3 +16,20 @@ body { text-align: left; overflow-y: scroll; } + +pre { + width: 80ch; + padding: 15px; + margin-left: auto; + margin-right: auto; + overflow: auto; + overflow-y: hidden; + font-size: 15.3px; + background: #ffffff; + border: 1px solid #c5c8c6; +} + +code { + background: #ffffff; + color: #c82829 +} -- cgit v1.2.3