I’m running Sonos in an OH2 server that is controlled by an OH1 server using the MQTT event bus binding. Item state communication is working well, but I’m having some trouble with commands. I’ve set up a Player item for one of my Sonos things and I’m trying to send it a PLAY command via MQTT.
The item definitions are:
Group OH2_Sonos_controller_group_2 String OH2_Sonos_controller_2 (OH2_Sonos_controller_group_2)
I don’t understand why I need a group here, but I’m following examples I’ve seen in various forum posts. In the site map, I have:
Group item=OH2_Sonos_controller_group_2 label="Sonos2: Controller" icon="settings"
I’m guessing there is something wrong with this because no player controls are displayed in the OH2 UIs (basic or classic).
When I try to send a “PLAY” command to the
OH2_Sonos_controller_2 item (not the group), I see a NullPointerException in OH2.
java.lang.NullPointerException at org.openhab.binding.mqtt.internal.MqttEventBusBinding$1.processMessage(MqttEventBusBinding.java:233)[168:org.openhab.binding.mqtt:188.8.131.52604110112] at org.openhab.io.transport.mqtt.internal.MqttBrokerConnection.messageArrived(MqttBrokerConnection.java:552)[169:org.openhab.io.transport.mqtt:184.108.40.206604110112] at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:336)[169:org.openhab.io.transport.mqtt:220.127.116.11604110112] at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:148)[169:org.openhab.io.transport.mqtt:18.104.22.168604110112] at java.lang.Thread.run(Thread.java:744)[:1.8.0]
If I send the command to the group item I see the following message in the log…
2016-04-25 06:17:10.535 [WARN ] [b.core.events.EventPublisherDelegate] - given command is NULL, couldn't post command for 'OH2_Sonos_controller_group_2' ``` From running in a debugger, I see in the first case the item registry does not have the ```OH2_Sonos_controller_2``` item. In the second case, it tries to parse the command using the ```OH2_Sonos_controller_group_2```, which doesn't understand the PLAY command. Any suggestions about how to make this work? Is it possible bind the Sonos play and stop commands as separate items without using a Player item? Thanks in advance.