Bit off topic - Shutting down local emoncms server from a 2nd pi on same local network

Hi

Thanks to all the recent help on setting up mqtt on emoncms I have made huge strides in automating a number of devices including a remote irrigation system with watering controlled by rain fall that is already monitored by emoncms.

The last few step are to make it as bullet proof as possible. My server and my mqtt broker run on 2 separate Pi.

My complete internet system (modem routers etc) along with the Pi are powered by an off grid 24V DC solar system. The only problem I have is that in a run of cloudy days in the winter the LVD operates and the 24V circuit is disconnected to protect the batteries. This is no problem to all the devices except the Pi wich need to be shut down. I have already implemented a low voltage warning that is texted and sent by Android nma when the cut out voltage is approached. I have also got node-red executing a shut down command on the mqqt broker Pi that is shared with node-red.

My question is how can I issue a command from the broker Pi to the emoncms Pi to tell it to shut down? The emoncms Pi is obviously running emoncms and apache. Could emoncms be programmed to issue a shut down command if a certain node changed from 0 to 1 which would be easy to arrange with mqtt.

Any suggestions appreciated.

Regards

Ian

 

dBC's picture

Re: Bit off topic - Shutting down local emoncms server from a 2nd pi on same local network

Is there a particular reason you want emoncms to be involved?  If not, you could just remotely shut it down via ssh.  Something like:  http://linuxcommando.blogspot.com.au/2013/04/one-liner-to-shutdown-remote-host.html

One gotcha' that you're probably already aware of, but in case not:  once you've decided to power down, there's no backing out.  I have the same issue with nut running on all my machines.  Once the nut server has told the nut clients the UPS battery is about to die, the nut server and UPS have to promise to cycle the power, even if the mains comes back on (or the sun comes back out in your case)... otherwise you're left with all those shutdown client machines that never come back up.

Ian Eagland's picture

Re: Bit off topic - Shutting down local emoncms server from a 2nd pi on same local network

Hi

Many thanks. After quite a lot of reading I have a single line shut down from the broker pi shutting down emoncms server pi.

Manually restarting the pi after power down is no problem. I have to reset the LVD manually.

Regards

Ian

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.