Actuators represent the physical devices — pumps, fans, heaters, lights, valves, and irrigation systems — that AgroPulse controls in response to sensor readings or automation rules. Each actuator is linked to a greenhouse, optionally mapped to a GPIO pin on an ESP32 device, and carries a liveDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/diarpicu2022-commits/backend-AgroPulse/llms.txt
Use this file to discover all available pages before exploring further.
status field (ON, OFF, or AUTO) that the firmware reads to drive its output.
POST /api/actuators performs an upsert: if an actuator already exists with the same type, gpioPin, and greenhouseId, the API updates that record instead of creating a duplicate. This keeps firmware boot-time registration idempotent.Actuator types
Thetype field must be one of the following string values, drawn from the ActuatorType enum:
| Value | Description |
|---|---|
FAN | Ventilation fan |
PUMP | Water or nutrient pump |
HEATER | Heating element |
LIGHTS | Grow lights |
VENTILATION | Roof vent or louvre motor |
IRRIGATION | Drip or sprinkler irrigation head |
Endpoints
GET /api/actuators
Returns all actuators. PassgreenhouseId to scope the response to a single greenhouse.
Query parameters
Filter results to actuators belonging to this greenhouse ID. Omit to return all actuators across all greenhouses.
actuators key containing an array.
Array of actuator objects. See the actuator object section for field definitions.
example response
POST /api/actuators
Creates a new actuator, or updates an existing one iftype + gpioPin + greenhouseId match a record already in the database.
Request body
Human-readable label for the actuator, e.g.
"Row-2 irrigation valve".Actuator category. Must be one of
FAN, PUMP, HEATER, LIGHTS, VENTILATION, or IRRIGATION.ID of the greenhouse this actuator belongs to. Required for the upsert lookup.
GPIO pin number on the ESP32 that drives this actuator. Required for the upsert lookup; must be
>= 0.Initial operating state. Accepted values:
ON, OFF, AUTO.Whether this actuator is enabled and visible to the automation engine. Defaults to
true on creation.Set to
true for relay modules wired active-low (e.g. HW-383 relay boards), where a LOW GPIO signal turns the relay on. When true, the firmware inverts the output signal before driving the pin.Identifier of the ESP32 device that owns this GPIO pin, e.g.
"esp32-gh3-01". Used to route commands to the correct device when multiple microcontrollers share a greenhouse.example response
GET /api/actuators/
Returns a single actuator by its database ID. Path parametersThe actuator’s integer ID.
404 Not Found if no actuator exists with that ID.
example request
PUT /api/actuators/
Updates one or more fields on an existing actuator. Only fields present in the request body are changed; omitted fields retain their current values. Path parametersThe actuator’s integer ID.
New display name.
New actuator type. Must be a valid
ActuatorType value.New operating state:
ON, OFF, or AUTO.Reassign the actuator to a different greenhouse.
Enable or disable the actuator.
Reassign the GPIO pin.
Change the active-low wiring flag.
Change the owning ESP32 device identifier.
404 if the ID does not exist, 403 if the caller does not own the record.
example request
example response
DELETE /api/actuators/
Permanently removes an actuator record. Path parametersThe actuator’s integer ID.
{"deleted": true} on success, 404 if not found, 403 if the caller does not own the record.
example request
example response
The actuator object
Auto-generated integer primary key.
Human-readable label.
Actuator category string:
FAN, PUMP, HEATER, LIGHTS, VENTILATION, or IRRIGATION.Current operating state:
ON, OFF, or AUTO. Defaults to OFF on creation.ID of the greenhouse this actuator belongs to.
Whether the actuator is enabled. Defaults to
true.GPIO pin number on the controlling ESP32.
null if not mapped to hardware.true if the relay or driver is wired active-low. The firmware inverts the pin signal when this flag is set.Identifier of the ESP32 that controls this actuator’s GPIO pin.
null if not assigned.ISO-8601 timestamp of when the record was first created.