MQTT Input

Publish / Subscribe through MQTT service

  • Ability to listen on multiple MQTT brokers
  • Ability to listen on multiple topic patterns per configuration

Related Context APIs

Mqtt Message Context
Mqtt Context

Related REST APIs

Create / Update Input
Retrieve Input
List Inputs
Count All Inputs
Start Stop Restart an Input
Delete Input
Delete All Inputs

Example

//Listen's on /boodskap/sensor/light1

log.info("Topic:%s :: %s", topic, new String(msg.getPayload()));

def val = Integer.valueOf(new String(msg.getPayload()));

def control = "off";

if(val > 1000){
    control = "on";
}

mqtt.publish('/boodskap/myhome/releay1', control);