Hello team
I have been really happy with some progress lately, getting a custom dash to play a selection of radio stations to a selection of remote players - and now I want ti throw some plex playlists in the mix.
According to documentation we can use media_player.play_media to play media on a ‘connected’ client, using the following detail:
- entity_id - media_player.theater_plex
- media_content_id - { \“playlist_name\” : \“The Best of Disco\” \“shuffle\”: \“0\” }
- media_content_type - PLAYLIST
I have noticed that the template example above is missing the comma between the playlist_name and shuffle entries. I have included that but keep getting the same error.
NOTE: The JSON requires the quotation charaters be escaped, hence the backslashes:
2018-06-21 17:43:25 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=media_player, service=play_media, service_data=entity_id=media_player.surf_kodi, media_content_id={ \"playlist_name\" : \"Chilled\", \"shuffle\": \"1\" }, media_content_type=playlist, service_call_id=139739065784192-410>
2018-06-21 17:43:25 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall media_player.play_media: entity_id=['media_player.surf_kodi'], media_content_id={ \"playlist_name\" : \"Chilled\", \"shuffle\": \"1\" }, media_content_type=playlist>
Traceback (most recent call last):
File "/usr/src/app/homeassistant/core.py", line 1007, in _event_to_service_call
await service_handler.func(service_call)
File "/usr/src/app/homeassistant/components/media_player/__init__.py", line 415, in async_service_handler
await getattr(player, method['method'])(**params)
File "/usr/src/app/homeassistant/components/media_player/kodi.py", line 245, in wrapper
yield from func(obj, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/jsonrpc_async/jsonrpc.py", line 45, in send_message
return message.parse_response(response_data)
File "/usr/local/lib/python3.6/site-packages/jsonrpc_base/jsonrpc.py", line 181, in parse_response
raise ProtocolError(code, message, data)
jsonrpc_base.jsonrpc.ProtocolError: (-32602, 'Invalid params.', {'error': {'code': -32602, 'message': 'Invalid params.'}, 'id': 7416810882365111645, 'jsonrpc': '2.0'})
PS I get a different error now. I think the change was entering the media_content_type in capitals (PLAYLIST) but I can’t be sure. The subsequent error (RE media_content_id) reads: “ValueError: invalid literal for int() with base 10:” no matter what I enter for that field. Which leads me to wonder if the actual requirement in the PLEX API has changed, and is now an integer - such as the playlist ID.
If I enter the playlist ID (a 5 digit integer) I then get ‘Received value does not match any of the union type definitions’.
Safe to say the Plex music playlist option is broken?