Reputation: 1302
In my current project, I am trying to connect my external temperature sensor to NODE-RED.
I have plugged MQTT with the external sensor. This sensor is publishing data with tempMeasurement
topic. The configuration of MQTT publisher is as follows:
public class MQTTPublisher {
// public static final String BROKER_URL =
// "tcp://broker.mqttdashboard.com:1883";
public static final String BROKER_URL = "tcp://test.mosquitto.org:1883";
private MqttClient client;
public MQTTPublisher() {
try {
client = new MqttClient(BROKER_URL, MqttClient.generateClientId(),
new MemoryPersistence());
client.connect();
} catch (MqttException e) {
e.printStackTrace();
}
}
public void publish(String topicName, int qos, byte[] payload)
throws MqttException {
final MqttTopic topic = client.getTopic(topicName);
final MqttMessage message = new MqttMessage(payload);
topic.publish(message);
System.out.println("Published data. Topic: " + topic.getName()
+ " Message: " + payload);
}
}
On the other side in Node-RED, I have created MQTT node, that has subscribe "tempMesurement". The configuration of MQTT node in NODE-RED is as follows:
My problem is that MQTT subscriber node is showing disconnected message as show in the above figure. Could you please suggest - what is wrong with the configuration in NODE-RED? How can I resolve this issue?
Upvotes: 2
Views: 1699
Reputation: 59608
As mentioned in the comments, you need to remove the tcp:// from the sever name in the config screen
Upvotes: 1