Battery#
import Yasb
Battery charge, charging state and time left, plus rate, voltage, capacity, temperature, cycle count and health
where the battery reports them. Updated every updateInterval.
BatteryMonitor#
Properties#
updateInterval : int#
Milliseconds between readings, 1000 to 60000.
Default: 5000
available : bool read-only#
true when the PC has a battery. Without one, data holds zeros and nulls.
data : object read-only#
percent: int, charge, 0 to 100.charging: bool,truewhile charging.pluggedIn: bool,truewhile on power.-
timeRemaining: int, time left in seconds.-1when Windows has no estimate.-2when there is no estimate and the PC is on power. -
timeUnknown: bool,truewhentimeRemainingis-1. timeUnlimited: bool,truewhentimeRemainingis-2.timeText: string, time left asH:MM:SS, such as"1:42:10".""without an estimate.timeNatural: string, time left in words.""without an estimate.rate: real, charge or discharge rate, in W.voltage: real, voltage, in V.capacity: int, current capacity, as the battery reports it.fullCapacity: int, capacity when full, same unit.designedCapacity: int, capacity when new, same unit.temperature: real, temperature in °C, one decimal.cycleCount: int, number of charge cycles.health: real,fullCapacityas a percent ofdesignedCapacity, one decimal.chemistry: string, battery chemistry, as the battery reports it.
Keys from rate down are null when the battery doesn't report them.
Functions#
refresh()#
Reads the battery now.
Used by#
YASB's own Battery widget, listed in Widgets.