mqtt-hub
A web interface and logger for MQTT, based on Django
Usage
The admin interface can be tested by running ./managy.py runserver
.
The connection to actual MQTT brokers works by adding subscriptions to the database and then starting the listener.
$ ./manage.py runmqttlistener
Messages send over brokers in topics that were subscribed to should now be saved in the database.
The messages can be accessed via a REST API:
http://localhost:8000/mqtt/messages/topic/you/want?format=txt&limit=5&skip=0&parse=<regex>
The format
must be one of 'txt', 'csv', 'json', 'html'.
If the format is 'html' or not specified, a html page with a table of the data and links to the other formats will be returned.
The message payloads can optionally be parsed with a regular expression provided with the parse
argument.
It accepts standard Python regular expressions.
All named groups in the expression will be added as additional columns to the output data.
If a group's name starts with one of the following letters and an underscore '_', the group is interpreted as that data type:
d,i: int(match)
e,E,f,g: float(match)
s: string, i.e. no interpretation
For example, the group (?P<d_number>\d+)
would be interpreted as an integer and a column 'parsed_number' would be added to the output data.