Disable Kodi Addon via API

I would like to create a script to disable the NextPVR Kodi addon via the JSON-RPC API. Based on the example in the Kodi integration docs and the API docs, I’ve put together this script but I get the error below on running the script.

Script:

service: kodi.call_method
data:
  method: Addons.SetAddonEnabled
  addonid: pvr.nextpvr
  params:
    enabled: false
target:
  entity_id: media_player.familyroom_kodi

HA Log Error:

Run API method media_player.familyroom_kodi.Addons.SetAddonEnabled({‘addonid’: ‘pvr.nextpvr’, ‘params’: {‘enabled’: False}}) error: {‘code’: -32602, ‘data’: {‘method’: ‘Addons.SetAddonEnabled’, ‘stack’: {‘message’: ‘Missing parameter’, ‘name’: ‘enabled’, ‘type’: [‘string’, ‘boolean’]}}, ‘message’: ‘Invalid params.’}

Here’s the relevant API documentation

Any help to troubleshoot would be appreciated.

You have to add both params (the addon name and the enabled flag) the same way. I used this to disable/enable the NextPVR addon from HA as a test, and it worked for me:

service: kodi.call_method
data:
  method: Addons.SetAddonEnabled
  addonid: pvr.nextpvr
  enabled: false
target:
  entity_id: media_player.vero4kplus

Sometimes, the answer is staring you right in the face and you don’t see it. Thanks so much for helping me out Kyle.