How to use the publish function from mqtt

Find comprehensive JavaScript mqtt.publish code examples handpicked from public code repositorys.

135
136
137
138
139
140
141
142
143
144
var
  dataPoint = reading.values,
  outputTopic = config.mqtt.outputTopic + "/" + reading.device_id;

if (dataPoint.t > config.alarm.maxTemp || dataPoint.p > config.alarm.maxPressure) {
  mqtt.publish(
    outputTopic, { alarm: 1, values: dataPoint }
  );
} else {
  alarm.train(trainingData);
fork icon0
star icon7
watch icon1

+ 3 other calls in file