jacdac.power.client

Module Contents

Classes

PowerClient

A power-provider service.

class jacdac.power.client.PowerClient(bus: jacdac.bus.Bus, role: str, *, missing_current_draw_value: Optional[int] = None)

Bases: jacdac.bus.SensorClient

A power-provider service. Implements a client for the Power service.

property allowed Optional[bool]

Can be used to completely disable the service. When allowed, the service may still not be providing power, see power_status for the actual current state.,

property max_power Optional[int]

(Optional) Limit the power provided by the service. The actual maximum limit will depend on hardware. This field may be read-only in some implementations - you should read it back after setting., _: mA

property power_status Optional[jacdac.power.constants.PowerPowerStatus]

Indicates whether the power provider is currently providing power (Powering state), and if not, why not. Overprovision means there was another power provider, and we stopped not to overprovision the bus.,

property current_draw Optional[int]

(Optional) Present current draw from the bus., _: mA

property battery_voltage Optional[int]

(Optional) Voltage on input., _: mV

property battery_charge Optional[float]

(Optional) Fraction of charge in the battery., _: /

property battery_capacity Optional[int]

(Optional) Energy that can be delivered to the bus when battery is fully charged. This excludes conversion overheads if any., _: mWh

property keep_on_pulse_duration Optional[int]

(Optional) Many USB power packs need current to be drawn from time to time to prevent shutdown. This regulates how often and for how long such current is drawn. Typically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%., _: ms

property keep_on_pulse_period Optional[int]

(Optional) Many USB power packs need current to be drawn from time to time to prevent shutdown. This regulates how often and for how long such current is drawn. Typically a 1/8W 22 ohm resistor is used as load. This limits the duty cycle to 10%., _: ms

on_power_status_changed(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn

Emitted whenever power_status changes.

shutdown() None

Sent by the power service periodically, as broadcast.