npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-appletv-now-playing

v0.3.6

Published

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

Downloads

156

Readme

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.

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......