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

#34396

Ian
Participant

Hi Dan

I am  thinking  it would be a good idea to have the MQTT module become a general change of state publisher via MQTT. If the blinker python module works and Dan is prepared to build it into the core OSPi code, then my MQTT plugin could subscribe to these events and send MQTT messages. I will develop a Node-red application to log the data.

One reason for thinking this way is that I noticed the Android Opensprinkler app polls the OSPi three times every three seconds for change of state via http://host/jc?pw=xxx,  http://host/jo?pw=xxx and http://host/js?pw=xxx calls. It obviously needs to keep its knowledge of the OSPI status up to date. I had noticed that my OSPI seemed to be struggling at times when I was polling it in a similar way, and it became unresponsive at times. Clearly it is not possible to run more similar applications on the Android and IOS world, as I found out. It would be best if these type of apps did not have to poll OSPi for events.

So your investigation of the Blinker module is timely! Let me know how you get on, and when it is likely I could have some source code to test.

munnecke

Let me describe my setup. I started with Mythtv and have an old desktop running this. It has a large hard drive and records any programs we are likely to watch (and autoexpires them when the disk is nearly full. I have 2 TVs and each have a Pi running XBMC. One is networked via wifi, and the other by ethernet over powerline using D-Link powerline AV 500. The one using wifi is on a different circuit so I can’t use the D-links. Hence the wifi, but it works well. I also have XBMC on my Nexus 7 tablet and my wifes iPad. I use the Yatse application on the Nexus 7, and Nexus 4 phone to control XBMC.  This is not a new house- we bought it in February and I have used wifi and powerline to avoid retro fitting Cat6e cable all over the house).

I have installed Emoncms on another Pi. This one has a small hard drive (even the small ones these days are massive overkill). I did this because the SD cards have a limited life (ie they have a limited number of write cycles and the Emoncms data logging application is expected to run into issues on SD cards. I use an Emontx at the main meter (fitted with 4 CTs) to monitor power consumption. This is essentially an arduino and it transmits by 433MHz radio using the RFM12b radio module. This system is partly to investigate whether a solar power system is worthwhile. I have also installed two EmonTH’s (arduinos)- monitoring temperature. These also transmit via 433MHz radio (which apparently has a range of several hundred metres).  One thing that is non standard in my setup is that Node-red intercepts the incoming radio signals (via the serial port) and forwards the data to Emoncms. This is because Emoncms seems to have little or no query capability, although there is an export CSV function. The Emontx and EmonTH are well engineered and work flawlessly.

So as summer is approaching I needed to get my garden reticulation working. The old controller that came with the hosue needed replacing. Given the above infrastructure it OSPi seemed a good fit. The OSPi is connected to the network via the WiPi module. Node-red and MQTT have allowed me to integrate all these systems and potentially customise them without modifying their core code.

My immediate plan is to introduce some sort of logging capability for OSPi. With your and munnecke’s  input the scope has grown!  The next plan is to measure the water consumption using the small water meters I provided a link to. These provide a pulse output. I have a number of options to integrate these – I could connect them to the EmonTX, or to OSPi, or use a dedicated Arduino. The distance between the meters and the Emontx and OSPi is only a meter or so.

 

Ian