hub.battery

The hub’s own battery: how full it is and whether it is charging.

Values update about every 2 seconds.

Attributes

CHARGING

plugged in and charging.

FULLY_CHARGED

plugged in and the battery is full.

ON_BATTERY

running on battery, no charger plugged in.

UNKNOWN

not known yet.

Functions

charging() → bool

True while the battery is charging.

fully_charged() → bool

True when a charger is plugged in and the battery is full.

percent() → int

How full the battery is, from 0 to 100 %.

state() → int

What the battery is doing: UNKNOWN, ON_BATTERY, CHARGING or FULLY_CHARGED.

voltage() → int

Battery voltage in millivolts (1000 mV = 1 V). 0 if it can't be measured.

Module Contents

hub.battery.charging() → bool[source]

True while the battery is charging.

hub.battery.fully_charged() → bool[source]

True when a charger is plugged in and the battery is full.

hub.battery.percent() → int[source]

How full the battery is, from 0 to 100 %.

hub.battery.state() → int[source]

What the battery is doing: UNKNOWN, ON_BATTERY, CHARGING or FULLY_CHARGED.

hub.battery.voltage() → int[source]

Battery voltage in millivolts (1000 mV = 1 V). 0 if it can’t be measured.

hub.battery.CHARGING: int[source]

plugged in and charging.

Type:

State

hub.battery.FULLY_CHARGED: int[source]

plugged in and the battery is full.

Type:

State

hub.battery.ON_BATTERY: int[source]

running on battery, no charger plugged in.

Type:

State

hub.battery.UNKNOWN: int[source]

not known yet.

Type:

State