MQTT CommandResponse Action
Publish MQTT Message based on event completely serverless via Thingsup IoT Platform.
This provides a way to publish MQTT Message based on event. Before adding MQTT CommandResponse Action, user has to define a MQTT Connection. User need to provide following parameters.
- User need to provide MQTT Topic on which data will be published.
User need to provide MQTT Topic on which data will be received.
MQTT QoS value. Default is 1.
- Javascript code to build mqtt message.
- "tx_topic","rx_topic","message" and "payload" objects are available in this code, function can be used to set message body and topic from payload before sending to MQTT.
- Setting tx_topic and rx_topic here overrides already defined PublishTopic and SubscribeTopic respectively.
//Example 1
message = payload;
tx_topic = "somenewtopic";
rx_topic = "someothertopic";
- Javascript code to validate received message.
- "tx_topic","rx_topic","rx_message" and "tx_message" objects are available in this code, keeping rx_message non null will result in success response of action and assigning rx_message to null will result in action failure.
- This function will execute for each message till success or timeout.
// Example 1
if(rx_message.id != tx_message.id ){
rx_message = null;
}
Maximum time expected in milliseconds for MQTT Response. Default value is 2000. Range is 1000 to 5000.
User need to provide a Connection ID of MQTT connection.

Add MQTT CommandResponse Action
Please note the following points:
- "payload" object is supplied from Action Trigger like Rules, Action Command etc.
Last modified 1yr ago