ebaauw / homebridge-zp

Homebridge plugin for Sonos ZonePlayer
Apache License 2.0
241 stars 20 forks source link

Request: Allow AUDIO_RECEIVER as Accessory Category #167

Closed jsiegenthaler closed 3 years ago

jsiegenthaler commented 3 years ago

Issue

This is a great plugin and written very well.

I'd love the option to have my ZP Speakers be displayed as an Audio Receiver instead of a Television, as the image on the Home app tile fits their purpose much better as a "radio". You could make this a user-configurable option.... for those that prefer TV vs Audio Receiver

To do this you only need to change the Accessory Category in this file: https://github.com/ebaauw/homebridge-zp/blob/master/lib/ZpAccessory.js

Line 181 is the line that sets the category:

params.category = platform.Accessory.Categories.TELEVISION

The category that shows the device as an audio receiver is AUDIO_RECEIVER I have been making my own plugin where the user can change the category between Television, AudoReceiver and SetTopBox, so I can report from experience that all other functionality stays working exactly the same. The category controls primarily the icon on the Home tile.

ebaauw commented 3 years ago

As far as I'm aware, the icon corresponding to the category only shows when newly adding the accessory. Can you please post a screenshot?

jsiegenthaler commented 3 years ago

the icon appears when newly adding and stays after the accessory is added. FWIW: my plugin works very much the same as yours: it auto-discovers the accessories and exposes them, and I give the user the option of TV or audio receiver. Let me do a screenshot later...

ebaauw commented 3 years ago

Cool, hadn't seen that before. The only reason I expose the zone player as TV is for the input selection, but that just continues to work. I think it would make most sense to use a SPEAKER category, wouldn't it? Or HOMEPOD, just to annoy people.

Somehow the setting is locked in HomeKit after pairing. When I change it in the plugin, Home doesn't pick up the new category. You need to remove the external accessory from HomeKit and re-add.

Still, category seems to do nothing for bridged accessories.

jsiegenthaler commented 3 years ago

I honestly cannot say if category SPEAKER could be used: I only tried the TV categories: TELEVISION, AUDIO_RECEIVER, TV_SET_TOP_BOX and TV_STREAMING_STICK, and notice no difference when switching between them.

I'll try it and see what happens... ...5 min later...

  1. The accessory displays as a Speaker icon during the add accessory process
  2. The accessory type is Speaker, "Connecting to Speaker", "Speaker location" etc. appears instead of "Connecting to Television"
  3. Only for the input sources do you see "Name TV Input Sources", but that is also the same for the AudioReceiver
  4. The accessory can be added normally
  5. After adding, the tile is displayed as a Speaker: grey when off, brown when on.
  6. All of the accessory functions appear to work exactly the same as a Television: Power, Input select, View TV Settings,
  7. The iOS remote control still displays a TV (but then it displays a TV also for Audio Receiver. Only SetTopBox gets a different icon) however all the remote control functions appear to work normally.

It appears that Category controls the icon only... and I am guessing that it makes a difference to Siri control, as Siri would understand it to be a Speaker now instead of a TV.

How about making it a configurable item, allowing the user to choose between Television, AudioReceiver and Speaker? And I'd recommend letting people test it for a while... I'm happy to be one of the testers....

jsiegenthaler commented 3 years ago

By the way: my plugin where I did my testing is an External Accessory.

ebaauw commented 3 years ago

Not a fan of another config.json setting.

The TV accessory is external (not bridged); the bridged accessories don't show the category.

jsiegenthaler commented 3 years ago

OK. Continued testing by me shows that Category=Speaker has no apparent adverse impact at all. And the tile icon is a much better fit to the Sonos speakers. So I recommend changing to Category = Speaker ;)

jsiegenthaler commented 3 years ago

Hi, I wanted to help by forking and trying it out, but I cannot run this plugin in my Win10 dev environment: npm link throws errors.

So I thought I'd ask if you'd consider the possibility of making a alpha or beta version with the category changed so I can test it?

jsiegenthaler commented 3 years ago

OK, I created a PR for you

ebaauw commented 3 years ago

v1.2.1 uses SPEAKER. Note that you will need to remove the external accessory and re-pair it to HomeKit, to make it show with a speaker icon in Home.

jsiegenthaler commented 3 years ago

Thanks. I found that a Homebridge restart was enough... i see the accessory the Serial Number is the Sonos MAC prefixed with "TV". That prefix should now be changed to "SPKR"

ebaauw commented 3 years ago

Why? It's still a TV accessory with a Television service. We just changed the accessory category, to show a different icon.