Juraj Nyíri
d199719708
|
4 years ago | |
---|---|---|
.vscode | 4 years ago | |
dist | 4 years ago | |
images | 4 years ago | |
src | 4 years ago | |
.eslintignore | 4 years ago | |
.eslintrc | 4 years ago | |
.gitignore | 4 years ago | |
.prettierignore | 4 years ago | |
.prettierrc | 4 years ago | |
LICENSE | 4 years ago | |
README.md | 4 years ago | |
hacs.json | 4 years ago | |
package-lock.json | 4 years ago | |
package.json | 4 years ago | |
rollup.config.js | 4 years ago | |
tsconfig.json | 4 years ago |
README.md
PlexMeetsHomeAssistant
Custom Home Assistant card which integrates plex into Home Assistant and makes it possible to launch movies or tv shows on TV with a simple click.
Supported are ALL Plex clients, some even with enhanced functionality. Kodi with PlexKodiConnect and Google Cast is also supported.
Video of the card:
More images at the end of the readme.
Important notice
If you are using Home Assistant via HTTPS, you need to specify port https
for Plex and have Plex available on https connection.
Installation
- Install Plex Meets Home Assistant from HACS.
- Reload browser, clear cache as usual
- Create a new Home Assistant tab, turn on panel mode
- Add a new card, see configuration below.
Configuration
type: 'custom:plex-meets-homeassistant'
token: Enter your Plex Token
ip: Enter ip address of plex server. You can also enter hostname without protocol or port.
libraryName: Name of the library you wish to render.
Available special libraries:
Special Library | Description |
---|---|
Watch Next | Shows Continue Watching feed just like in your new plex interface. Does not work with old servers. |
Recently Added | Shows recently added tv show episodes, might use old Plex API. For recently added movies use sort with your movies library. |
Continue Watching | Shows movies and tv shows in progress, uses old Plex API. |
Deck | Shows tv shows on deck, uses old Plex API. |
entity: You need to configure at least one supported media_player entity.
- androidtv: Entity id of your media_player configured via Android TV. See detailed instructions.
- kodi: Entity id of your media_player configured via Kodi. See detailed instructions.
- plexPlayer: Name or machine ID of your plex client. Use this if you do not have devices above. See detailed instructions.
- cast: Entity id of your media_player configured via Google Cast. See detailed instructions.
port: Optional Port of your plex sever.
protocol: Optional Protocol to use for Plex. Defaults to "http".
maxCount: Optional Maximum number of items to display in card.
sort: Optional Define sort by. See detailed instructions
runBefore: Optional Specify a script to run before playing. This can be for example a script which turns on your TV and waits 5 seconds. If this is specified and provided entity/script exists, all the other play checks for availability of entity are ignored.
runAfter: Optional Specify a script to run after playing.
showExtras: Optional Specify whether to show extras if any available on movie / episode. Possible values: true, false. Default: true
playTrailer: Optional Specify whether to play trailer if available. Possible values: true, false, muted. Default: true
Example of card configuration:
type: 'custom:plex-meets-homeassistant'
token: QWdsqEXAMPLETOKENqwerty
ip: 192.168.13.37
port: 32400
libraryName: Movies
protocol: http
maxCount: 10
sort: title:desc
entity:
kodi: media_player.kodi_123456qwe789rty
androidtv: media_player.living_room_nvidia_shield
plexPlayer: 192.168.13.38
cast: media_player.bedroom_tv
Example using lists:
type: 'custom:plex-meets-homeassistant'
token: QWdsqEXAMPLETOKENqwerty
ip: 192.168.13.37
port: 32400
libraryName: Deck
protocol: http
maxCount: 10
sort: title:desc
runBefore: script.turn_on_tv_and_wait
runAfter: script.movie_time
entity:
kodi:
- media_player.kodi_bedroom
- media_player.kodi_living_room
androidtv:
- media_player.living_room_nvidia_shield
- media_player.bedroom_nvidia_shield
- media_player.kithen_nvidia_shield
plexPlayer:
- TV 2020
- 192.168.13.50
cast:
- media_player.bedroom_tv
In this example, it will try to first play via kodi, in bedroom. If that kodi is unavailable or off, it tries in living room kodi. If that fails, it moves on to android tvs, starting with living room, continuing with bedroom and ending with kitchen. Next, if a possible player still has not been found (all kodis and shields are off) it tries to play via plexPlayer, trying TV 2020 and if not found, IP 192.168.13.50. Finally, it tries to cast into media_player.bedroom_tv.
Detailed configuration instructions for end devices
You can combine multiple supported entities, in that case, entity for supported content will be chosen in order how you entered them.
As an example, if content can be played / shown both by kodi and androidtv, and you entered kodi first, it will be shown by kodi. If it cannot be played by kodi but can be played by androidtv, androidtv will be used.
This will also work with play button being shown, it will only show when you can actually play content on your device.
Play button is only visible if all the conditions inside Availability section of end devices below are met.
Android TV or Fire TV
Difficulty to setup: Easy
Steps:
- Install plex application on your Android TV device. Open it and do the default setup so that you can see and navigate your libraries.
- Setup Android TV. You need just a default configuration, no optional parameters needed.
- Use entity_id of media_player provided by Android TV integration in card, example:
androidtv: media_player.living_room_nvidia_shield
.
Availability:
- Provided entity ID needs to exists
- Provided entity ID needs to have attributes
- Provided entity ID needs to have attribute adb_response
Supported play types:
✅ Movies
✅ Show
✅ Season
✅ Episodes
Kodi
Difficulty to setup: Moderate
Steps:
- Install and configure PlexKodiConnect on Kodi itself.
- Setup Kodi integration for your device.
- Install and configure integration Kodi Recently Added Media and its sensor kodi_media_sensor_search
- Use entity_id of media_player provided by Kodi integration in card, example:
media_player.kodi_123456qwe789rty
.
Availability:
- Provided entity ID needs to exists
- Entity 'sensor.kodi_media_sensor_search' needs to exist
- State of both entities cannot be 'unavailable'
- State of kodi cannot be 'off'
Supported play types:
✅ Movies
❌ Show
❌ Season
✅ Episodes
Google Cast
Difficulty to setup: Very easy
Steps:
- Set up Google Cast in Home Assistant.
- Use entity_id of media_player provided by Google Cast integration in card, example:
cast: media_player.bedroom_tv
. - Save card configuration and make sure the entity is not
unavailable
, if you see play buttons on movies or individual episodes configuration was successful.
Availability:
- Media player entity cannot be
unavailable
Supported play types:
✅ Movies
❌ Show
❌ Season
✅ Episodes
All other plex clients
Difficulty to setup: Very Easy to Moderate
Steps:
Easy setup:
Notice: While easy, it might not work if you have multiple devices with the same name, or you buy a second device with the same name in the future. Some plex clients also incorrectly report theirs IP Address, so addition by that might not be working. Take a look at Machine ID setup below if this is a concern for you.
- Open Plex app on the device you wish to add
- Open your Plex web GUI
- Click on cast on the top right corner and note down name of your device
- Add it to card, example:
entity:
plexPlayer: TV 2020
Instead of device name, you can also enter device IP address or product name.
- Save card configuration, if you see play buttons everywhere configuration was successful.
If you do not see play button, or have multiple devices with the same name, follow Machine ID setup below.
Machine ID setup:
- Open Plex app on the device you wish to add
- Open your Plex web GUI
- Modify URL so that just after the port, just after the first slash, you enter
clients?X-Plex-Token=PLEX_TOKEN
. Replace PLEX_TOKEN with your plex token. Example final URLhttp://192.168.13.37:32400/clients?X-Plex-Token=qweRTY123456
. - You will get a list of all currently connected Plex clients.
- Find the client you wish to add, and copy machineIdentifier key without quotes.
- Add machineIdentifier into card, for example:
entity:
plexPlayer: mYaweS0meMacHin3Id3ntiFI3r
- Save card configuration, if you see play buttons everywhere configuration was successful.
Availability:
- Plex needs to run on the defined device
Supported play types:
✅ Movies
✅ Show
✅ Season
✅ Episodes
Sorting
You can use :desc or :asc after every value to change the order from ascending to descending. For example, titlesort would become titleSort:asc, or titleSort:desc.
TV Shows
Sort Value | Description |
---|---|
titleSort | Sorts by title, removing words like "the" |
title | Sorts by title, without removing words like "the" |
year | Sorts by year |
originallyAvailableAt | Sorts by release date |
rating | Sorts by critic rating |
audienceRating | Sorts by audience rating |
userRating | Sorts by user rating |
contentRating | Sorts by content rating |
unviewedLeafCount | Sorts by unplayed count |
episode.addedAt | Sorts by last episode date added |
addedAt | Sorts by date added |
lastViewedAt | Sorts by date viewed |
Movies
Sort Value | Description |
---|---|
titleSort | Sorts by title, removing words like "the" |
title | Sorts by title, without removing words like "the" |
originallyAvailableAt | Sorts by release date |
rating | Sorts by critic rating |
audienceRating | Sorts by audience rating |
userRating | Sorts by user rating |
duration | Sorts by duration |
viewOffset | Sorts by progress |
viewCount | Sorts by plays |
addedAt | Sorts by date added |
lastViewedAt | Sorts by date viewed |
mediaHeight | Sorts by resolution |
mediaBitrate | Sorts by bitrate |
Ask for help or help development
Join Discord or Home Assistant Community.
Images
Want to buy me a beer?
Disclaimer
Author is in no way affiliated with Kodi, Plex, Roku, Android TV, Google or any other companies mentioned above.
Author does not guarantee functionality of this card and is not responsible for any damage.
All product names, trademarks and registered trademarks in this repository, are property of their respective owners.
This card provides user interface for navigating plex library and playing plex content on users devices. It does not host any content on its own and does not provide any plex server.