OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Using MQTT to log data Reply To: Using MQTT to log data

#34383

Dan in CA
Participant

Just an FYI.

I have started testing the Blinker Python module:

https://pythonhosted.org/blinker/

It enables message sending when an event occurs rather than by polling. It can even include a data payload with the message. I have a working proof of concept plugin that prints a message to the python console whenever a zone is turned on or off. It is only 5 lines of code plus 3 lines in the gpio_pins.py file:

from blinker import signal
zone_change = signal('zone_change')

and at the end of the set_output() function:

zone_change.send()

This requires installing a non-standard Python module, something I have avoided in the main program code. I was able to install Blinker on both my OSPi test rig and my Windows development system with

"pip install blinker"

It looks like there are about 6-8 places in the main program code where changes are handled. these could have messaging code added that would be ignored if the blinker module was not present.

One possibility for detecting if the Pi is up and running is to simply ping the URL. A heartbeat would be trivial to implement in the ospi software.

Dan