So the basic functionality would be:
- Recieve data from MQTT, process and save it to MySQL
- Follow MySQL binlog and send saved data to MQTT
For input I need to have a table that stores:
- Subscribed topic.
- How to get raw sensorid from topic, maybe regexp.
- How to parse data from message.
- Small script that processes the data so it's ready to store.
And a second table that's used to convert raw sensorid's to db sensorid's:
- Rawid
- Sensorid
For output I need a table that stores:
- Sensorid
- Topic to push data to
- How to process data before sending
There are still some features to implement, like outputting data from db to MQTT, need to think how this should be done with some kind of plugin system, MySql will probably use binlog to read data, but other databases have other mechanisms.
There are depencies for Paho-MQTT client, pep3143daemon and SQLAlchemy. More detailed dependencies in requirements.txt
Code in GitHub https://github.com/mika-koivusaari/mqtt_db_gateway.
There are depencies for Paho-MQTT client, pep3143daemon and SQLAlchemy. More detailed dependencies in requirements.txt
Code in GitHub https://github.com/mika-koivusaari/mqtt_db_gateway.
No comments:
Post a Comment