Edit: Solved.
Just name this baby “autoexec.py” and place it at /home/.kodi/userdata
Works like a charm. CEC turns on my TV and switches to the correct input when I push a video to Kodi through my phone.
import xbmc,xbmcgui
class Player(xbmc.Player):
def __init__(self):
xbmc.Player.__init__(self)
def onPlayBackStarted(self):
xbmc.executebuiltin('CECActivateSource()')
player = Player()
mon = xbmc.Monitor()
while(not mon.waitForAbort(10)):
pass