blob: 59e3aeba56557970f0765764dc789a89fa6ae93a (
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
|
<!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>mosquitto.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 purposefully isolated to the campus network. <br>
If you are reading this, congrats---you're on the network.
</p>
<p>
This server is maintained by Blaise Thompson and Alan Silver. <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>
You'll need a password to publish to this broker.
Talk to Blaise Thompson or Alan Silver 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.
Anyone on the campus network can query this 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>
The following example will return all of the recorded "temperature" measurements within the last one day using curl.
</p>
<pre><code>
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"
</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="mosquitto.chem.wisc.edu",
database="homie")
result = c.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.
Check it out at <a href="grafana.chem.wisc.edu">grafana.chem.wisc.edu</a>.
</p>
<hr>
<p>
<a href="https://git.chem.wisc.edu/shop/mqtt">source</a>
<a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>: no copyright
</p>
</body>
</html>
|