Mqtt not connecting

Mqtt not connecting

2016-09-22 13:39:45.541 [ERROR] [.io.transport.mqtt.MqttService] - Error starting broker connection
org.eclipse.paho.client.mqttv3.MqttSecurityException: Not authorized to connect
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:24) ~[na:na]
at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:773) ~[na:na]
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:110) ~[na:na]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_65]

You need to give more details so we can help you. Which platform are you on, where is which mqtt broker installed? versions? Help us help you.

Not authorized to connect sounds like your broker expects login credentials or your connection details might be wrong.

Openhab is installed in a Raspberry Pi B and the broker is CloudMQTT. The broker and the service is working fine as I am using it with other programs. I have edited the openhab.cfg file with the credentials also. But…

Please help still could not figure out the problem…:weary:

Are you on openHAB1.8 or 2.0? Can you post the relevant lines from your openhab.cfg here (you should replace your credentials by xxx). Are you sure the data is correct?

I am using OH 1.8

#######################################################################################
#####                       Transport configurations                              #####
#######################################################################################

################################# MQTT Transport ######################################
#
# Define your MQTT broker connections here for use in the MQTT Binding or MQTT
# Persistence bundles. Replace <broker> with a id you choose.
#

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
mqtt:cloudmqtt.url=tcp://m12.cloudmqtt.com:10980

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a default one is generated.
mqtt:cloudmqtt.clientId=openhab

# Optional. User id to authenticate with the broker.
mqtt:cloudmqtt.user=jicrubuy

# Optional. Password to authenticate with the broker.
mqtt:cloudmqtt.pwd=kNVmlicF8ezC

# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#mqtt:<broker>.qos=<qos>

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
#mqtt:<broker>.retain=<retain>

# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#mqtt:<broker>.async=<async>

# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#mqtt:<broker>.lwt=<last will definition>

I have left the credentials intentionally as i can change them later and you will be able to test it out.
The topic “bd1/temp” tells a temperature at my home.

Thanks

Is there any more details required to be put in Openhab.cfg file.

It’s fairly easy to setup mosquitto as a broker, if that is a possible solution for you take a look here:

I have mosquitto installed, but it has problems while connecting. My NodeMCU doesn’t connect to the mosquitto services, it gets timeout all the time…

That sound like a problem with your nodemcu, not with the broker …
Make sure you have a good power supply, at least 500mA for your nodemcu.
Actually you don’t need all the recommended capacitors and resistors with the nodemcu, only with a “naked” esp8266 module.
The only important thing is a stable power supply.

I have a 2amp power supply connected to it

That does not necessarily mean it produces a stable voltage … :grin:

When I use cloudmqtt it works…
Its all very confusing :tired_face: