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.
Resources
10Install
npx skillscat add giocaizzi/tuya-irrigation Install via the SkillsCat registry.
Tuya Smart Irrigation System
Evidence-based irrigation with Tuya Cloud sensors, multi-plant conflict resolution, and self-learning efficiency analysis.
Cluster Types
- With irrigator — automated irrigation + learning alerts
- Without irrigator — moisture monitoring only (manual watering reminders)
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).
Setup
Environment Variables (~/.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 | inInitialize Cluster
# 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 12CLI Reference
Primary (cron / automated)
tuya-irrigation check --all # Unified check: all clusters, all alert types
tuya-irrigation check 1 # Check single clusterOutput protocol (for agent parsing):
ACTION: irrigated|skipped|monitored|error <cluster_name> [— notes]
ALERT: <cluster_name> <type> # needs_water | learning
ALERT_ITEM: <emoji> <message>
ALERT_ENDExit codes: 0 = silent (ok/skip) · 2 = alerts to forward · 1 = error
Operations (interactive / manual)
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)Setup (CRUD)
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 12Cron Setup
| 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.
Check Command: Internal Logic
Cluster with irrigator
- Sync sensors from Tuya Cloud (last 6h)
- Determine temperature (indoor → sensor primary; outdoor → Open-Meteo primary)
- Run
IrrigationLogic.decide_for_cluster():- 6h global cooldown check
- Stress detection (water stress, heat, over-watering)
- Multi-sensor conflict resolution (driest plant wins)
- 48h trend analysis
- Plant-specific targets from scientific literature
- Execute on irrigator if
action == "irrigate" - Collect learning alerts (drainage, efficiency)
- Output
ACTION:+ anyALERT:blocks
Cluster without irrigator
- Sync sensors from Tuya Cloud (last 2h)
- Compare latest soil moisture vs plant targets
- Flag sensors below threshold as
needs_water - Output
ACTION: monitored+ALERT: needs_waterblock if dry
Multi-Sensor Logic
With 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.
Learning Engine
After ≥3 irrigation cycles with sensor data, the system learns:
- Absorption rate: +X%/min of irrigation per plant
- Drainage rate: -X%/hr natural moisture loss
- Efficiency score: How consistently irrigation increases moisture
Alert Types
| 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% |
Confidence Scoring
| 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% |
References
- Plant Database — Evidence-based plant care data and sources
- Database Schema — SQLite table definitions