Sonos; TV as source of playbar

I have a sonos playbar. Via the regular sonos program you can see if the TV is used as an input for the playbar.
Is this possible via the sonos binding?

I would like to use this to make some rules like:
if source = TV; then …

no. TV input is not supported.

An issue is already opened for that in Git.

OK, thx

I tried to implement the support for the optical line-in.
Please read instructions for testing: https://github.com/eclipse/smarthome/issues/2410

It should be now available in the nightly snapshots.

I’ll give it a try this weekend and feedback

@Marijn_Oudijk : I realize that we have not answered to your initial question. Nothing was necessary for that, you can just test the value of your linked channel currenttransporturi that takes the value x-sonos-htastream:RINCON_XXXXXXXXXXXX01400:spdif when your TV is playing.

Honestly I am bit lost with respect how to test this new capability.
I understand that updating to the most recent build a new sonos binding will be installed that now supports the spdif interface.

What I do not understanding how this interface can be accessed or checked.
What is the channel definition?
Could you please provide an example that creates an item that can be used to check and switch the TV input (spdif) interface.

I gave it a check.
Updated Openhab and added the Sonos Playbar as a ‘Thing’.
This ‘Thing’ has multiple items, but for this test I’m using two of them.

When using TV as input for the Playbar I get:

Current AV transport URI = 
x-sonos-htastream:RINCON_B8E937749EF501400:spdif

Current track URI = 
x-sonos-htastream:RINCON_B8E937749EF501400:spdif

and when I change to a spotify number I get:

Current AV transport URI = 
x-rincon-queue:RINCON_B8E937749EF501400#0

Current track URI = 
x-sonos-spotify:spotify%3atrack%3a1HYzRuWjmS9LXCkdVHi25K?sid=9&flags=8224&sn=1

So this seams to work!

And to request the playback of the playbar live-in, you can use the playlinein channel. Take a look to the binding documentation.
The linein channel just informs you whether the line-in is connected or not. Should be ON in your case.
Please try a sound notification when line-in is playing as it was something not working before my patch. Should resume TV playback after notification. You can run smarthome:audio play sonos:PLAYBAR:xxxxxxxxxx doorbell.mp3 in the console.

No sounds is being played.

In the paperUI I’ve set the sonos playbar as default audio-sink. In console I’ve checked my audio-sinks.

openhab> smarthome:audio sinks
enhancedjavasound
javasound
webaudio
sonos:PLAYBAR:RINCON_B8E937749EF501400

but when I try to play a sound I hear noting, but I alson don’t get an error

openhab> smarthome:audio play sonos:PLAYBAR:RINCON_B8E937749EF501400 doorbell.mp3

@Marijn_Oudijk : is it the same thing even when your Playbar is playing a tune-in radio for example ?
When you say your hear nothing, is the current playback stopped and then later resumed ? Or not interrupted at all ?

If you have installed a TTS service, could you please try smarthome:voice say blablabla

Please link the channel linein to a switch item and restart OH. Is the switch item ON as expected ?

No chance to test the play command with another Sonos ?

@Lolodomo: I hear nothing. The playback is not stopped or interrupted at all; nothing is happening (sound-wise).
I just checked with installing a TTS service; that’s also not working. I’ve tested with a Sonos Play1 as default audio sink and with a Playbar as default audio sink. So it seems to have nothing to do with the line-in but with my own Sonos-binding skills (or lack of it).

Edit:
I just realised I’m working with the binding-sonos - 0.9.0.SNAPSHOT (installed via Paper-UI) and not with the *.jar you’ve mentioned on github. Will give it a try again tonight!

This change is now included in nightly builds. Just try with a recent one.

Quite old topic but when updating from OH 2.50 to 2.5.4 my rule stopped working. I tried out several commands, none are working:

                SonosWohnzimmer_Currenttransporturi.sendCommand("x-sonos-htastream:RINCON_xxx:spdif")
                SonosWohnzimmer_Currenttrackuri.sendCommand("x-sonos-htastream:RINCON_xxx:spdif")
                SonosWohnzimmer_Linein.sendCommand(ON)
                SonosWohnzimmer_Playlinein.sendCommand("RINCON_xxx")

Following this documentation, Currenttrackuri and currenttransporturi should be read only but my log shows the following:

2020-05-05 22:35:49.783 [ome.event.ItemCommandEvent] - Item 'SonosWohnzimmer_Currenttransporturi' received command x-sonos-htastream:RINCON_xxx:spdif
2020-05-05 22:35:49.789 [ome.event.ItemCommandEvent] - Item 'SonosWohnzimmer_Currenttrackuri' received command x-sonos-htastream:RINCON_xxx:spdif
2020-05-05 22:35:49.797 [ome.event.ItemCommandEvent] - Item 'SonosWohnzimmer_Linein' received command ON
2020-05-05 22:35:49.799 [nt.ItemStatePredictedEvent] - SonosWohnzimmer_Currenttransporturi predicted to become x-sonos-htastream:RINCON_xxx:spdif
2020-05-05 22:35:49.847 [ome.event.ItemCommandEvent] - Item 'SonosWohnzimmer_Playlinein' received command RINCON_xxx
2020-05-05 22:35:49.848 [nt.ItemStatePredictedEvent] - SonosWohnzimmer_Currenttrackuri predicted to become x-sonos-htastream:RINCON_xxx:spdif
2020-05-05 22:35:49.883 [nt.ItemStatePredictedEvent] - SonosWohnzimmer_Linein predicted to become ON
2020-05-05 22:35:49.920 [vent.ItemStateChangedEvent] - SonosWohnzimmer_Currenttransporturi changed from x-sonosapi-stream:s14991?sid=254&flags=32 to x-sonos-htastream:RINCON_xxx:spdif
2020-05-05 22:35:49.921 [nt.ItemStatePredictedEvent] - SonosWohnzimmer_Playlinein predicted to become RINCON_xxx
2020-05-05 22:35:49.950 [vent.ItemStateChangedEvent] - SonosWohnzimmer_Currenttrackuri changed from x-sonosapi-stream:s14991?sid=254&flags=32 to x-sonos-htastream:RINCON_xxx:spdif
2020-05-05 22:35:49.951 [vent.ItemStateChangedEvent] - SonosWohnzimmer_Linein changed from OFF to ON

Any idea / hint?

Thanks and best
Matthias