OH3 to send shutdown command to remote host

Dear all

I’ve used an APC UPS all the time so far, but I’ve never managed to fully use the capabilities of it fully. Recently we had a planned power outage where I was away from home.
And sure enough my Synology NAS was shutdown after my return.

  • Platform information:
    • Hardware: MacMini
    • OS: Debian 5.10.84-1
    • Java Runtime Environment: openjdk version “11.0.13” 2021-10-19 LTS
    • openHAB version: 3.2.0
  • Issue of the topic: controlled shutdown of remote host in case of powerloss (battery discharge)

I would like to enhance openHAB in such a way that I can initiate a controlled shutdown before the battery is empty. I’m thinking to use the approach described in

But up to now I havn’t fully understand how to get the things done.

Exec binding is already installed and used for other stuff.
SNMP package is installed on OH server too.
A rule with a tigger event (Network UPS tools) is already created but not active yet.

Can anyone of you guys help me to realize that goal?

Kind regards

If you are using NUT you don’t need OH for this. On the Synology under Control Panel → Hardware and Power → UPS you can configure the Synology to connect to your NUT server and define when to enter standby mode.

There is also support for SNMP UPS there too.

Hi Rich

Thanks for your quick reply.
I was thinking about this approach too. But this only addresses the Synology.
Maybe I will need to implement something for other devices as well.

NUT runs on just about everything. Just configure nutmon to monitor the server connected to the UPS and you can configure the behavior each does when the UPS reports it has lost power.

Thought I’d chime in since it notified me of the quoted post… I don’t have much to add that Rich didn’t already explain. Controlled shutdown is usually already installed or easy to install in any normal OS, but it’s not really part of OpenHAB. You could force it through, but there’d be no point.

On another note, I monitor my UPS with a small python scrip that posts updates to an MQTT broker. I have another MQTT service that I could use for graceful shutdowns, but it seems weird to put all that through OpenHAB. I wrote about (and posted) the script a few year ago in the comments here: Monitoring an APC Back-UPS With openHAB 2

Thanks for your comment Nick

If possible (and it should be) I would avoid to control the additional devices by OH. The point that I struggle with is the fact that Synology DSM 7 does not allow me to set a config in the way of NUTs ups slave. Despite the fact that the installed binaries can access the remote stats.



My UPS is connected via USB to openHAB server. And OH3 get’s the details of it.
apcups software is not installed.

Synology DSM offers only the options:

  • USB-UPS - attached to Synology
  • Synology UPS Server

So from my dumb perspective, it would be possible to set the master config on Synology having OH server acting as a client using NUT. But not the other way around at least not without a dirty syno hack.
It would be possible use SNMP UPS, but as my device is USB-hid attached to ohserver it seems impossible, because in all the docs I found so far the authors refer to as an IP connection to the UPS directly.

Again from my perspective of thinking: I consider the openhab server more important (chain of control) than the NAS. So I would based on that to stop NAS first in order to save battery time and initiate a clean shutdown of ohserver afterwards if there is no way out. But this for sure doesn’t work with Synology’s first option.