Files
Hossain Khan 0614f59ff9 feat: migrate battery reporting to Percent-Charged header
Replace complex user-level battery reporting (PATCH /api/devices/{id}) with
simplified device-level Percent-Charged header sent with image fetch requests.

Changes:
- Add percentCharged parameter to TrmnlApiService.getNextDisplayData()
- Update TrmnlDisplayRepository to send battery for BYOD devices only
- Deprecate reportDeviceBatteryStatus() and getDeviceIdFromApi() methods
- Remove battery reporting call from TrmnlImageRefreshWorker
- Disable user API token UI in AppSettingsScreen (100+ lines)
- Deprecate TrmnlUserApiService and TrmnlDeviceUpdateRequest
- Deprecate userApiToken and deviceId in TrmnlDeviceConfig
- Deprecate DataStore methods for user token and device ID
- Add 4 new battery percentage header tests
- Ignore 6 deprecated battery/device ID tests
- Update existing RSSI tests to include percentCharged parameter

Benefits:
- Simpler: No separate API call needed
- Secure: Uses device-level auth only (no user token required)
- Consistent: Follows same pattern as RSSI header
- BYOD-only: Battery reporting limited to BYOD devices as designed

All changes maintain backward compatibility with deprecated code preserved.

Verified with:
- formatKotlin:  (0 errors)
- lintKotlin:  (0 errors)
- testDebugUnitTest:  (203 passed, 9 skipped)
- assembleDebug:  (APK built successfully)
2026-02-05 19:37:50 -05:00
..

TRMNL API Specification

This directory contains the OpenAPI specification for the TRMNL API.

Resources

Files

  • trmnl-openapi.yaml - OpenAPI 3.0.1 specification exported from the TRMNL API portal

Authentication

The TRMNL API uses two authentication methods:

  1. Device-level authentication - Uses Access-Token header with device API key

    • Implemented in TrmnlApiService.kt
    • Used for device operations (display, setup, etc.)
  2. User-level authentication - Uses Authorization: Bearer header with account API key

    • Implemented in TrmnlUserApiService.kt
    • Used for account operations (device management, plugin settings, etc.)