MQTT evenbus.cfg

Hello,

The config of mqtt-evenbus.cfg isn’t really clear to me. Config uses variable ${item}.
In my case, all windows are defined by numbers:

shutter/window/1/
shutter/window/2/
shutter/window/3/
...
shutter/window/7/

Openhab doesn’t let me name my Item as number so I can’t use:

CommandPublishTopic=shutter/window/${item}/

Do I have to enter static line into config file for each of my window?

CommandPublishTopic=shutter/window/1/
CommandPublishTopic=shutter/window/2/
...

Is this proper use or would you recommend a different solution?
Thanks

The whole point of the eventbus configuration is to publish the events that happen on Items. Therefore the topics that get published are going to use the Item name.

If you are looking to link Items to a device, you should be using the MQTT binding normally, not in the event bus configuration. The event bus configuration is intended to, for example, synchronize two OH instances with each other or expose all events for all Items to some other service.

Thanks @rlkoshak
So there is a way to skip mqtt-evenbus.cfg config and use MQTT command and status directives directly from items?
Or there is a need to write MQTT actions in rules?

Could you pls post an example or link one?

If you continue to use MQTT 1.x (which I don’t recommend) see MQTT Binding (v1.11) Getting Started 101.

If you use MQTT 2.x which I highly recommend start with the binding docs and MQTT Generic Thing docs. Then search the forum for “MQTT 2.4” and you will see lots of examples.

Thanks @rlkoshak pointing me to right direction.

I’ve migrated MQTT 1.x to 2.4. There are great tutorials when migrate using:

Sonoff switches works great using new MQTT binding.

Unfortunately, I got stuck on a known bug Binding-mqtt - 2.5.0.SNAPSHOT; rollershutter command is sent wrong
MQTT 2.4 is not working for Rollershutter type.

I believe it’s still possible to run both MQTT bindings so you can set up and use MQTT 1 to handle the Rollershutter types until that problem gets fixed. Or you can set up a Rule and use the MQTT Action (NOTE: The MQTT Action comes with the MQTT 2.x binding is not separately installed, see the MQTT 2.x readme docs for how to access and use it).