Documentation
Configuration
Learn how to configure MudPi for your specific garden setup.
Configuration File
MudPi uses a JSON configuration file (mudpi.config.json) to define your system. This file specifies your sensors, controls, workers, and schedules.
Basic Structure
Every MudPi configuration starts with this basic structure:
{
"name": "My Garden",
"debug": false,
"redis": {
"host": "127.0.0.1",
"port": 6379
},
"sensors": [],
"controls": [],
"workers": [],
"triggers": []
}
Note
The debug option enables verbose logging. Set it to true during development and false in production for cleaner output.
Sensor Configuration
Each sensor entry defines the type of sensor, its pin assignment, and polling interval:
{
"sensors": [
{
"pin": 4,
"type": "soil_moisture",
"name": "Garden Bed 1",
"poll_interval": 30
}
]
}
| Property | Type | Description |
|---|---|---|
pin |
Integer | GPIO pin number the sensor is connected to |
type |
String | Sensor type identifier (e.g. soil_moisture, dht22) |
name |
String | Human-readable name for identification |
poll_interval |
Integer | Seconds between sensor readings (default: 30) |
Control Configuration
Controls define outputs like relays for pumps and valves:
{
"controls": [
{
"pin": 17,
"type": "relay",
"name": "Main Water Valve",
"default_state": "off"
}
]
}
Trigger Configuration
Triggers link sensor readings to control actions. When a sensor value meets a condition, the specified control is activated:
{
"triggers": [
{
"source": "Garden Bed 1",
"condition": "below",
"value": 40,
"action": "Main Water Valve",
"action_state": "on",
"duration": 120
}
]
}
Tip
Use duration (in seconds) to prevent over-watering. The control will automatically turn off after the specified time.
Schedule Configuration
Schedules define time-based actions using cron-like syntax, allowing you to water on a set schedule regardless of sensor readings:
{
"schedules": [
{
"name": "Morning Watering",
"action": "Main Water Valve",
"action_state": "on",
"at": "06:00",
"duration": 300
}
]
}
Next Steps
Learn more about specific components in the Sensors and Controls documentation.