Git Product home page Git Product logo

homebridge-appletv_as_an_accessory's Introduction

Homebridge Apple TV - Now Playing

A homebridge plugin that exposes Apple TV devices to Homekit, along with it's current Power State, Playback State and Now Playing Information.

Copyright (c) 2020 Kurt Warwick

Overview

This plugin exposes the Apple TV as a switch device, with the switch power state representing the Apple TV power state. The playback state is exposed through the Active charceristic and all other now playing information get's exposed through customised characteristics.

The media type is calculated by checking artist and album information. This characterist comes in handy if you would like to setup automations that dim light for only videos and not music.

Note: The now playing information are exposed as custom charactersitics, which means that the Apple Home App will not be able to read these. You will need to use an app such as Home+ 4 or Eve for Homekit.

TV Accessory

The TV Accessory is an experimental feature, so please use it expecting things to not work.

Limitations

  • The TV Accessory does not show up in the Home+ 4 or Eve for Homekit apps and thefore cannot be used in more complex automations. The only option for now is to create scenes with the desired state in the native Home app and use those scenes in the other apps.
  • Apps are launched by mimicking button presses to highlight the app at the index specified in the config. It seems to be working fairly well and is a good substitute for when / if true application launching is available.
  • I am unable to get the current application on the fly unless the now playing information changes, so changing the application outside of this accessory will not always reflect in the accessory.

Configration

Configuration can be done using Homebridge Config UI X.

Configuration

Sample Configuration

{    
  "platform": "AppleTvNowPlayingPlatform",
  "debug": true, 
  "devices": [        
    {            
      "name": "Lounge Apple TV",            
      "credentials": "C8309D5A-4AAD-4338-8B45....",
      "showTVAccessory": true,
      "inputs": [
        {
          "name": "Netflix", 
          "index": 9,
          "applicationId": "com.netflix.Netflix"
        }
      ]
    }    
  ]
}

Configuration Definition

  • platform: The identifier for the platform (AppleTvNowPlayingPlatform).
  • debug [optional]: Enables limited debugging.
  • devices: A list of devices you would like to register with the platform.
    • name: The name you would like to expose for the device.
    • credentials: The credentials needed to authorise connection to the device.
    • showTvAccessory: Expose a TV Accessory for the device.
    • inputs: A list of applications (shown as inputs) for the TV Accessory.
      • name: The application name.
      • index: The location (index) of the application on your Apple TV home screen. For example, Netflix is at index 9 in this screenshot. Apple TV Home Scree
      • applicationId: The Application Bundle Id used to change current input when now playing information is changed.

Retrieving credentials

In order to retrieve credentials for your Apple TV, please follow these step

  1. Execute the cli application bundled with this package from the package directory.

    You should be able to run npm root -g to find the NPN installation location, or if you are using the Docker image from Oznu it should be /homebridge/node_modules/homebridge-appletv-now-playing

/path/to/homebridge-appletv-now-playing $ node .\bin\cli.js
  1. Choose the device with which you would like to pair.
  2. Enter the PIN shown on your device.

Example:

/path/to/homebridge-appletv-now-playing $ node .\bin\cli.js

Scanning for devices...
These Apple TVs were found:

        1 : Lounge [C8309D5A-XXXX-XXXX-XXXX-2F7F2E813680]

Pair with Apple TV (enter index) : 1

Attempting to connect to Lounge [C8309D5A-XXXX-XXXX-XXXX-2F7F2E813680]...
Attempting to pair with Lounge [C8309D5A-XXXX-XXXX-XXXX-2F7F2E813680]...

Enter PIN shown on Lounge [C8309D5A-XXXX-XXXX-XXXX-2F7F2E813680] : 1234

Successfully paired with Lounge [C8309D5A-XXXX-XXXX-XXXX-2F7F2E813680].

Please update your configuration with the following credentials for this device:

C8309D5A-XXXX-XXXX-XXXX-2F7F2E813680:27y934hj523843kj2432423j4234kj23423kj4234j......

homebridge-appletv_as_an_accessory's People

Watchers

 avatar

homebridge-appletv_as_an_accessory's Issues

Can‘t get credential with cli.js

Hi,
thanks for this plugin.

If I try

/usr/local/lib/node_modules/homebridge-appletv-now-playing $ node .\bin/cli.js

there is an issue.

Could you help me, please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.