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

#34233

Ian
Participant

Dan  – your last message was marked as private. Did you mean this to happen? I was sent an automatic email copy, so I have read it.

The “web api document” was a pdf titled “Opensprinkler Firmware 2.1.0 API document (18th Oct, 2014. I found it somewhere on the Opensprinkler website. I think it is the one you referred to.

eg It documents sending http requests such as http://hostname:port/jc?pw=password  to get the controller variables. The filename was fw210_api-1.pdf.

 

Node red has the capability to send such http requests and process the response often with not more to do  than  drag and drop, and fill in a few parameters. So it is almost trivial to send a request for station status data, and receive the response. Then I just use a javascript function node to massage the format of the returned data so it is suitable for wherever I am sending it.

It does open up a lot of possibilities. For example I have some of these cheap water meters (see http://www.seeedstudio.com/depot/G12-Water-Flow-Sensor-p-635.html although I bought mine from element14 some years ago, and never got around to using it). I have an arduino reading pulses from one on my desk, and calculating flow rates. (I simulate water flow by blowing in it occasionally to check it works!). I am thinking to place it just upstream of my master valve, and read it from either Opensprinkler or the EmonTX (ie an arduino reading my power consumption) node  I have next to it. It doesn’t matter much where I read it, I will send it to Emoncms via Node-red (which will be able to allocate the flow to a station). Emoncms can then calculate daily. weekly totals etc. These totals could easily be sent to an Opensprinkler plugin for display, or I could display them in an Emoncms dashboard.

Even where there are no specific node-red nodes to interface with an application, often the application will have an MQTT interface. XBMC is one case, Openhab is another that I can think of quickly.

Regards

Ian

In a day or so I will have a working prototype of a node-red application interacting with Opensprinkler. It won’t have much error checking initially, and won’t handle things such as adding stations, changing the master etc. I will post it when it is working.