# \[SOLVED\] Mqtt 1.13 legacy with oh 2.4.0 not working tried everything

**URL:** <https://community.openhab.org/t/solved-mqtt-1-13-legacy-with-oh-2-4-0-not-working-tried-everything/74710>\
**Category:** Bindings\
**Tags:** openhab2, mqtt\
**Created:** [May 19, 2019, 4:10am UTC](https://community.openhab.org/t/solved-mqtt-1-13-legacy-with-oh-2-4-0-not-working-tried-everything/74710 "2019-05-19T04:10:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![asking](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/4bbf92/32.png) [@asking](https://community.openhab.org/u/asking)\
**Post date:** [May 19, 2019, 4:10am UTC](https://community.openhab.org/t/solved-mqtt-1-13-legacy-with-oh-2-4-0-not-working-tried-everything/74710/1 "2019-05-19T04:10:06Z")

</div>

- Platform information:

- Issue:  
Mqtt Not started, but no commands are observed in openhab log..  
I am trying to simply simulate using dummy switch as show in below item file.  
Legacy 1.x Binding Installed from paperui  
Mosquitto mqtt installed from sudo openhabian-config

Configuration is as below  
livingroom.items

```csv
Switch MQTT_Test "Testing..." { mqtt="<[broker:testing/mqtt/topic:state:default], >[broker:testing/mqtt/back-topic:command:*:default]" }

```

Using MQTT FX publishing on below topic with payload “ON” / “OFF” nothing shows up in openhab.log or events.log

```csv
testing/mqtt/topic

```

Openhab Logs shows no error

```csv
2019-05-19 09:16:17.586 [INFO] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel

2019-05-19 09:16:17.638 [INFO] [.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Asia/Calcutta'.

2019-05-19 09:16:17.670 [INFO] [.core.internal.i18n.I18nProviderImpl] - Location set to '22.44030830534578,70.08164521108743'.

2019-05-19 09:16:17.679 [INFO] [.core.internal.i18n.I18nProviderImpl] - Locale set to 'en_IN'.

2019-05-19 09:16:33.096 [INFO] [el.core.internal.ModelRepositoryImpl] - Loading model 'livingroom.items'

2019-05-19 09:16:40.288 [INFO] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007

2019-05-19 09:16:41.383 [INFO] [el.core.internal.ModelRepositoryImpl] - Loading model 'main.sitemap'

2019-05-19 09:16:43.536 [INFO] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.31.122:8080

2019-05-19 09:16:43.549 [INFO] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.31.122:8443

2019-05-19 09:16:44.036 [INFO] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.

2019-05-19 09:16:44.050 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection '<broker>'

2019-05-19 09:16:46.147 [INFO] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui

2019-05-19 09:16:46.374 [INFO] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin

```

mqtt.cfg (/var/lib/openhab2/config/org/openhab)

```csv
<broker>.clientId="openhab2"
<broker>.pwd="abcd123"
<broker>.url="tcp://192.168.31.122:1883"
<broker>.user="openhabian"
service.pid="org.openhab.mqtt"

```

/etc/openhab2/services/mqtt.cfg

```csv
#
# 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
<broker>.url=tcp://192.168.31.122:1883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
<broker>.clientId=openhab2

# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false

# Optional. User id to authenticate with the broker.
<broker>.user=openhabian

# Optional. Password to authenticate with the broker.
<broker>.pwd=abcd123

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

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

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

# 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>

```

I am hitting my head on wall, but this thing is not working.

I also tried Cleaning Cache and all other Suggestion available in community. even Re-Installed Openhab2 but still same. What could be possibly wrong ?

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [May 19, 2019, 5:10am UTC](https://community.openhab.org/t/solved-mqtt-1-13-legacy-with-oh-2-4-0-not-working-tried-everything/74710/2 "2019-05-19T05:10:41Z")

</div>

> [@asking](#):
>
> but this thing is not working.

because your mqtt.cfg syntax is wrong:

try `broker` instead of `<broker>`

```auto
broker.url=tcp://192.168.31.122:1883

```

(also for all the other occurrences)

---

<div class="post-metadata">

**Author:** ![asking](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/4bbf92/32.png) [@asking](https://community.openhab.org/u/asking)\
**Post date:** [May 19, 2019, 5:16am UTC](https://community.openhab.org/t/solved-mqtt-1-13-legacy-with-oh-2-4-0-not-working-tried-everything/74710/3 "2019-05-19T05:16:21Z")

</div>

I changed to following

```csv
#
# 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
broker.url=tcp://192.168.31.122:1883

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

# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false

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

# Optional. Password to authenticate with the broker.
broker.pwd=abcd123

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

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

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

# 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>

```

But i am getting continuous error now.

```csv
2019-05-19 10:43:59.463 [WARN] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to '<broker>' was lost: Connection lost : ReasonCode 32109 : Cause : null

2019-05-19 10:43:59.468 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restoring connection to broker '<broker>'

2019-05-19 10:44:09.478 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection '<broker>'

2019-05-19 10:44:09.510 [WARN] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to 'broker' was lost: Connection lost : ReasonCode 32109 : Cause : null

2019-05-19 10:44:09.516 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restoring connection to broker 'broker'

2019-05-19 10:44:19.523 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker'

2019-05-19 10:44:19.558 [WARN] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to '<broker>' was lost: Connection lost : ReasonCode 32109 : Cause : null

2019-05-19 10:44:19.563 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restoring connection to broker '<broker>'

2019-05-19 10:44:29.574 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection '<broker>'

2019-05-19 10:44:29.602 [WARN] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to 'broker' was lost: Connection lost : ReasonCode 32109 : Cause : null

2019-05-19 10:44:29.614 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restoring connection to broker 'broker'

2019-05-19 10:44:39.622 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker'

2019-05-19 10:44:39.652 [WARN] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to '<broker>' was lost: Connection lost : ReasonCode 32109 : Cause : null

2019-05-19 10:44:39.658 [INFO] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restoring connection to broker '<broker>'

```

Anything else to try ? 🤔

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [May 19, 2019, 5:24am UTC](https://community.openhab.org/t/solved-mqtt-1-13-legacy-with-oh-2-4-0-not-working-tried-everything/74710/4 "2019-05-19T05:24:07Z")

</div>

> [@asking](#):
>
> Anything else to try ?

Stop openHAB, delete /var/lib/openhab2/config/org/openhab/mqtt.config, restart openHAB.  
Make sure all clients connected have different client id’s.

---

<div class="post-metadata">

**Author:** ![asking](https://community.openhab.org/letter_avatar_proxy/v4/letter/a/4bbf92/32.png) [@asking](https://community.openhab.org/u/asking)\
**Post date:** [May 19, 2019, 5:42am UTC](https://community.openhab.org/t/solved-mqtt-1-13-legacy-with-oh-2-4-0-not-working-tried-everything/74710/5 "2019-05-19T05:42:30Z")

</div>

Thanks sihui

Changed to broker in all instances. and delete /var/lib/openhab2/config/org/openhab/mqtt.config and rebooted openhab server everything working now.

I have

```csv
<broker>.url=tcp://192.168.31.122:1883

```

thing working in old version. I think in new version “broker” is required.

---

<div class="post-metadata">

**Author:** ![David\_Graeff](https://community.openhab.org/user_avatar/community.openhab.org/david_graeff/32/61322_2.png) [@David\_Graeff](https://community.openhab.org/u/David_Graeff)\
**Post date:** [May 19, 2019, 5:42pm UTC](https://community.openhab.org/t/solved-mqtt-1-13-legacy-with-oh-2-4-0-not-working-tried-everything/74710/6 "2019-05-19T17:42:32Z")

</div>

In every documentation on the planet that I know of the “\<…\>” syntax is used to symbolize **placeholders**. We do this here as well. A placeholder is as the name suggests to be replaced by a value that is valid in that context. The corresponding documentation usually restricts values. We do this as well: Only latin ascii characters are allowed for broker connection ids (no “\<”, no “\>”).

The tl;dr: Please read the documentation.
