org.freedesktop.UPower.Device: UPower Reference Manual

## org.freedesktop.UPower.Device org.freedesktop.UPower.Device — Device interface |

## Methods

    Refresh       ()
    GetHistory    (in  's'      type,
                   in  'u'      timespan,
                   in  'u'      resolution,
                   out 'a(udu)' data)
    GetStatistics (in  's'      type,
                   out 'a(dd)'  data)

## Implemented Interfaces

Objects implementing org.freedesktop.UPower.Device also implements org.freedesktop.DBus.Introspectable, org.freedesktop.DBus.Properties

## Properties

    'NativePath'       read      's'
    'Vendor'           read      's'
    'Model'            read      's'
    'Serial'           read      's'
    'UpdateTime'       read      't'
    'Type'             read      'u'
    'PowerSupply'      read      'b'
    'HasHistory'       read      'b'
    'HasStatistics'    read      'b'
    'Online'           read      'b'
    'Energy'           read      'd'
    'EnergyEmpty'      read      'd'
    'EnergyFull'       read      'd'
    'EnergyFullDesign' read      'd'
    'EnergyRate'       read      'd'
    'Voltage'          read      'd'
    'Luminosity'       read      'd'
    'TimeToEmpty'      read      'x'
    'TimeToFull'       read      'x'
    'Percentage'       read      'd'
    'Temperature'      read      'd'
    'IsPresent'        read      'b'
    'State'            read      'u'
    'IsRechargeable'   read      'b'
    'Capacity'         read      'd'
    'Technology'       read      'u'
    'WarningLevel'     read      'u'
    'BatteryLevel'     read      'u'
    'IconName'         read      's'

## Description

Objects implementing this interface are usually discovered through the `org.freedesktop.UPower` interface on the `/org/freedesktop/UPower` object on the D-Bus system bus service with the well-known name `org.freedesktop.UPower` using the `EnumerateDevices` method.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    $ dbus-send --print-reply \
                --system \
                --dest=org.freedesktop.UPower \
                /org/freedesktop/UPower/devices/battery_BAT0 \
                org.freedesktop.DBus.Properties.GetAll \
                string:org.freedesktop.UPower.Device

    method return sender=:1.386 -> dest=:1.477 reply_serial=2
       array [
          dict entry(
             string "native-path"
             variant             string "/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0"
          )
          dict entry(
             string "vendor"
             variant             string "SONY"
          )
          dict entry(
             string "model"
             variant             string "42T4568"
          )
          dict entry(
             string "serial"
             variant             string "4179"
          )
          dict entry(
             string "update-time"
             variant             uint64 1226417875
          )
          dict entry(
             string "type"
             variant             uint 2
          )
          dict entry(
             string "power-supply"
             variant             boolean true
          )
          dict entry(
             string "has-history"
             variant             boolean true
          )
          dict entry(
             string "has-statistics"
             variant             boolean true
          )
          dict entry(
             string "online"
             variant             boolean false
          )
          dict entry(
             string "energy"
             variant             double 72.85
          )
          dict entry(
             string "energy-empty"
             variant             double 0
          )
          dict entry(
             string "energy-full"
             variant             double 74.55
          )
          dict entry(
             string "energy-full-design"
             variant             double 74.88
          )
          dict entry(
             string "energy-rate"
             variant             double 0
          )
          dict entry(
             string "voltage"
             variant             double 16.415
          )
          dict entry(
             string "time-to-empty"
             variant             int64 0
          )
          dict entry(
             string "time-to-full"
             variant             int64 0
          )
          dict entry(
             string "percentage"
             variant             double 97.7197
          )
          dict entry(
             string "is-present"
             variant             boolean true
          )
          dict entry(
             string "state"
             variant             uint 3
          )
          dict entry(
             string "is-rechargeable"
             variant             boolean true
          )
          dict entry(
             string "capacity"
             variant             double 100
          )
          dict entry(
             string "technology"
             variant             uint 1
          )
       ]

