Bouke / HAP

Swift implementation of the Homekit Accessory Protocol
https://boukehaarsma.nl/HAP/
MIT License
366 stars 50 forks source link

Initial support for iOS 12.2 (beta) Television Accessory #72

Closed gbrooker closed 5 years ago

gbrooker commented 5 years ago

Based on KhaosT's HAP-NodeJS implementation, this PR adds the Services and Characteristics for the new Television accessory in the current iOS 12.2 beta.

In order to properly map characteristics, this PR includes support for UInt8, UInt16 and UInt32 based Characteristics.

Support is added to Service for Linked, Hidden and Primary services.

In order to support the remote control function, I found that the tear down of server connections was too aggressive, so this has been scaled back. I'm running a few instances to test if this reintroduces the port/connection leak that existed before.

gbrooker commented 5 years ago

The travis configuration is failing due to some dependency errors

Bouke commented 5 years ago

Looking good thus far, great to see these new features added in! Do you have some television set to test things out?

gbrooker commented 5 years ago

I have written a back-end which communicates with a Logitech Harmony Hub, a kind of IR blaster configured for various AV setups. The Hub is configured with activities such as "Watch Netflix" which sets up the TV, set-top boxes, audio etc.

For iOS 12.1 and lower, I simply expose the Hub as a series of switches, one for each 'activity'. https://www.brooker.mobi/harmony-bridge/ (I'm still in a testing phase so only available in a couple of countries app stores for now: FR & SG).

With this PR, I can now expose each Hub as a Television to HomeKit, with each activity as an input source. In iOS 12.2 beta there is also a remote control feature accessed via control centre, which provides remote control keys for up/down/left/right/select/back/play/exit/info. I send these keys to the relevant set top box, via the Harmony Hub. Even the phones volume controls can be used to adjust the TV volume when the remote control view is open on the phone. It's pretty neat.

I'll release the updated version of my bridge app to the Mac App store soon, though I prefer to wait for at least beta 2 of iOS 12.2 to see if there are any changes to the new Accessory and Services.

Bouke commented 5 years ago

That's very cool indeed! I might even have a look at intercepting my Samsung Tv's remote control app, there might be something to it.