Skip to content

Utility to publish MQTT topics to cloud services like cosm.com or tempo-db.com

License

Notifications You must be signed in to change notification settings

xoseperez/mqtt2cloud

Repository files navigation

mqtt2cloud

MQTT2Cloud is a set of python daemons that will subscribe to an MQTT broker and push values to different providers whenever a message is recevied from certain topics.

You can read more about this in my post about Storing and publishing sensor data.

Requirements

  • python-yaml
sudo apt-get install python-yaml
  • python-mosquitto
sudo apt-get install python-mosquitto
  • tempodb [if using TempoDB daemon]
pip install tempodb
  • requests [tempodb installs this]
pip install requests

Install

Just clone or extract the code in some folder. I'm not providing an setup.py file yet.

Configuration

Rename or copy the config/mqtt2???.yaml.sample files to config/mqtt2???.yaml and edit them. The configuration is pretty straight forward:

daemon

Just define the log file paths.

mqtt

These are standard Mosquitto parameters. The status topic is the topic to post messages when the daemon starts or stops.

cosm, xively, sen.se

The API key and timeout value.

tempodb

A set of databases, each with its api key and secret.

thethings.io

A set of things, each with its token.

topics

For every topic you want to push you have to specify a destination string. This destination string has two parameters, using '/' as separator. Depending on the cloud service you are using these parameters could be: feed/datastream for xively.com, feed/(empty) for sen.se or database/series from tempo-db.com. The tempo-db.com 'database' must have been defined in the tempodb/databases section of the configuration.

topics:
    /raw/sensor/battery: 45243/battery

Running it

The utils stay resident as a daemons. You can start them, stop them or restart them (to reload the configuration) by using:

python mqtt2cosm.py start|stop|restart
python mqtt2tempodb.py start|stop|restart

About

Utility to publish MQTT topics to cloud services like cosm.com or tempo-db.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published