Unless otherwise noted, an empty string or the value 0 in a property on this interface means not set.

## Details

### Refresh ()

    Refresh ()

Refreshes the data collected from the power source.

#### Errors

`org.freedesktop.UPower.Device.GeneralError`: | if an error occured while refreshing

#### Permissions

Callers need the org.freedesktop.upower.refresh-power-source authorization

### GetHistory ()

    GetHistory (in  's'      type,
                in  'u'      timespan,
                in  'u'      resolution,
                out 'a(udu)' data)

Gets history for the power device that is persistent across reboots.

`type`: | The type of history. Valid types are `rate` or `charge`.
`timespan`: | The amount of data to return in seconds, or 0 for all.
`resolution`: | The approximate number of points to return. A higher resolution is more accurate, at the expense of plotting speed.
`data`: | The history data for the power device, if the device supports history. Data is ordered from the earliest in time, to the newest data point. Each element contains the following members: time: The time value in seconds from the `gettimeofday()` method. value: The data value, for instance the rate in W or the charge in %. state: The state of the device, for instance `charging` or `discharging`.

### GetStatistics ()

    GetStatistics (in  's'     type,
                   out 'a(dd)' data)

Gets statistics for the power device that may be interesting to show on a graph in the session.

`type`: | The mode for the statistics. Valid types are `charging` or `discharging`.
`data`: | The statistics data for the power device. Each element contains the following members: value: The value of the percentage point, usually in seconds accuracy: The accuracy of the prediction in percent.

## Property Details

### The "NativePath" property

    'NativePath'  read      's'

OS specific native path of the power source. On Linux this is the sysfs path, for example `/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0`. Is blank if the device is being driven by a user space driver.

### The "Vendor" property

    'Vendor'  read      's'

Name of the vendor of the battery.

### The "Model" property

    'Model'  read      's'

Name of the model of this battery.

### The "Serial" property

    'Serial'  read      's'

Unique serial number of the battery.

### The "UpdateTime" property

    'UpdateTime'  read      't'

The point in time (seconds since the Epoch Jan 1, 1970 0:00 UTC) that data was read from the power source.

### The "Type" property

    'Type'  read      'u'

Type of power source.

- 0: Unknown
- 1: Line Power
- 2: Battery
- 3: Ups
- 4: Monitor
- 5: Mouse
- 6: Keyboard
- 7: Pda
- 8: Phone

If the value is set to "Battery", you will need to verify that the property `power-supply` has the value "true" before considering it as a laptop battery. Otherwise it will likely be the battery for a device of an unknown type.

### The "PowerSupply" property

    'PowerSupply'  read      'b'

If the power device is used to supply the system. This would be set TRUE for laptop batteries and UPS devices, but set FALSE for wireless mice or PDAs.

### The "HasHistory" property

    'HasHistory'  read      'b'

If the power device has history.

### The "HasStatistics" property

    'HasStatistics'  read      'b'

If the power device has statistics.

### The "Online" property

    'Online'  read      'b'

Whether power is currently being provided through line power. This property is only valid if the property `type` has the value "line-power".

### The "Energy" property

    'Energy'  read      'd'

Amount of energy (measured in Wh) currently available in the power source.

This property is only valid if the property `type` has the value "battery".

### The "EnergyEmpty" property

    'EnergyEmpty'  read      'd'

Amount of energy (measured in Wh) in the power source when it's considered to be empty.

This property is only valid if the property `type` has the value "battery".

### The "EnergyFull" property

    'EnergyFull'  read      'd'

Amount of energy (measured in Wh) in the power source when it's considered full.

This property is only valid if the property `type` has the value "battery".

### The "EnergyFullDesign" property

    'EnergyFullDesign'  read      'd'

Amount of energy (measured in Wh) the power source is designed to hold when it's considered full.

