How do I get the battery voltage?

There is an elegant solution posted at Adding a battery meter to Wio Terminal.