mirror of
https://github.com/usetrmnl/trmnl-android.git
synced 2026-04-29 13:35:26 -07:00
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)
TRMNL API Specification
This directory contains the OpenAPI specification for the TRMNL API.
Resources
- OpenAPI Portal: https://trmnl.com/api-docs/index.html
- API Documentation: https://docs.trmnl.com/go
- Private API Docs: https://docs.trmnl.com/go/private-api/introduction
Files
trmnl-openapi.yaml- OpenAPI 3.0.1 specification exported from the TRMNL API portal
Authentication
The TRMNL API uses two authentication methods:
-
Device-level authentication - Uses
Access-Tokenheader with device API key- Implemented in
TrmnlApiService.kt - Used for device operations (display, setup, etc.)
- Implemented in
-
User-level authentication - Uses
Authorization: Bearerheader with account API key- Implemented in
TrmnlUserApiService.kt - Used for account operations (device management, plugin settings, etc.)
- Implemented in