[SOLVED] [MQTTv2] MqttBroker connection configuration faulty: host : You need to provide a hostname/IP!

openhab2
mqtt2
Tags: #<Tag:0x00007fe05f3616f8> #<Tag:0x00007fe05f3606e0>

(the tiana) #1

Hello, i have problem running mqtt on OpenHab2 cannot connect to mqtt broker “You need to provide a hostname/IP!”

config /services/mqtt.cfg

pi6broker.url=tcp://192.168.3.6:1883
pi6broker.clientId=OpenHAB2

var/lib/openhab2/config/org/openhab/mqtt.config is empty

the broker and the OH2 are on the same machine.

log

2018-12-04 22:22:58.653 [DEBUG] [org.openhab.io.transport.mqtt       ] - BundleEvent [unknown:512] - org.openhab.io.transport.mqtt
2018-12-04 22:23:21.931 [DEBUG] [org.openhab.io.transport.mqtt       ] - BundleEvent STARTING - org.openhab.io.transport.mqtt
2018-12-04 22:23:21.937 [DEBUG] [org.openhab.io.transport.mqtt       ] - BundleEvent STARTED - org.openhab.io.transport.mqtt
2018-12-04 22:23:21.964 [DEBUG] [penhab.io.transport.mqtt.MqttService] - Starting MQTT Service...
2018-12-04 22:23:21.970 [DEBUG] [org.openhab.io.transport.mqtt       ] - ServiceEvent REGISTERED - {org.openhab.io.transport.mqtt.MqttService, org.osgi.service.cm.ManagedService}={service.id=320, service.bundleid=269, service.scope=bundle, service.pid=org.openhab.mqtt, component.name=MQTT Connection Service, component.id=15} - org.openhab.io.transport.mqtt
2018-12-04 22:23:21.972 [TRACE] [penhab.io.transport.mqtt.MqttService] - Processing property 'pi6broker.clientId' = OpenHAB2
2018-12-04 22:23:21.998 [TRACE] [t.mqtt.internal.MqttBrokerConnection] - clientId property changed. client will be shut down.
2018-12-04 22:23:22.000 [DEBUG] [t.mqtt.internal.MqttBrokerConnection] - Closing connection to broker 'pi6broker'
2018-12-04 22:23:22.002 [TRACE] [penhab.io.transport.mqtt.MqttService] - Processing property 'pi6broker.url' = tcp://192.168.3.6:1883
2018-12-04 22:23:22.004 [TRACE] [t.mqtt.internal.MqttBrokerConnection] - url property changed. client will be shut down.
2018-12-04 22:23:22.006 [DEBUG] [t.mqtt.internal.MqttBrokerConnection] - Closing connection to broker 'pi6broker'
2018-12-04 22:23:22.008 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-12-04 22:23:22.010 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'pi6broker'
2018-12-04 22:23:22.019 [DEBUG] [t.mqtt.internal.MqttBrokerConnection] - Creating new client for 'tcp://192.168.3.6:1883' using id 'OpenHAB2' and file store '/var/lib/openhab2/tmp/pi6broker'
2018-12-04 22:23:24.214 [WARN ] [.MqttBrokerConnectionServiceInstance] - MqttBroker connection configuration faulty: host : You need to provide a hostname/IP!

(Angelos) #2

did you try without a number in the alias? (this maybe a bug)

pid:org.openhab.mqtt
rpibroker.url=tcp://127.0.0.1:1883
rpibroker.clientId=OpenHAB2

that’s not good. it should be populated with the info coming from $OPENHAB_CONF/services/mqtt.cfg
delete $OPENHAB_USERDATA/config/org/openhab/mqtt.config and let OH2 recreate it
Did you erase the info from this file manually?

Do you have the MQTT Action installed also?


(Angelos) #3

oops… it seems that you are using the new MQTTv2 Binding?

What exactly did you install in PaperUI? Which OH2 version are you running?


(the tiana) #4

Yes i use the new V2 binding, i use openHAB 2.4.0 Build #1447
PaperUI i have install mqtt action and binding. And some other bindings witch also not work. The in OH2 item files, sitemaps files, … everything is different. And this Thinks i read the documentation about them but i cannot understand their purpose. is it needed to communicate with the broker.


(Angelos) #5

Then you should not use mqtt.cfg anymore. This is for MQTTv1 (same with the MQTT Action Addon)

For MQTTv2 Read:

  1. https://github.com/eclipse/smarthome/blob/master/extensions/binding/org.eclipse.smarthome.binding.mqtt/README.md
  2. MQTT binding version 2.4

Also: read: How to ask a good question (you should have mentioned your OH2 and binding version in the first post :stuck_out_tongue:)


(the tiana) #6

Finally is fixed.

I delete the new binding 2.4 and install the old one and everything is ok.

The documentation is little bit confusing there write version “latest” but is for MQTTv1


(Angelos) #7

Take a look at the URL: https://www.openhab.org/addons/bindings/mqtt1/ (MQTTv1)
The docs for MQTTv2 have not been published yet on the openhab website
The latest refers to the openHAB Release # (latest = 2.4.0)


(David Graeff) #8

Is this solved? :slight_smile:
With openHAB 2.4 there is no need to use mqttv1, except if you like text files and pain.

Cheers, David


(Angelos) #9

seems so :slight_smile:
user fell back to MQTTv1

kinky !


(Fernando García) #10

Hello. I have the same problem, but I don’t know how to install MQTTv1.
The only option that appears in Paper UI is:
### Embedded MQTT Broker
misc-mqttbroker - 2.3.0

Even with “Include Legacy 1.x Bindings” activated.
My OH2 version: 2.3.0 Release Build

Do you know how to install MQTTv1?
Thanks


(Angelos) #11

you are looking in the Misc tab of the addons
check the Bindings tab


(Steffen) #12

Hiho,
I’m using:
250 x Active x 80 x 0.10.0.oh240 x Eclipse SmartHome MQTT Binding
251 x Active x 80 x 0.10.0.oh240 x Eclipse SmartHome MQTT Thing Binding
252 x Active x 80 x 0.10.0.oh240 x Eclipse SmartHome MQTT Transport Bundle
everything works fine.
I delete also:
$OPENHAB_USERDATA/config/org/openhab/mqtt.config
$OPENHAB_CONF/service/mqtt.config
But anyway I got the log entry:

2018-12-21 13:45:35.721 [WARN ] [.MqttBrokerConnectionServiceInstance] - MqttBroker connection configuration faulty: host : You need to provide a hostname/IP!

As I mentioned everything works fine but I will not see this entry :wink:


(David Graeff) #13

Have you cleared the cache?


(Steffen) #14

Yes just now but it did not solve it.


(Jürgen Baginski) #15

How did you configure MQTT, by PaperUI or files?

Please post all your settings and all log lines relating to mqtt after a restart.


(David Graeff) #16

This is not related to MQTT Things. This is related to what is referred to as System brokers in the MQTT blog post. There is a UI for this in Paper UI. Look under “Config -> Services -> MQTT Brokers” or so and delete all broker instances over there.


(Steffen) #17

Hey David - 100 Points :slight_smile:
This solves the problem. Thank You.
BTW: Under “Config -> Services -> MQTT Brokers” I had no instances.
I do the this in Karaf console:

  229  config:list | grep -i mqtt
  230  config:delete org.eclipse.smarthome.mqttbroker