mmh- i recently worked in a similar area querying acpi wt sysctl.
Ive seen that things like this were implemented a bit different.
All the html is placed right directly in the widget, so everythings fine.
But i dont see hows your widget is going to update the batterys state over time.
If the NUT package is not an option, then you may want to refactor your codes core functionality in functions.inc.php and return the data to the battery widget. If you are interested, then youll find some examples in system_information.widget.php.
Oh and i see a missing gettext($dev_ident)
But if you liked the experience of creating code and want to do the refactoring the i can help you
wt updating your widgets data with ajax.js/getstatus.php and to display a pretty battery bar
so - its up to you