ECMA/Java: how to fetch a value from mqtt trigger event

  • Platform information:
    • Hardware: QNAP Nas w. Docker OH3 image
    • openHAB version: 3.01

Dear all,

Easy task (it seems), but I’m stuck again :frowning:

I want to visualize values I retreive from mqtt.

So I set up a broker connection Thing (mqtt:broker:xxxxx) and defined a trigger channel (which seems to be the only way to subscribe to an mqtt topic?)

The event trigger fires, which is good; log:

[INFO ] [openhab.event.ChannelTriggeredEvent ] - mqtt:broker:xxxxxxxx:CO2 triggered 565

Now I want to have the value (565) somehow visualized.

First try was to define an Item following this value, which seems not possible.
Second option would be to use a rule to transfer the mqtt value into a dummy item
And here I don’t get a clue on how to do that, even reading loads of documentation and forums. Can anybody give me the right hint here?

Thanks a lot!
Peter

No!
Create a Generic MQTT Thing which connects to the Broker Thing (that acts as a bridge) and add channels to that Thing These Channels can subscribe to topics ( Command- and Statetopics).
However you have read about that in the documentation, haven’t you?

Oh… yes, sometimes you don’t see the forest for there are too many trees. I’ll try that, thanks! :slight_smile:

Kaum macht man’s richtig funktioniert es auch. It works, thanks!