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-theater-mode

v1.0.2

Published

A homebridge plugin for reacting to Apple TV play/pause events.

Downloads

12

Readme

homebridge-theater-mode

A homebridge plugin to make your HomeKit devices react to the play/pause state of your Apple TV. Configured via the Home app.

npm version License

Overview

homebridge-theater-mode started as a pet project of mine. I loved using Plex's webhooks to control my Hue bulbs, but I wanted that to extend to other apps on my Apple TV.

To enable this project, I created node-appletv to communicate with the Apple TV. This uses a new protocol introduced by Apple with the 4th-generation Apple TV and there still isn't much out there about it. I did my best to reverse engineer the iOS Apple TV app to determine how it tracks the play/pause state, depsite the quirks I ran into with the new protocol.

Because of this, at times the plugin can be slightly slow to receive state changes, but it always does seem to settle out after a few seconds. It works well enough for me, so I hope it does for you, too!

Installation

Follow the steps below to pair your Apple TV after installation is complete.

# Install homebridge
$ npm install -g homebridge

# Install plugin
$ npm install -g homebridge-theater-mode

or add homebridge-theater-mode to your install.sh file.

Pairing

The pairing process makes use of the command line utility that ships with node-appletv. You must be on the same network as your Apple TV to pair.

# Install node-appletv
$ npm install -g node-appletv

# Scan for Apple TVs and follow the prompts
$ appletv pair

At the end of the process, you'll received a credentials string. This string should be input into the credentials field in your config.json entry for the Apple TV. See the example below or config.example.json for a practical use.

{
  "accessory": "AppleTVTheaterMode",
  "name": "Living Room Apple TV",
  "credentials": "<credentials>"
}

Usage

Two devices are added to your Home app by homebridge-theater-mode for each paired Apple TV.

The Theater Mode Switch is used to toggle theater mode on and off. It is recommend that you turn this off when you are done watching. This will prevent your lights from going crazy when you start AirPlaying music later. Each Apple TV gets its own Theater Mode switch.

The Apple TV Programmable Light Switch is used to define what should happen when theater mode is enabled and your Apple TV enters one of three states (playing, paused, and stopped). This programmable switch has three "buttons," one for each state. 3D touch on the programmable switch and tap details. You'll then be able to configure each of these three buttons. See below for which button is which.

| | Apple TV State | | :-----------: | :-----------------------: | | Button 1 | Play | | Button 2 | Plause | | Button 3 | Stop (Tapping "Menu") |

Meta

You can find me on Twitter @edc1591

Distributed under the MIT license. See LICENSE for more information.