Common Issues - xante8088/kasa-monitor GitHub Wiki
Quick solutions to frequently encountered problems with Kasa Monitor.
Error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock
Solution:
# Start Docker service
sudo systemctl start docker
# Add user to docker group
sudo usermod -aG docker $USER
# Log out and back in
exitError:
Error: bind: address already in use :3000
Solution:
# Find process using port
sudo lsof -i :3000
# OR
sudo netstat -tulpn | grep 3000
# Kill process
sudo kill -9 <PID>
# Or change port in docker-compose.yml
ports:
- "3001:3000" # Use different portError:
Permission denied: '/app/data/kasa_monitor.db'
Solution:
# Fix volume permissions
docker exec kasa-monitor chown -R appuser:appuser /app/data
# Or recreate volume
docker volume rm kasa_data
docker-compose up -dProblem: Discovery returns 0 devices
Solutions:
- Check network mode:
# Verify using host or macvlan
docker inspect kasa-monitor | grep NetworkMode- Allow UDP broadcasts:
sudo ufw allow 9999/udp- Verify same network:
# In container
docker exec kasa-monitor ip addr
# Should be same subnet as devices- Use manual entry:
- Settings → Device Management
- Add Device Manually
- Enter IP address
Problem: Devices appear but show as offline
Solutions:
- Check device power:
- Ensure device is plugged in
- Verify device LED is on
- Test connectivity:
docker exec kasa-monitor ping <device-ip>- Reset device:
- Hold reset button 10 seconds
- Re-configure via Kasa app
- Re-add to Kasa Monitor
- Check firewall:
sudo iptables -L | grep DROPProblem: Devices discovered initially but stop responding
Solution:
# Restart discovery service
docker restart kasa-monitor
# Clear device cache
docker exec kasa-monitor rm /app/data/device_cache.json
# Increase timeout
environment:
- DISCOVERY_TIMEOUT=10Problem: Setup page doesn't appear or errors
Solutions:
- Clear database:
docker exec kasa-monitor rm /app/data/kasa_monitor.db
docker restart kasa-monitor- Check API connectivity:
curl http://localhost:5272/api/auth/setup-required- View logs:
docker logs kasa-monitor --tail 50Problem: After login, redirected back to login page
Solutions:
- Clear browser data:
- Clear cookies for localhost
- Clear localStorage
- Try incognito mode
- Check token storage:
// In browser console
localStorage.getItem('token')- Verify API response:
# Test login endpoint
curl -X POST http://localhost:5272/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"password"}'Problem: Cannot log in as admin
Solution:
# Stop container
docker stop kasa-monitor
# Reset database
docker run --rm -v kasa_data:/data alpine \
rm /data/kasa_monitor.db
# Restart
docker start kasa-monitor
# Go to /setup to create new adminProblem: Container using excessive CPU
Solutions:
- Reduce polling frequency:
environment:
- POLLING_INTERVAL=120 # 2 minutes instead of 1- Limit device count:
- Remove unused devices
- Disable monitoring for idle devices
- Set resource limits:
deploy:
resources:
limits:
cpus: '1.0'
memory: 1GProblem: Container consuming too much RAM
Solutions:
- For Node.js:
environment:
- NODE_OPTIONS=--max-old-space-size=512- Reduce data retention:
environment:
- DATA_RETENTION_DAYS=30 # Instead of 365- Use InfluxDB for storage:
- Offload time-series data
- Better compression
- Automatic downsampling
Problem: Dashboard loads slowly
Solutions:
- Clear browser cache:
- Ctrl+Shift+R (hard refresh)
- Clear site data
- Reduce dashboard devices:
- Filter to show only active
- Group by rooms
- Paginate results
- Check network latency:
# From browser machine
ping <docker-host-ip>Problem: Power values seem wrong
Solutions:
- Calibrate device:
# If device supports calibration
device.set_calibration_values(
voltage=120,
current=1.0,
power=120
)- Update firmware:
- Use Kasa mobile app
- Check for updates
- Install and restart
- Verify with kill-a-watt:
- Compare readings
- Adjust calibration factor
Problem: Gaps in graphs
Solutions:
- Check polling status:
docker logs kasa-monitor | grep "Polling"- Verify database writes:
docker exec kasa-monitor sqlite3 /app/data/kasa_monitor.db \
"SELECT COUNT(*) FROM readings WHERE date > datetime('now', '-1 day');"- Check disk space:
docker exec kasa-monitor df -h /app/dataProblem: Costs don't match expectations
Solutions:
- Verify rate configuration:
- Settings → Electricity Rates
- Compare with utility bill
- Include all fees/taxes
- Check time zone:
docker exec kasa-monitor date
# Should match local time- Align billing period:
- Set correct billing cycle start
- Account for partial months
Problem: Container in restart loop
Solutions:
- Check logs:
docker logs kasa-monitor --tail 100- Verify image:
docker pull xante8088/kasa-monitor:latest- Check disk space:
df -h
docker system pruneProblem: http://localhost:3000 doesn't work
Solutions:
- Check container status:
docker ps
# Should show kasa-monitor running- Verify port mapping:
docker port kasa-monitor
# Should show 3000/tcp -> 0.0.0.0:3000- Test from container:
docker exec kasa-monitor curl http://localhost:3000- Check firewall:
sudo ufw status | grep 3000Problem: Cannot write to volumes
Solution:
# Fix ownership
docker exec -u root kasa-monitor chown -R appuser:appuser /app/data
# Or recreate with correct permissions
docker-compose down
docker volume rm kasa_data
docker-compose up -dProblem: Container cannot reach external services
Solutions:
- Check DNS:
docker exec kasa-monitor nslookup google.com- Set custom DNS:
services:
kasa-monitor:
dns:
- 8.8.8.8
- 8.8.4.4- Check proxy settings:
docker exec kasa-monitor env | grep -i proxyProblem: Container cannot ping devices
Solutions:
- Bridge mode - use host gateway:
extra_hosts:
- "host.docker.internal:host-gateway"- Check routing:
docker exec kasa-monitor ip route- Try host network mode:
network_mode: hostError:
sqlite3.OperationalError: database is locked
Solution:
# Restart container
docker restart kasa-monitor
# If persists, check for locks
docker exec kasa-monitor fuser /app/data/kasa_monitor.dbError:
sqlite3.DatabaseError: database disk image is malformed
Solution:
# Backup corrupted database
docker exec kasa-monitor cp /app/data/kasa_monitor.db /app/data/backup.db
# Attempt repair
docker exec kasa-monitor sqlite3 /app/data/kasa_monitor.db ".recover" | \
sqlite3 /app/data/recovered.db
# Replace if successful
docker exec kasa-monitor mv /app/data/recovered.db /app/data/kasa_monitor.db# Nuclear option - full reset
docker-compose down
docker volume rm kasa_data kasa_logs
docker rmi xante8088/kasa-monitor
docker-compose up -d# Update image and restart
docker-compose pull
docker-compose down
docker-compose up -d# Enable debug logging
environment:
- LOG_LEVEL=DEBUG
- PYTHONUNBUFFERED=1If these solutions don't work:
- Check logs thoroughly:
docker logs kasa-monitor --tail 200 > debug.log- Search existing issues:
- Create detailed bug report:
- Describe problem
- Include error messages
- List steps to reproduce
- Attach debug.log
- Ask community:
- FAQ - Frequently asked questions
- Installation - Setup guide
- Network Configuration - Network setup
- Docker Issues - Docker-specific problems
Document Version: 1.0.0
Last Updated: 2025-08-20
Review Status: Current
Change Summary: Initial version tracking added