Conneting openhab2 to mosquitto

Hello all,

i am a beginner when it comes to openhab.
I have a raspberrypi3, installed openhab2 and installed mosquitto server and client.
I have made certificates using this guid: https://jamielinux.com/docs/openssl-certificate-authority/introduction.html
Now when i connect trou ssh to my Pi, i can send and receive massages with the following comments:

mosquitto_sub -u MyUser -P MyPass -t "test" -v --cafile /etc/mosquitto/certs/ca-chain.cert.pem -p 8883 --insecure -d

mosquitto_pub -u MyUser -P MyPass --cafile /etc/mosquitto/certs/ca-chain.cert.pem -h localhost -t "test" -m "Hello Wold" -p 8883 --insecure -d

when i place the ca-chain.cert.pem on my pc en link it to MQTT.fx and connect to topic test, i also receive the massage “Hello Wold”

When i start Openhab2 and look at my openhab.log i see:

2018-04-21 21:18:35.446 [INFO ] [ternal.dhcp.DHCPPacketListenerServer] - DHCP request packet listener online
2018-04-21 21:18:37.975 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-04-21 21:18:38.107 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-04-21 21:18:38.242 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-04-21 21:18:38.617 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-04-21 21:18:38.620 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘mosquitto’
2018-04-21 21:18:39.001 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin

But when i look at the mosquitto log i see:

1524338319: New client connected from 127.0.0.1 as paho620498316594915 (c1, k60, u’openhab2’).
1524338817: Client paho620498316594915 disconnected.
1524338852: New connection from 127.0.0.1 on port 8883.

So my question, is openhab2 now connected correctly to mosquitto?

Greets

The openHAB mqtt binding doesn’t support ssl
You can set it up by following:

However, I would recommend that you start by getting everything up and running without ssl, especially if you are running mosquitto only inside your own network, there is no need to use ssl. I had to use it because I had to use a cloud server due to my stupid cellular/mobile provider.
Once you have everything up and running without ssl then by all means set it up it you still need/want to,

Thanks for the reply.
I have added:

require_certificate false

port 1883

To my Mosquitto.conf. I am now able to connect MQTT.fx to Mosquitto without the use of a certificate.
I go play around and see iff i now get my Openhab2 connected to Mosquitto.
When i have it working i will try to get ssl working, thanks for the link.
The reason i would like ssl is that i dont what to send my username en pass over my LAN unincrypted.

i now receive this on the mosquitto.log:

1524410095: New client connected from 127.0.0.1 as paho5894986274797 (c1, k60, u’openhab2’).
1524410159: Client paho5894986274797 disconnected.
1524410190: New connection from 127.0.0.1 on port 1883.

So only the port changed, rest off massage is the same.

My mqtt.cfg is:

mosquitto.url=tcp://localhost:1883
mosquitto.user=openhab2
mosquitto.pwd=Boerendebaas
mosquitto.qos=1
mosquitto.retain=true
mosquitto.async=false

My Mosquitto.conf is:

Place your local configuration in /etc/mosquitto/conf.d/

A full description of the configuration file is at

/usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

allow_anonymous false
password_file /etc/mosquitto/passwd

include_dir /etc/mosquitto/conf.d

require_certificate false

port 1883

listener 8883
cafile /etc/mosquitto/certs/ca-chain.cert.pem
certfile /etc/mosquitto/certs/www.example.com.cert.pem
keyfile /etc/mosquitto/certs/www.example.com.key.pem

What is it that i am doing wrong?

Greets

What does the openHAB log show?

My openhab.log is:

2018-04-22 17:16:27.461 [INFO ] [ternal.dhcp.DHCPPacketListenerServer] - DHCP re quest packet listener online
2018-04-22 17:16:29.916 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-04-22 17:16:30.075 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-04-22 17:16:30.158 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-04-22 17:16:30.437 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Se rvice initialization completed.
2018-04-22 17:16:30.440 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Startin g MQTT broker connection ‘mosquitto’
2018-04-22 17:16:30.706 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin

Good. You are connected to your broker. Time to play with the binding!

Thanks for the help man. Now indeed time to play around with the binding.