Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for input selection #8

Closed
ebaauw opened this issue Nov 20, 2016 · 30 comments
Closed

Support for input selection #8

ebaauw opened this issue Nov 20, 2016 · 30 comments

Comments

@ebaauw
Copy link
Owner

ebaauw commented Nov 20, 2016

Provide some basic support for selecting input. At least TV, Line-In, Sonos Favourites, and Next/Previous track.

@ebaauw
Copy link
Owner Author

ebaauw commented Jun 17, 2018

v0.2.23 provides basic support for Next Track and Previous Track. A new Track Change characteristic now shows in Eve (at the group service), with Up and Down buttons. It shows value 0, and it automatically resets to this value, 0.5 seconds after Up or Down has been pressed.

Please let me know what you think. I've been struggling badly with the best way to provide this functionality in HomeKit. It would seem like HomeKit doesn't like configuration changes at all, so I cannot dynamically enable or disable Next and Previous buttons, like the Sonos app. Also, dynamically setting the maxValue property causes HomeKit to reject the whole configuration.

I might "wrap" the tracks, i.e. move to track 1 when pressing Up while playing the last track, and move to the last track when pressing Down when playing the first track.

I also added a Volume Change characteristic in v0.2.24, similar to Track Change to increment or decrement the volume. If you define a HomeKit scene in Eve setting this characteristic, you can activate it from a HomeKit automation in Apple's Home app, or assign it to a Stateless Programmable Switch button. I can now control my Sonos (Volume Up, Volume Down, Next Track, Previous Track) using a Trådfri remote!

@fraannk
Copy link

fraannk commented Jan 6, 2019

Hey, so I just got another Hue Dimmer Switch to use this volume feature. Works great when set up with the Eve app, however a push of the button only increments the volume with 1%. I'm not able to set it differently in the Eve app either, so is this a limitation of homebridge-zp, the Eve app, or Homekit itself? Thanks for an awesome plugin.

@ebaauw
Copy link
Owner Author

ebaauw commented Jan 6, 2019

The 1% is hard-coded in homebridge-zp. I haven't really tested if this is the best value. I'm no fan of yet another config.json setting, but this might be a good one.

My idea was to use this in combination with hueDimmerRepeat for homebridge-hue. With that config.json setting, homebridge-hue will fire Single Press events continuously while holding the DimUp or DimDown button, instead of a single Long Press.

@fraannk
Copy link

fraannk commented Jan 6, 2019

Interesting! I don’t use the homebridge-hue plugin since I just use the built in HomeKit support, but I might just try that now, since that’s exactly what I wanted to do (the long press to keep increasing volume)
Thanks for the suggestion!

@Garywoo
Copy link

Garywoo commented Jan 8, 2019

I like the suggestion of implementing a hueDimmerRepeat style solution in homebridge-zp. Would love to see this implemented.

I have an extra Hue Dimmer in the kitchen to control some non Hue lights, and facilitate Sonos play/pause controls. Currently my finger get sore having to click to ~20 times to crank up the volume when I'm in the mood for some louder music.

@Garywoo
Copy link

Garywoo commented Jan 8, 2019

As a suggestion for how to allow for a configurable % increase/decrease values, without resorting to another config.json value, how about allowing the Volume Change characteristic to accept a greater range of values?

Currently setting the characteristic to 1 increases the volume by 1%, and setting to to -1 decreases the volume by 1%. Allowing for a greater range of values means, for example, you could set the Volume Change characteristic to 10 to increase the volume by 10%, or -23 to decrease the volume by 23%. This gives greater flexibility over a defined config.json value, and would allow for different accessories and scenes to change the volume with different granularity.

@ebaauw
Copy link
Owner Author

ebaauw commented Jan 8, 2019

how about allowing the Volume Change characteristic to accept a greater range of values?

Could do. Eve would display a slider instead of the Up/Down controls for Volume Change, but you would be able to set a larger step size in a HomeKit scene or automation. While taking bigger steps, you’d still need a press per step.

I like the suggestion of implementing a hueDimmerRepeat style solution in homebridge-zp.

I’m not sure what you mean here. This cannot be implemented in homebridge-zp. The Hue dimmer switch sends a message every second while a button is held. deCONZ sends a notification for each message to homebridge-hue. Normally homebridge-hue issues a Long Press to HomeKit on the first notification. With the hueDimmerRepeat setting, it issues a Single Press on each notification, as if you pressed and released the button multiple times in succession.

@Garywoo
Copy link

Garywoo commented Jan 8, 2019

I like the suggestion of implementing a hueDimmerRepeat style solution in homebridge-zp.

Whoops sorry, I misunderstood what you were suggesting. I thought you were thinking of implementing support for Hue Dimmers in homebridge-zp. On re-reading this, I now see this is not what you meant.
I do use homebridge-hue, but have some questions. I'll post them on that repo instead.

ebaauw added a commit to ebaauw/homebridge-lib that referenced this issue Jan 11, 2019
- Allow values -10 to 10 for _Volume Change_, see ebaauw/homebridge-zp#8.
ebaauw added a commit that referenced this issue Jan 11, 2019
Change default (undocumented) `resetTimeout` to cope with larger range of allowed values for _Volume Change_, see #8.
@ebaauw
Copy link
Owner Author

