A Raspberry Pi-powered Telegram bot that helps you track your daily water intake and sends timely reminders to stay hydrated. This system combines hardware reliability with user-friendly interaction through Telegram.
- π° Track daily water intake
- β° Hourly reminders during active hours
- π― Daily water intake goal tracking
- π Quiet hours support
- π₯ Multi-user support(sharing one common session)
- π Status updates and progress tracking
- π Automatic daily reset
- π€ Runs on Raspberry Pi
- π§ Auto-start capability
- π Comprehensive logging
- Raspberry Pi (any model with network connectivity)
- SD card (8GB+ recommended)
- Power supply for Raspberry Pi
- Internet connection
- Raspberry Pi OS
- Python 3.6+
requestslibrary- Telegram account
- Telegram Bot Token
-
Install Raspberry Pi OS:
# Update system sudo apt update && sudo apt upgrade -y # Install Python and pip if not present sudo apt install python3 python3-pip
-
Install Required Library:
pip3 install requests
-
Create a new bot:
- Open Telegram and search for "BotFather"
- Send
/newbotcommand - Follow prompts to name your bot
- Save the bot token provided
-
Get Your Chat ID:
- Start a chat with your new bot
- Send any message
- Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Find your chat ID in the response
-
Clone this repository:
git clone https://github.com/yourusername/hydrohub.git cd hydrohub -
Configure the bot:
nano water_reminder.py
-
Update these variables:
bot_token = 'YOUR_BOT_TOKEN' chat_ids = ['YOUR_CHAT_ID', 'ADDITIONAL_CHAT_ID'] # Add multiple IDs if needed daily_goal_liters = 2.5 # Adjust as needed
QUIET_HOURS_START = datetime.time(0, 0) # 12:00 AM
QUIET_HOURS_END = datetime.time(7, 30) # 7:30 AMdaily_goal_liters = 2.5 # Set your daily goal in literspython3 water_reminder.pynohup python3 water_reminder.py &-
Edit RC local file:
sudo nano /etc/rc.local
-
Add before
exit 0:python3 /home/pi/hydrohub/water_reminder.py & -
Reboot to test:
sudo reboot
- Send number (e.g.,
0.5) - Log water intake in liters /start- Get welcome message and instructions/status- Check current water intake status/reset- Reset daily intake to 0/clear- Clear chat history
- Midnight reset
- All users notified
- Progress tracking restarts
- Real-time progress updates
- Goal completion notifications
- Smart reminder system
- Synchronized updates
- Shared tracking
- Individual interaction
- File:
water_reminder.log - Detailed timestamps
- Error tracking
- Performance monitoring
- Store bot token securely
- Keep chat IDs private
- Use environment variables for sensitive data
- Regular system updates
- Monitor access logs
-
Bot Not Responding
# Check if process is running ps aux | grep water_reminder.py # Check logs tail -f water_reminder.log
-
Permission Issues
# Fix permissions chmod +x water_reminder.py -
Network Problems
# Test network ping api.telegram.org
- Fork the repository
- Create feature branch (
git checkout -b feature/NewFeature) - Commit changes (
git commit -m 'Add NewFeature') - Push to branch (
git push origin feature/NewFeature) - Open a Pull Request
- Telegram Bot API
- Raspberry Pi Foundation
- Python
requestslibrary contributors - Community feedback and contributions