Automated off-peak grid charging for your Tesla Powerwall.
PowerNight is a lightweight Docker-based application with a web interface that automates Tesla Powerwall backup reserve management. Schedule reserve percentage changes to optimize energy costs by charging from the grid during cheaper off-peak hours and discharging during expensive peak hours.
My Personal Use Case: Charge from grid overnight at low rates (in my case 0,16 EUR/kWh) and use the battery during peak hours (0,26 EUR/kWh).
- π Tesla Cloud Integration - Secure cloud authentication via Tesla.com
- ποΈ Intelligent Scheduling - Daily task execution at specified times with timezone support
- π Real-time Dashboard - Live Powerwall status, battery level, power flow visualization
- π Multi-Site Support - Manage multiple Powerwall installations (experimental)
- π³ Docker-First Design - Multi-stage builds, non-root user, security hardening
- ποΈ Multi-Architecture - Supports AMD64, ARM64, ARM/v7 (Raspberry Pi compatible)
- πΎ Persistent Storage - SQLite database with Docker volume mounting
- π Auto-Recovery - Circuit breaker pattern, exponential backoff, health monitoring
- π± Modern Web UI - React SPA with responsive design
- π Structured Logging - JSON logs with component filtering and real-time updates
Access the web interface at http://ip-address:8020 or http://localhost:8020.
Powerwall status with battery level, power flow, and system information
- System Information: Site name, ID, operating mode, battery level
- Power Data: Real-time grid, home, battery, solar power readings
- Grid Settings: Backup reserve percentage, grid charging status, export mode
- Last Updated: Timestamp of latest data fetch
Task management UI for scheduling backup reserve changes
- Task Management: Create, edit, delete scheduled tasks
- Manual Execution: Test tasks immediately
- Execution Tracking: View last execution time and status
Execution logs with timestamps and task results
- Structured Logging: JSON-formatted logs with filtering
- Real-time Updates: Auto-refresh for live monitoring
Tesla Account configuration, site selection, and timezone settings
- Tesla Cloud Configuration: Authorize and manage Tesla Access
- Site Selection: Switch between multiple Powerwall installations
- Timezone Configuration: Set scheduling timezone
- System Information: Version, build date, runtime environment
PowerNight CLI commands
# Get Powerwall status
powernight status-
Install & Run PowerNight Docker Container
docker run -d \ --name PowerNight \ -p 8020:8020 \ -v ./PowerNight-Data:/data \ zaaicom/powernight:latest
-
Open web interface Navigate to http://localhost:8020 in your browser
-
Set your Timezone under Settings Navigate to Settings β Configure your local timezone
-
Authenticate with your Tesla account on the Settings page Click "Authorize with Tesla" and complete OAuth flow
-
Check Powerwall data on the Dashboard and compare with the Tesla Mobile App Verify battery level, power flow, and operating mode match
-
Create your tasks under Planner Navigate to Planner β Add tasks with time and reserve percentage
-
Start a manual task execution Test a task immediately to verify connectivity
-
Verify successful execution on the History page Check execution logs for success/error status
Docker Hub is recommended for most users, especially Synology NAS deployments.
# Run with volume mount (IMPORTANT for data persistence)
docker run -d \
--name PowerNight \
-p 8020:8020 \
-v ./PowerNight-Data:/data \
zaaicom/powernight:latest-v ./PowerNight-Data:/data) to persist OAuth tokens, database, and configuration. Without volumes, data is lost after container restart.
Alternative registry hosted on GitHub Packages.
# Pull from GHCR
docker pull ghcr.io/zaai-com/powernight:latest
# Run with volume mount
docker run -d \
--name PowerNight \
-p 8020:8020 \
-v ./PowerNight-Data:/data \
ghcr.io/zaai-com/powernight:latestRecommended for production deployments - ensures persistent volumes are always configured.
-
Download
docker-compose.ymlfile -
Start the application:
docker-compose up -dOptimized for Synology DSM Docker integration:
-
Install Synology Container Manager from Package Center
-
Create Folder
/docker/PowerNight-Datavia File Station and add Read&Write permission to 'SYSTEM' user -
Pull image from Docker Hub via Synology DSM UI: Go to Registry tab β Search for
zaaicom/powernightβ Downloadlatesttag -
Create container with:
- Port Settings: Local Port 8020 β Container Port 8020
- Volume:
/docker/PowerNight-Dataβ/data - Auto-restart: Enable
-
Access via
http://synology-ip:8020 -
Additional Synology Notes
- Docker Hub recommended (native DSM UI integration)
- GHCR requires manual pull via SSH
- Use Synology Task Scheduler for automatic updates
- Consider DSM Firewall rules for access control
For contributors and developers:
# Clone repository
git clone https://github.com/ZAAI-com/PowerNight.git
cd PowerNight
# Install Python dependencies
pip install -e ".[dev]"
# Install Node.js dependencies
npm install
# Build frontend (with version metadata)
./build.sh --no-docker
# Run application
python -m powernight.mainAccess at http://localhost:8020
PowerNight is designed for trusted local networks only
- π Local Network Only: Deploy within your home/private network behind a firewall
- π Web UI Access: The web interface is NOT password protected
- β Do NOT expose to internet: Never expose port 8020 directly to the public internet
- π Network Security Required: Use firewall rules, VPN, or reverse proxy for access control
Warning: Exposing PowerNight to the internet without additional security could allow unauthorized control of your Tesla Powerwall.
For detailed security guidance, see SECURITY.md.
Why Volumes Are Critical:
docker runWITHOUT-vβ Data lost on container restart- Tokens stored in
/dataβ Re-authentication required - SQLite database in
/dataβ All schedules lost
Data Backup:
# Backup entire data directory
tar -czf powernight-backup-$(date +%Y%m%d).tar.gz PowerNight-Data/
# Restore from backup
tar -xzf powernight-backup-20251022.tar.gz# Complete build with Docker image
./build.sh
# Build without Docker (faster for development)
./build.sh --no-docker
# Frontend only (version info won't update - NOT RECOMMENDED)
npm run buildBuild Script Features:
- Generates fresh build timestamp (UTC)
- Creates
version-info.jsonwith build metadata - Copies version info to
dist/for web access - Builds frontend with Vite
- Optionally builds Docker image with OCI labels
For troubleshooting common issues, debugging, and log analysis, see FAQ.md.
- MIT License - Copyright (c) 2025 Manuel Gruber
- See LICENSE.md for full license text.
- PyPowerwall: jasonacox/pypowerwall - Tesla Powerwall API library
- Flask: Web framework for Python
- React: Frontend library
- Vite: Frontend build tool
- Tailwind CSS: Utility-first CSS framework
Made with β‘ by Manuel
GitHub: ZAAI-com/PowerNight | Docker Hub: zaaicom/powernight | GHCR: ghcr.io/zaai-com/powernight



