node-sonos-discovery icon indicating copy to clipboard operation
node-sonos-discovery copied to clipboard

Support switch to Line In and TV

Open neophob opened this issue 6 years ago • 6 comments

I use a Playbar which is connected to my TV. After the configuration step, I can select "TV" in the Sonos app - which uses the optical input from the tv.

Looks like at the moment, sonos-discovery does not support switching to this input, which would be very handy.

do you have an idea how to implement that?

edit: looks like Soco implement this feature: https://github.com/SoCo/SoCo/blob/06a5e758f65dcb920f72b21353094b468173fa77/soco/core.py#L1077 and https://github.com/SoCo/SoCo/blob/06a5e758f65dcb920f72b21353094b468173fa77/soco/core.py#L1140

neophob avatar Oct 20 '17 14:10 neophob

Yeah, just setting the the source to the optical input is really simple, the tricky part is to know whether the player has an optical in or a regular line in since the action you need to invoke will differ.

See https://github.com/jishi/node-sonos-http-api/issues/109 for a longer discussion about the problem.

The preferable way would be to listen for events that would expose whether the player has spdif or line-in, and preferably also if it is connected or not. I know the regular line-in does announce it, and I would be surprised of the PLAYBAR/PLAYBASE didn't do the same.

I have been meaning to look into it, but haven't gotten around to it. It also helps if I have a PLAYBAR around (which I don't have at home).

jishi avatar Oct 20 '17 14:10 jishi

thanks for the quick feedback. maybe it make sense to split your request up in two different issues: 1) switch to tvin and linein and 2) detect model. then the application which use this library is responsible to limit the access to certain calls.

neophob avatar Oct 20 '17 21:10 neophob

any thought @jishi ?

neophob avatar Oct 25 '17 09:10 neophob

Having different methods for line-in and spdif-in would be easy to solve, but would be very confusing since you can select a line-in from another device. That would mean that you need to call the correct method depending on which src player you are using, which I assume feels totally backwards. My goal is always to keep it as simple as possible.

However, if you would really need this functionality right now, it's easily implemented. On another note, it is already possible using the setAVTransport() however you would need to create the uri yourself from the player UUID.

jishi avatar Oct 25 '17 09:10 jishi

Thanks for the hint about the setAVTransport() workaround.

about

That would mean that you need to call the correct method depending on which src player you are using

for example the playbar has two distinct inputs if I'm not wrong. so the the application should know which input to choose. but i don't know how sonos handles this internally, I guess they map the correct input depending on your configuration.

neophob avatar Oct 25 '17 09:10 neophob

It has two? One spdif and one analogue? Yeah, I'm guessing you have told it which one it uses, but I also think it knows which one is connected, so the only confusion would be if you have two inputs connected simulatenously.

jishi avatar Oct 25 '17 10:10 jishi