Smart irrigation system for Tuya-based devices with sensor integration. Features: cluster management, plant profiles, sensor data logging, smart irrigation logic. Use when: managing irrigation, adding plants/sensors, analyzing conditions, auto-watering. Requires: TUYA_CLIENT_ID, TUYA_CLIENT_SECRET in ~/.openclaw/.env.
Evidence-based irrigation with Tuya Cloud sensors, multi-plant conflict resolution, and self-learning efficiency analysis.
check --all auto-detects cluster type and runs the appropriate pipeline. Output is always structured ACTION: / ALERT: lines (exit code 2 = alerts to forward via Telegram).
~/.openclaw/.env)TUYA_CLIENT_ID=your_client_id
TUYA_CLIENT_SECRET=your_client_secret
TUYA_DEVICE_ID=your_irrigator_device_id
TUYA_REGION=eu # eu | us | cn | in
# 1. Create cluster
tuya-irrigation cluster add "My Plants" --location "Indoor" --environment indoor
# 2. Add plants
tuya-irrigation plant add --cluster 1 "Monstera deliciosa" --category tropical --water-needs medium
# 3. Add irrigator
tuya-irrigation irrigator add --cluster 1 --device-id YOUR_DEVICE_ID --name "Rainpoint"
# 4. Add sensors
tuya-irrigation sensor add --cluster 1 --device-id SENSOR_ID --name "Monstera" --type soil_moisture --plant-id 1
# 5. Set config
tuya-irrigation config set --cluster 1 --mode smart --minutes 2 --interval 12
tuya-irrigation check --all # Unified check: all clusters, all alert types
tuya-irrigation check 1 # Check single cluster
Output protocol (for agent parsing):
ACTION: irrigated|skipped|monitored|error <cluster_name> [— notes]
ALERT: <cluster_name> <type> # needs_water | learning
ALERT_ITEM: <emoji> <message>
ALERT_END
Exit codes: 0 = silent (ok/skip) · 2 = alerts to forward · 1 = error
tuya-irrigation status 1 # Full overview: sensors, config, events, smart analysis
tuya-irrigation irrigate 1 # Force irrigation pipeline: sync → weather → decide → execute
tuya-irrigation irrigate 1 --dry-run # Analysis only, no execution
tuya-irrigation irrigate 1 --temp 22 # Override temperature (skips weather fetch)
tuya-irrigation irrigate 1 --no-sync # Skip sensor sync (use DB data)
tuya-irrigation monitor 1 # Raw moisture check for sensor-only cluster
tuya-irrigation monitor 1 --no-sync # Skip sync
tuya-irrigation sync --hours 6 # Cloud → DB sensor sync
tuya-irrigation learn 1 # Learning report + efficiency alerts
tuya-irrigation history 1 --hours 24 # Readings + events combined timeline
tuya-irrigation stats 1 --days 7 # Statistics + CSV export (--export file.csv)
tuya-irrigation cluster list
tuya-irrigation cluster add "Garden" --location "Backyard" --environment outdoor
tuya-irrigation plant list --cluster 1
tuya-irrigation plant add --cluster 1 "Ficus elastica" --category tropical --water-needs medium
tuya-irrigation plant sync # Sync all plants with evidence-based data
tuya-irrigation plant sync --plant-id 1 # Sync specific plant
tuya-irrigation plant sync --cluster 1 # Sync plants in cluster
tuya-irrigation irrigator list --cluster 1
tuya-irrigation irrigator start 1 --minutes 3
tuya-irrigation irrigator stop 1
tuya-irrigation irrigator log-manual 1 --minutes 5 --notes "Watered by hand"
tuya-irrigation sensor list --cluster 1
tuya-irrigation sensor add --cluster 1 --device-id XXXX --name "Nespolo" --type soil_moisture --plant-id 4
tuya-irrigation config get --cluster 1
tuya-irrigation config set --cluster 1 --mode smart --minutes 2 --interval 12
| Cron | Schedule | Command | Purpose |
|---|---|---|---|
| Sensor Sync | every 30min | sync --hours 24 | Cloud → DB data freshness |
| Irrigation & Plant Check | 07:00 + 20:00 (Rome) | check --all | Irrigate + monitor + alert |
The Irrigation & Plant Check cron runs as an OpenClaw agent job: it executes check --all, parses ALERT_ITEM: lines (exit code 2), and forwards a single batched Telegram message to Kez.
Adding a new cluster (with or without irrigator) is automatically picked up by check --all — no cron changes needed.
IrrigationLogic.decide_for_cluster():
action == "irrigate"ACTION: + any ALERT: blocksneeds_waterACTION: monitored + ALERT: needs_water block if dryWith one irrigator serving multiple plants:
| Scenario | Action | Duration | Confidence |
|---|---|---|---|
| All adequate (40-65%) | Skip | — | 70% |
| One dry, none wet | Normal irrigation | 2-3 min | 80-90% |
| Conflict: one dry + one wet | Short burst | 1 min | 65% |
| All wet | Skip | — | 80% |
Decision uses min_soil_moisture (driest sensor), not average.
After ≥3 irrigation cycles with sensor data, the system learns:
| Alert | Severity | Trigger |
|---|---|---|
| Blocked drip | Critical | <0.5%/min absorption, <30% efficiency |
| Rapid drainage | Warning | >5%/hr moisture loss |
| Chronic underwatering | Warning | Peak moisture never reaches target (7d) |
| Unresolvable conflict | Critical | Irrigating dry plant would bring wet plant >85% |
| Level | Source | Score |
|---|---|---|
| Critical stress override | Sensor + trends | 95% |
| Sensor-driven (adequate data) | Sensor | 70-90% |
| Temperature fallback | Open-Meteo | 60% |
| Minimal data | Config defaults | 20-30% |