################################################################################
#                                                                              #
#        PowerPanel for Linux Software User's Manual                           #
#                                                                              #
################################################################################

Outline

* Getting Online Help
* Getting the UPS status
* Getting the Daemon settings
* Setup the UPS and Daemon
* Daemon Configuration
* Troubleshooting


Getting Help
============

pwrstat -help

Listing help contents with each direction and options for 'pwrstat' command.


Getting the UPS status
======================

pwrstat -status

Listing current UPS propertyies and status as following.

Properties:
	Model Name.................. UPS CP585
	Firmware Number............. BFH8102-6O1.5
	Rating Voltage.............. 120 V
	Rating Power................ 515 VA (335 Watt)

Current UPS status:
	State....................... Normal
	Power Supply by............. Utility Power
	Utility Voltage............. 111 V
	Output Voltage.............. 110 V
	Battery Capacity............ 100 %
	Remaining Runtime........... 60 min.
	Load........................ 0 Watt(0 %)
	Test Result................. Passed at 2011/01/27 13:17:15
	Last Power Event............ Blackout at 2011/01/27 13:21:15

Note. These display items depends on UPS specification.


Getting the Daemon settings
===========================

pwrstat -config

Listing current Daemon settings as following.

Daemon Configuration:

Alarm .................................... On
Hibernate ................................ Off

Action for Power Failure:

	Delay time since Power Failure ....... 60 sec.
	Run script command ................... On
	Path of script command ............... /etc/pwrstatd-powerfail.sh
	Duration of command running ........... 1 sec
	Enable shutdown system................ on

Action for Battery Low:

   Remaining runtime threshold .......... 300 sec.
   Battery capacity threshold ........... 35 %.
	Run script command ................... On
	Path of script command ............... /etc/pwrstatd-lowbatt.sh
	Duration of command running ........... 1 sec
	Enable shutdown system................ on


Setup the UPS and Daemon
========================

# Setup action for power failure as example

pwrstat -pwrfail -delay 60 -active on -cmd /etc/pwrstatd-powerfail.sh
-duration 1 -shutdown on

As above setting, it will take 1 second to run a shell script
/etc/pwrstatd-powerfail.sh and shutdown system since utility power has failure
for 1 minute.


# Setup action for low battery as example

pwrstat -lowbatt -runtime 300 -capacity 35 -active on -cmd /etc/pwrstatd-lowbatt.sh
-duration 1 -shutdown on

As above setting, it will take 1 second to run a shell script
/etc/pwrstatd-lowbatt.sh and shutdown system since UPS's remaining runtime has low 
than 300 seconds or battery capacity has low than 35 %.

Note. 
1. The battery capacity Threshold can be changed in file /etc/pwrstatd.conf.
2. The parameter -pwrfail and -lowbatt are exclusively.
3. The unit of options -delay is second.
4. Both shell script /etc/pwrstatd-powerfail.sh and /etc/pwrstatd-lowbatt.sh 
   were copied in installation procedure.
5. The parameter -pwrfail least one of parameter -delay, -active, -cmd, -duration
   or -shutdown is necessary.
6. The parameter -lowbatt least one of parameter -runtime, -capacity, -active,
   -cmd, -duration or -shutdown is necessary.
7. The options of -cmd can be any shell script in system, but it will be run by
   root authority.
8. The default action setting for both of -pwrfail and -lowbatt are same as 
   above setting of example.


# Setup UPS alarm

pwrstat -alarm on
pwrstat -alarm off

To turn UPS's alarm On or Off.

# Setup UPS mute temporary

pwrstat -mute

To mute UPS's alarm for this power event until next one.

# Setup UPS to do a battery test

pwrstat -test

To verify the UPS will work well in battery power.

# Setup hibernation

pwrstat -hibernate

Using hibernate to instead of system shutdown when power event occurred.

Daemon Configuration
====================

The daemon's configuration file is locate at /etc/pwrstatd.conf.


Daemon Event Log
================

The daemon will record the power event in 'pwrstatd.log' log file, which can be
found on /var/log directory.

Troubleshooting
===============

1. What kind of UPS is supported by PowerPanel for Linux.
   a. The pwrstatd support USB Port and Serial Port to monitor UPS.
   b. A UPS is designed under architecture of USB HID/Power Class, a UPS has 
      DB-9 connector for RS-232 or Dry-Contact communication.

2. Can not establish communication with UPS 
   a. Ensure UPS type is supported by PowerPanel for Linux. 
   b. Ensure USB or Serial cable is connected between UPS and computer.
      Directly connect computer and UPS without USB Hub is helpful to solve if
      which have communication problem.
   c. Try to unplug and plug the USB Cable with UPS.
   d. Ensure hid device can be found at directory of /dev/hiddev, 
      /dev/usb/hiddev, /dev/usb/hid/hiddev such as 'hiddev0' if UPS is
      connected by USB cable. Ensure hid device can be found at directory of
      /dev such as ttyS0 if UPS is connected by serial cable.
   e. Ensure Linux kernel version is more than 2.4.22 or 2.6. Ensure kernel
      module 'usbhid.ko' is loaded on system in kernel 2.4 and 'hid.o' in 
      kernel 2.6.
      
3. Can not installation or uninstallation
   a. Ensure user account is root, because the installation/uninstallation
      needs 'root' privilege to setup system.
   b. The target Linux may not work with our installation procedure, please
      refer to file doc/deploy-guide to get more detail information.

4. pwrstat have no function.
   a. Ensure pwrstatd is working.
   b. Ensure `prohibit-client-access' option is set as 'no' in pwrstatd 
      configuration file.
      
5. The pwrstatd daemon can not detect the UPS which has H2C USB adapter.
   a. Ensure linux system have libusb library. It can be found at /usr/lib
      directory.
   b. Ensure the libusb soname is libusb-0.1.so.4. 
   c. If libusb soname version is less than libusb-0.1.so.4, please go to 
      'rpmfind' or 'sourceforge' web site download the libusb rpm package
      and install it. The 'rpmfind' and 'sourceforge' download web site are
      shows as below:       
      *rpmfind web site, http://rpmfind.net
      *sourceforge web site, http://sourceforge.net
      