Hassio command shell for Kodi control


I’m trying to control Kodi over HA with the JSON-RPC API.

It works with the RESTful Switch, but it send the command every 30 seconds again. So I tried to find an other way. Now I’m trying to make a script that runs a shell command. Here is what I did:

configuration.yaml :
shell_command: !include shell_commands.yaml
script: !include scripts.yaml

shell_commands.yaml :

kodi_playpause: " /config/shells/kodi_playpause.sh "

in the folder config/shells/ I created the file kodi_playpause.sh :

curl --silent -k "http://[KODI_IP]:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 1 }, "id": 1}"

I tried this format to:
curl --silent -k "http://[KODI_IP]:8080/jsonrpc?request={%22jsonrpc%22:%20%222.0%22,%20%22method%22:%20%22Player.PlayPause%22,%20%22params%22:%20{%20%22playerid%22:%201%20},%20%22id%22:%201}"

and last the scripts.yaml :

    - service: shell_command.kodi_playpause

If I open this url from my browser it works fine.

I think that the path of the sh-file is wrong. Any ideas?

shouldn’t this just be shells/kodi_playpause.sh?

I tried this one but it doesn’t work.