[CLOSED] MQTT binding version 2.4 (Pre-release !)

Do you mean for e.g. a base64 encoded string of binary data? I’m just wondering from a practical level how you would send pure binary data over MQTT.

using the -f (file) option:

mosquitto_pub -t test -f image.jpg

but I don’t think that you can use OH2 MQTT bound Items to do this
I think that here, @vzorglub is right: OH2 MQTTv1 will only publish strings for payloads.
maybe you can do binary with the MQTT Action (doubt it)

This would be a nice test: use an Image item and subscribe to a topic. publish the image using MQTTfx (or mosquitto_pub) and see if OH2 item will get it :slight_smile:

We are going way off-topic (again) :slight_smile:

Started to experiment with this binding today to migrate all my existing mqtt items and noticed a minor bug: when setting up the broker, the ‘Client ID’ is not set to the value I put in the field (in paperui) and instead overwritten with a random string. Nothing important, so don’t make it a priority :wink: Thanks for all your work!

Edit: More pressing issues when trying to create things in paperui. I could create a broker, which successfully connects to mosquitto. But when i try to create a ‘topic’ thing, it seems like it doesn’t use the broker thing. I can choose the broker bridge I created, but when I create a channel on the topic thing it goes offline.

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

The channel id gets set to mqtt:topic:<thing id>:<channel id> but i believe it should be mqtt:<broker>:topic:<thing id>:<channel id>
I will try a manual configuration in .things-files and see if it works, in which case there’s an issue either in paperui or how the binding handles the thins created there.

Edit 2: Seems that stopping and restarting the openhab 1.x mqtt bundles resolved it. Perhaps there is some conflict between them?

1 Like

Are you using OH snapshots? This sounds like a problem fixed some weeks ago.

I’m using M6, but as I wrote in my second edit, a restart of all mqtt-bundles (both 1.x and 2.x versions) solved it :slight_smile:

Hello,
Newbie alert.
Can anyone help me with linking a master(docker in a VM) and slave(openhabianpi with z wave controller) openhab configuration with mqtt eventbus/or the newer way of doing it with binding 2.4?

Hi, don’t even think about using MQTTv2 to setup such “link” :slight_smile:
We haven’t tested this integration so you will enter in deep waters almost alone
(unless of course you want to break new ground and be a pioneer… in this case go ahead :stuck_out_tongue:)

It’s better to leave this thread alone for the developments of MQTTv2 and open up a new one asking your stuff

Noted with thanks. I will stick with the 1.13 binding for now then.

1 Like

I am using mqtt 2.4 binding to extract values from a topic using jsonpath. Every time a value is extracted I got a warning in OH log. This happens for all channels that are linked to an item. The extract works well. Thanks for any suggestions.

Log message:

2018-11-26 09:02:36.944 [WARN ] [ofiles.JSonPathTransformationProfile] - Please specify a function and a source format for this Profile in the 'function' and 'sourceFormat' parameters. Returning the original state now.

MQTT message:

Client mosqsub/20978-openHABia received PUBLISH (d0, q0, r0, m0, 'tasmota/sonoff_heater/tele/SENSOR', ... (303 bytes))
{"Time":"2018-11-26T09:04:35","DS18B20-1":{"Id":"000006B54467","Temperature":49.6},"DS18B20-2":{"Id":"000006B56D00","Temperature":37.1},"DS18B20-3":{"Id":"000006B66271","Temperature":40.9},"DS18B20-4":{"Id":"000006B7001D","Temperature":43.3},"AM2301":{"Temperature":23.1,"Humidity":47.0},"TempUnit":"C"}

JSONPATH example:

JSONPATH:$.DS18B20-4.Temperature

@David_Graeff

For some reason having restarted my OH2, my Generic MQTT Things will not go online anymore.

The reason is fairly nondescript as to why:

UNINITIALIZED - HANDLER_CONFIGURATION_PENDING

These were complete configured through Paper UI and working until I restarted so it seems like a bug somewhere in the handler start up. If I have time towards the end of the week I’ll try and debug it.

Your oh got updated. I needed to change channel type names, so all things created before X will go offline if such an old channel is part of it.
I have already changed the offline message in an update to shed some light on this.

Not sure that is why. I am on latest snapshot and these are newly created Things (yesterday) - my OH2 hasn’t been updated since.

Check that switches have a command entry, that was my problem

Exactly my problem too. Adding in a dummy topic brought my Thing back online.

Edit: It looks like this line would need changing so that commandTopic is not required for the Thing to come online.

The fact that you can create a Thing that will go online the first time without a required parameter but not after a restart also seems like a bug but I’m not sure if this is in the binding (not so important if it will be changed) or the framework (probably more important).

Edit 2: An alternative approach may be to create a new Binary Sensor thing type which only has a state topic rather than a command topic.

1 Like

I’m having problems with textual configuration.
Using the latest snapshot #1445 and have my broker setup texually just fine. But there is something strange when I try to set up a generic thing as per https://github.com/eclipse/smarthome/blob/master/extensions/binding/org.eclipse.smarthome.binding.mqtt.generic/README.md. The thing does not get created. If I edit out the broker from the thing ie: mqtt:topic:mything, the thing gets created and I can add the broker through the bridge selection in paperui although it throws a : ERROR: 409 conflict.

Those problems are all fixed in snapshots newer than today :slight_smile:

Read-only switches are now possible.

1 Like

I’m not using the textual configuration, so I do not test any of my bindings with textual configurations. I assume that if Paper UI works, textual should work as well. So my advice is: Have you tried to use Paper UI for configuration as well?

Cheers, David

Hi David,

I have a problem with that code :

Bridge mqtt:broker:mynewsnips "MQTT Broker 2" [ host="192.168.1.2", username="user", password="xxxx" ] 
{
    Thing topic mything "Generic MQTT Thing 2" 
    {
        Channels:
            Type string : testmqttrois "mqtttestrois"  [ stateTopic="hermes/hotword/default/detected", stateCommand="", formatBeforePublish="" ]
    }
}

The broker seems ok, the generic MQTT seems ok.
When i go in paperui, i can see the channel. But when i edit it, state topic is empty and formatBeforePublish is always with %s. It’s like my parameter above was not read.
I tried with mqttstate and mqttcommand too, but the result is the same.

When all is configured from paperui, it’s OK.

Have you an idea ?

Thank you

Ced

**edit 2 : **

It’s Ok now. I did apt-get dist-upgrade 4 hours ago and i did it now. There was an update during this time.

Thank you !

Hi @David_Graeff is there a solution implemented yet so that a channel can receive an INCREASE or DECREASE payload?

A dimmer/percentage channel can process increase/decrease commands. What exactly do you mean?