Launch a python script on Kodi with Homeassistant

Just curious if it’s possible to launch one of my python scripts from home assistant?

Or to send a command, for example:

xbmc.executebuiltin(“SlideShow(/storage/videos/vaporwave/,[,recursive,random,])”)

Kodi may well have an api that you can call directly, which will be a better solution, but you can use ssh from a command line switch, or anywhere you can use the command line to run your python script on the remote machine.

First, you have to set up ssh with keys so that there is not login prompt for the user that is running HA - see https://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id

Then something like

# Example configuration.yaml entry
switch:
  platform: command_line
  switches:
    slide_show:
      command_on: "ssh kodi_username@kodimachine python your_on_script"
      command_off: "ssh kodi_username@kodimachine python your_off_script"

see

1 Like

This is great. Would like to find a kodi way but this will work for now (and for other things as well!) Thank you!

1 Like