Skip to content

Frost-bit-star/battery-deamon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🔋 Battery Daemon for Termux

A lightweight battery monitoring daemon for Android (Termux) that runs continuously in the background, monitors battery health, temperature, drain, and sends real-time alerts — all from a single compiled binary.

Designed for developers, hackers, and power users who run long Termux sessions and want to protect battery health.


Screenshots

1. Battery Dashboard

Shows the TUI with battery status, health, trend, and smart advice. Dashboard

2. Logs View

Displays the detailed log entries collected by the daemon. Logs

3. Real-time Mobile Notifications

Example of battery alerts sent as notifications on your phone. Mobile Notifications

✨ Features

  • Runs as a background daemon
  • Battery health monitoring (GOOD, overheating, degradation)
  • Temperature monitoring with alerts
  • High drain detection
  • Low battery warnings
  • Android notifications via Termux:API
  • Simple CLI control:
    battery start | stop | status | logs

Compiled binary (no Python needed at runtime)

📦 Requirements

Android 8+ Termux (F-Droid recommended) Termux:API app (must be installed separately) Notification permission granted to Termux

⚠️ This tool does NOT require root.

🚀 Installation (From Source) Copy code Bash

apt install wget jq -y && \
wget https://raw.githubusercontent.com/Frost-bit-star/battery-deamon/main/src/battery -O $PREFIX/bin/battery && \
chmod +x $PREFIX/bin/battery

Install the binary system-wide: Copy code Bash cp dist/battery $PREFIX/bin/battery chmod +x $PREFIX/bin/battery

▶️ Usage

Before starting (important): Copy code Bash termux-wake-lock Start the daemon: Copy code Bash battery start Check status: Copy code Bash battery status View logs: Copy code Bash battery logs Stop the daemon: Copy code Bash battery stop 🔄 Auto-start on Boot (Optional) Install Termux:Boot from F-Droid Create startup script: Copy code Bash mkdir -p ~/.termux/boot nano ~/.termux/boot/battery.sh Copy code Bash #!/data/data/com.termux/files/usr/bin/bash termux-wake-lock battery start Copy code Bash

chmod +x ~/.termux/boot/battery.sh

Now the daemon starts automatically on device boot. 🧠 What This Tool Can & Cannot Do ✅ Can Monitor battery health Detect overheating Detect abnormal drain Prevent damage during heavy workloads Log battery behavior over time

❌ Cannot

Repair battery hardware Modify charging voltage Bypass Android power management Control kernel-level battery behavior This tool is monitoring & protection, not hardware modification. 📁 Project Structure


Copy code

battery-daemon/ ├── src/ │ └── battery.py ├── dist/ │ └── battery ├── build.sh ├── README.md └── .gitignore


🛠 Build Script

The build.sh script: Installs all dependencies automatically Installs PyInstaller Builds a single ARM-compatible binary Safe to re-run multiple times


⚠️ Known Limitations

Android may kill background processes without termux-wake-lock Some devices do not expose full battery metrics Notifications depend on Termux permission settings


📜 License

MIT License Feel free to use, modify, and distribute.


⭐ Contributing

Pull requests are welcome: Performance improvements New alert rules Logging enhancements Packaging for Termux


🙌 Acknowledgments

Termux Termux:API Android open battery interfaces 📢 Disclaimer This software is provided as-is, without warranty. Use at your own risk. Battery data accuracy depends on device manufacturer implementation.

About

Advanced Termux Battery Daemon with Smart TUI, Alerts, and Degradation Tracking. Monitors your device battery in the background, provides on-demand dashboard, notifications, and actionable advice for optimal battery health.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages