gcorgnet / sensor.emby_upcoming_media

Home Assistant component to feed Upcoming Media Card with the latest releases on an Emby instance.
MIT License
22 stars 17 forks source link

Emby Latest Media Component

hacs_badge

Home Assistant component to feed Upcoming Media Card with the latest releases on an Emby instance.
This component does not require, nor conflict with, the default Emby component.

If you're having issues, check out the troubleshooting guide before posting an issue or asking for help on the forums.

Installation:

  1. Install this component by copying these files to /custom_components/emby_upcoming_media/.
  2. Install the card: Upcoming Media Card
  3. Add the code to your configuration.yaml using the config options below.
  4. Add the code for the card to your lovelace configuration.
  5. You will need to restart after installation for the component to start working.
key default required description
api_key yes Your Emby API key
user_id yes The id of the user you want to impersonate. Note: this is an id, not a username. Spy on Emby API calls to retrieve yours.
(The Libraries and Medias that get retrieved depend on what that user has access to)
host localhost no The host Emby is running on.
port 8096 no The port Emby is running on.
ssl false no Whether or not to use SSL for Emby.
max 5 no Max number of items in sensor.
use_backdrop false no Defines whether to use the Backdrop Image, instead of the poster. (Great for using with the fanart display mode)
include no The names of the Emby Libraries you want to include. If not specified, all libraries will be shown and this component will create one sensor per Library. This is language specific.
group_libraries false no This option generates only two sensors (emby_latest_movies / emby_latest_tv_shows), grouping all your movies and tv into seperate sensors despite library setup in Emby.
This is useful for when Emby has many libraries but you only want one sensor in Home Assistant.
episodes true no Setting this to false will change the items shown from Episodes to Seasons (for tv show libraries) and Songs to Albums (for music libraries).


Do not just copy examples, please use config options above to build your own!

Sample for configuration.yaml:

This will add items from the 'Movies', 'Kids Movies', 'TV Shows' and 'Music' Libraries in Emby, as well as show seasons and albums for their respective libraries, creating a seperate sensor per library

sensor:
- platform: emby_upcoming_media
api_key: YOUR_EMBY_API_KEY
user_id: YOUR_EMBY_USER_ID
host: 192.168.1.4
port: 8096
ssl: True
max: 5
use_backdrop: true
group_libraries: false
episodes: false
include:
- Movies
- Kids Movies
- TV Shows
- Music

This will add all items Emby and create one sensor for movies (emby_latest_movies) and one for tv (emby_latest_tv_shows)

sensor:
- platform: emby_upcoming_media
api_key: YOUR_EMBY_API_KEY
user_id: YOUR_EMBY_USER_ID
host: 192.168.1.4
port: 8096
ssl: True
max: 5
use_backdrop: true
group_libraries: true

Sample for ui-lovelace.yaml:

- type: custom:upcoming-media-card
  entity: sensor.emby_latest_movies
  title: Latest Movies

Getting Information for the Plugin

api_key

  1. Navigate to the Emby Admin Dashboard (Cog in the top right)
  2. Select Api Keys from the side menu
  3. Select New Api Key from the top of the page

user_id

Via Web Interface

This is just an example, make sure you get your own personal user_id

  1. Navigate to the Emby Admin Dashboard (Cog in the top right)
  2. Select Users from the side menu
  3. Select the user you plan to use in HA from the list
  4. From the address bar you can get the user id
    http://emby_host_ip:8096/emby/web/index.html#!/users/user?userId=527563753xfd422288a32198522f821a

Via API Interface

  1. Navigate to http://emby_host_ip:8096/emby/Users/Public
  2. You will be provided a JSON response containing all the users details
  3. Find the Name attribute for your user in the results
  4. Next to the Name you will see an attribute name ServerId
  5. Next to the ServerId you will see Id - this is your user_id