Your response started me thinking. That plus the fact that I have been reading the web api document has led me to realise I dont need to modify Opensprinkler at all! I can get the station status via the web api from node-red. I have tested this and it works.
So now I must think through what I want do with this. Node-red accessing Opensprinkler once a second is also testing that Opensprinkler is still running. If I run node-red on the Opensprinkler Pi, it just tests the application is running. However if I am running node-red on the Pi running Emoncms it tests that the whole Opensprinkler system is running, and can alert me!
So these are my initial thoughts. This is all in node-red.
Initially get the station names and store them. Store the master valve. Also the hostname and port of the Opensprinkler system.
Detect when a station starts and display its name as a message popup on my TV (because I can!)
Detect when it stops and log the run time to Emoncms if it is not a master valve (Emoncms will timestamp it).
Detect if opensprinkler is not running and send an email (twitter, or sms?) If it is not running after 10 seconds. Send reminders after 1 hour, 1 day, and the weekly until it responds again.
I will be using the copy of node-red running on my Eoncms Pi as it provides a better warning of failure of Opensprinkler that way. I only need MQTT to display the popup message on my TV.
However I am also thinking to have this copy of node-red publish a regular MQTT meßsage and have node-red on the Opensprinkler Pi check this “heartbeat” and alert me if the Emoncms Pi fails!
Most of this I have already prototyped.
If anyone has any further thoughts, or suggestions for additional functions I would be grateful.