The LiPo battery apparently ranges from 3.0 V to 3.95 V. Since we know
the range, we can report the current level as a percentage, which Home
Assistant will display.
We'll leave the original voltage reading in the MQTT state payload for
diagnostic purposes.
Home Assistant will display a "Firmware Version" field in the device
information panel if the `sw_version` field is populated in the
discovery configuration payload. We'll fill this with the build date
and time of the firmware as a proxy.
Populating these options helps Home Assistant display the sensors better
in the UI.
The `publish_client` function has too many parameters as it is, making
it difficult to keep track of which value is passed as which argument.
Using a structure and designated initializers makes this a lot cleaner.