[SOLVED] MQTT 2.4, can't get device to connect

Hello, I’m having some MQTT 2.4 woahs.

Specs:
openhabian pi3
build 2.4.0.-1 (ran latest updates a week ago)
mosquito installed via putty
mqtt 2.4.0 binding
embedded broker installed as well

Thing:
Nodemcu running ESPeasy
devices are oled screen, DHT temp/humidity sensor and a PIR sensor.
I’m currently working on the DHT temp sensor

If I run:

Bridge mqtt:broker:myBroker [ host="192.168.2.153", username="openhabian", password="openhabian", secure=false ]
{   
    Channels:
        Type number : temperature "Temperature" [stateTopic="/NW_Bedroom/DHT/Temperature" ]
}
//Test MQTT
Number Test123 "Temperature [%.1f °F]" {channel="mqtt:topic:NW_Bedroom:temperature", autoupdate="true" }

I can see it reading in logs:
2019-02-03 09:11:04.421 [vent.ChannelTriggeredEvent] - mqtt:broker:myBroker:temperature triggered 69.1

however I can’t see a “thing” or any “items”.

My understanding, my code for Thing should be something along these lines:

Bridge mqtt:broker:myBroker [ host="192.168.2.153", username="openhabian", password="openhabian", secure=false ]
{
    Thing mqtt:topic:NW_Bedroom "Bedroom" @ "NW Bedroom" {   
    Channels:
        Type number : temperature "Temperature" [stateTopic="DHT/Temperature" ]
    }
}

logs dont show the thing or item however I do see the:
2019-02-03 09:19:26.444 [hingStatusInfoChangedEvent] - ‘mqtt:broker:myBroker’ changed from OFFLINE to ONLINE
I’ve had no success. I’ve spent a week on this. Literally read every thread I can find. What am I missing and/or doing wrong?

Have you tried

Bridge mqtt:broker:myBroker [ host="192.168.2.153", username="openhabian", password="openhabian", secure=false ]
{
    Thing topic NW_Bedroom "Bedroom" @ "NW Bedroom" {   
    Channels:
        Type number : temperature "Temperature" [stateTopic="DHT/Temperature" ]
    }
}

Also with esp easy you may need the leading slash but not sure as I haven’t converted my esp easy devices to 2.x yet.

    Channels:
        Type number : temperature "Temperature" [stateTopic="/DHT/Temperature" ]
    }
}

gets an error in logs , thing offline

2019-02-03 09:31:48.755 [DEBUG] [core.thing.internal.ThingManagerImpl] - Thing 'mqtt:topic:myBroker:NW_Bedroom' is no longer tracked by ThingManager.

2019-02-03 09:31:48.758 [DEBUG] [core.thing.internal.ThingManagerImpl] - Calling dispose handler for thing 'mqtt:topic:myBroker:NW_Bedroom' at 'org.eclipse.smarthome.binding.mqtt.generic.internal.handler.GenericThingHandler@1dbf7df'.

2019-02-03 09:31:48.769 [DEBUG] [core.thing.internal.ThingManagerImpl] - Calling unregisterHandler handler for thing 'mqtt:topic:myBroker:NW_Bedroom' at 'org.eclipse.smarthome.binding.mqtt.generic.internal.MqttThingHandlerFactory@1d81c1b'.

2019-02-03 09:31:48.771 [hingStatusInfoChangedEvent] - 'mqtt:topic:myBroker:NW_Bedroom' changed from OFFLINE (COMMUNICATION_ERROR): java.lang.Exception: No MQTT client to UNINITIALIZED

2019-02-03 09:31:48.807 [hingStatusInfoChangedEvent] - 'mqtt:topic:myBroker:NW_Bedroom' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)

2019-02-03 09:32:08.480 [DEBUG] [ore.common.registry.AbstractRegistry] - Cannot remove "ThingImpl" with key "mqtt:topic:NW_Bedroom" from provider "GenericThingProvider" because it does not exist!

I tried the Thing the way you suggest but it goes offline, goes back online with mqtt:topic. I’ve also tried the channel every which way I can think of. Leading / etc.

I forgot to add NW_Bedroom to the Topic.

Bridge mqtt:broker:myBroker [ host="192.168.2.153", username="openhabian", password="openhabian", secure=false ]
{
    Thing topic NW_Bedroom "Bedroom" @ "NW Bedroom" {   
    Channels:
        Type number : temperature "Temperature" [stateTopic="/NW_Bedroom/DHT/Temperature" ]
    }
}

