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


Dan in CA


You are right that the gv module is a repository for global variables which can be shared among the main program and other modules such as plugins just by importing it. You can assign new vars to it if needed.

There are some existing sources of state data. For example, the mobile_app plugin provides the “/jx” urls such as ‘/js’ which returns the current state of stations. There is also an /’api/status’ URL which returns some state info but these return the information only when requested via an HTTP Get request. I am looking into ways to broadcast status data when a change occurs. Any ideas in this regard are welcome. Your list of things you want to track is very helpful.

I ‘m also experiencing the drought (Sacramento area). There are dead lawns everywhere. A recent study released by (I think) U.C. Riverside concluded that one of the most effective water conservation measures is tiered pricing. The state of CA even has an Urban-Drought-Guidebook that recommends “large per billing unit price increases” to water suppliers to help reduce usage. I am thinking about writing a plugin that will allow a user to set a cost/volume restriction on irrigation. It would require the irrigation system to be calibrated by e.g. running each zone for a specific time and determining the amount of water used by taking water meter readings before and after. This should become useful as the cost of water goes up.

Another project on my workbench is an Arduino based system for connecting soil moisture sensors to the OSPi. My plan is to use the modbus protocol over RS-485 serial. It could be used for other types of sensors as well. The Raspberry Pi can easily communicate with an Arduino via serial using a USB cable.

Anyway, this is a fun and useful project.