Pi as a UPS monitor
-
I'll rewrite this as an actual how to in the next few days.
-
@JaredBusch said in Pi as a UPS monitor:
Well that would be a problem. Where did the file I made go? I guess the default directory was a bad choice?
pi@bna-pwr-pi-01:~ $ sudo ls -l /var/run/nut/ total 12 -rw-r--r-- 1 nut nut 4 Feb 2 04:27 upsd.pid -rw-r--r-- 1 root root 4 Feb 2 04:27 upsmon.pid srw-rw---- 1 nut nut 0 Feb 2 04:27 usbhid-ups-bnajaredrouter -rw-r--r-- 1 nut nut 4 Feb 2 04:27 usbhid-ups-bnajaredrouter.pid pi@bna-pwr-pi-01:~ $
@scottalanmiller what would be the 'proper' place for these files?
-
@JaredBusch said in Pi as a UPS monitor:
Well that would be a problem. Where did the file I made go? I guess the default directory was a bad choice?
pi@bna-pwr-pi-01:~ $ sudo ls -l /var/run/nut/ total 12 -rw-r--r-- 1 nut nut 4 Feb 2 04:27 upsd.pid -rw-r--r-- 1 root root 4 Feb 2 04:27 upsmon.pid srw-rw---- 1 nut nut 0 Feb 2 04:27 usbhid-ups-bnajaredrouter -rw-r--r-- 1 nut nut 4 Feb 2 04:27 usbhid-ups-bnajaredrouter.pid pi@bna-pwr-pi-01:~ $
If it's me, that's normally forgetting to add the sudo before my favorite text editor. Anything in /dev or /etc requires root privilege. Besides that, dunno. Nano complains at you saying "read only" when you try to save.... yeah, seen that a few more times than I can count.
-
@JaredBusch said in Pi as a UPS monitor:
@JaredBusch said in Pi as a UPS monitor:
Well that would be a problem. Where did the file I made go? I guess the default directory was a bad choice?
pi@bna-pwr-pi-01:~ $ sudo ls -l /var/run/nut/ total 12 -rw-r--r-- 1 nut nut 4 Feb 2 04:27 upsd.pid -rw-r--r-- 1 root root 4 Feb 2 04:27 upsmon.pid srw-rw---- 1 nut nut 0 Feb 2 04:27 usbhid-ups-bnajaredrouter -rw-r--r-- 1 nut nut 4 Feb 2 04:27 usbhid-ups-bnajaredrouter.pid pi@bna-pwr-pi-01:~ $
@scottalanmiller what would be the 'proper' place for these files?
Hey @scottalanmiller you never answered this one. What is 'proper' for this kinda thing.
-
@JaredBusch said in Pi as a UPS monitor:
@JaredBusch said in Pi as a UPS monitor:
@JaredBusch said in Pi as a UPS monitor:
Well that would be a problem. Where did the file I made go? I guess the default directory was a bad choice?
pi@bna-pwr-pi-01:~ $ sudo ls -l /var/run/nut/ total 12 -rw-r--r-- 1 nut nut 4 Feb 2 04:27 upsd.pid -rw-r--r-- 1 root root 4 Feb 2 04:27 upsmon.pid srw-rw---- 1 nut nut 0 Feb 2 04:27 usbhid-ups-bnajaredrouter -rw-r--r-- 1 nut nut 4 Feb 2 04:27 usbhid-ups-bnajaredrouter.pid pi@bna-pwr-pi-01:~ $
@scottalanmiller what would be the 'proper' place for these files?
Hey @scottalanmiller you never answered this one. What is 'proper' for this kinda thing.
Should be /etc/nut. The standard is to put config files in /etc. /dev is generally hardware devices.
-
You could add this little display on your Pi for local status-
-
@gjacobse I like that, it's cute.
-
@gjacobse Nice find. And only uses 6 pins? I've got a 2.5" display that uses most of the GPIO block
-
@travisdh1 said in Pi as a UPS monitor:
@gjacobse Nice find. And only uses 6 pins? I've got a 2.5" display that uses most of the GPIO block
The only thing I might do is see if it was possible to rotate the display part 90deg,.. free up the header area for more - OR make a breakout board for all 20 GPIO with the OlED turned...
-
Did you ever get this project finished?
-
Aside from alerting, this was working. No, I never circled back to this.
-
Struggling with getting nut to work with an old APC UPS ... lsusb suggests the UPS USB port is connecting to the PI (it lists the device when plugged in) but can't seem to find the right combination of configurations to allow nut to actually monitor the UPS itself.
tried drivers;
usbhid-usb port=auto
genericusb with type; = 1, 2, 9, or 12 (port=serial1)
apcsmart
apcsmart-old
apcupsd-upsseems that the ups is just not being found
is there some way to manually poke the USB port (sort of like we used to do with uarts with AT commands)?
-
@bxdobs said in Pi as a UPS monitor:
Struggling with getting nut to work with an old APC UPS ... lsusb suggests the UPS USB port is connecting to the PI (it lists the device when plugged in) but can't seem to find the right combination of configurations to allow nut to actually monitor the UPS itself.
tried drivers;
usbhid-usb port=auto
genericusb with type; = 1, 2, 9, or 12 (port=serial1)
apcsmart
apcsmart-old
apcupsd-upsseems that the ups is just not being found
is there some way to manually poke the USB port (sort of like we used to do with uarts with AT commands)?
I actually just went through this about a month or so ago when I set up Ubuntu Server and a APCups. I'm not at the house to pull what I did,... but I heavily referenced this very thread. Yes - where I don't live in Linux CLI as some do, I had to do some trial and error again. but that's part of (re)learning.
-
Removed the nut installation, config files and did a complete Raspbian upgrade ... Now after reinstalling nut with the bare minimum configuration, it is finally talking to the ups.
Even though I have been technically involved with computer tech going back to the late '70s, this install was certainly not for the faint of heart ... I can understand why people walk away in frustration from this stuff
-
2023, and this thread is still the best resource for getting nut/apcupsd running.
-
I'll add another note for future reference here.
For Fedora 39 Server, apcupsd has another package
apcupsd-cgi
that can be used with a web server to display UPS status. However, you have to move the files it installs by default because they're not in the/var/www/cgi-bin
directory.sudo dnf install -y apcupsd apcupsd-cgi httpd
sudo mv /var/www/apcupsd /var/www/cgi-bin/
sudo chown apache:apache /var/www/cgi-bin/apcupsd/*
sudo systemctl enable --now httpd
Should get it up and running.
I found 3 useful tools with it.
http://YOURIP/cgi-bin/apcupsd/uspstats.cgi
http://YOURIP/cgi-bin/apcupsd/multimon.cgi
http://YOURIP/cgi-bin/apcupsd/upsfstats.cgi