Giter Site home page Giter Site logo

plexhue's Introduction

PlexHue

PlexHue is a PHP Application which connects Plex to the Philips Hue Lighting System. As an example, you can trigger a certain light state when starting to watch a movie on a defined player. When pausing or stopping the movie, the lights will resume to the original state.

Prerequisites

  • PHP 7.0 or greater with curl extension.
  • Plex Pass (https://www.plex.tv/plex-pass/) (required for using the Webhooks in Plex Media Server)
  • The Webserver hosting PlexHue must be reachable from Plex Media Server and must be able to reach the Philips Hue Bridge.

Files

  • PlexHue.json Used by PlexHue.php to store settings. This file shouldn't be edited as it is fully controlled by PlexHue.
  • PlexHue.log Used by PlexHue.php for logging to troubleshoot issues.
  • PlexHue.php Contains the main logic.
  • PmsWebhookPayloadEmulator.html Standalone testing utility to simulate Plex Webhooks.

Installing

  1. Copy PlexHue.json, PlexHue.log, PlexHue.php to your Webserver.
  2. Open PlexHue.php and modify the below options
    • PLEX_PLAYER Specify the name of the Plex Player. (e.g. Living)
    • HUE_API_URL Specify the Address to your Philips Hue Bridge with a valid API Token.
    • HUE_GROUPS Specify all the Hue Groups/Room in your Home, which you want to control. Currently you need to retrieve the group id directly from the bridge (work in progress).
    • HUE_GROUPS_PLAY_RESUME_STATES Specify the states (configured below), which should apply to the groups when playing or resuming a movie.
    • HUE_STATES_SETTINGS Specify the light states that are used above. By default, this contains a "movie" state, which is a darkened red, as well as a state to turn the lights off.
  3. Open Plex Media Server and go to Settings -> Webhooks -> Add Webhook. Define the URL to PlexHue.php
  4. Everything should be good. You can use "PmsWebhookPayloadEmulator.html" to simulate a Plex Webhook for finetuning your settings, without the need to play/stop a movie every time.

Enabling / Disabling PlexHue via HTTP Request

There are always situations, where you don't like that your lights start dimming while watching a movie. Since version 3.0.0 the option to enable/disable PlexHue can be configured via a simple HTTP Call to the main PlexHue.php Script.

Enable

PlexHue.php?SetEnable

Disable

PlexHue.php?SetDisable

Get Status

PlexHue.php?GetStatus

Returns 1 if PlexHue is enabled and 0 if disabled.

Apple Homekit Integration

Personally, I use Homebridge with the Homebridge Http Switch Plugin for quicky enabling and disabling PlexHue. An example utilizing a stateful switch can be found below.

"accessories": [
	{
		"accessory": "HTTP-SWITCH",
		"name": "PlexHue",
		"switchType": "stateful",
		"onUrl": "http://server/PlexHue.php?SetEnable",
		"offUrl": "http://server/PlexHue.php?SetDisable",
		"statusUrl": "http://server/PlexHue.php?GetStatus"
	}
],

PlexHue Homekit Switch 1 PlexHue Homekit Switch 2

plexhue's People

Contributors

simondettling avatar

Watchers

 avatar

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.