Battery/power information All functions here may return nil, if the information requested is not available.
This module is based primarily on code from the previous incarnation of Mjolnir by Steven Degutis.
Signature | hs.battery._report() -> table |
---|---|
Type | Function |
Description | Returns a table containing all of the details concerning the Mac's powersource(s). |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/battery/battery.lua line 374 |
Signature | hs.battery.adapterSerialNumber() -> integer | string |
---|---|
Type | Function |
Description | Returns the serial number of the attached power supply, if present |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 323 |
Signature | hs.battery.amperage() -> number |
---|---|
Type | Function |
Description | Returns the amount of current flowing through the battery, in mAh |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 168 |
Signature | hs.battery.batterySerialNumber() -> string |
---|---|
Type | Function |
Description | Returns the serial number of the battery, if present |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 337 |
Signature | hs.battery.batteryType() -> string |
---|---|
Type | Function |
Description | Returns the type of battery present, or nil if there is no battery |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 309 |
Signature | hs.battery.capacity() -> number |
---|---|
Type | Function |
Description | Returns the current capacity of the battery in mAh |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/battery/battery.lua line 101 |
Signature | hs.battery.cycles() -> number |
---|---|
Type | Function |
Description | Returns the number of discharge cycles of the battery |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/battery/battery.lua line 53 |
Signature | hs.battery.designCapacity() -> number |
---|---|
Type | Function |
Description | Returns the design capacity of the battery in mAh. |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 118 |
Signature | hs.battery.getAll() -> table |
---|---|
Type | Function |
Description | Get all available battery information |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/battery/battery.lua line 351 |
Signature | hs.battery.health() -> string |
---|---|
Type | Function |
Description | Returns the health status of the battery. |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 209 |
Signature | hs.battery.healthCondition() -> string or nil |
---|---|
Type | Function |
Description | Returns the health condition status of the battery. |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 223 |
Signature | hs.battery.isCharged() -> boolean |
---|---|
Type | Function |
Description | Returns the charged state of the battery |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 267 |
Signature | hs.battery.isCharging() -> boolean |
---|---|
Type | Function |
Description | Returns the charging state of the battery |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 253 |
Signature | hs.battery.isFinishingCharge() -> boolean or string |
---|---|
Type | Function |
Description | Returns true if battery is finishing its charge |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 281 |
Signature | hs.battery.maxCapacity() -> number |
---|---|
Type | Function |
Description | Returns the maximum capacity of the battery in mAh |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/battery/battery.lua line 84 |
Signature | hs.battery.name() -> string |
---|---|
Type | Function |
Description | Returns the name of the battery |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 70 |
Signature | hs.battery.otherBatteryInfo() -> table |
---|---|
Type | Function |
Description | Returns information about non-PSU batteries (e.g. Bluetooth accessories) |
Parameters |
|
Returns |
|
Source | extensions/battery/libbattery.m line 110 |
Signature | hs.battery.percentage() -> number |
---|---|
Type | Function |
Description | Returns the current percentage of battery charge |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 132 |
Signature | hs.battery.powerSource() -> string |
---|---|
Type | Function |
Description | Returns the current source providing power |
Parameters |
|
Returns |
|
Source | extensions/battery/libbattery.m line 55 |
Signature | hs.battery.powerSourceType() -> string |
---|---|
Type | Function |
Description | Returns current power source type |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 295 |
Signature | hs.battery.privateBluetoothBatteryInfo() -> table |
---|---|
Type | Function |
Description | Returns information about Bluetooth devices using Apple Private APIs |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/battery/libbattery.m line 171 |
Signature | hs.battery.timeRemaining() -> number |
---|---|
Type | Function |
Description | Returns the battery life remaining, in minutes |
Parameters |
|
Returns |
|
Source | extensions/battery/libbattery.m line 33 |
Signature | hs.battery.timeToFullCharge() -> number |
---|---|
Type | Function |
Description | Returns the time remaining for the battery to be fully charged, in minutes |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 239 |
Signature | hs.battery.voltage() -> number |
---|---|
Type | Function |
Description | Returns the current voltage of the battery in mV |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 154 |
Signature | hs.battery.warningLevel() -> string |
---|---|
Type | Function |
Description | Returns a string specifying the current battery warning state. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/battery/libbattery.m line 80 |
Signature | hs.battery.watts() -> number |
---|---|
Type | Function |
Description | Returns the power entering or leaving the battery, in W |
Parameters |
|
Returns |
|
Source | extensions/battery/battery.lua line 185 |