PLNTRK Automation API

Connect Sensors, Cameras, and Automation Devices Directly to PLNTRK

Build a connected grow environment with the PLNTRK Automation API. Devices can submit live temperature, humidity, CO2, light, soil moisture, device telemetry, firmware information, and optional camera images directly to PLNTRK Areas.

Devices authenticate with a PLNTRK Setup Key and a permanent hardware identity, poll PLNTRK for their logging schedule, and upload measurements using multipart form data.

thermostat Environmental logging
photo_camera Optional image uploads
vpn_key Setup Key authentication
fingerprint Hardware-bound identity
system_update_alt OTA firmware coordination
hub PLNTRK & custom devices
This page documents the current /api/Automation/device/should-log and /api/Automation/device/log endpoints. The request examples follow the same authentication and multipart upload pattern used by current PLNTRK sensor firmware.

How it works

  1. Open an Area in PLNTRK and use Add Sensor to create a Setup Key.
  2. Enter the Setup Key on the physical sensor or automation device.
  3. The device identifies itself with a permanent hardware UID and polls PLNTRK to determine whether logging is currently due.
  4. PLNTRK validates both the Setup Key and hardware identity.
  5. When logging is due, the device submits environmental measurements, device telemetry, firmware information, and optionally an image.
A pending Setup Key is claimed by a valid hardware identity when the sensor connects. After the sensor is associated with that hardware identity, a different physical hardware UID cannot use the same active Setup Key.

Authentication & hardware identity

Every device request must include a valid PLNTRK Setup Key. Bearer authentication is the preferred method:

Authorization: Bearer YOUR_SETUP_KEY

For backward compatibility, PLNTRK also accepts the Setup Key through:

X-PLNTRK-APIKEY: YOUR_SETUP_KEY

PLNTRK also requires a permanent hardware identity:

X-PLNTRK-HARDWARE-UID: YOUR_HARDWARE_UID
Request Setup Key Hardware UID
GET /device/should-log Required Required in X-PLNTRK-HARDWARE-UID
POST /device/log Required Required either as the hardwareUID multipart field or in X-PLNTRK-HARDWARE-UID

Current PLNTRK sensor firmware sends the hardware UID in both the header and the multipart form when posting readings.

Treat the Setup Key as a secret credential. It identifies and authorizes the sensor together with its hardware UID and should not be embedded in public source code, screenshots, or client-side applications.

Available endpoints

GET /api/Automation/device/should-log
POST /api/Automation/device/log

1. Check whether the device should log

GET /api/Automation/device/should-log

Call this endpoint on the device's configured polling interval. PLNTRK validates the Setup Key and hardware identity, records the sensor as seen, and returns whether the device should submit a reading now.

The response also includes the current polling interval and may include an OTA firmware offer when a compatible firmware update has been requested for the sensor.

curl -X GET "https://www.plntrk.com/api/Automation/device/should-log" \
  -H "Authorization: Bearer YOUR_SETUP_KEY" \
  -H "X-PLNTRK-HARDWARE-UID: YOUR_HARDWARE_UID"

Polling response information

A successful response includes the logging decision, sensor/Area identity, polling schedule, and firmware-update information when applicable.

  • should_I_Log_Data — whether the sensor should submit readings now.
  • pollingIntervalMinutes — the configured polling/logging interval.
  • Last-log and next-allowed-log timestamps.
  • Sensor node and Area identifiers.
  • firmwareUpdateRequested — whether a compatible OTA update is being offered.
  • When an update is offered: target version, temporary download URL, SHA-256 hash, and firmware file size.

2. Submit sensor data

POST /api/Automation/device/log

The logging endpoint accepts multipart/form-data. It does not use a JSON request body.

At least one sensor measurement or an image must be included. Device/network telemetry by itself does not count as a sensor measurement.

When using tools such as curl -F, do not manually create the multipart boundary or set the Content-Type header yourself. The client will create the correct multipart/form-data boundary automatically.
curl -X POST "https://www.plntrk.com/api/Automation/device/log" \
  -H "Authorization: Bearer YOUR_SETUP_KEY" \
  -H "X-PLNTRK-HARDWARE-UID: YOUR_HARDWARE_UID" \
  -F "hardwareUID=YOUR_HARDWARE_UID" \
  -F "deviceName=Custom Sensor" \
  -F "temperatureF=75.4" \
  -F "humidity=58.2" \
  -F "soilMoistureRaw=420" \
  -F "soilMoisturePercent=42.0"

To include an image, add a multipart file field such as:

-F "image=@snapshot.jpg;type=image/jpeg"
The POST /device/log action has a total request-size limit of 15,000,000 bytes, including multipart headers, fields, and image data.

POST form fields

