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


Dan in CA

Hi Ian,

This sounds very interesting.

You should be able to make a plugin that does what you want without modifying the log_run function.

The plugin contains some code that could give you some ideas. It checks each station once a second to determine when a change happens. Actually there is an easier way. The list gv.srvals holds the state of the stations/zones (see gv_reference.txt in the OSPi directory for more.). You could copy that list then use a loop to check when a change happens:

import time
from gv import srvals, lrun

zone_state = srvals[:]
while zone_state == srvals:

The list gv.lrun holds the data that is used to create log entries in log_run(). You could use that even if logging is disabled.

As far as the Android app goes, I think it uses it’s own logging functions separate from the one in ospi. There are some issues with the logging in ospi that will be addressed soon so log_run() will likely change in the near future.