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

#34297

Ian
Participant

Dan

Yes – Node-red is fun. I am nearly finished an application which uses the web API to get data from OSPi, and logs the information to Emoncms and to XBMC. I will post the flow when it is ready. However as I mentioned earlier I am now think that sending data from OSPi to Node-red and exposing the data  via global variables is the way to go long term so I won’t be developing this further eg to add more error checking etc.

The data that is sent must also be able to be retrieved by Node-red via the web interface so that Node-red can initialise the globals.  An example would be the station status information. You can retrieve nstations and sn via the web interface, and I would have node-red globals context.global.nstations and context.globals.sn[]. These would be initialised by Node-red using the web interface on startup, and thereafter updated via the MQTT interface. I can then process the data in Node-red in any way I wish. Obviously in some applications it will be necessary to send data back to OSPi via MQTT.

This is therefore a way to achieve your goal – a platform for customisation and experimenting. This could be done in Node-red or any other environment simply subscribing to the appropriate MQTT topics.

Regards

Ian