[SOLVED] Mosquitto and Openhab no connection

Hello,

I’ve installed the newest openhab version and also mosquitto on my Raspberry.

A NodeMcu is recieving commands and turns on/off a LED.
When i send a command on the subscribed channel (with the chrome extension), the arduino is receiving the “message”, when i press the button in openhab, nothing happens.

For example, I named the channel: /garage/light

The mqtt.cfg file:

#
# 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://<host>:1883

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

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

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

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

broker.url=tcp://IP:1883


The test.items file:

Switch mySwitch {mqtt=">[mybroker:/garage/light:command:ON:1],>[mybroker:/garage/light:command:OFF:0]"}

the log says:
2018-05-15 19:09:33.713 [vent.ItemStateChangedEvent] - mySwitch changed from NULL to ON

2018-05-15 19:09:34.969 [ome.event.ItemCommandEvent] - Item ‘mySwitch’ received command OFF

2018-05-15 19:09:35.049 [vent.ItemStateChangedEvent] - mySwitch changed from ON to OFF

But it doesn’t happen anything, either on this channel with the chrome extension or the arduino.
So the fault must be the openhab…

What do you think?

You need to configure access to your broker: delete the # mark and replace <host> with the IP address of the computer where you installed your MQTT broker, if it is the same machine use 127.0.0.1, and <broker> with a name that you want to use for reference of your MQTT broker
Make sure to fill in and replace all the other lines if you have setup your broker with a user id and password authentication.
And delete:

In your item file use the same name for your broker that you have given it when replacing <broker>

I found the mistake, it was a mistake after trying it several times (mybroker instead of broker in the item file).

Thank you!