Install the CyberPowerAVR "pwrstat" application from CyberPower website.
Set password less sudo access to pwrstat
sudo visudo
your_user_name ALL = NOPASSWD: /usr/sbin/pwrstat
Note: your_user_name can be any user that is running the application.
Add this line to your application's Gemfile:
gem 'CyberPowerAVR'
And then execute:
$ bundle
Or install it yourself as:
$ gem install CyberPowerAVR
Run ruby command.
CyberPowerAVR.to_hash
Output
{
"Model Name"=>"CP 1500C",
"Firmware Number"=>"B23",
"Rating Voltage"=>"120 V",
"Rating Power"=>"900 Watt",
"State"=>"Normal",
"Power Supply by"=>"Utility Power",
"Utility Voltage"=>"121 V",
"Output Voltage"=>"121 V",
"Battery Capacity"=>"100 %",
"Remaining Runtime"=>"",
"Load"=>"108 Watt(12 %)",
"Line Interaction"=>"None",
"Test Result"=>"Unknown",
"Last Power Event"=>"None"
}
- Fork it ( https://github.com/SaimonL/CyberPowerAVR/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request