hammerspoon2-docs
    Preparing search index...

    Function batteryInfo

    • Returns a snapshot of all available battery information, or null if no battery is present.

      The returned object contains (values may be null if unavailable on the current hardware):

      • percentage — charge level 0–100
      • isCharging — whether charging
      • isCharged — whether fully charged
      • source — "ac", "battery", "ups", or "unknown"
      • health — health string, e.g. "Good"
      • healthCondition — health condition detail, or null
      • cycleCount — charge cycle count
      • capacity — current capacity in mAh
      • maxCapacity — current maximum capacity in mAh
      • designCapacity — original design capacity in mAh
      • voltage — voltage in millivolts
      • amperage — current in milliamps (negative when discharging)
      • watts — power in watts (negative when discharging)
      • temperature — temperature in °C
      • timeRemaining — estimated minutes remaining, or null if calculating
      • timeToFullCharge — estimated minutes to full charge, or null if not applicable
      • serial — battery serial number

      Returns Record<string, any> | null

      An object with battery fields, or null if no battery is present.