MQTT Event Bus in OH2 Sending "Undefined"

I’m currently using the snapshot version of OH2 with the MQTT binding. I’ve setup MQTT with Event Bus configuration because this OH2 instances is going to feed some internal information to an external server over MQTT. The issue is that I am seeing real values for a Sonos control item in my events.log, but “Undefined” is published to MQTT.

For example, in my events.log, I see the following when I pause a player:

2016-12-04 22:28:21.388 [ItemStateChangedEvent ] - sonosJOControl changed from PLAY to PAUSE

But the following is what I see on the related topic for the same occurrence:

XXXXXX/out/sonosJOControl/state Undefined

I would expect to see “PAUSE” published to the topic.

Same problem here.
Is there a solution for this?

Related issue on github:

It looks like this is still an open issue. Did anyone try defining a direct publish (I’m still new to mqtt so just trying to figure out if there is a way to take the player output and convert to a clean string in an mqtt publish)

I use the “state” channel, which is a string, to publish the current state of the Sonos player. And I have a MQTT string item defined to receive commands and the following rule converts those commands to control the Sonos player.

rule "Sonos Player String Connecter (sonosJOControlString)"
when
Item sonosJOControlString received command
then
sonosJOControl.sendCommand (receivedCommand.toString)
end

Thanks, I just stumbled on that as well :wink:

Edit: I did find a Sonos control node for Node-Red if you wanted another option for the control side. For me, I was just trying to get the state changes so I could control my Harmony.