Skip to content

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

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

or

sudo apt-get install python-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.

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

Languages

  • Python 100.0%