Toggles the actuator state of a device owned by the authenticated user. The newDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/GaelCeballos/Smart_Enviro_Backend/llms.txt
Use this file to discover all available pages before exploring further.
current_state (ON, OFF, or STANDBY) is persisted and returned to the ESP32 on its next GET /api/device/sync call or in the device_control block of the next POST /api/sensor-data response.
Endpoint
| Field | Value |
|---|---|
| Method | POST |
| Path | /api/my-devices/{id}/toggle |
| Auth | Bearer token required (Authorization: Bearer YOUR_TOKEN) |
Path Parameters
The unique ID of the device whose state should be changed. The device must belong to the authenticated user.
Request Body
The new actuator state to set. Must be exactly one of:
ON— activate the actuatorOFF— deactivate the actuatorSTANDBY— place the device in standby mode
Request Example
Responses
200 OK
The device state was updated successfully.Always
"success" on a 200 response.Confirmation including the new state (e.g.
"Estado acutalizado a ON"). Note: the message text is returned verbatim from the controller.The device’s new state after the update:
ON, OFF, or STANDBY.404 Not Found
The device does not exist or does not belong to the authenticated user.422 Unprocessable Entity
Thestate field is missing or contains a value other than ON, OFF, or STANDBY.
The state change is not pushed to the device in real-time. The ESP32 will receive the new command on its next
GET /api/device/sync request or in the device_control.current_state field of its next sensor data response.