A lightweight Linux-based Adhan automation system that:
- Fetches daily prayer times via API
- Plays Adhan automatically at each prayer time
- Plays a reminder 2 minutes before each prayer
- Works offline using cached prayer times
- Runs as a systemd service for 24/7 reliability
Designed to run on:
- Old laptops
- Raspberry Pi
- Linux home servers
- Automatic daily prayer time fetch (Aladhan API)
- Offline fallback using cached data
- 2-minute pre-Adhan reminder
- Systemd auto-start support
- Automatic daily refresh at 00:01
- Crash recovery (Restart=always)
- SSH CLI mode to check prayer times
adhan/
│
├── adhan.py
├── config.json
├── requirements.txt
├── logs/
│ └── cache.json
│
└── audio/
├── Adzan Mekkah.mp3
└── reminder.mp3
git clone https://github.com/YOUR_USERNAME/adhan-automation-server.git
cd adhan-automation-server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
sudo apt update
sudo apt install python3 python3-venv mpg123 alsa-utils
Edit:
config.json
Example JSON:
{
"city": "New Delhi",
"country": "India",
"method": 2
}
python3 adhan.py
Create:
/etc/systemd/system/adhan.service
Example:
[Unit]
Description=Adhan Player Service
After=network.target sound.target
[Service]
Type=simple
User=YOUR_USERNAME
WorkingDirectory=/home/YOUR_USERNAME/adhan-automation-server
ExecStart=/home/YOUR_USERNAME/adhan-automation-server/venv/bin/python /home/YOUR_USERNAME/adhan-automation-server/adhan.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Then:
sudo systemctl daemon-reload
sudo systemctl enable adhan
sudo systemctl start adhan
python adhan.py --show
python adhan.py --cached
- Uses
mpg123for playback - Ensure correct output device:
alsamixer