Skip to content

Medando/mqtt-receiver-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Medando MQTT Example

Example application for receiving Quantified Self data via MQTT.

These Python scrips demonstrate how to receive data from Medando apps. The Android apps BloodPressureCompanion and WeightCompanion have experimental support for sending the latest entries as MQTT messages.

Read more about the MQ Telemetry Transport (MQTT) protocol at MQTT.org.

Installation of requirements

Install Python as described on python.org (if it's not installed on your system already). We recommend to install the Python distribution Anaconda.

Install the Paho MQTT client library for Python (https://pypi.python.org/pypi/paho-mqtt):

pip install -r requirements.txt

Configure the MQTT Broker

Within the scripts configure the host name of the MQTT broker that you use. You must use the same MQTT broker that you configured in the Android apps.

WeightCompanion MQTT settings

test.mosquitto.org is an public test server that you can use for testing.

MQTT_BROKER_HOSTNAME = 'test.mosquitto.org'

We recommend to setup your own MQTT broker which should be non-public and secured.

Starting the example

To receive your MQTT messages start the simple MQTT subscriber:

python mqtt_subscriber.py

After you configured MQTT in the Android app, you should see something like:

de/medando/weightcompanion {"unit":"kg","weight":73.1}

This very simple example runs as an infinite loop. To end execution, use Ctrl-C.

Continue...

Continue from here with more serious examples and applications. For example, evaluate the received MQTT payload with your data by extending the Python script.

You should also change the MQTT topic to something more specific than the default topic.

MQTT_TOPIC = 'de/medando/#'

About

Example application for receiving Quantified Self data via MQTT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages