#hs.battery
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.
#Submodules
#API Overview
Functions - API calls offered directly by the extension
- _report
- adapterSerialNumber
- amperage
- batterySerialNumber
- batteryType
- capacity
- cycles
- designCapacity
- getAll
- health
- healthCondition
- isCharged
- isCharging
- isFinishingCharge
- maxCapacity
- name
- otherBatteryInfo
- percentage
- powerSource
- powerSourceType
- privateBluetoothBatteryInfo
- timeRemaining
- timeToFullCharge
- voltage
- warningLevel
- watts
#API Documentation
#Functions
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 |
|
Examples | None |
Source | extensions/battery/battery.lua line 365 |
Signature | hs.battery.adapterSerialNumber() -> integer | string |
Type | Function |
Description | Returns the serial number of the attached power supply, if present |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 314 |
Signature | hs.battery.amperage() -> number |
Type | Function |
Description | Returns the amount of current flowing through the battery, in mAh |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 159 |
Signature | hs.battery.batterySerialNumber() -> string |
Type | Function |
Description | Returns the serial number of the battery, if present |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 328 |
Signature | hs.battery.batteryType() -> string |
Type | Function |
Description | Returns the type of battery present, or nil if there is no battery |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 300 |
Signature | hs.battery.capacity() -> number |
Type | Function |
Description | Returns the current capacity of the battery in mAh |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/battery/battery.lua line 92 |
Signature | hs.battery.cycles() -> number |
Type | Function |
Description | Returns the number of discharge cycles of the battery |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/battery/battery.lua line 44 |
Signature | hs.battery.designCapacity() -> number |
Type | Function |
Description | Returns the design capacity of the battery in mAh. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 109 |
Signature | hs.battery.getAll() -> table |
Type | Function |
Description | Get all available battery information |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/battery/battery.lua line 342 |
Signature | hs.battery.health() -> string |
Type | Function |
Description | Returns the health status of the battery. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 200 |
Signature | hs.battery.healthCondition() -> string or nil |
Type | Function |
Description | Returns the health condition status of the battery. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 214 |
Signature | hs.battery.isCharged() -> boolean |
Type | Function |
Description | Returns the charged state of the battery |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 258 |
Signature | hs.battery.isCharging() -> boolean |
Type | Function |
Description | Returns the charging state of the battery |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 244 |
Signature | hs.battery.isFinishingCharge() -> boolean or string |
Type | Function |
Description | Returns true if battery is finishing its charge |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 272 |
Signature | hs.battery.maxCapacity() -> number |
Type | Function |
Description | Returns the maximum capacity of the battery in mAh |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/battery/battery.lua line 75 |
Signature | hs.battery.name() -> string |
Type | Function |
Description | Returns the name of the battery |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 61 |
Signature | hs.battery.otherBatteryInfo() -> table |
Type | Function |
Description | Returns information about non-PSU batteries (e.g. Bluetooth accessories) |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/libbattery.m line 110 |
Signature | hs.battery.percentage() -> number |
Type | Function |
Description | Returns the current percentage of battery charge |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 123 |
Signature | hs.battery.powerSource() -> string |
Type | Function |
Description | Returns the current source providing power |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/libbattery.m line 55 |
Signature | hs.battery.powerSourceType() -> string |
Type | Function |
Description | Returns current power source type |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 286 |
Signature | hs.battery.privateBluetoothBatteryInfo() -> table |
Type | Function |
Description | Returns information about Bluetooth devices using Apple Private APIs |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | extensions/battery/libbattery.m line 171 |
Signature | hs.battery.timeRemaining() -> number |
Type | Function |
Description | Returns the battery life remaining, in minutes |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
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 |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 230 |
Signature | hs.battery.voltage() -> number |
Type | Function |
Description | Returns the current voltage of the battery in mV |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 145 |
Signature | hs.battery.warningLevel() -> string |
Type | Function |
Description | Returns a string specifying the current battery warning state. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
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 |
|
Notes | None |
Examples | None |
Source | extensions/battery/battery.lua line 176 |