This property is only valid if the property `type` has the value "battery".

### The "EnergyRate" property

    'EnergyRate'  read      'd'

Amount of energy being drained from the source, measured in W. If positive, the source is being discharged, if negative it's being charged.

This property is only valid if the property `type` has the value "battery".

### The "Voltage" property

    'Voltage'  read      'd'

Voltage in the Cell or being recorded by the meter.

### The "Luminosity" property

    'Luminosity'  read      'd'

Luminosity being recorded by the meter.

### The "TimeToEmpty" property

    'TimeToEmpty'  read      'x'

Number of seconds until the power source is considered empty. Is set to 0 if unknown.

This property is only valid if the property `type` has the value "battery".

### The "TimeToFull" property

    'TimeToFull'  read      'x'

Number of seconds until the power source is considered full. Is set to 0 if unknown.

This property is only valid if the property `type` has the value "battery".

### The "Percentage" property

    'Percentage'  read      'd'

The amount of energy left in the power source expressed as a percentage between 0 and 100. Typically this is the same as (`energy` - `energy-empty`) / (`energy-full` - `energy-empty`). However, some primitive power sources are capable of only reporting percentages and in this case the energy-* properties will be unset while this property is set.

This property is only valid if the property `type` has the value "battery".

The percentage will be an approximation if the `battery level` is set to something other than None. The percentage is kept for compatibility reasons.

### The "Temperature" property

    'Temperature'  read      'd'

The temperature of the device in degrees Celsius. This property is only valid if the property `type` has the value "battery".

### The "IsPresent" property

    'IsPresent'  read      'b'

If the power source is present in the bay. This field is required as some batteries are hot-removable, for example expensive UPS and most laptop batteries.

This property is only valid if the property `type` has the value "battery".

### The "State" property

    'State'  read      'u'

The battery power state.

- 0: Unknown
- 1: Charging
- 2: Discharging
- 3: Empty
- 4: Fully charged
- 5: Pending charge
- 6: Pending discharge

This property is only valid if the property `type` has the value "battery".

### The "IsRechargeable" property

    'IsRechargeable'  read      'b'

If the power source is rechargeable.

This property is only valid if the property `type` has the value "battery".

### The "Capacity" property

    'Capacity'  read      'd'

The capacity of the power source expressed as a percentage between 0 and 100. The capacity of the battery will reduce with age. A capacity value less than 75% is usually a sign that you should renew your battery. Typically this value is the same as (`full-design` / `full`) * 100. However, some primitive power sources are not capable reporting capacity and in this case the capacity property will be unset.

This property is only valid if the property `type` has the value "battery".

### The "Technology" property

    'Technology'  read      'u'

Technology used in the battery:

- 0: Unknown
- 1: Lithium ion
- 2: Lithium polymer
- 3: Lithium iron phosphate
- 4: Lead acid
- 5: Nickel cadmium
- 6: Nickel metal hydride

This property is only valid if the property `type` has the value "battery".

### The "WarningLevel" property

    'WarningLevel'  read      'u'

Warning level of the battery:

- 0: Unknown
- 1: None
- 2: Discharging (only for UPSes)
- 3: Low
- 4: Critical
- 5: Action

### The "BatteryLevel" property

    'BatteryLevel'  read      'u'

The level of the battery for devices which do not report a percentage but rather a coarse battery level. If the value is None, then the device does not support coarse battery reporting, and the percentage should be used instead.

- 0: Unknown
- 1: None (the battery does not use a coarse level of battery reporting)
- 3: Low
- 4: Critical
- 6: Normal
- 7: High
- 8: Full

### The "IconName" property

    'IconName'  read      's'

An icon name, following the Icon Naming Specification Note that the icons might not match end-user expectations in terms of presentation relative to the amount of battery left or perceived to be left. It is recommended that front-ends use the BatteryLevel property first, if available, followed by the Percentage, to present a more realistic battery level to the user.