PAYLOAD Entity
Feature | Since Version | Notes |
---|---|---|
PAYLOAD |
>v1.5.1 | Represents incoming message content |
The PAYLOAD
entity represents the content of the message that triggered an event, typically within an ACTION
defined with ON TOPIC
.
Usage
PAYLOAD
is commonly used:
- With
PUBLISH TOPIC
: To forward or use the incoming data. - In Expressions: As part of calculations or conditional logic.
Examples
1. Echoing Payload:
2. Using Payload in Calculation:
DEFINE ACTION ProcessSensorData
ON TOPIC "sensors/raw" DO
// Assumes payload is numeric
PUBLISH TOPIC "sensors/processed" WITH (PAYLOAD * 1.8 + 32) // Example: C to F
3. Using Payload in Conditional Logic:
DEFINE ACTION CheckStatus
ON TOPIC "device/status_report" DO
IF PAYLOAD == "ERROR" THEN
PUBLISH TOPIC "alerts/device" WITH "Device reported an error!"
ENDIF
Related Documentation