ebaauw commented Jan 13, 2019

how about allowing the Volume Change characteristic to accept a greater range of values?

In v0.3.8

@fraannk
Copy link

fraannk commented Jan 14, 2019

Tested and it works great. Thanks for the quick addition!

@fugazzy
Copy link

fugazzy commented Mar 5, 2019

Please also include the new Amp for the TV input

@ebaauw
Copy link
Owner Author

ebaauw commented Mar 5, 2019

Please also include the new Amp for the TV input

Happy to do so, but I need the model number, see #58.

@fugazzy
Copy link

fugazzy commented Mar 5, 2019

OK, it looks like it is: ZPS16

ebaauw added a commit that referenced this issue Mar 5, 2019
Add _TV_ characteristic for Amp, see #8
@leoneleone
Copy link

@ebaauw
Is there any way to set the Input (Line in) as a default input?
After I connect my HomePod to my Sonos via AirPlay2, the input on the speakers change to “started from AirPlay”. I would like to have a characteristic or a switch so that I can change the speaker input back to Line_in via HomeKit, or automate this process.

@ebaauw
Copy link
Owner Author

ebaauw commented Apr 10, 2019

I still haven’t figured out how to expose input selection to HomeKit. I hoped I could use the Television service for that, but that seems like a dead end. It only seems to be visible in Apple’s Home app, not in other HomeKit apps. Also, it cannot be bridged, so you’d need to pair each zone separately to HomeKit, rather than just a single homebridge Bridge accessory.

I could copy the mechanism, but than you’d select input 1, 2, 3, ... without any description. While that would work well in automations, it’s a lousy user interface, that wouldn’t pass the waf. I could create a write-only custom characteristic for each input, but that result in a lot of new custom characteristics, none of which would be supported by Siri nor by Apple’s Home app. It’s probably cleaner to expose an instance of a standard service per input (as Television does for the descriptions), so each input uses their own copy of the same characteristic (probably just Name and Active or something). That would lead to an additional tile in Apple’s Home app per input per zone.

@ebaauw
Copy link
Owner Author

ebaauw commented Apr 10, 2019

Actually, using a single number characteristic might be the least worse alternative. When combined with Track and/or a new string characteristic that displays the input, you would get feedback from Eve which number corresponds to which input. To use this in Apple's Home or Siri, you could create a (series of) HomeKit scenes (in Eve) to set the input to the numeric value corresponding to the input (from Siri and/or Home).

Will try and give it a go this weekend.

@fugazzy
Copy link

fugazzy commented Apr 11, 2019

Is there a way to switch TV-Input On/Off on the new Sonos AMP ? TV shows up, but it is only text

@ebaauw
Copy link
Owner Author

ebaauw commented Apr 11, 2019

Is there a way to switch TV-Input On/Off on the new Sonos AMP ?

Not sure what you mean by switching the input On/Off? You select an input or play/pause the zoneplayer (through the On attribute of the Sonos service).

Currently, there's no way to select any input (other than previous/next track). Once I'll have figured out how to expose input selection, I'll definitely include the TV input for devices that support it. Note that the TV characteristic reflects whether there's a signal on the digital audio input (presumably from the TV) and Track reflects whether the input is set to the digital audio.

I don't know the new AMP, but the PlayBar doesn't support Play/Pause while on TV input. Consequently, there's no way to switch the Sonos service on or off while the input is set to TV. You can double-check whether the Sonos app displays Play/Pause for the new AMP, but I don't think it does.

@fugazzy
Copy link

fugazzy commented Apr 11, 2019

OK, I see, I mean selecting the TV input. Starting eg. music on Sonos switches the input automatically, but afterwards switching back to TV input is not possible. Except for when I switch the TV on if it was off before.

@ebaauw
Copy link
Owner Author

ebaauw commented Apr 11, 2019

Starting eg. music on Sonos switches the input automatically

How do you start music? homebridge-zp only issues a Play to start the currently selected input.

@fugazzy
Copy link

fugazzy commented Apr 11, 2019

yes that's the way, but the Sonos amp switches automatically to TV if I turn on TV and it switches to music if I start some music.
So music is not the problem, switching back to TV if the TV is already on is what I am missing.

@leoneleone
Copy link

@ebaauw

Thanks for thinking about my request.
I truly believe a far more streamlined (no pun intended) solution would be for  to in include an “Audio Source Input” characteristic for HomeKit re AirPlay 2 Speakers, to control Audio Sources via HomeKit.

I think the solution you suggested would work but would complicate things within the Home.app
Ideally, one switch to control the Audio Input Source for all Sonos homebridge-zp Speakers would work best for me. Also, Sonos needs to sort out a “persistent grouping” implementation, so that grouped Sonos Zones remain attached within their specified grouping even after using Airplay 2 from within the Music control in iOS Notification Centre.

@ebaauw
Copy link
Owner Author

ebaauw commented Apr 14, 2019

