**entity**: You need to configure at least one supported media_player entity.
- **androidtv**: Entity id of your media_player configured via [Android TV](https://www.home-assistant.io/integrations/androidtv/). See [detailed instructions](https://github.com/JurajNyiri/PlexMeetsHomeAssistant#android-tv-or-fire-tv).
- **kodi**: Entity id of your media_player configured via [Kodi](https://www.home-assistant.io/integrations/kodi/). See [detailed instructions](https://github.com/JurajNyiri/PlexMeetsHomeAssistant#kodi).
- **plexPlayer**: Name or machine ID of your plex client. Use this if you do not have devices above. See [detailed instructions](https://github.com/JurajNyiri/PlexMeetsHomeAssistant#all-other-plex-clients).
- **cast**: Entity id of your media_player configured via [Google Cast](https://www.home-assistant.io/integrations/cast/). See [detailed instructions](https://github.com/JurajNyiri/PlexMeetsHomeAssistant#google-cast).
**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.
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.
_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.
- Setup [Android TV](https://www.home-assistant.io/integrations/androidtv/). You need just a [default configuration](https://www.home-assistant.io/integrations/androidtv/#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`.
- Install and configure integration [Kodi Recently Added Media](https://github.com/jtbgroup/kodi-media-sensors#installation) and its sensor **kodi_media_sensor_search**
- Set up [Google Cast](https://www.home-assistant.io/integrations/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.
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
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 URL `http://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.
plexPlayer can be configured in multiple ways, achieving the same thing:
```
entity:
plexPlayer: TV 2020
```
```
entity:
plexPlayer:
- TV 2020
```
```
entity:
plexPlayer:
identifier: TV 2020
```
```
entity:
plexPlayer:
- identifier: TV 2020
```
As can be seen from the last two examples, it is possible to configure it as an object having key "identifier".
That is useful, if you want to stream media from shared or remote Plex server. Add information about your local Plex server which sees your device on which you wish to play content. This is done by including a new key, "server" having additional keys:
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.
<ahref="https://www.buymeacoffee.com/jurajnyiri"target="_blank"><imgsrc="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png"alt="Buy Me A Coffee"width="150px"></a>
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.