These are the fields currently accepted by the POST /api/Automation/device/log request model. Multipart form field names are matched case-insensitively by the server.

Individual measurements are optional, but the request must contain at least one measurement field or an image.

Field Type Required Description
Device identity & firmware
deviceName string No Friendly name reported by the physical or automation device.
hardwareUID string Conditional Permanent physical hardware identity. Required in this field unless supplied through X-PLNTRK-HARDWARE-UID.
firmwareVersion string No Firmware version currently running on the device.
firmwareBuild string No Firmware build identifier or build date reported by the device.
hardwareModel string No Hardware model, for example ESP32-S3.
arduinoCoreVersion string No Arduino/ESP32 core version used by the firmware.
otaCapable boolean No Indicates whether the current device/partition layout supports PLNTRK OTA updates.
Sensor measurements
deviceRecordedUtc datetime No UTC timestamp recorded by the device for the measurement.
temperatureF decimal No Air temperature in degrees Fahrenheit.
humidity decimal No Relative humidity percentage.
co2Ppm integer No Carbon dioxide concentration in parts per million.
lightRaw integer No Raw light-sensor reading in device-specific units.
lightPercent decimal No Light level expressed as a percentage.
lightLux decimal No Light measurement in lux.
lightPPFD decimal No Photosynthetic photon flux density reading reported by the device.
soilMoistureRaw integer No Raw uncalibrated soil-moisture sensor reading.
soilMoisturePercent decimal No Calibrated soil-moisture percentage. This is the preferred percentage field.
soilMoisture decimal No Legacy backward-compatible soil-moisture percentage field. It is not a raw ADC reading. If soilMoisturePercent is also supplied, soilMoisturePercent takes precedence.
Image
image file No Optional image uploaded from a device or camera. When active plants exist in the Area, PLNTRK can store the image as a plant photo.
Device & network telemetry
serverUrl string No PLNTRK server URL configured on the device.
localUrl string No Local network URL for the device configuration or status page.
dnsName string No mDNS or DNS hostname assigned to the device.
ipAddress string No Current IP address of the device.
ipMode string No Network configuration mode, such as DHCP or Manual / Static.
subnet string No Device subnet information or subnet mask.
gateway string No Gateway IP address used by the device.
macAddress string No Wi-Fi MAC address reported by the device.
wifiSsid string No Name of the connected Wi-Fi network.
wifiRssi string No Wi-Fi signal strength reported by the device, commonly including dBm units.
uptime string No Human-readable uptime reported by the device.
sensor string No Connected sensor name, model, or status reported by the device.
lastHTTPCode string No Most recent HTTP response code/status reported by the device.
pollingIntervalMinutes integer No Current device polling interval in minutes.
liveStreamUrl string No Optional live-stream URL associated with the device or attached camera.

Soil moisture semantics

PLNTRK supports separate raw and calibrated soil-moisture values:

  • soilMoistureRaw is the raw sensor/ADC value.
  • soilMoisturePercent is the calibrated percentage and is the preferred field.
  • soilMoisture remains available only for backward compatibility and is also interpreted as a percentage.

If both soilMoisturePercent and the legacy soilMoisture field are supplied, PLNTRK uses soilMoisturePercent.

-F "soilMoistureRaw=420" \
-F "soilMoisturePercent=42.0"
Do not send a raw sensor value such as 420 in the legacy soilMoisture field. That field represents a percentage.

Logging behavior

  • A missing Setup Key returns an authentication error.
  • A missing hardware identity is rejected.
  • A Setup Key that does not match the sensor's hardware identity is rejected.
  • If auto logging is disabled for the sensor, PLNTRK accepts the device contact but does not create a new reading.
  • If the sensor already logged within its configured polling window, PLNTRK returns successfully but tells the device to wait until the next allowed log time.
  • A POST containing no sensor measurement and no image is rejected.
  • When temperature and humidity are both supplied, PLNTRK calculates VPD server-side.
  • Standardized measurements are saved as an Area sensor reading.
  • When active plants exist in the Area, supported environmental measurements can also create plant environmental logs.
  • Soil-moisture values are stored with the Area sensor reading; they are not currently written into plant environmental-condition logs.
  • An uploaded image is stored as a plant photo only when active plants exist in the Area.

Current PLNTRK sensor flow

Current PLNTRK firmware follows this sequence:

  1. Read local environmental sensors.
  2. Call GET /device/should-log using the Setup Key and hardware UID.
  3. Process the server's logging decision and any compatible OTA firmware offer.
  4. If logging is due, create a multipart/form-data request.
  5. Include device identity, firmware inventory, environmental measurements, network telemetry, and optional soil readings.
  6. If a camera snapshot is available, stream it as the multipart image field.
  7. POST the request to /api/Automation/device/log.