My setup: I have a Synology NAS and a Raspberry Pi running Home Assistant Yellow, with the NUT add-on. My Raspberry Pi is configured as the master, because in the event of a power outage, I want to power off my server but keep my home automation online. I found a potentially helpful article online for how to configure this, but no matter what, I can't get it to work.
On the Home Assistant side, I have NUT configured with the following settings:
users:
- username: monuser
password: secret
upsmon: master
instcmds:
- all
actions: []
devices:
- name: ups
driver: usbhid-ups
port: auto
config: []
mode: netserver
shutdown_host: false
list_usb_devices: false
log_level: trace
i_like_to_be_pwned: true
leave_front_door_open: false
On the Synology side, configurable settings are basically nonexistent, but I am adding in the internal IP address of my Pi, and still getting a Cannot connect to the network UPS server error.
I'm not sure what else to try to troubleshoot. I thought that by setting the UPS name as ups, username as monuser and password as secret in my Pi, then it would work.
Synology NAS to nut-server (none Synology) | Synology Community
Network UPS Tools (NUT) with Synology NAS and CyberPower UPS
Synology as a NUT client
Network UPS Tools. Synology. How to run the NUT client in OS Home Assistant
Videos
Hi everyone,
I know there's information on using our Synology NAS' as UPS servers to power down other Synology devices, but it took me some time to piece together how to use Synology to safely power down my Mac Mini server in the event of a power outage so I figured I'd put it into a writeup here to maybe help some others.
WHY: Most UPS' only have one USB port to control a single device in the event power outage and the battery running low. If you're like me, I have my Synology NAS and other devices (i.e. Mac server) that I want all powered down safely.
My setup: These steps are not specific to my hardware/OS/UPS, but figured I'd provide for context.
-
APC 600VA UPS
-
Synology DS918+
-
Mac mini (running Ubuntu server 20.04, not Mac OS X) - this is not specific to Linux, it will work for Mac, Windows servers/computers
-
Your router needs to be also attached to the UPS otherwise your NAS and computers/servers won't be able to communicate.
Synology Setup
-
Connect NAS to UPS via USB cable.
-
Open up DSM and go to Control Panel > Hardware & Power > UPS (tab)
-
Enable UPS Support and check "Enable network UPS server"
4. Click "Permitted DiskStation Devices" and input the IP addresses of your servers/computers you would like to power down. In my case, I input the IP of my Mac Mini.
5. Apply settings. If you click, "Device Information" you should see your UPS info. (May require a restart of the NAS, I can't remember)
Server/Computer Setup
Linux
Synology is running a NUT Server (http://networkupstools.org) and in this part we have to install the Nut-client to monitor the NAS. I am walking through setup of the Nut-client on Linux, but the same basic steps apply for Mac/Windows. The NUT website has download/install instructions specific to Windows/Mac.
1.Install NUT
sudo apt-get install nut
2.Modify /etc/nut/nut.conf file to specify your computer/server as a client instead of server. Edit this specific line:
MODE=netclient
3.Add Synology address and credentials to /etc/nut/upsmon.conf
MONITOR ups@192.168.0.102 1 monuser secret slave
*Note: these credentials can be changed or you can add a user by SSHing into the NAS and modifying /usr/syno/etc/ups/upsd.users.
4. Lastly, start the nut-client service.
service nut-client restart
Now if I unplug my UPS (to simulate power outage), my Mac will update with the status of the UPS and also will safely shutdown when Synology triggers. I left my Synology settings to trigger shutdown when the UPS battery runs low, but you can check "Time before DiskStation enters Safe Mode" in step 3 above and put a specific time to shutdown.
Windows (Thanks to u/xnaas for providing Windows instructions)
-
Download and install the latest binary https://github.com/networkupstools/nut-package-archive/tree/master/windows
During install, uncheck the box for Install libUSB driver
2. Go to the etc folder of your NUT installation folder
Default: C:\Program Files (x86)\NUT\etc
3. Rename or copy nut.conf.sample to nut.conf
4. Rename or copy upsmon.conf.sample to upsmon.conf
5. Edit MODE inside nut.conf
MODE=netclient
6. Edit upsmon.conf
Find the SHUTDOWNCMD section
Default: SHUTDOWNCMD "/sbin/shutdown -h +0"
Change the default to something like SHUTDOWNCMD
SHUTDOWNCMD "C:\\WINDOWS\\system32\\shutdown.exe -s -t 0"
Customize the time (-t 0) to your liking. Optionally add -f to force the shutdown. If you want to hibernate, replace -s with -h.
Find the MONITOR section and add the following
MONITOR ups@192.168.1.150 1 monuser secret slave
Make sure to update the IP to your Synology IP
7. Copy libgcc_s_dw2-1.dll from the bin subfolder to the sbin subfolder
8. Download OpenSSL library https://indy.fulgan.com/SSL/
9. Copy libeay32.dll and ssleay32.dll to the sbin subfolder
10. Launch services.msc from Run (WIN+R)
11. Find the service called Network UPS Tools and Start it
Mac
To be added later. In the meantime, this wiki should be a good guide: https://github.com/networkupstools/nut/wiki/NUT-on-Mac-OS-X
Hope this helps someone!