Kodi subtitle command

I have an IR remote with a subtitle button for my kodi box that does work (though I have no idea what command it is sending), it cycles through the available subtitles. However I would like to do this without relying on IR control.

I’ve used this in the past:

lounge_kodi_input_next_subtitle:
  sequence:
    service: kodi.call_method
    data:
      entity_id: media_player.lounge_osmc_kodi
      method: Player.SetSubtitle
      playerid: 1
      subtitle: "next"
      enable: true

But it no longer seems to work, I’m reasonably sure it used to. Any idea what I am doing wrong?

The relevant api doc is here:

https://kodi.wiki/view/JSON-RPC_API/v10#Player.SetSubtitle

Are you using Kodi v19 (Matrix)? You’ve linked to the API v10, which is outdated, it’s v12 for Kodi v19.

Functionally nothing should have changed, you could enable debug logging in Kodi while calling the method you’ve posted.

EDIT: I’ve tested the code you’ve provided and it works on my Kodi instance (latest android release)

1 Like

No, I’m still on Leia, 18.something.

Damn. Thanks for testing.

Now I have to work out what the heck has changed on my Kodi box.

To rule out a connection issue, try restarting Home Assistant and shortly after the restart, and issue the command then. (Vice-versa; Restart Kodi and issue the command shortly afterwards)

It’s connected fine, I have lots of other controls that work as intended (play, pause, big skip, etc…)

Before I shut down for the night I did notice that for the file I was playing the subtitles are internal, I.e. in the mkv container, rather than in an external file. I’ll do some more testing tomorrow night to see if the command only works with external subtitle files.

I’ve had a quick look through Kodis source code and the SetSubtitle function hasn’t been touched in years (neither internal nor API), so I’d assume it might have something to do with int/ext subtitles.
Maybe try a simple video with an embedded one and an external .srt

I’ve confirmed it working with 2 external .srt files.

Finally got this sorted out:

lounge_kodi_input_next_subtitle:
  sequence:
    service: kodi.call_method
    data:
      entity_id: media_player.lounge_osmc_kodi
      method: Input.ExecuteAction
      action: "nextsubtitle"
3 Likes