Today I learned how to get battery information (including remaining time) using upower.

upower -i /org/freedesktop/UPower/devices/battery_BAT0

Source