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.
sudo apt-get install python-yaml
sudo apt-get install python-mosquitto
- tempodb [if using TempoDB daemon]
pip install tempodb
- requests [tempodb installs this]
pip install requests
Just clone or extract the code in some folder. I'm not providing an setup.py file yet.
Rename or copy the config/mqtt2???.yaml.sample files to config/mqtt2???.yaml and edit them. The configuration is pretty straight forward:
Just define the log file paths.
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.
A set of databases, each with its api key and secret.
A set of things, each with its token.
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
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