hammerspoon2-docs
    Preparing search index...

    Function batteryInfo

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

      Returns
          | {
              amperage: number
              | null;
              capacity: number | null;
              cycleCount: number | null;
              designCapacity: number | null;
              health: string;
              healthCondition: string | null;
              isCharged: boolean;
              isCharging: boolean;
              maxCapacity: number | null;
              percentage: number;
              serial: string | null;
              source: "unknown" | "ac" | "battery" | "ups";
              temperature: number | null;
              timeRemaining: number | null;
              timeToFullCharge: number | null;
              voltage: number | null;
              watts: number | null;
          }
          | null

      The battery's information, or null if no battery is present. Values are null if unavailable on the current hardware

      • {
            amperage: number | null;
            capacity: number | null;
            cycleCount: number | null;
            designCapacity: number | null;
            health: string;
            healthCondition: string | null;
            isCharged: boolean;
            isCharging: boolean;
            maxCapacity: number | null;
            percentage: number;
            serial: string | null;
            source: "unknown" | "ac" | "battery" | "ups";
            temperature: number | null;
            timeRemaining: number | null;
            timeToFullCharge: number | null;
            voltage: number | null;
            watts: number | null;
        }
        • amperage: number | null

          Current in milliamps (negative when discharging)

        • capacity: number | null

          Current capacity in mAh

        • cycleCount: number | null

          Charge cycle count

        • designCapacity: number | null

          Original design capacity in mAh

        • health: string

          Health string, e.g. "Good", or "Unknown"

        • healthCondition: string | null

          Health condition detail

        • isCharged: boolean

          Whether it's fully charged

        • isCharging: boolean

          Whether it's charging

        • maxCapacity: number | null

          Current maximum capacity in mAh

        • percentage: number

          Charge level 0–100, or -1 if unknown

        • serial: string | null

          Battery serial number

        • source: "unknown" | "ac" | "battery" | "ups"

          What the Mac is running on

        • temperature: number | null

          Temperature in °C

        • timeRemaining: number | null

          Estimated minutes remaining, or null if calculating

        • timeToFullCharge: number | null

          Estimated minutes to full charge, or null if not applicable

        • voltage: number | null

          Voltage in millivolts

        • watts: number | null

          Power in watts (negative when discharging)

      • null