Event bus configuration

Hi I have configured Event Bus in mqtt-eventbus.cfg like this but i am getting error like:-

This not a valid outbound configuration: Configuration requires 5 parameters separated by ‘:’

Name of the broker as it is defined in the openhab.cfg. If this property is not available, no event bus MQTT binding will be created.

broker=mosquitto

When available, all status updates which occur on the openHAB event bus are published to the provided topic. The message content will

be the status. The variable ${item} will be replaced during publishing with the item name for which the state was received.

statePublishTopic=home:out:${item}:state

When available, all commands which occur on the openHAB event bus are published to the provided topic. The message content will be the

command. The variable ${item} will be replaced during publishing with the item name for which the command was received.

commandPublishTopic=home:out:${item}:command

When available, all status updates received on this topic will be posted to the openHAB event bus. The message content is assumed to be

a string representation of the status. The topic should include the variable ${item} to indicate which part of the topic contains the

item name which can be used for posting the received value to the event bus.

stateSubscribeTopic=home:in:${item}:state

When available, all commands received on this topic will be posted to the openHAB event bus. The message content is assumed to be a

string representation of the command. The topic should include the variable ${item} to indicate which part of the topic contains the

item name which can be used for posting the received value to the event bus.

commandSubscribeTopic=home:in:${item}:command

I am not understaing why this error is comming

Please help me to do proper event-bus configuration

please fill in your configuration files in Code fences (``` or ust one of the Icons on the upper right).

To your question:

  1. Do you have your mqtt.cfg configured accordingly? Meaning the Broker “mosquitto” is in there and is functioning?
    if unsure, please provide your mqtt.cfg and the regarding entry in openhab.log also
  2. Do you know, how MQTT works? the topics and subtopics for mqtt messaging are divided by / not :
    if not, please have a look: https://www.hivemq.com/mqtt-essentials/

your mqtt-eventbus.cfg should read something like:

broker=mosquitto
commandPublishTopic=home/out/${item}/command
stateSubscribeTopic=home/in/${item}/state
...

Hi I have done that and my error are gone but I am still getting this error which I have taken from Mqttfx

*** PAYLOAD IS NOT VALID JSON DATA ***

Unexpected character (‘o’ (code 111)): expected a valid value (number, String, array, object, ‘true’, ‘false’ or ‘null’)
at [Source: java.io.StringReader@2ae9d28e; line: 1, column: 2]

I am not understanding what is this error

for what purpose do you need the eventbus? and when exactly do you see this error message in mqtt.fx?

I have multiple things such as tv, hue lights , sonos nusic player configured in my house with openhab

I want to get message when I turn on/off tv . If I
do this in Switch item of TV it would be static things.
So I have configured Event bus so that all the updates on state change as well as on command change can be sent to mqtt broker

But I am not getting value of state (like for tv (ON/OFF etc.)) On my broker side (i.e Mqtt.fx).

ok. the eventbus is normally used, if you need all of your items’ states published to lets say another instance of openHAB. if you just need some of the items published, there’s a simple configuration for your items:

Switch  MyTV    { bindingconfig, mqtt=">[mosquitto:home/out/MyTV/command:*:default] }

You can have multiple configurations per item, divided by comma. So insert your existing bindingconfig in the first one. the second one “mqtt…” sends (hence the >)

  • via the mqtt-broker “mosquitto
  • with the Topic home/out/MyTV/command
  • the state
  • with default transformation
Item myItem {mqtt="<direction>[<broker>:<topic>:<type>:<transformer>], <direction>[<broker>:<topic>:<type>:<transformation>], ..."}

(see https://docs.openhab.org/addons/bindings/mqtt1/readme.html for more on that).

How do you use the MQTT-Messages for display?

if you still want to use the eventbus, please paste your item config, mqtt.cfg and mqtt-eventbus.cfg here. And include the action, which lead to the errormessage in mqtt.fx as well as the content of your events.log and openhab.log.