A beautiful, Apple-style minimalistic website with flashy animations that monitors voltage spikes and sends Telegram notifications when critical levels are detected.
- Minimalistic Interface: Clean, modern design inspired by Apple's aesthetic
- Real-time Monitoring: Live voltage graph with smooth animations
- Flashy Animations: GSAP-powered animations for voltage spikes
- Responsive Design: Works perfectly on desktop and mobile devices
- Dark Theme: Professional dark interface with glassmorphism effects
- Interactive Elements: Hover effects and smooth transitions
- Real-time Data Processing: Handles voltage data and spike detection
- Telegram Integration: Sends instant notifications to your phone
- RESTful API: Clean API endpoints for data exchange
- Error Handling: Robust error handling and logging
- Configurable Alerts: Customizable voltage thresholds and cooldowns
- Instant Alerts: Get notified immediately when voltage spikes occur
- Rich Formatting: Beautifully formatted messages with emojis and details
- Severity Levels: Different alert levels based on voltage magnitude
- Cooldown System: Prevents spam notifications
- Test Functionality: Easy testing of notification system
git clone <repository-url>
cd voltage-spike-monitorpip install -r requirements.txt- Open Telegram and search for
@BotFather - Send
/newbotcommand - Follow the instructions to create your bot
- Save the bot token (looks like:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz)
- Search for
@userinfobotin Telegram - Send any message to get your chat ID
- Save the chat ID (looks like:
123456789)
Windows:
set TELEGRAM_BOT_TOKEN=your_bot_token_here
set TELEGRAM_CHAT_ID=your_chat_id_heremacOS/Linux:
export TELEGRAM_BOT_TOKEN=your_bot_token_here
export TELEGRAM_CHAT_ID=your_chat_id_herepython app.pyThe application will be available at: http://localhost:5000
- Start BotFather: Open Telegram and search for
@BotFather - Create New Bot: Send
/newbot - Choose Name: Enter a name for your bot (e.g., "Voltage Monitor")
- Choose Username: Enter a unique username ending with 'bot' (e.g., "voltage_monitor_bot")
- Get Token: BotFather will give you a token - save it!
- Find UserInfoBot: Search for
@userinfobotin Telegram - Send Message: Send any message to the bot
- Get ID: The bot will reply with your chat ID
Once configured, you can test the Telegram integration:
curl http://localhost:5000/api/test-telegramEdit style.css to customize:
- Color scheme
- Animation timing
- Layout dimensions
- Typography
Modify app.js to adjust:
- Spike detection frequency
- Animation intensity
- Chart behavior
- Alert thresholds
Edit telegram_notifier.py to change:
# Voltage severity levels
if voltage >= 300:
severity = "CRITICAL"
elif voltage >= 280:
severity = "HIGH"
elif voltage >= 260:
severity = "MEDIUM"
else:
severity = "LOW"Adjust the cooldown period in telegram_notifier.py:
self.alert_cooldown = 300 # 5 minutes between alertsGET /- Main application interfaceGET /static/*- Static files (CSS, JS, images)
GET /api/status- System status and configurationPOST /api/telegram-alert- Send voltage spike alertGET /api/test-telegram- Test Telegram integrationGET /api/voltage-data- Get simulated voltage data
curl -X POST http://localhost:5000/api/telegram-alert \
-H "Content-Type: application/json" \
-d '{
"voltage": 295.5,
"area": "Istanbul, KadΔ±kΓΆy",
"timestamp": "2024-01-15T14:30:00Z"
}'curl http://localhost:5000/api/status- Live Updates: Voltage data updates every 200ms
- Smooth Animations: Chart.js with GSAP for fluid animations
- Spike Detection: Automatic detection of voltage spikes
- Visual Feedback: Color changes and animations during spikes
- Instant Notifications: Telegram messages sent immediately
- Rich Content: Formatted messages with severity levels
- Actionable Information: Clear instructions for users
- Spam Prevention: Cooldown system prevents notification spam
- Apple-Style Design: Clean, minimalistic interface
- Glassmorphism Effects: Modern blur and transparency effects
- Responsive Layout: Works on all screen sizes
- Interactive Elements: Hover effects and smooth transitions
voltage-spike-monitor/
βββ index.html # Main HTML file
βββ style.css # Apple-style CSS with animations
βββ app.js # Frontend JavaScript with Chart.js and GSAP
βββ app.py # Flask backend server
βββ telegram_notifier.py # Telegram notification system
βββ requirements.txt # Python dependencies
βββ README.md # This file
- Frontend: HTML5, CSS3, JavaScript (ES6+)
- Charts: Chart.js for real-time data visualization
- Animations: GSAP (GreenSock) for smooth animations
- Backend: Python Flask for API and server
- Notifications: Telegram Bot API
- Styling: Custom CSS with Apple-inspired design
- Chrome 80+
- Firefox 75+
- Safari 13+
- Edge 80+
- Environment Variables: Store sensitive data (bot tokens) in environment variables
- Input Validation: All API inputs are validated
- Error Handling: Comprehensive error handling prevents crashes
- Rate Limiting: Built-in cooldown prevents spam
- Check bot token and chat ID are correct
- Ensure bot is not blocked
- Verify internet connection
- Check console logs for errors
- Ensure Flask server is running
- Check browser console for JavaScript errors
- Verify all static files are accessible
- Check Chart.js CDN is accessible
- Verify canvas element exists
- Check JavaScript console for errors
Run with debug enabled:
export FLASK_ENV=development
python app.py- Database Integration: Store historical voltage data
- Multiple Areas: Monitor multiple locations simultaneously
- Advanced Analytics: Trend analysis and predictions
- Mobile App: Native mobile application
- Email Notifications: Additional notification methods
- WebSocket Support: Real-time bidirectional communication
- Machine Learning: Predictive voltage spike detection
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Chart.js for beautiful data visualization
- GSAP for smooth animations
- Telegram Bot API for instant notifications
- Apple Design Guidelines for UI inspiration
β‘ Stay safe and monitor your voltage! β‘