Instantaneous electrical state of a measured circuit, bus, or device.
Published by power-monitor chips (e.g. INA219, INA226) and any device that exposes voltage and current as part of its normal telemetry (e.g. Robotis or Feetech servos reporting their own draw).
This is a raw electrical snapshot. Battery-aware concepts like
state-of-charge, percentage, or health belong in
BB.Message.Sensor.BatteryState and are the job of a downstream
consumer that subscribes to PowerState and maintains charge state.
Fields
voltage- Bus voltage in Voltscurrent- Current in Amperes (signed; sign convention is producer-defined, typically positive = flowing in the measured direction)power- Power in Watts, ornilif the producer doesn't measure itshunt_voltage- Shunt voltage in Volts, ornilif not exposed (diagnostic)
Examples
alias BB.Message.Sensor.PowerState
{:ok, msg} = PowerState.new(:battery_bus,
voltage: 12.4,
current: 0.85,
power: 10.54
)
Summary
Types
Functions
@spec new( atom(), keyword() ) :: {:ok, BB.Message.t()} | {:error, term()}