=====Cyberpower Powerpanel Business===== Note: Does not work with the free version of ESXi. ====Setup==== Deploy the premade Cyberpower Powerpanel Business Local VM on to ESXi and set it up to shutdown the host it is running on. ===VM Setup=== * Download the latest ''PowerPanel Business Local for Virtual Machine'' from ''https://www.cyberpower.com/eu/en/product/sku/powerpanel_business_for_virtual_machine#downloads'' * Unzip the downloaded zip file * In ESXi: * Select ''Create/Register VM'' * Choose ''Deploy a virtual machine from an OVF or OVA file'' * Press ''Next'' * Enter ''Cyberpower Powerpanel Business'' as the name, and select all the extracted files * Choose the data store and press ''Next'' * Make sure ''Thin'' is selected, and deselect ''Power on automatically'', and press ''Next'' * Press ''Finish'' to start the import process * Find the MAC address and assign the VM an IP address in the router settings with the name ''Cyberpower-PPB'' * Edit the ''Virtual Hardware'' settings: * ''Add other device'' > ''USB device'' > The UPS * On the side panel ''Host'' > ''Manage'': * ''System'' > ''Autostart'': * Enable the ''Cyberpower Powerpanel Business'' VM, and make sure it is set to 1 in the autostart order * ''Security & Users'' > ''Users'' > ''Add user'': * Add a new user to be used for the Cyberpower VM to allow shutting down the ESXi system * Use ''cyberpower'' as the username, and a generated password * ''Host'' > ''Actions'' > ''Permissions'': * ''Add user'' * Select the ''cyberpower'' user that was just created * Select ''Administrator'' * Finalise with ''Add user'' * Power on the Cyberpower VM * Add ''http://cyberpower-ppb:3052/local/'' to Caddy ===Pre-Config=== Extra things to be set in the command line before setting up PowerPanel. One issue with PowerPanel is that it constantly writes to ''/usr/local/PPB/db_local/filedb.log'' ([[https://www.reddit.com/r/HomeServer/comments/usno37/cyberpower_powerpanel_business_linux_excessive/]]). We fix this by installing and using [[https://wiki.archlinux.org/title/Anything-sync-daemon|Anything-sync-daemon]] to put the directory into a ram disk that gets synced to disk occasionally. * Connect to ''admin@cyberpower-ppb'' using SSH and login with ''admin'' as the password. # Change the default password: passwd # Change the time zone to the one the server is in: # Find your time zone using: timedatectl list-timezones # Then set it with: sudo timedatectl set-timezone Australia/Perth # Set the hostname: sudo hostnamectl set-hostname Cyberpower-PPB # Make sure the system is up to date sudo apt update && sudo apt upgrade # Install Anything-sync-daemon sudo apt install make pv zstd git clone https://github.com/graysky2/anything-sync-daemon.git /tmp/asd cd /tmp/asd sudo make install-systemd-all cd / rm -R /tmp/asd sudo nano /etc/asd.conf # Edit the following lines: WHATTOSYNC=() #VOLATILE="/tmp" #USE_OVERLAYFS="no" # into: WHATTOSYNC=('/usr/local/PPB/db_local') VOLATILE="/dev/shm" USE_OVERLAYFS="yes" # Write out the file and exit # Check to see if configured properly sudo asd p # Enable to run at startup sudo systemctl enable asd.service sudo reboot 0 ===Configuration=== * Visit [[http://cyberpower-ppb:3052/local/]]: * Login with ''admin'' and ''admin'' as username and password * Verify that the UPS is showing up correctly * Change the username and password: * In the top right, click ''admin'' > ''Change password'' * Change the username and use a generated password * Sign in again with the new details * ''UPS Setting'' > ''Configuration'' > ''Set Replacement Date'' to when the unit was purchased or the battery was last replaced * ''Setting'' > ''Network Configurations'' > ''Network Configurations'': * Enable ''HTTPS Secure'' * Change the default ''HTTPS Port'' to something slightly different * Click ''Apply'' * ''Setting'' > ''Notifications'': * ''Notification Channels'': * Disable and apply all the channels except ''E-mail'' * Configure ''E-mail'' to use Gmail: * If your Gmail account uses 2 factor auth: * Go to [[https://myaccount.google.com/apppasswords]] and generate an app password for the VM called: ''Cyberpower VM Notification Emails'' * Copy the app password * Enable ''Enabled'' * ''Provider'' > ''Other'' * ''SMTP server address'' > ''smtp.gmail.com'' * ''Connection Security'' > ''TLS'' > ''Auto'' * ''Service port'' > ''587'' * ''Sender name'' > The name you want the sender to show in the email * ''Sender E-mail'' > Gmail account email address * Enable ''Authentication'' * ''User Name''/''Password'' > Gmail account username and password * ''Apply'' * And ''Test'' to make sure it sends correctly * ''Recipients'': * ''Default Receiver'' > ''Edit'': * ''Recipient Name'' > Your name * ''E-mail Address'' > ''+powerpanel@gmail.com'' * In Gmail, make a filter to give the emails a label: * Filter emails matching: ''to:(+powerpanel@gmail.com)'' * Mark them with a Label, and never send to spam * ''Setting'' > ''Shutdown Setting'' > ''Shutdown Events'': * ''Local Host Shutdown Requirements'': * ''Shutdown Type'' > ''Shutdown'' * Disable ''Shutdown UPS'' * ''ESXi'': * Set ''Shutdown Duration'' to a reasonable estimation of how long it takes the ESXi server to shut down all the VMs and itself, e.g. 10 min * ''IP Address'' > Set to the local hostname of the ESXi host * Set ''Account'' and ''Password'' to the previously created account with administrator access * ''Virtual Machine'': * Enable ''Shutdown'' * Set the ''Shutdown Duration'' to the time it takes for all the VMs to shutdown * ''Apply'' * ''Shutdown Delays'': * ''Utility power failure'' > Set to the time you want the server to run on the battery, with enough safe time to shut down, e.g. 30 min * ''Available runtime is insufficient'' > ''Inactive'' * ''Reporting'' > ''Energy Use'' > ''Cost Per kWh'' > ''AU - AUSTRALIA'' ====Update==== * Using SSH, connect to ''admin@cyberpower-ppb'': * Run ''sudo apt update && sudo apt upgrade'' * Visit [[http://cyberpower-ppb:3052/local/]]: * Go to the ''Help'' tab, and ''Check for Updates'' ====Sources==== * https://wiert.me/2021/07/09/automatically-shutting-down-an-esxi-6-7-server-from-a-cyberpower-ups-using-the-powerpanel-business-edition-4-x/ ====Notes==== * Maybe try integrating into Home Assistant: https://community.home-assistant.io/t/monitor-cyberpower-ups-plugged-into-windows-machine-via-usb/170497/31