AI-Guided Program Creation
AI assistants connected through the MCP server can create irrigation programs from natural-language requests. The assistant reads controller context first, then writes a normal OpenSprinkler program through the API.
Workflow
- Read
get_stationsto learn station names and count. - Read
get_optionsfor timezone, sunrise/sunset settings and controller capabilities. - Read
get_programsto avoid duplicate or conflicting programs. - Call
change_programwithpid=-1to create a new program.
Program encoding
change_program uses:
v=[flag, days0, days1, [start0,start1,start2,start3], [dur0,dur1,...]]
| Flag bit | Meaning |
|---|---|
| 0 | Enabled |
| 1 | Use weather adjustment |
| 2-3 | Day restriction: none, odd, even |
| 4-5 | Schedule type: weekly, single-run, monthly, interval |
| 6 | Start type: repeating or fixed |
| 7 | Date range enabled |
Example
Request: “Water lawn and flower beds every weekday at 6:00, 15 and 20 minutes, with weather adjustment.”
{
"pid": -1,
"name": "Morning Watering",
"v": "[67,31,0,[360,-1,-1,-1],[900,1200,0,0,0,0,0,0]]"
}
The created program appears in the normal Programs UI and can be edited there afterward.