Skip to content

Pondiniii/chargelimes

Repository files navigation

ChargeLimes βš‘πŸ”‹

Smart battery charging optimizer for Android

Automatically manage your phone's charging to extend battery lifespan by preventing overcharging and overheating.

License: MIT Android F-Droid


🎯 What is ChargeLimes?

ChargeLimes helps extend your phone's battery life by intelligently controlling charging based on:

  • Battery level (stop at X%, resume at Y%)
  • Temperature (stop charging when too hot)

πŸ”“ No Root Required!

This app does NOT need root access. Instead, it uses an external WiFi smart plug (like a power relay) between your charger and wall outlet. The app tells the smart plug when to turn ON/OFF power to your charger.

Simple setup:

[Wall Outlet] β†’ [WiFi Smart Plug] β†’ [Phone Charger] β†’ [Your Phone]
                      ↑
                 Controlled by app via WiFi

Why does this matter?

Lithium-ion batteries (used in all modern smartphones) degrade faster when:

  • βœ— Kept at 100% charge for extended periods
  • βœ— Charged in hot conditions (>30-35Β°C)
  • βœ— Subjected to high voltage stress

ChargeLimes prevents this by automatically stopping charging before hitting 100% and when temperature exceeds safe limits, significantly extending your battery's usable lifespan from ~2-3 years to 4-5+ years.


✨ Features

  • πŸ”‹ Battery-based charging control - Set custom charge start/stop levels
  • 🌑️ Temperature monitoring - Stop charging when phone gets too hot
  • πŸ“Š 24h history chart - Visual battery & temperature tracking
  • πŸ“ Detailed logs - See every charging decision and HTTP request
  • πŸ”Œ Smart plug integration - Works with Tasmota, Shelly, and other HTTP-controlled smart plugs
  • 🎨 Material You - Adapts to your Android theme
  • 🌍 Open Source - MIT licensed, community-driven

πŸ“± Screenshots

Status Screen Settings Screen Logs Screen
Status Settings Logs

Add screenshots to screenshots/ folder


πŸ“‹ Requirements

Hardware

  • Android phone (8.0 Oreo or later)
  • WiFi Smart Plug with HTTP control
    • βœ… Tasmota (recommended - what I use)
    • βœ… Shelly
    • βœ… Any smart plug with HTTP REST API

Software

  • Android 8.0+ (API 26+)
  • WiFi connection (for smart plug control)

πŸš€ Quick Start

Installation

F-Droid (Recommended)

# Coming soon - app will be available on F-Droid

Manual APK

  1. Download latest APK from Releases
  2. Install APK: adb install chargelimes-vX.X.X.apk
  3. Grant permissions (location for WiFi detection)

Setup

  1. Configure Smart Plug URLs

    • Settings β†’ Smart Plug Control
    • Enter your plug's ON/OFF URLs

    Example (Tasmota):

    Turn OFF: http://192.168.1.242/cm?cmnd=Power%20OFF
    Turn ON:  http://192.168.1.242/cm?cmnd=Power%20ON
    
  2. Set Charging Rules

    • Stop Charging: Battery reaches X% OR Temperature exceeds YΒ°C
    • Resume Charging: Battery drops to X% AND Temperature cools to YΒ°C
  3. Enable ChargeLimes

    • Toggle switch in Status screen
    • App runs as foreground service

πŸ› οΈ Development Setup

Prerequisites

  • Android Studio Hedgehog+ (2023.1.1)
  • JDK 17
  • Android SDK 35
  • Kotlin 1.9.0+

Clone & Build

git clone https://github.com/yourusername/chargelimes.git
cd chargelimes
./gradlew assembleDebug

Install to Device

# Via USB
./gradlew installDebug

# Via wireless ADB
adb connect 192.168.1.XXX:5555
./gradlew installDebug

Project Structure

chargelimes/
β”œβ”€β”€ app/
β”‚   └── src/main/
β”‚       β”œβ”€β”€ java/io/chargelimes/
β”‚       β”‚   β”œβ”€β”€ MainActivity.kt        # Main UI (Compose)
β”‚       β”‚   β”œβ”€β”€ BatteryService.kt      # Background service
β”‚       β”‚   β”œβ”€β”€ BatteryLogger.kt       # DataStore logging
β”‚       β”‚   └── BatteryData.kt         # Data models
β”‚       └── res/
β”‚           β”œβ”€β”€ values/strings.xml      # Localization
β”‚           └── drawable/               # Icons (Material You adaptive)
β”œβ”€β”€ screenshots/                        # App screenshots
β”œβ”€β”€ LICENSE                            # MIT License
└── README.md                          # This file

πŸ“ Architecture

Event-Driven, KISS Principle

  • MainActivity: Jetpack Compose UI with 3 tabs (Status/Settings/Logs)
  • BatteryService: Foreground service listening to ACTION_BATTERY_CHANGED
  • BatteryLogger: DataStore for 24h log retention
  • HTTP Client: OkHttp for smart plug control

Key Design Choices

  • βœ… Event-driven (not polling) - efficient battery usage
  • βœ… 2-second debounce - prevents oscillation at thresholds
  • βœ… DataStore (not SQLite) - simpler for logs
  • βœ… Material3 + Material You - native Android feel
  • βœ… No analytics, no tracking - privacy-first

πŸ”§ Configuration

Typical Settings

Stop Charging:
  Battery: 80%
  Temp: 35Β°C

Resume Charging:
  Battery: 70%
  Temp: 30Β°C

This keeps battery in optimal 70-80% range and prevents thermal stress.


πŸ› Troubleshooting

Smart Plug Not Responding

  1. Check URLs are correct (test in browser)
  2. Verify WiFi restriction setting (if enabled)
  3. Check Logs tab for HTTP errors

Service Stops After Phone Restart

  • Android battery optimization may kill service
  • Settings β†’ Apps β†’ ChargeLimes β†’ Battery β†’ Unrestricted

Unknown WiFi SSID (Android 13+)

  • Grant location permission (required for WiFi SSID access)

🀝 Contributing

Contributions welcome! Please:

  1. Fork repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“œ License

MIT License - see LICENSE file

TL;DR: Do whatever you want, just keep the copyright notice.


πŸ™ Acknowledgments

  • Built with Jetpack Compose
  • Icon design inspired by Material Design battery icons
  • Smart plug control tested with Tasmota

πŸ“ž Support


Made with ⚑ for battery longevity

About

Limit android 14 battery charge without root, by using simple tasmota smart wifi plug

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages