-
Notifications
You must be signed in to change notification settings - Fork 928
mqtt_and_current_cost
Current Cost meters publish XML data every 6 seconds. How is that information parsed, stored, re-read, re-published?
Probably the best way to do this is to not try to do too many things in one go. Think in terms of clients that publish, clients that subscribe and clients that process and re-publish.
You can read the XML data from the Current Cost and publish it as-is. This means that all of the information becomes available to any subscribers to do with as they please. The mosquitto repository has examples of doing this in Perl and Python.
The second part of the puzzle is to process the data and re-publish it. This extracts the interesting information and presents it in a friendlier manner. For the Current Cost data, for example, this could mean separating out the temperature data and data for each of the monitor channels and publishing them on their own topics whilst ignoring any of the long-term sensor data. The mosquitto repository has an example of this in perl.
The final stage is storage. Because the sensor data is now on separate topics, it is easy to make a generic client to subscribe to an appropriate topic and store the data in some way, assuming the incoming data format is consistent across topics. This may be to a MySQL database, or to Pachube, as demonstrated in this simple perl example.
- CurrentCostGUI on Google Code
MQTT Community Wiki by mqtt.org community members is licensed under a Creative Commons Attribution 4.0 International License and was made possible by the generosity of all of its contributors.