Master Setup
Connect UPS using USP cable
Installation
$ sudo apt-get install nut
$ vi /etc/nut/ups.conf
Add the following config
[homeups] driver = usbhid-ups port = auto desc = "Back-UPS ES 750"
Update Nut.Conf
$ sudo vi /etc/nut/nut.conf
Set Mode=netserver
MODE=netserver
Verify Hardware Config
$ sudo upsdrvctl start
Restart the Service
$ sudo service nut-server restart
Get Status
sudo service nut-server status ● nut-server.service - Network UPS Tools - power devices information server Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-08-24 20:28:53 EDT; 7s ago Process: 12995 ExecStart=/sbin/upsd (code=exited, status=0/SUCCESS) Main PID: 12996 (upsd) Tasks: 1 (limit: 877) CGroup: /system.slice/nut-server.service └─12996 /lib/nut/upsd Aug 24 20:28:53 pihole systemd[1]: Starting Network UPS Tools - power devices information server... Aug 24 20:28:53 pihole upsd[12995]: fopen /var/run/nut/upsd.pid: No such file or directory Aug 24 20:28:53 pihole upsd[12995]: listening on 127.0.0.1 port 3493 Aug 24 20:28:53 pihole upsd[12995]: listening on ::1 port 3493 Aug 24 20:28:53 pihole upsd[12995]: listening on 127.0.0.1 port 3493 Aug 24 20:28:53 pihole upsd[12995]: Connected to UPS [homeups]: usbhid-ups-homeups Aug 24 20:28:53 pihole upsd[12995]: listening on ::1 port 3493 Aug 24 20:28:53 pihole upsd[12995]: Connected to UPS [homeups]: usbhid-ups-homeups Aug 24 20:28:53 pihole systemd[1]: Started Network UPS Tools - power devices information server. Aug 24 20:28:53 pihole upsd[12996]: Startup successful
Query the UPS
$ upsc homeups@localhost
Client Setup
Installation
Install nut-client
$ sudo apt-get install nut-client
Configure
Update nut-config
$ vi /etc/nut/nut.conf
Set mode to netclient
MODE=netclient
Update upsmon.conf
$ vi upsmon.conf
Update MONITOR
RUN_AS_USER root MONITOR qnapups@192.168.1.50 1 admin 123456 slave
For our QNAP master
- upsname = qnapups
- user = admin
- password = 123456
Restart Nut Client
Restart nut client:
$ systemctl restart nut-client
Get Status of Nut Client
Get Status:
$ systemctl status nut-client
● nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-08-24 12:39:49 EDT; 2s ago Process: 162230 ExecStart=/sbin/upsmon (code=exited, status=0/SUCCESS) Main PID: 162234 (upsmon) Tasks: 2 (limit: 19043) Memory: 1.1M CGroup: /system.slice/nut-monitor.service ├─162231 /lib/nut/upsmon └─162234 /lib/nut/upsmon Aug 24 12:39:49 deepthought systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller... Aug 24 12:39:49 deepthought upsmon[162230]: fopen /run/nut/upsmon.pid: No such file or directory Aug 24 12:39:49 deepthought upsmon[162230]: UPS: qnapups@192.168.1.60 (slave) (power value 1) Aug 24 12:39:49 deepthought upsmon[162230]: Using power down flag file /etc/killpower Aug 24 12:39:49 deepthought systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: Operation not permi> Aug 24 12:39:49 deepthought upsmon[162231]: Startup successful Aug 24 12:39:49 deepthought systemd[1]: nut-monitor.service: Supervising process 162234 which is not our child. We'll most likely not notice> Aug 24 12:39:49 deepthought systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.
Check connection
Check Connection:
$ upsc qnapups@192.168.1.60
References
Reference | URL |
---|---|
Raspberry Pi Home Server v2: Network UPS Tools | https://melgrubb.com/2016/12/11/rphs-v2-ups/ |