MQTT binding help

Great write up, but he is using openHAB2 where you don’t have the prefix “mqtt:” anymore.
http://docs.openhab.org/tutorials/migration.html#configure-add-ons
But he should definitely perform all other suggestions …

No to the log edit - well, saying that i forced OH/Mosquitto to create new logs so i could see what was going on.

You may well be right, i can’t see OH connecting to the MQTT broker in the logs so its probably misconfigured somewhere, I’ll try testing it some more.

Thanks Sihui

Very helpful write up there Jonny i copied the config file with the # in the line but i think that turns it to a heading in the forum,

I’ll try your Tail command, many thanks for that - t like to think i know my way around Linux but there are always commands you forget!

Thanks for everyone’s help - hopefully i’ll figure it out early in the new year - Have a good one all!

James

I’m not sure what to say to that. I posted my working openhab 2 config. Maybe if it is the 1.9 binding like you said above, it still uses the old style config statements? I think it would be worth a try since it’s just a matter of typing 5 characters and restarting the openhab.

I don’t think so because it is working on my system without the leading “mqtt:”.

Why not. openHAB is full of surprises …

@Jamesb4uk, the forum doesn’t change # characters into headings if you use the backticks like I described. See how it works in my first post. There’s actually a little “code” button in the editor that does the backticks for you.

Another thought on your problem: I vaguely remember that mqtt didn’t like host names in some instances. Try changing localhost to 127.0.0.1 and see if that helps.

OK, lets see if this works.

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

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
mymosquitto.url=tcp://192.168.1.201:1883

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

# Optional. User id to authenticate with the broker.
mymosquitto.user=odroid

# Optional. Password to authenticate with the broker.
mymosquitto.pwd=odroid

# 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.
mymosquitto.qos=1

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
mymosquitto.retain=true

# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
mymosquitto.async=true

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

Most recent changes i had the same thought over the local host so actually changed it to the machines IP address.

I’ll take out the my in the broker name now so it will read mosquitto.url=tcp://192.168.1.201:1883

Back shortly with results

James

OK i still haven’t seen any change in output on the Odroid machine, i think there is something I’ve missed/messed up.

I’m now trying another image, openhabian to be precise and on that i’m now seeing the MQTT broker starting up in the logs so already an improvement.

I also see the link in from OH2 to mosquitto now - result!

1483200880: mosquitto version 1.4.10 (build date Thu, 25 Aug 2016 10:12:09 +0100) starting
1483200880: Config loaded from /etc/mosquitto/mosquitto.conf.
1483200880: Opening ipv4 listen socket on port 1883.
1483200880: Opening ipv6 listen socket on port 1883.
1483200934: New connection from 192.168.1.105 on port 1883.
1483200934: New client connected from 192.168.1.105 as ESPClient2 (c1, k15, u'pi').
1483200979: New connection from 127.0.0.1 on port 1883.

A quick recreation of the items & sitemap

Thanks again for everyones advice - its tought me a lot

Have a good New Year’s Eve all.
James

1 Like