Also in the item’s file add the broker name to the channel like this.

Number Test123 "Temperature [%.1f °F]" {channel="mqtt:topic:myBroker:NW_Bedroom:temperature", autoupdate="true" }
1 Like
2019-02-03 09:39:27.798 [DEBUG] [core.thing.internal.ThingManagerImpl] - Thing 'mqtt:topic:NW_Bedroom' is no longer tracked by ThingManager.

2019-02-03 09:39:27.802 [DEBUG] [core.thing.internal.ThingManagerImpl] - Calling dispose handler for thing 'mqtt:topic:NW_Bedroom' at 'org.eclipse.smarthome.binding.mqtt.generic.internal.handler.GenericThingHandler@164b51a'.

2019-02-03 09:39:27.812 [DEBUG] [core.thing.internal.ThingManagerImpl] - Calling unregisterHandler handler for thing 'mqtt:topic:NW_Bedroom' at 'org.eclipse.smarthome.binding.mqtt.generic.internal.MqttThingHandlerFactory@1d81c1b'.

2019-02-03 09:39:27.812 [hingStatusInfoChangedEvent] - 'mqtt:topic:NW_Bedroom' changed from ONLINE to UNINITIALIZED

2019-02-03 09:39:27.833 [hingStatusInfoChangedEvent] - 'mqtt:topic:NW_Bedroom' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)

2019-02-03 09:39:28.011 [DEBUG] [.thing.internal.GenericThingProvider] - Adding thing 'mqtt:topic:myBroker:NW_Bedroom' from model 'home.things'.

2019-02-03 09:39:28.057 [DEBUG] [core.thing.internal.ThingManagerImpl] - Thing 'mqtt:topic:myBroker:NW_Bedroom' is tracked by ThingManager.

2019-02-03 09:39:28.062 [DEBUG] [core.thing.internal.ThingManagerImpl] - Calling 'MqttThingHandlerFactory.registerHandler()' for thing 'mqtt:topic:myBroker:NW_Bedroom'.

2019-02-03 09:39:28.067 [DEBUG] [core.thing.internal.ThingManagerImpl] - Config description for 'mqtt:topic' is not resolvable, assuming 'mqtt:topic:myBroker:NW_Bedroom' is initializable

2019-02-03 09:39:28.089 [DEBUG] [core.thing.internal.ThingManagerImpl] - Configuration of 'mqtt:topic:myBroker:NW_Bedroom:temperature' needs [], has [retained, step, formatBeforePublish, stateTopic].

2019-02-03 09:39:28.096 [DEBUG] [core.thing.internal.ThingManagerImpl] - Calling initialize handler for thing 'mqtt:topic:myBroker:NW_Bedroom' at 'org.eclipse.smarthome.binding.mqtt.generic.internal.handler.GenericThingHandler@dfd554'.

2019-02-03 09:39:28.100 [hingStatusInfoChangedEvent] - 'mqtt:topic:myBroker:NW_Bedroom' changed from UNINITIALIZED to INITIALIZING

2019-02-03 09:39:28.104 [DEBUG] [.MqttChannelStateDescriptionProvider] - Adding state description for channel mqtt:topic:myBroker:NW_Bedroom:temperature

2019-02-03 09:39:28.119 [hingStatusInfoChangedEvent] - 'mqtt:topic:myBroker:NW_Bedroom' changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): java.lang.Exception: No MQTT client

I think you’re on the right path, I see a thing now in paperui. I did not previously.

Status: OFFLINE - COMMUNICATION_ERROR java.lang.Exception: No MQTT client

Did you make the change to the channel, adding the broker name, like in my post above? Also when editing the thing file on 2.x binding you will need to restart OH for the binding to work.

You the man!! (or woman), rebooted and it came online and shows proper on paperui. Seriously I’ve spent so much time on this, i bet the entire time it was because I was not rebooting.

Can I send you a NodeMCU or maybe some zigbee sensors as a thankyou? PM if you’re interested.

Thank you, that is very nice, but currently I have plenty.:sunglasses: I enjoy helping others and knowing that I helped is good enough. If you want, click the heart icon and give a like on post that you find helpful. That’s a good way to show anyone on the forum a thank you.

Also, if you would, please mark the topic solved by clicking the square box (lower right corner) on the post that provided the solution and edit the title to start with [Solved].

Thanks

1 Like