aboutsummaryrefslogtreecommitdiff
path: root/web/index.html
blob: da135fc24a22ffb138af92d9111d9dfd572ab7a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" name="viewport" content="width=80ch">
  <title>mosquitto</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>

<h1>mqtt.chem.wisc.edu</h1>

<hr>

<p>
This server hosts an <a href="https://en.wikipedia.org/wiki/MQTT">MQTT</a> broker for "internet of things" applications within the <a href="https://chem.wisc.edu">Department of Chemistry</a> at the <a href="https://wisc.edu">University of Wisconsin-Madison</a>. <br>
In particular, this server hosts:
</p>

<ul>
  <li><a href="https://mosquitto.org/">mosquitto</a>, an MQTT broker</li>
  <li><a href="https://www.influxdata.com/">influxdb</a>, a time series database</li>
</ul>

<p>
This server is maintained by Blaise Thompson and Chemistry Comphelp. <br>
Please contact them with any questions or concerns.
</p>

<h2>mosquitto</h2>

<p>
This server runs <a href="https://mosquitto.org/">mosquitto</a>, an MQTT broker.
Briefly, MQTT is a lightweight publish-subscribe protocol that allows many devices to communicate.
The broker provides structured topics, e.g. "sensor42/temperature" and "instrument9/opa2/wavelength".
Clients can publish topic updates.
Other clients can subscribe to be notified each time a topic is updated.
Refer to <a href="https://mqtt.org">mqtt.org</a> for more information.
</p>

<p>
Anyone on the campus network can subscribe to the topics served here.
There are lots of great MQTT clients you can use.
We recommend:
</p>

<ul>
  <li><a href="https://mosquitto.org/man/mosquitto_sub-1.html">mosquitto_sub</a> (command line interface)</li>
  <li><a href="https://github.com/eerimoq/mqttools">mqttools</a> (python)</li>
  <li><a href="https://www.eclipse.org/paho/">paho</a> (many languages)</a></li>
</ul>

<p>
To see all topic updates on your command line:
</p>

<pre><code>
mosquitto_sub -h mqtt.chem.wisc.edu -t "#" --verbose

</code></pre>

<p>
You'll need a password to publish to this broker.
Talk to Blaise Thompson or Chemistry Comphelp if you want to start publishing.
</p>

<h2>influxdb</h2>

<p>
The Chemistry Department has standardized on the <a href="https://homieiot.github.io/">homie convention</a>.
This convention imposes a well-defined structure on top of the basic MQTT communication layer.
This structure introduces a "device" topology.

<p>
This server stores all homie device history to an <a href="https://www.influxdata.com/">influx</a> time-series database.
Importantly, only homie-convention compliant MQTT topics are stored---other published topics are not recorded in any permanent way.
</p>

<p>
While we make every attempt to prevent data loss, please do not treat this database as an archive.
You are responsible for saving data that you care about in a more permanent way.
Device history older than two years will automatically be deleted.
</p>

<p>
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.
</p>

<p>
Anyone on the campus network can query this database using the following read-only account:
</p>

<pre><code>
username: user
password: xtssxgxy

</code></pre>

<p>
The following example will return all of the recorded "temperature" measurements within the last one day using curl.
</p>

<pre><code>
curl -u user:xtssxgxy \
-G "mqtt.chem.wisc.edu:8086/query?pretty=true" \
--data-urlencode "db=homie" \
--data-urlencode "q=SELECT value FROM temperature WHERE time > now()-1d"

</code></pre>

<p>
The following example will return all of the recorded "temperature" measurements within the last one day using Python. You will need the <a href="https://influxdb-client.readthedocs.io/">influxdb Python package</a>.
</p>

<pre><code>
import influxdb

client = influxdb.InfluxDBClient(host="mqtt.chem.wisc.edu",
                                 database="homie",
                                 username="user",
                                 password="xtssxgxy")

result = client.query("SELECT value FROM temperature WHERE time > now()-1d")

</code></pre>

<p>
We have also set-up a <a href="https://grafana.com/">grafana</a> appliance with this database as a source.
You will need Chemistry Department LDAP credentials to log in.
Check it out at <a href="https://grafana.chem.wisc.edu">grafana.chem.wisc.edu</a>.
</p>

<hr>

<p>
<a href="https://git.chem.wisc.edu/infrastructure/mqtt">source</a>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>: no copyright
</p>

</body>
</html>