[HELP NEEDED ]Kodi call_method to stop Kodi addon

Dear all,

I Try to start and stop an addon of kodi but did not really understand how to od that.
#The first question would be:

  1. How to find out the id of the addon
  2. How to "translate this command into hass command?
{
  "description": "Enables/Disables a specific addon",
  "permission": "ManageAddon",
  "type": "method",
  "params": [
    {
      "type": "string",
      "name": "addonid",
      "required": true
    },
    {
      "$ref": "Global.Toggle",
      "name": "enabled",
      "required": true
    }
  ],
  "returns": {
    "type": "string"
  }
}

Thanks for your help

this is my config:

transmission_stop:
  alias: Stop Transmission
  sequence:
    - service: kodi.call_method
      data:
        entity_id: media_player.kodi
        method: Addons.SetAddonEnabled
        addonid: service.transmission
        params: 
          addonid: service.transmission
          enabled: false

and this is my error

2020-03-01 15:10:30 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi.Addons.SetAddonEnabled({'addonid': 'service.transmission', 'params': OrderedDict([('addonid', 'service.transmission'), ('enabled', False)])}) error: {'code': -32602, 'data': {'method': 'Addons.SetAddonEnabled', 'stack': {'message': 'Missing parameter', 'name': 'enabled', 'type': ['string', 'boolean']}}, 'message': 'Invalid params.'}

Look at the URL in a web browser when you are viewing the Supervisor / Kodi addon page. The random alphanumeric part is the ID.

E.g. in this case: https://my_domain.duckdns.org/hassio/addon/15ef4d2f_esphome

15ef4d2f_esphome is the ID.

Thanks for the hint but I cannot watch service addons in the browser. You mean well the webinterface right? like IP:8080 ?

We completley misunderstand each other. I don’t have kodi addon for hassio but mean the transmission addon for kodi :slight_smile: wanna control this addon via kodi platfomr and call_method

Oh a Kodi addon. No a home assistant addon. Got it. No idea sorry.

https://kodi.wiki/view/JSON-RPC_API/v6#Addons.SetAddonEnabled

No idea about the ID but there’s some info in this thread about converting the Kodi API services to HA services for remote control that may help:

Actually go to the thread and read the replies.

I’m using a mini media player to control my Kodi installation. I can start a Kodi addon. Stopping is more complex. You can switch to the menu or another addon but have to stop any mediaplayer that is started by the addon separately.
This is my Kodi remote in Home Assistant:


The four buttons on the right start Kodi addons. The only problem I have now is that the i-radio addon will not start. it generates an invalid params error. When I launch Chrome, I still have to switch to my KDE app to control it as Chrome runs outside of Kodi. I’m still looking for a way to control Chrome on the media player (an Ubuntu box) from HA. Below is the Yaml for the remote. The volume is controlled by an ampifier which, being twenty years old, can only be controlled by IR signals.

entity: media_player.kodi
hide:
  controls: true
  icon_state: false
  mute: true
  power_state: false
  volume: true
idle_view:
  when_idle: false
  when_paused: false
  when_standby: false
name: Kodi
icon: 'mdi:kodi'
shortcuts:
  buttons:
    - data:
        entity_id: media_player.kodi
        method: Input.Home
      icon: 'mdi:home'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: GUI.ActivateWindow
        window: favourites
      icon: 'mdi:star'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: Input.Up
      icon: 'mdi:arrow-up-bold'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: Input.Back
      id: kodi.call_method
      name: Back
      type: service
    - data:
        addonid: plugin.audio.i-radio
        entity_id: media_player.kodi
        method: Addons.ExecuteAddon
      id: kodi.call_method
      name: i-radio
      type: service
    - data:
        entity_id: media_player.kodi
        method: GUI.ActivateWindow
        window: videos
      id: kodi.call_method
      name: Videos
      type: service
    - data:
        entity_id: media_player.kodi
        method: Input.Left
      icon: 'mdi:arrow-left-bold'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: Input.Select
      id: kodi.call_method
      name: OK
      type: service
    - data:
        entity_id: media_player.kodi
        method: Input.Right
      icon: 'mdi:arrow-right-bold'
      id: kodi.call_method
      type: service
    - data:
        addonid: plugin.video.youtube
        entity_id: media_player.kodi
        method: Addons.ExecuteAddon
        params:
          command: activate
      id: kodi.call_method
      name: YouTube
      type: service
    - data:
        entity_id: media_player.kodi
        method: GUI.ActivateWindow
        window: music
      id: kodi.call_method
      name: Music
      type: service
    - data:
        entity_id: media_player.kodi
        method: Input.Info
      icon: 'mdi:information'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: Input.Down
      icon: 'mdi:arrow-down-bold'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: Input.ContextMenu
      icon: 'mdi:menu-open'
      id: kodi.call_method
      type: service
    - data:
        addonid: plugin.audio.rco
        entity_id: media_player.kodi
        method: Addons.ExecuteAddon
      id: kodi.call_method
      name: RCO
      type: service
    - data:
        entity_id: media_player.kodi
        method: Player.GoTo
        playerid: 1
        to: previous
      icon: 'mdi:skip-backward'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: Player.PlayPause
        playerid: 1
      icon: 'mdi:play-pause'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: Player.Stop
        playerid: 1
      icon: 'mdi:stop'
      id: kodi.call_method
      type: service
    - data:
        entity_id: media_player.kodi
        method: Player.GoTo
        playerid: 1
        to: next
      icon: 'mdi:skip-forward'
      id: kodi.call_method
      type: service
    - data:
        addonid: plugin.program.chrome.launcher
        entity_id: media_player.kodi
        method: Addons.ExecuteAddon
        params:
          command: activate
      id: kodi.call_method
      name: Chrome
      type: service
    - data:
        d: denon
        f: vol_down
      icon: 'mdi:volume-minus'
      id: script.send_ir
      type: service
    - data:
        d: denon
        f: mute
      icon: 'mdi:volume-off'
      id: script.send_ir
      type: service
    - data:
        d: denon
        f: vol_up
      icon: 'mdi:volume-plus'
      id: script.send_ir
      type: service
    - data:
        entity_id: media_player.kodi
        method: System.EjectOpticalDrive
      icon: 'mdi:eject'
      id: kodi.call_method
      type: service
    - data:
        d: denon
        f: source
      icon: 'mdi:exit-to-app'
      id: script.send_ir
      type: service
  columns: 5
type: 'custom:mini-media-player'
volume_stateless: true
1 Like

Forgot to mention that you can find the Kodi addonid in the .kodi/addon/addonname/addon.xml file in the home folder of the user that started Kodi. That is for Ubuntu. Don’t know where that file is on other platforms.

Thanks I created she’ll command switches now . I’ll post it later

my setup is KODI with a screen saver running with my pictures of the family, now I have surveillance cameras these I have integrated via script in Kodi which displays a small picture of the camera for 30 seconds, so far so good. but the script does not turn off the screen saver and thus I see
the picture of the surveillance camera not! in FHEM I had solved this quite simply with an exec mousemove, in Home Assistant this is certainly also possible unfortunately I do not yet understand how my approach

service: kodi.call_method
target:
  entity_id: media_player.kodi_b
data:
  method: Input.mousemove

but unfortunately it does not work has one an idea would be great!

IF someone has the same problem, it works with the command

service: kodi.call_method
target:
  entity_id: media_player.kodi_b
data:
  method: Input.ExecuteAction
  action: mousemove