include an “Audio Source Input” characteristic for HomeKit re AirPlay 2 Speakers, to control Audio Sources via HomeKit.

Airplay 2 is a protocol for streaming audio to a speaker. The speaker is relatively dumb, in that it just plays the stream. To control smarter speakers (like Sonos) you would need another protocol (like HAP) to set the speaker’s input. This would need an AppleTV-like service on the speaker, very much like they do for the HomeKit enabled smart TVs. I tried to fake that through homebridge-zp, see #62, but there are a lot of issues with that approach.

Ideally, one switch to control the Audio Input Source for all Sonos homebridge-zp Speakers would work best for me.

That’s not going to happen. I won’t supporting functionality in homebridge-zp that isn’t in the Sonos app.

Sonos needs to sort out a “persistent grouping” implementation, so that grouped Sonos Zones remain attached within their specified grouping even after using Airplay 2 from within the Music control in iOS Notification Centre.

I bought my Sonos players too soon: none of them support Airplay 2, but I would expect this functionality to be there already: the Sonos app does provide a setting to keep the group, when autoplaying digital audio input on my PlayBar or analogue audio input on my Connect.

@leoneleone
Copy link

My current setup is a mixture of older Sonos speakers and newer AirPlay2 Sonos Speakers:

  • Sonos Grouped Rooms (inside Sonos app)
  • Each Sonos Grouped Room has a main (coordinator) AirPlay2 Sonos Speaker with older Sonos Speakers (in my Sonos app “Rooms” tab).
  • I can group my HomePod + 2 separate Sonos Speakers (the Sonos app grouped Zones/Rooms) using AirPlay2 (via the iOS Music Control).
  • After UnGrouping the same three AirPlay2 Speakers in iOS Music Control, the two Sonos Speakers”Rooms” remain grouped together in the Sonos app, with all the older (non AirPlay2) zones in one big group with the 2 newer Sonos (Sonos group coordinators). This is in the Sonos app.
  • I would prefer that after ungrouping in the iOS Music Control, then in the Sonos app they would go back to the way the were grouped in Sonos.app before

I’ve contacted Sonos directly regarding this. Fingers crossed 🤞🏼

@ebaauw
Copy link
Owner Author

ebaauw commented Apr 16, 2019

After UnGrouping the same three AirPlay2 Speakers in iOS Music Control, the two Sonos Speakers”Rooms” remain grouped together in the Sonos app, with all the older (non AirPlay2) zones in one big group with the 2 newer Sonos (Sonos group coordinators). This is in the Sonos app.

So Sonos decides to inherit the Airplay 2 group as Sonos zone group after the non-Sonos Airplay 2 device has left. What happens if you first remove one of the Sonos players from the Airplay 2 group?

@ebaauw
Copy link
Owner Author

ebaauw commented Apr 16, 2019

I can group my HomePod + 2 separate Sonos Speakers (the Sonos app grouped Zones/Rooms) using AirPlay2 (via the iOS Music Control).

After this, do they still show as two rooms in the Sonos app, or as one room? In other words: does Sonos recognise that the same Airplay 2 stream is connected to multiple zoneplayers and group them on the Sonos side (presumably to optimise the network traffic on Sonosnet and on your home network)?

@ebaauw
Copy link
Owner Author

ebaauw commented Jul 23, 2019

homebridge-lib@1.0.0 supports input source selection from Apple's Home app, through the TV service in the Television accessory (see #62). TODO: provide next/previous input controls in the Sonos service.

homebridge-zp supports up to 20 sources per zone player. In order these are assigned to:

  • Sonos Chime (for testing, and to make sure the list won't be empty);
  • Airplay (if supported by the player);
  • Audio In (if supported by the player);
  • TV in (if supported by the player);
  • Leave Group - TODO: only shown when zone player is member of a group;
  • Join - TODO: only shown for coordinators, or maybe: only show platform coordinator.
  • Sonos Favourite - The list is updated run time, whenever favourites are changed in the Sonos app.

These inputs are the same for all zone players, but only the applicable inputs will be shown. So if you have 1 rooms, there's 14 inputs available for favourites, even if only the Sonos Chime and Leave Group are shown.

Please let me know what you think of this.

@ebaauw
Copy link
Owner Author

ebaauw commented Jul 27, 2019

Changed the grouping logic in v1.0.3.

You can only select input in the TV accessory when it's on. However, when the zone player has no current input, or a short input (like a text to speech clip), it will switch back off, before you'll be able to select the input. Not sure if I can change that. Will add Next/Previous input source to the Sonos service though, so at least it can be selected from other HomeKit apps. Also, use up/down arrows in the widget for input selection.

@ebaauw
Copy link
Owner Author

ebaauw commented Jul 28, 2019

v1.0.5 supports changing input from Sonos service and from the Remote widges (up and down arrows). Note that the order of the inputs has changed: Group first, Sonos Chime last.

@ebaauw
Copy link
Owner Author

ebaauw commented Jul 30, 2019

As of v1.0.7, manually disabled input sources are skipped when cycling through input sources.

@ebaauw ebaauw closed this as completed Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants