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 HomeKit Television service #62

Closed
ebaauw opened this issue Jan 26, 2019 · 15 comments
Closed

Support HomeKit Television service #62

ebaauw opened this issue Jan 26, 2019 · 15 comments

Comments

@ebaauw
Copy link
Owner

ebaauw commented Jan 26, 2019

See homebridge/homebridge#2104.

@ebaauw ebaauw changed the title Support HomeKit _Television_ service Support HomeKit Television service Jan 26, 2019
@ebaauw
Copy link
Owner Author

ebaauw commented Feb 22, 2019

Not looking good - it would seem that Apple only supports a single TV accessory per HomeKit bridge (i.c. homebridge instance). See https://github.com/KhaosT/HAP-NodeJS/issues/641.

Also still some instabilities and changes between beta versions, see https://github.com/KhaosT/HAP-NodeJS/issues/645 and https://github.com/KhaosT/HAP-NodeJS/issues/646.

ebaauw added a commit that referenced this issue Feb 23, 2019
Add `"tv"` config.json parameter, see #62.
ebaauw added a commit that referenced this issue Feb 23, 2019
Add experimental _Television_ service, see #62.
@ebaauw
Copy link
Owner Author

ebaauw commented Feb 23, 2019

v0.3.11 has experimental support for the Television service in iOS 12.2, to get a feeling what it would look like.

  • To try this, you need to run iOS 12.2 beta on your iPhone or iPad;
  • Set "tv": true in config.json, and homebridge-zp will expose four additional services per zoneplayer:
    • One Television service;
    • One Television Speaker service;
    • Two Input Source services, linked to the Television service.
  • The Television service should appear as a tile in Apple's Home app (on iOS 12.2 beta). Pressing the tile toggles the "television" active (on) or inactive (off), but doesn't do anything yet. When holding the tile, you see two buttons: Input and Settings. I've hardcoded two inputs, "Uno" and "Due" (to check the fixed order), neither are functional yet. Under settings you can rename the inputs.
  • When selecting the AppleTV widget in the Control Centre (swipe up from the bottom of your iPhone screen, or swipe down on the upper right of your iPad screen), you should find a single new device, next to your AppleTV(s). Somehow, the widget randomly selects a single zoneplayer, instead of showing them all. You should be able to control the zoneplayer, using the Play/Pause button. The other buttons are not yet functional.
  • To control the volume, use the hardware Volume Up and Volume Down buttons while in the widget. In beta 3, you might need to change devices to your AppleTV and back to the zoneplayer, before these buttons work.

@fugazzy
Copy link

fugazzy commented May 1, 2019

Would it be possible to include inputs (like TV on the Amp) and Favourites (from Sonos) in the TV service?
I know, they will not be visible in 3rd party apps - only in Apples Home App
But by using scenes they will be usable

@ebaauw
Copy link
Owner Author

ebaauw commented May 1, 2019

Would it be possible to include inputs (like TV on the Amp) and Favourites (from Sonos) in the TV service?

That was my main reason to try and expose the zoneplayers as televisions.

I know, they will not be visible in 3rd party apps - only in Apples Home App

And only one of them (random) will be available in the Remote widget. But, luckily, you don't need that for the input selection.

But by using scenes they will be usable

Guess again :-( In Apple's Home app, you can only select the TV service for On/Off control. Eve does show the scene, but with empty actions. Consequently, you cannot recall the scene, because Eve brings out the Edit Scene dialogue.

@fugazzy
Copy link

fugazzy commented May 1, 2019

I have a TV Service running for my Sony TV (homebridge-bravia-tvos) and there I can switch between DVBC and HDMI-Inputs ans Channels.
I can configure scenes in Apple Home to switch between DVBC and HDMI 2 and they work, even though this setting does not show up in e.g. EVE

@ebaauw
Copy link
Owner Author

ebaauw commented May 1, 2019

Can you please post a screenshot of setting up the scene? I’ve got my test setup on iOS 12.3 beta, maybe that’s the issue. Or maybe that I still exposed the TV accessory bridged.

How do you recall the scene from Eve? Or did you add some other settings that Eve does see?

@fugazzy
Copy link

fugazzy commented May 2, 2019

So sieht das aus:
die Sonos tauchen in Apple Home nicht auf
der TV taucht in EVE nicht auf
funktionieren tut es aber trotzdem

IMG_7278
IMG_7279
IMG_7280
IMG_7281
IMG_7277

@ebaauw
Copy link
Owner Author

ebaauw commented May 2, 2019

I need to check their code, but it would seem they expose the inputs twice: once as input service linked to the TV service for the Home app, and once as switch for the scene and the other apps. Do you see a switch for each input?

@fugazzy
Copy link

fugazzy commented May 2, 2019

After the first run I do see switches for each input / channel, but after force-quitting the Apple Home App I find everything nice in one place in the tile of the Sony TV

@ebaauw
Copy link
Owner Author

ebaauw commented May 2, 2019

I need to check their code, but it would seem they expose the inputs twice

No, they don't.

After the first run I do see switches for each input / channel, but after force-quitting the Apple Home App I find everything nice in one place in the tile of the Sony TV

See homebridge/homebridge#2192. I'm not sure what to think of this, but it would seem you would only be able to create the scene with the input after the first run, before force-quitting the Home app.

@fugazzy
Copy link

fugazzy commented May 2, 2019

The screenshots are from my scenes, not directly after the first start.
It works for me as described.
The separate tiles seem to be a slow syncing problem that is gone after a wile or by force-quitting the app.
IMG_7282
compare to the screenshot of EVE with the same scene.
TV is not visible, but Sonos is, which is not visible in Home App

@fugazzy
Copy link

fugazzy commented May 21, 2019

I tried the new version 0.3.18 in my testing instance, with TV service.
Input TV ist showing up for my Sonos Amp and a switch of the input is detected and shown in the Home App (One and TV) when I switch eg. in the Sonos App.
What is not working is switching inputs from the Home App.

@ebaauw
Copy link
Owner Author

ebaauw commented Jul 23, 2019

[email protected] supports non-bridged Television accessories in Apple's Home app and in the Remote widget. The Home app supports selection of external input, groups, and favourites (see #8). The widged supports volume up/down (hardware volume buttons), play/pause, and next/previous track (right/left button). TODO: next/previous input (up/down button). I'm open for suggestions for the other buttons, and for the View TV Settings in the details screen.

When tv is true in config.json, homebridge-zp creates an external, non-bridged TV accessory for each zone (room). It needs to be paired to HomeKit separately. The TV service in this accessory is linked to the Sonos service, which is still needed for other HomeKit apps. Somehow accessories with a TV service are invisible to other HomeKit apps.

Please let me know what you think.

@ebaauw
Copy link
Owner Author

ebaauw commented Jul 24, 2019

Some more technical details:

  • You can specify the range of ports to be used by the non-bridged TV accessories in config.json, using, e.g. "ports": { "start": 51827, "end": 51839 } at the top level;
  • To check that the HAP server for each accessory is running, use
    $ sudo netstat -an -p tcp | grep LISTEN
    
  • To check the HAP server has announced itself through Bonjour, use the hap command-line utility (from homebridge-lib):
    $ hap
    
    On macOS, you can also use:
    $ dns-sd -B _hap._tcp
    
    On Raspbian, you can also use:
    $ avahi-browse _hap._tcp
    
    Somehow Bonjour Browser (on macOS) and Discovery (on iOS) don't show _hap._tcp announcements. In (32-bit) version 1.5.6 of Bonjour Browser, you can still add it in the Preferences, but the latest (64-bit) version no longer support this.
  • Homebridge generates the the username (fake mac address) for the accessory from its UUID. The four-hex-digit suffix to the accessory name is derived from this username.
  • homebridge-lib generates the accessory UUID from its serial number;
  • homebridge-zp sets the accessory serial number to TV_xxxxxxxxxxxx, where xxxxxxxxxxxx is the zone player's mac address;
  • To run multiple instances of homebridge-zp on your network (e.g. for testing), each instance needs to use different serial numbers. I will add a "tvIdPrefix" setting in config.json for this.

@ebaauw
Copy link
Owner Author

ebaauw commented Jul 27, 2019

Need to use up and down arrows in the widget to change current input. See #8 (comment).

EDIT In v1.0.5.

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

2 participants