Skip to content

smart-swimmingpool/pool-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

316 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Pool Controller 3.3 | 🏊 Smart Swimming Pool

Smart Swimmingpool PlatformIO CI Contributor Covenant License: MIT

ko-fi


⚠️ WARNING: This project involves 230V AC mains voltage!

  • Only proceed if you have basic electronics knowledge.
  • Always use a Residual Current Device (RCD/FI circuit breaker) for the pump circuit.
  • Disconnect power before working on the circuit.
  • Keep low-voltage (sensor) wiring separate from mains wiring.
  • If in doubt, consult a qualified electrician.
  • This project is NOT certified (no CE/UL mark). For personal use only!

🏊 The MQTT-enabled Smart Swimming Pool Controller πŸŽ›οΈ

Manage your swimming pool the smart way - enjoy it in a comfortable and affordable (less than 100€) way with professional-grade reliability.

πŸ”— Discussions: GitHub Discussions


πŸš€ Quick Start

New to the project? Start here:


✨ Main Features

🏊 Pool Management

  • βœ… Timed circulation for cleaning
  • βœ… Solar heating control via additional pump
  • βœ… Multiple operation modes: Auto, Manual, Boost, Timer
  • βœ… Temperature-based automation (e.g., disable solar heating if pool is too hot)

🌐 MQTT Integration

πŸ›‘οΈ Reliability & 24/7 Operation (v3.3.0)

  • βœ… State Persistence – All settings survive reboots and power failures
    • Operation mode, temperatures, timer settings automatically restored
    • ESP32 NVS storage
  • βœ… System Health Monitoring – Continuous health checks
    • Memory monitoring every 10 seconds
    • Auto-reboot at critical memory threshold (8KB)
    • Hardware watchdog timer (30s timeout)
  • βœ… Memory Optimization – Efficient resource usage
    • 90% reduction in heap fragmentation
    • 2,880-28,800 fewer allocations per day
    • Fixed millis() overflow for operation beyond 49.7 days
  • βœ… Automatic Recovery – Self-healing capabilities
    • Auto-recovery from memory exhaustion
    • Watchdog timer prevents system hangs
    • Sensor auto-recovery with fast re-polling
    • Boot-loop detection with Safe Mode
    • NTP graceful degradation (3-stage)
    • Zero manual intervention required

🌐 Built-in Web Interface

  • βœ… Full Web Dashboard – Direct device management without Home Assistant
    • AP Mode: Connects as Pool-Controller-Setup WiFi hotspot at 192.168.4.1
    • STA Mode: Web server on port 80 at the device's local IP
    • REST API for programmatic access (/api/status, /api/config, etc.)
    • Password-protected with session management (cookie-based, SHA-256)
    • Tabs: Dashboard, WiFi Setup, MQTT Settings, Configuration, Security & Update
    • OTA firmware update via web interface

πŸ”§ Developer Features

  • βœ… Over-The-Air (OTA) Updates – Remote firmware updates via WiFi
    • No physical access required for updates
    • Password-protected secure updates
    • mDNS discovery support
  • βœ… Time sync via NTP (configurable server, default: pool.ntp.org)
  • βœ… Configurable timezone with DST support (10 major timezones available)
  • βœ… Logging information via MQTT
  • βœ… Modern libraries (ArduinoJson 7.3.0, NTPClient 3.2.1)
  • βœ… Clean, formatted code following project standards

πŸ“š Documentation

Guide Description For
Quick Start Guide Step-by-step setup for beginners πŸ†• New users
FAQ Troubleshooting common issues ❓ All users
Users Guide Web dashboard, operation modes, MQTT πŸŽ›οΈ Intermediate users
Hardware Guide Assembly, wiring, parts list πŸ”§ Builders
MQTT Configuration Home Assistant Discovery, entity reference 🌐 Smart home integrators
State Persistence How settings are saved across reboots πŸ’Ύ Advanced users
OTA Updates Remote firmware updates πŸ“‘ Developers
ESP32 Schematic Optimization (DE) Pin assignment and optimization πŸ”Œ Hardware experts

πŸ“¦ Recent Updates (v3.3.0)

πŸ”„ ESP8266 Support Removed

  • Codebase is now ESP32-only β€” cleaner, faster, more reliable
  • Removed all #ifdef ESP8266 conditional compilation
  • Platform: esp32dev (ESP32 DevKit V1)

πŸ›‘οΈ Phase 3 β€” Proactive Resilience

  • P7: Fast Sensor Recovery β€” DallasTemperatureNode polls every 5s (instead of 300s) when sensor reads NaN
  • P8: Boot-Loop Detection β€” NVS-based boot counter, Safe Mode after 4 consecutive short boots (<5 min), all relays forced OFF
  • P9: Configurable Fallback Times β€” ConfigManager settings time-loss-green-hours and time-loss-red-hours replace hardcoded NTP thresholds

πŸ› v3.1.0 (Previous Release)

  • Critical Bug Fixes
    • Fixed critical logging bug (vsnprintf buffer initialization)
    • Fixed millis() overflow for reliable operation beyond 49.7 days
    • Added buffer validation and overflow detection
  • New Features
    • State persistence across reboots and power failures
    • Home Assistant MQTT Discovery support
    • System health monitoring with auto-reboot
    • Hardware watchdog timer (ESP32)
  • Performance Improvements
    • Eliminated 10+ String allocations per measurement cycle
    • Reduced heap fragmentation by ~90%
    • Optimized memory usage for 24/7 operation

See CHANGELOG.md for complete details.


πŸš€ Planned Features

  • Configurable NTP Server (currently hardcoded: europe.pool.ntp.org)
  • Smart learning: Improved pool pump circulation optimization
  • Two separate circulation cycles
  • Temperature-based cleaning circulation time
  • Improved operation without WiFi connection
    • Display and button setup interface
  • See also the issue list

πŸ”§ Configuration

MQTT Protocol Selection

Configure your preferred MQTT protocol in the device settings:

  • mqtt-protocol = "homeassistant" - Home Assistant native discovery (only option in v3.3.0+)

See docs/mqtt-configuration.md for setup details.

State Persistence

All controller states are automatically saved and restored:

  • Operation modes and settings
  • Temperature thresholds
  • Timer configurations
  • Relay states

See docs/state-persistence.md for details.


🀝 Contributing

We welcome contributions! Before submitting a pull request, please:

  1. Read the coding guidelines: .github/CODING_GUIDELINES.md
  2. Run local linting: make lint-fix && make lint
  3. Test your changes: make build (builds for ESP32)
  4. Check for issues: See .github/QUICK_REFERENCE.md for common fixes

All code must pass the same Super-Linter checks run in CI (cpplint for C/C++, EditorConfig, and Markdown/YAML/JSON validation) before merge.


πŸ™ Credits


πŸ“œ License

MIT License – Free to use, modify, and share.


🌐 Community


πŸ“’ Support

If you encounter issues:

  1. Check the FAQ for common problems.
  2. Search the Discussions.
  3. Open a new issue with:
    • A detailed description of the problem.
    • Screenshots (e.g., serial monitor output, Web Dashboard).
    • Your hardware setup (ESP32 model, relay module, sensors).
    • Firmware version (check Web Dashboard or serial monitor).

DIY My Smart Home

Sponsor this project

Contributors