maykar / plex_assistant

❱ Plex Assistant is a Home Assistant integration for casting Plex media to Google devices, Sonos devices, and Plex clients with Google Assistant, HA's conversation integration, and more.
MIT License
281 stars 60 forks source link

Creating a playlist doesn't cause an media list update #132

Open nopoz opened 3 years ago

nopoz commented 3 years ago

I'm trying to play a music playlist called "Jazz". However when I ask "Tell Plex to play jazz playlist on Office Display", it starts playing a video playlist. Is it currently possible to play music playlists? I've tried variations with the same results, "Tell Plex to play playlist jazz on Office Display", "Tell Plex to play music playlist Jazz on Office Display".

Debug output:

2021-06-25 21:43:17 DEBUG (SyncWorker_0) [custom_components.plex_assistant.const] IFTTT Call: play jazz playlist on office display
2021-06-25 21:43:17 DEBUG (SyncWorker_2) [custom_components.plex_assistant.const] Command: play jazz playlist on office display
2021-06-25 21:43:17 DEBUG (SyncWorker_2) [custom_components.plex_assistant.const] Processed Command: {'media': 'jazz', 'device': 'office display'}
2021-06-25 21:43:18 DEBUG (SyncWorker_2) [custom_components.plex_assistant.const] PA Devices: <device list>
2021-06-25 21:43:18 DEBUG (SyncWorker_2) [custom_components.plex_assistant.const] Device: Office display
2021-06-25 21:43:18 DEBUG (SyncWorker_2) [custom_components.plex_assistant.const] Media: [<Episode:217557:The-Simpsons-s02e03>, <Episode:217607:The-Simpsons-s03e07>, <Episode:217582:The-Simpsons-s04e05>, <Episode:217708:The-Simpsons-s05e05>, <Episode:217657:The-Simpsons-s06e06>, <Episode:217683:The-Simpsons-s07e06>, <Episode:217626:The-Simpsons-s08e01>, <Episode:217756:The-Simpsons-s09e04>, <Episode:217730:The-Simpsons-s10e04>, <Episode:217804:The-Simpsons-s11e04>, <Episode:217779:The-Simpsons-s12e01>, <Episode:218170:The-Simpsons-s13e01>, <Episode:217825:The-Simpsons-s14e01>, <Episode:218125:The-Simpsons-s15e01>, <Episode:217848:The-Simpsons-s16e01>, <Episode:218196:The-Simpsons-s17e04>, <Episode:217875:The-Simpsons-s18e04>, <Episode:217899:The-Simpsons-s19e05>, <Episode:218151:The-Simpsons-s20e04>, <Episode:217919:The-Simpsons-s21e04>, <Episode:217943:The-Simpsons-s22e04>]
github-actions[bot] commented 3 years ago

Important:

Issues that don't provide the information requested in the troubleshooting docs may not get a reply and may be closed until the info is provided. Please, include as much of the requested info as possible so that I can replicate and investigate your issue.

When pasting in your config/code/errors always place 3 backticks ``` above the first line and after the last line. Doing this will format it correctly.

nopoz commented 3 years ago

Okay after some more troubleshooting it does seem possible. I had created the plex music playlist after I had installed the plex assistant integration in home assistant. I deleted the integration and re-added it, then the playlist command works. I assume this is due to some sort of caching being done? When I add the plex assistant for the first time there is this line in the logs:

2021-06-25 22:15:53 DEBUG (SyncWorker_6) [custom_components.plex_assistant.const] Media titles: 34175

Is there anyway to refresh the cache so the integration doesn't have to be removed and re-added?

maykar commented 3 years ago

There is no cache (edit: only partially true), Plex Assistant searches all current media reported by HA's Plex integration for the best match. I'm not sure what the original issue might have been. That debug line is there to let me know how many media items exist when issues pertaining to speed are posted.

maykar commented 3 years ago

Actually, thinking about it more I think I know what the issue is. Plex Assistant looks at the time the last item was added to update the list of media items, I imagine playlists aren't included in that list. Will try to get a fix in soon. So I guess it is a caching issue of sorts.