MQTT Problems, its connects but doesn't send messages

Hi, im starting to work with OpenHub2 and have some problems witha mqtt switch

I see in the logs of my mqtt server the connection but no the messages (and of course it doesn’t turn on the switch).

#logs.txt (from the mqtt server)
2017-07-13T22:14:14.278Z ‘client connected’ ‘openhab2’

But when i click on the buttons they are never sent

#items/home.items

LuzPiezaNora "Luz Pieza Nora" {mqtt=">[broker:/interior/pieza_nora:command:ON:ON],>[broker:/interior/pieza_nora:command:OFF:OFF]"}

#sitemaps/home.sitemap
sitemap home label=“Home”
{
Frame label=“Luces”
{
Switch item=LuzPiezaNora
Switch item=LuzPiezaCristian
}
}

services/mqtt.cfg

#
# 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.0.106: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=<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>

first of all, don’t use <broker>. change it to something like:

mybroker.url=tcp://192.168.0.106:1883
mybroker.clientId=openhab2

Then, for your item, try:

LuzPiezaNora "Luz Pieza Nora" {mqtt=">[mybroker:/interior/pieza_nora:command:*:default]"}

Additional troubleshooting step:

1 Like