OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Using MQTT to log data › Reply To: Using MQTT to log data
I have a “proof of concept” working. Whenever entries are placed in the log, a message is published on an MQTT broker, and Node-Red sends this to a Raspberry Pi running XBMC. This causes a popup with the log entry to appear on my TV. Although I doubt I want to have this popup appearing in the long term it is useful when testing! Node-Red can send it elsewhere just as easily.
The code is
– import the MQTT library into helpers.py (1 line),
– in log_run reformatting the log entry as an MQTT message (1 line),
– publishing the message in log_run (1 line)
– and in Node Red I had to reformat the message to a format suitable for the XBMC addon I use (a couple of lines).
If there is interest I will provide more detail.
To do this I had to modify log_run in helpers.py so that when it inserts a log entry it publishes it to MQTT. I would prefer not to modify core code and have this option as a separate plugin. Is this possible?
Also I noticed that when using the Android Opensprinkler application, manually running a station does not result in a log entry. Is this a bug?