Skip to main content

Get Battery & Charging Timeline

GET 

/api/v1/analytics/battery-charging

Battery status (percentage) over a time window. The server reads raw battery events from event_analytics, carries the last known value forward to seed the window start, tags each reading as charging (rising %) or discharging (falling %), and returns an ascending time series. When export=true the response is a CSV file download instead of JSON.

Request​

Query Parameters

    start_timestamp stringrequired

    Mandatory. Inclusive window start — ISO 8601 datetime or epoch milliseconds.

    end_timestamp stringrequired

    Mandatory. Inclusive window end — ISO 8601 datetime or epoch milliseconds.

    export string

    Possible values: [true, false]

    When true, returns a CSV file download (columns: timestamp, battery_percentage, status). When false or omitted, returns the standard JSON response.

Responses​

JSON battery timeline (default) or CSV file download (when export=true)

Schema
    success booleanrequired
    message stringrequired
    data objectrequired
    window objectrequired
    start stringrequired
    end stringrequired
    elapsed_ms numberrequired
    sample_count numberrequired
    charging_events numberrequired
    series object[]required
  • Array [
  • t stringrequired
    val numberrequired
    status stringrequired

    Possible values: [charging, discharging]

  • ]
  • status numberrequired
Loading...