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.amperage() -> number |
---|---|
Type | Function |
Description | Returns the amount of current flowing through the battery, in mAh Parameters:
Returns:
|
Signature | hs.battery.capacity() -> number |
---|---|
Type | Function |
Description | Returns the current capacity of the battery in mAh Parameters:
Returns:
Notes:
|
Signature | hs.battery.cycles() -> number |
---|---|
Type | Function |
Description | Returns the number of discharge cycles of the battery Parameters:
Returns:
Notes:
|
Signature | hs.battery.designCapacity() -> number |
---|---|
Type | Function |
Description | Returns the design capacity of the battery in mAh. Parameters:
Returns:
|
Signature | hs.battery.getAll() -> table |
---|---|
Type | Function |
Description | Get all available battery information Parameters:
Returns:
Notes:
|
Signature | hs.battery.health() -> string |
---|---|
Type | Function |
Description | Returns the health status of the battery. Parameters:
Returns:
|
Signature | hs.battery.healthCondition() -> string or nil |
---|---|
Type | Function |
Description | Returns the health condition status of the battery. Parameters:
Returns:
|
Signature | hs.battery.isCharged() -> boolean |
---|---|
Type | Function |
Description | Returns the charged state of the battery Parameters:
Returns:
|
Signature | hs.battery.isCharging() -> boolean |
---|---|
Type | Function |
Description | Returns the charging state of the battery Parameters:
Returns:
|
Signature | hs.battery.isFinishingCharge() -> boolean or string |
---|---|
Type | Function |
Description | Returns true if battery is finishing its charge Parameters:
Returns:
|
Signature | hs.battery.maxCapacity() -> number |
---|---|
Type | Function |
Description | Returns the maximum capacity of the battery in mAh Parameters:
Returns:
Notes:
|
Signature | hs.battery.name() -> string |
---|---|
Type | Function |
Description | Returns the name of the battery Parameters:
Returns:
|
Signature | hs.battery.otherBatteryInfo() -> table |
---|---|
Type | Function |
Description | Returns information about non-PSU batteries (e.g. bluetooth accessories) Parameters:
Returns:
|
Signature | hs.battery.percentage() -> number |
---|---|
Type | Function |
Description | Returns the current percentage of battery charge Parameters:
Returns:
|
Signature | hs.battery.powerSource() -> string |
---|---|
Type | Function |
Description | Returns current source of power Parameters:
Returns:
|
Signature | hs.battery.privateBluetoothBatteryInfo() -> table |
---|---|
Type | Function |
Description | Returns information about Bluetooth devices using Apple Private APIs Parameters:
Returns:
Notes:
|
Signature | hs.battery.psuSerial() -> integer |
---|---|
Type | Function |
Description | Returns the serial number of the attached power supply, if present Parameters:
Returns:
|
Signature | hs.battery.psuSerialString() -> string |
---|---|
Type | Function |
Description | Returns the serial string of the attached power supply, if present Parameters:
Returns:
|
Signature | hs.battery.timeRemaining() -> number |
---|---|
Type | Function |
Description | Returns the battery life remaining, in minutes Parameters:
Returns:
|
Signature | hs.battery.timeToFullCharge() -> number |
---|---|
Type | Function |
Description | Returns the time remaining for the battery to be fully charged, in minutes Parameters:
Returns:
|
Signature | hs.battery.voltage() -> number |
---|---|
Type | Function |
Description | Returns the current voltage of the battery in mV Parameters:
Returns:
|
Signature | hs.battery.watts() -> number |
---|---|
Type | Function |
Description | Returns the power entering or leaving the battery, in W Parameters:
Returns:
|