You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MicroPython firmware for an ESP32 that controls an automatic irrigation system via MQTT.
Features
8 zones + main valve — only one zone active at a time; main valve opens/closes automatically
3 float switches — water level monitoring (read-only)
Manual control — activate any zone for a custom duration (max 60 min)
Automatic programs — weekly schedules with conflict detection; programs cannot overlap on the same day
Manual priority — a manual activation pauses the running auto program; it resumes automatically when the manual zone ends, for the remaining window time
Late start — if an auto program's window is still open at check time, it starts for the remaining time
User pause/resume/stop — the user can pause a running program; it can be resumed as long as the original time window has not expired
Duration capping — a resumed program is truncated if another scheduled program starts before its natural end
MQTT notifications — real-time feedback for every action
Hardware
Component
GPIO
Zone 1–8
16, 17, 18, 25, 26, 27, 32, 33
Main valve
19
Float switches 1–3
23, 34, 35
Project Structure
main.py # Core logic: scheduler, MQTT handlers, pause/resume
irrigation_controller.py # Hardware state: pins, zone activation, timeouts
irrigation_programs.py # JSON-based program storage and conflict detection
boot.py # WiFi connection and NTP sync on startup
utils/
timezone.py # DST-aware local time (Italy)
messages.py # Notification message templates
utils.py # WiFi helpers and payload validation
lib/
umqtt.py # MQTT client
secrets.py # WiFi and MQTT credentials (not committed)
MQTT Topics
Commands (subscribe)
Topic
Description
api/irrigation/zone
Manual zone control (cmd: on/off/toggle, zone, duration)
api/irrigation/program/create
Create a new auto program
api/irrigation/program/edit
Edit an existing program
api/irrigation/program/delete
Delete a program
api/irrigation/program/list
Request program list
api/irrigation/program/upcoming
Request next N scheduled activations
api/irrigation/program/control
Pause / resume / stop a running program
api/irrigation/status
Start streaming system status (1 s interval, 60 s window)