Media_player.play_media Kodi Erroring

Hi
I had a script that was working fine some time ago and I’ve just got around to looking at automating it again and it seems it’s stopped working. The script was to play a rtsp stream from a local camera to a kodi system.

I had some problems using the media_player.play_media service with Kodi a few weeks ago and I resorted to using the kodi.call_method instead. I will probably figure the JSON out to play the script but in the meantime is there something up with media_player.play_media service or has this been deprecated? If the latter can we update the examples in the documentation?

My script looks like this:

front_door_camera_lounge:
  alias: Front Door Camera Lounge
  sequence:
    - service: homeassistant.turn_on
      entity_id: switch.0x000d6ffffe2b94dc_switch
    - service: script.turn_on
      entity_id: script.blr_lounge_amp_hector
    - delay: '00:00:05'
    - service: media_player.play_media
      data:
        entity_id: media_player.kodi_main
        media_content_type: DIRECTORY
        media_content_id: special://profile/playlists/video/Cam_front_door.strm

And this is the error thrown in the log:

Logger: homeassistant.components.script
Source: components/kodi/media_player.py:759
Integration: Script (documentation, issues)
First occurred: 3:14:32 PM (1 occurrences)
Last logged: 3:14:32 PM

Front Door Camera Lounge: Error executing script. Unexpected error for call_service at pos 4: (-32602, 'Invalid params.', {'error': {'code': -32602, 'message': 'Invalid params.'}, 'id': 1963930333, 'jsonrpc': '2.0'})
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 154, in _async_step
    self, f"_async_{cv.determine_script_action(self._action)}_step"
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 624, in _async_call_service_step
    *self._prep_call_service_step(), blocking=True, context=self._context
  File "/usr/src/homeassistant/homeassistant/core.py", line 1232, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1255, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    self._platforms.values(), func, call, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 412, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 600, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 443, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 237, in wrapper
    await func(obj, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 759, in async_play_media
    await self.server.Player.Open({"item": {"directory": str(media_id)}})
  File "/usr/local/lib/python3.7/site-packages/jsonrpc_websocket/jsonrpc.py", line 45, in send_message
    return message.parse_response(response)
  File "/usr/local/lib/python3.7/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': 1963930333, 'jsonrpc': '2.0'})

no news here? would also like to use this to show my cam stream :slight_smile:

Instead of DIRECTORY try file