mjolnir._asm.sys.battery

Home: https://github.com/asmagill/mjolnir_asm.sys

Functions for getting battery info. 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.

amperage

mjolnir._asm.sys.battery.amperage() -> number

Returns the amperage of the battery in mA. (will be negative if battery is discharging)

capacity

mjolnir._asm.sys.battery.capacity() -> number

Returns the current capacity of the battery in mAh.

cycles

mjolnir._asm.sys.battery.cycles() -> number

Returns the number of cycles the connected battery has went through.

designcapacity

mjolnir._asm.sys.battery.designcapacity() -> number

Returns the design capacity of the battery in mAh.

get_all

mjolnir._asm.sys.battery.get_all() -> table

Iterates through all informational functions defined in this module and returns a table containing the current information. Useful if you want more than one piece of information at a given time.

health

mjolnir._asm.sys.battery.health() -> string

Returns the health status of the battery. One of {Good, Fair, Poor}

healthcondition

mjolnir._asm.sys.battery.healthcondition() -> string

Returns the health condition status of the battery. One of {Check Battery, Permanent Battery Failure}. Nil if there is no health condition set.

ischarged

mjolnir._asm.sys.battery.ischarged() -> boolean

Returns true if battery is charged.

ischarging

mjolnir._asm.sys.battery.ischarging() -> boolean

Returns true if the battery is charging.

isfinishingcharge

mjolnir._asm.sys.battery.isfinishingcharge() -> boolean

Returns true if battery is finishing charge.

maxcapacity

mjolnir._asm.sys.battery.maxcapacity() -> number

Returns the current maximum capacity of the battery in mAh.

name

mjolnir._asm.sys.battery.name() -> string

Returns the name of the battery.

percentage

mjolnir._asm.sys.battery.percentage() -> number

Returns the current percentage of the battery between 0 and 100.

powersource

mjolnir._asm.sys.battery.powersource() -> boolean

Returns current source of power. One of {AC Power, Battery Power, Off Line}.

timeremaining

mjolnir._asm.sys.battery.timeremaining() -> number

Returns the time remaining in minutes. Or a negative value: -1 = calculating time remaining, -2 = unlimited (i.e. you're charging, or apple has somehow discovered an infinite power source.)

timetofullcharge

mjolnir._asm.sys.battery.timetofullcharge() -> number

Returns the time remaining to a full charge in minutes. Or a negative value, -1 = calculating time remaining.

voltage

mjolnir._asm.sys.battery.voltage() -> number

Returns the voltage flow of the battery in mV.

watts

mjolnir._asm.sys.battery.watts() -> number

Returns the watts into or out of the battery in Watt (will be negative if battery is discharging)