Created
August 7, 2022 17:06
-
-
Save eumel8/7ed9759fbe757131bf01df9887a1caef to your computer and use it in GitHub Desktop.
cyberpower-raspberry.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Setup Raspberry PI to monitor CybperPower USV and send alarm SMS | |
| # Connect CyberPower USV and Raspberry with USB cable | |
| # Install Software on Raspberry (Ubuntu): | |
| # apt-get update && apt-get install nut nut-client nut-server | |
| # Adjust config: | |
| ``` | |
| /etc/nut/nut.conf | |
| MODE=netserver | |
| /etc/nut/ups.conf | |
| maxretry = 3 | |
| [cyberpower] | |
| driver = usbhid-ups | |
| port = auto | |
| desc = "CyberPower CP1500" | |
| /etc/nut/upsd.users | |
| [upsmon] | |
| password = pass | |
| upsmon master | |
| /etc/nut/upsd.conf | |
| LISTEN 127.0.0.1 3493 | |
| LISTEN ::1 3493 | |
| /etc/nut/upsmon.conf | |
| MONITOR cyberpower@localhost 1 upsmon pass master | |
| MINSUPPLIES 1 | |
| SHUTDOWNCMD "/sbin/shutdown -h +0" | |
| NOTIFYCMD /etc/nut/notifycmd.sh | |
| POLLFREQ 5 | |
| POLLFREQALERT 5 | |
| HOSTSYNC 15 | |
| DEADTIME 15 | |
| POWERDOWNFLAG /etc/killpower | |
| NOTIFYMSG ONLINE "UPS %s on line power" | |
| NOTIFYMSG ONBATT "UPS %s on battery" | |
| NOTIFYMSG LOWBATT "UPS %s battery is low" | |
| NOTIFYMSG FSD "UPS %s: forced shutdown in progress" | |
| NOTIFYMSG COMMOK "Communications with UPS %s established" | |
| NOTIFYMSG COMMBAD "Communications with UPS %s lost" | |
| NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding" | |
| NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced" | |
| NOTIFYMSG NOCOMM "UPS %s is unavailable" | |
| NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible" | |
| NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC | |
| NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC | |
| NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC | |
| NOTIFYFLAG FSD SYSLOG+WALL+EXEC | |
| NOTIFYFLAG COMMOK SYSLOG+WALL+EXEC | |
| NOTIFYFLAG COMMBAD SYSLOG+WALL+EXEC | |
| NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC | |
| NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC | |
| NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC | |
| NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC | |
| RBWARNTIME 43200 | |
| NOCOMMWARNTIME 300 | |
| FINALDELAY 5 | |
| /etc/nut/upssched.conf | |
| CMDSCRIPT /bin/upssched-cmd | |
| /etc/nut/notifycmd.sh | |
| #!/bin/bash | |
| gateway_uri="https://api.twilio.com/2010-04-01/Accounts/AC401c3757bbb0774d0a8177565748a88e/SMS/Messages.json" | |
| identifier="xxxxxxxxxxxxxxxxx" | |
| from="From=%2B00000000" | |
| to="To=%2B4900000000" | |
| message="UPS POWER SUPPLY ALERT (HWR): $NOTIFYTYPE UPS: $UPSNAME Alert type: $NOTIFYTYPE" | |
| curl -X POST $gateway_uri \ | |
| -u $identifier \ | |
| -d $from \ | |
| -d $to \ | |
| --data-urlencode "Body=$message" > /dev/null 2>&1 \ | |
| ``` | |
| ref: | |
| https://perfecto25.medium.com/monitor-cyberpower-ups-devices-with-raspberry-pi-99559725dbb8 | |
| https://telekomhilft.telekom.de/t5/Telefonie-Internet/Notstromversorgung-Speedport-Router/m-p/5790332/highlight/true#M1478736 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment