Ruby interface to UPower.Device tool available by default on Ubuntu and Debian distros.
battery = Rupower::Battery.new
battery.serial # => 5981
battery.voltage # => 12.15 # [V]
battery.energy_rate: # => 18.97 # [W]
percentage: # => 77.36 # [%]
capacity: # => 100 # [%]
technology: # => 'lithium-ion'
See the UPower documentation for full list of properties that can be used as methods, or look at the acceptance tests.
Add this to your Gemfile:
gem 'rupower'
Then run:
bundle
- Ruby >= 1.9.2
bundle exec rake test
Released under the MIT license. Copyright (C) 2012 Karol Nowicki