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.
- 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.
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.
- Copy
PlexHue.json
,PlexHue.log
,PlexHue.php
to your Webserver. - Open
PlexHue.php
and modify the below optionsPLEX_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.
- Open
Plex Media Server
and go toSettings
->Webhooks
->Add Webhook
. Define the URL to PlexHue.php - 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.
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.
PlexHue.php?SetEnable
PlexHue.php?SetDisable
PlexHue.php?GetStatus
Returns 1 if PlexHue is enabled and 0 if disabled.
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"
}
],