Things files with MQTT 2.4

i am on 2.4 correct.
its good if this is a known bug.
i will create a .thing file for each mqtt-device as long as it takes to fix.

It is fixed already. The next stable version is scheduled to come before the coming xmas ( just as if we have nothing else to do during those days☺).

hmm, and why isnt it working on my side ?

it helped me a lot - thank you hakan!

It isn’t solved on your side because you are not using a changed version. In order to get a version with changed code you would need to update now either to a snapshot or milestone version. As said before a new stable version will be released soon, if you want to stick by stable versions you could use this one.

yes, because i am a noob :slight_smile: thanks for the clarification!

What we really need for any useful comment, is what is your working setup, what is your not-working setup, what does “the whole stuff breaks” look like?

raspb.3 with openhabian 2.4

bridge.things

Bridge mqtt:broker:riot "MQTT Broker" 
[ 
    host="XXXXXXXXX", 
    port=1883, 
    secure=false, 
    username="XXXXXX", 
    password="XXXXXX" 
]

sonoff.things

Thing mqtt:topic:sonoff_th16 "MQTT Thing: Sonoff TH16" (mqtt:broker:riot) @ "MQTT-Things"
{
  Channels:
    Type switch : power "Power Switch" [ 
        stateTopic="stat/sonoff_th16/POWER", 
        commandTopic="cmnd/sonoff_th16/POWER",
        on="ON",
        off="OFF"          
    ]
    Type string : state "Power State" [ 
        stateTopic="stat/sonoff_th16/POWER",
        on="ON",
        off="OFF"
    ]
    Type number : temperature "Temperature" [ 
        stateTopic="tele/sonoff_th16/SENSOR",
        transformationPattern="JSONPATH:$.SI7021.Temperature"
    ]
    Type number : humidity "Humidity" [ 
        stateTopic="tele/sonoff_th16/SENSOR",
        transformationPattern="JSONPATH:$.SI7021.Humidity"
    ]
    Type number : rssi "RSSI" [ 
        stateTopic="tele/sonoff_th16/STATE",
        transformationPattern="JSONPATH:$.Wifi.RSSI"
    ]
    Type number : load "Load" [ 
        stateTopic="tele/sonoff_th16/STATE",
        transformationPattern="JSONPATH:$.LoadAvg"
    ]
    Type string : uptime "Uptime" [ 
        stateTopic="tele/sonoff_th16/STATE",
        transformationPattern="JSONPATH:$.Uptime"
    ]
    Type string : ssid "SSId" [ 
        stateTopic="tele/sonoff_th16/STATE",
        transformationPattern="JSONPATH:$.Wifi.SSId"
    ]
}

to here all is fine.


and as soon as i put this on the bottom of the file (sonoff.things) , both sonoffs arent showing up as Thing in PaperUI

Thing mqtt:topic:sonoff_1  "MQTT Thing: Sonoff Basic"  (mqtt:broker:riot) @ "MQTT-Things"
{
    Channels:
        Type number : wifi "Wifi"  
        [ 
            stateTopic="/Sonoff_1/WI-FI/" 
        ]
        Type number : uptime "Uptime"  
        [ 
            stateTopic="/Sonoff_1/uptime/Minutes" 
        ]
}

in 2 seperate .things files, both sonoff work as intended

I’m gonna guess openhab.log will tell you something about it when the xxx.things file is loaded.

I wonder if it has anything to do with duplicate channel ID uptime

Could you explain how you set this up with the embedded broker (Openhab Moquette, misc-mqttbroker - 2.5.1). I tried out all sorts of combinations of the bridge and things files but cannot manage to get it working. I try to send some test MQTT commands to OpenHAB via MQTT.fx first, but this does not work.

How do I setup the bridge.things file for the embedded broker? I both to use the “mqtt:systemBroker:embedded-mqtt-broker” directly in the mqtt.things file to assign a topic but also tried:

Bridge mqtt:broker:myMQTT "MQTT Broker: MyTest Mosquitto"
[
    host="localhost",
    port=1883,
    secure=false
]

Doesn’t work :frowning:

I tried it the other way around and apparently set it up somewhat correctly, because using a trigger and this rule, I can send MQTTs and can view them in MQTT.fx

rule "MQTTtest"
when
	Item mqtttest received command ON
then 
    val mqttActions = getActions("mqtt","mqtt:systemBroker:embedded-mqtt-broker")
    mqttActions.publishMQTT("MQTT-Testtrigger","Testtest", true)
end