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

  1. Read get_stations to learn station names and count.
  2. Read get_options for timezone, sunrise/sunset settings and controller capabilities.
  3. Read get_programs to avoid duplicate or conflicting programs.
  4. Call change_program with pid=-1 to 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.