node-sonos-discovery
node-sonos-discovery copied to clipboard
Support switch to Line In and TV
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
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).
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.
any thought @jishi ?
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.
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.
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.