Openhab2 and MQTT connected but doesn't work together

openhab2
mqtt
Tags: #<Tag:0x00007f0142d8b838> #<Tag:0x00007f0142d8b5b8>

(Alex Smart) #1

Weird stuff going on. I have a couple of servers successfully running with similar config. But this one is killing me.
openhab 2.3.0

mqtt-eventbus.config

broker="broker"
commandPublishTopic="home/openHAB/out/${item}/command"
service.pid="org.openhab.mqtt-eventbus"
statePublishTopic="home/openHAB/state/${item}/state"
stateSubscribeTopic="home/openHAB/in/${item}/state"

openhab.log

2018-07-05 09:46:27.070 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.199.201:8080
2018-07-05 09:46:27.110 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.199.201:8443
2018-07-05 09:46:28.201 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-07-05 09:46:28.814 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-07-05 09:46:28.817 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker'

mosquitto.log

1530783794: Config loaded from /etc/mosquitto/mosquitto.conf.
1530783794: Opening ipv4 listen socket on port 1883.
1530783794: Opening ipv6 listen socket on port 1883.
1530783809: New connection from 192.168.199.25 on port 1883.
1530783809: New client connected from 192.168.199.25 as Device1Bathroom (c1, k15, u'openhab').
1530783838: New connection from 192.168.199.192 on port 1883.
1530783838: New client connected from 192.168.199.192 as Device1Kitchen (c1, k15, u'openhab').
1530783842: New connection from 192.168.199.176 on port 1883.
1530783842: New client connected from 192.168.199.176 as Device2Bedroom (c1, k15, u'openhab').
1530783843: New connection from 192.168.199.103 on port 1883.
1530783843: New client connected from 192.168.199.103 as Device1Bedroom (c1, k15, u'openhab').
1530783848: New connection from 192.168.199.199 on port 1883.
1530783848: New client connected from 192.168.199.199 as Device2Kitchen (c1, k15, u'openhab').
1530783854: New connection from 127.0.0.1 on port 1883.
1530783854: New client connected from 127.0.0.1 as openhab (c1, k60, u'openhab').

all seems fine, but openhab doesn’t get info from the mqtt and vice versa…

MQTT ir running ok - I see data from connected devices…


(Psyciknz) #2

Are both oh systems using same MQTT client Id? That causes issues. Certainly makes debug difficult


(SiHui) #3

… and the commandSubscribeTopic config parameter is missing:


(Alex Smart) #4

I never used before commandSubscribeTopic, added it, no changes…
And where can I check MQTT client Id?


(Stefan Haupt) #5

check your services\mqtt.cfg and look for

broker.clientId=clientId


(Alex Smart) #6

broker.clientId=“openhab”
same everywhere


(Stefan Haupt) #7

try to change it to unique values, like ‘openhab1’ ‘openhab2’ …


(Udo Hartmann) #8

Only a typo here? Should be mqtt-eventbus.cfg


(Angelos) #9

not a typo… he is wrongly modifying the userdata version of the config file :slight_smile: (you can identify this from the quotes)

@AlexSmart use the OPENHAB_CONF/services/mqtt.cfg & mqtt-eventbus.cfg files (not the userdata .config ones)


(Alex Smart) #10

Tried both ways…


(Udo Hartmann) #11

You shouldn’t change files in userdata (except you are aware of the consequences and really know what you are doing). Maybe you messed up your openHAB.


(Alex Smart) #12

Maybe. I reinstall Openhab, and got the same issue. I always changed a /etc/openhab2/services/mqtt-eventbus.cfg And only after facing this problem I started to play with /var/lib/openhab2/config/org/openhab/mqtt-eventbus.config


(Alex Smart) #13

I managed to get this working. What I did is remove completely openhab, mosquitto and java. Then, installed zulu embedded, as it recommended by openhab and then installed openhab and mosquitto. Magic or stupidity?

btw, I had to reinstall openhab2 one more time. After first reinstallation it didnt started (status said: running) and openhab.log file contained this:

Jul 08, 2018 7:42:52 AM org.apache.karaf.main.Main launch
INFO: Installing and starting initial bundles

Jul 08, 2018 7:42:55 AM org.apache.karaf.main.Main launch
INFO: All initial bundles installed and set to start

Jul 08, 2018 7:42:55 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO: Trying to lock /var/lib/openhab2/tmp/lock

Jul 08, 2018 7:42:55 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO: Lock acquired

Jul 08, 2018 7:42:55 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired
INFO: Lock acquired. Setting startlevel to 100

Jul 08, 2018 7:46:16 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO: Trying to lock /var/lib/openhab2/tmp/lock

Jul 08, 2018 7:46:16 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO: Lock acquired

Jul 08, 2018 7:46:16 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired
INFO: Lock acquired. Setting startlevel to 100