This OctoPrint plugin interfaces with a UPS monitored by NUT (Network UPS Tools).
battery.charge
Install the plugin using Plugin Manager from Settings
Help can be found at the OctoPrint Community Forums