当前位置: 首页 > 软件库 > 其他开源 > 物联网 >

homebridge-plex-sensors

授权协议 MIT License
开发语言 JavaScript
所属分类 其他开源、 物联网
软件类型 开源软件
地区 不详
投 递 者 邵骁
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Homebridge Sensors for Plex

This plugin for Homebridge adds sensor(s) to HomeKit that are triggered by Plex playbacks. You can use these sensors to trigger HomeKit scenes when Plex starts and stops playback.

Automatically dim the lights when you start watching TV, or turn them off completely for a movie. With advanced HomeKit automations you can even trigger different scenes depending on the time of day.

Plex Sensors uses Plex's webhooks feature to get notified by your Plex server immediately when playback starts and stops, without needing to constantly poll your server.

Note: Because webhooks require Plex Pass for the Plex Media Server account, this plugin also effectively requires Plex Pass.

Installation

You can install this homebridge plugin with npm:

sudo npm install -g homebridge-plex-sensors

Go to the Homebridge page to read more about installing and configuring Homebridge.

Setting up the Webhook

For this plugin to receive playback events, you need to add a webhook to your Plex account. You can do this by visiting:

https://app.plex.tv/desktop#!/account/webhooks

On that page, click ADD WEBHOOK and then enter the IP of your homebridge server with the port used by this plugin (by default 22987 but this can be changed in the config file). So for example enter http://192.168.1.100:22987/ if you kept the default port, and your IP address is 192.168.1.100.

Note: to work with Plex servers outside your local network you'll need to expose the address used to the outside world via port forwarding etc.

Configuration

Plex Sensors supports various configuration options to suit your needs, and runs as a homebridge platform so it can add multiple sensors for different types of playback.

Your config for the platform should include a sensors object that can contain any number of sensors with different configurations (each sensor can filter events, eg. only movie events on the living room player). Those sensor objects can include the following variables:

Variable Description
name This will be the name of this sensor, it must be included and unique.
types (Optional) This is an array of types for which playback can trigger the sensor. (Valid types include movie, episode, track, photo)
players (Optional) This is an array of player names or UUIDs for players that will trigger the sensor. (To find out your player name you can check the Now Playing section of Plex Web while that player is playing, or enable the logSeenPlayersAndUsers setting described below which will also log UUID values as an alternative to names)
users (Optional) This is an array of user names for users that will trigger the sensor. (To find out your user name you can check the Now Playing section of Plex Web while that user is playing)
genres (Optional) This is an array of genre strings. If set, movie playbacks will only trigger the sensor if the movie's genre matches one or more of the genres in this array.
ignorePauseResume (Optional - default: false) If set to true the sensor will remain "triggered" while playback is paused. By default paused players will untrigger the sensor.
customFilters (Optional / Advanced) Custom filters allow you to filter for specific properties on the JSON events that the above use cases don't cover. For example you could make a sensor only triggered by playing a specific TV Show or movie. See Plex's article on Webhooks for more details of what is passed in webhook events.
delayOff (Optional - default: 0) Setting this to a value above 0 will delay the occupancy sensor being untriggered when playback is stopped. This timeout is measured in milliseconds.

Additionally, you can set the following settings globally, outside of the sensors object:

Variable Description
logSeenPlayersAndUsers (Optional - default: false) Setting this to true will log every player device name and username that the plugin sees starting a playback from the webhook, potentially useful for figuring out device names.

debug | (Optional - default: false) Setting this to true will log every webhook and how it is handled by the plugin's logic. You should probably leave this false, but you might find it useful for looking at the entire contents of a webhook payload.

Example Configs

Example config with one sensor triggered by any Plex playback by your account or from your server:

{
"platforms": [
  {
    "platform": "homebridge-plex-sensors.Plex",
    "sensors": [
      {
        "name": "Plex Playing"
      }
    ]
  }
]
}

Example config with a sensor triggered by TV show playbacks, and a sensor triggered by movie playbacks (both filtered to a specific user and player):

{
"platforms": [
  {
    "platform": "homebridge-plex-sensors.Plex",
    "sensors": [
      {
        "name": "Movie Playing",
        "types": ["movie"],
        "players": ["Living Room"],
        "users": ["MyUserName"]
      },
      {
        "name": "TV Playing",
        "types": ["episode"],
        "players": ["Living Room"],
        "users": ["MyUserName"]
      }
    ]
  }
]
}

Example config with a horror movie genre-specific sensor:

{
"platforms": [
  {
    "platform": "homebridge-plex-sensors.Plex",
    "sensors": [
      {
        "name": "Horror Movie",
        "types": ["movie"],
        "genres": ["Horror"]
      }
    ]
  }
]
}

Example config with a sensor triggered only by playing the TV show Breaking Bad (also shows a custom port number being set for the webhook server):

{
"platforms": [
  {
    "platform": "homebridge-plex-sensors.Plex",
    "port": "22988",
    "sensors": [
      {
        "name": "Breaking Bad is on",
        "types": ["episode"],
        "customFilters":
        {
          "Metadata.grandparentTitle": "Breaking Bad"
        }
      }
    ]
  }
]
}

Example config with the logSeenPlayersAndUsers setting to true for helping you figure out device names:

{
"platforms": [
  {
    "platform": "homebridge-plex-sensors.Plex",
    "logSeenPlayersAndUsers": true,
    "sensors": [
      {
        "name": "Plex Playing",
      }
    ]
  }
]
}
 相关资料
  • Plex Plugin for Homebridge Use the active sessions on your Plex server as a sensor in Homebridge. Enable your cozy cinema light scene when Plex starts playing and go back to your normal lighting when

  • plex-bridge-homebridge-http-webhooks ARCHIVED This repo's intended purpose has been met by homebridge-plex-sensors.I recommend it in place of this package. The code here is still a decent starting poi

  • synology-update-plex Script to Auto Update Plex Media Server on Synology NAS Goals Make the echoed messages super clear Make the version checking logic as smart as possible Ensure the script fails if

  • Homebridge 是一个轻量级 NodeJS 服务器,它模拟 iOS HomeKit API,提供从 HomeKit 到“智能家居”设备制造商提供的各种第三方 API 的基本桥接。通过 Homebridge 的桥接,可以让 Siri 控制完全不支持 HomeKit 的设备。 此外 Homebridge 支持插件。

  • homebridge-ecobee3-sensors Homebridge plugin for exposing wireless temperature and occupancy sensors of your Ecobee 3 Thermostat as HomeKit accesories. The thermostat itself is a HomeKit accessory, bu

  • homebridge-vsx homebridge-vsx is a plugin made for homebridge,which allows switching on and off your Pioneer AV receiver. All AV receivers (VSX and SC),which work with the iControl AV5 App are support