Kodi - complicated programming

A lot of people use kodi and as i can see it can also be controlled via the json rpc funtionality.
My problem is that i’m running Kodi on top of ESXi - so every time i start the projetor instead of full screen i get a windowed mode. Have already tried different settings with no luck.
Currently i’m solving it by using a phone with yatse and pressing the full screen/windowed mode twice.
Wonder if HA can do that for me. Tried going through the docs on kodi but with no luck.
Currently tried it this way
Call a service from a component.
Domain
media_player
Service
kodi_call_method
Service Data (JSON, optional)
{“entity_id”: “media_player.kodi_cinema”, “method”: “togglefullscreen” }

Any suggestions on how to do it?

P.S. Also would love to see someone share their advanced kodi rules. Is there a way to launch a random unwatched movie of a preset genre?

Maybe you could use the python_script component together with https://pypi.python.org/pypi/kodi-json/ for easier access to the JSON interface?

~Cheers

1 Like

But as it is already in HA - would love to hear if it’s possible to use with built in tools

How about.

{“entityid”: “media_player.kodi_cinema”, “method”: “Input.ExecuteAction”, “params”: {“action”:“togglefullscreen”}}

Almost i guess. Running
{“entityid”: “media_player.kodi_cinema”, “method”: “Input.ExecuteAction”, “params”: {“action”:“togglefullscreen”}}

INFO (MainThread) [homeassistant.core] Bus:Handling <Event kodi_call_method_result[L]: result_ok=False, input=method=Input.ExecuteAction, params=entityid=media_player.kodi_cinema, params=action=togglefullscreen, result=data=stack=name=action, message=Missing parameter, type=string, method=Input.ExecuteAction, code=-32602, message=Invalid params., entity_id=media_player.kodi_cinema>

ERROR (MainThread) [homeassistant.components.media_player.kodi] Run API method media_player.kodi_kitchen.Input.ExecuteAction({‘entityid’: ‘media_player.kodi_cinema’, ‘params’: {‘action’: ‘togglefullscreen’}}) error: {‘data’: {‘stack’: {‘name’: ‘action’, ‘message’: ‘Missing parameter’, ‘type’: ‘string’}, ‘method’: ‘Input.ExecuteAction’}, ‘code’: -32602, ‘message’: ‘Invalid params.’}#033[0m

ERROR (MainThread) [homeassistant.components.media_player.kodi] Run API method media_player.kodi_kitchen.Input.ExecuteAction({‘entityid’: ‘media_player.kodi_cinema’, ‘params’: {‘action’: ‘togglefullscreen’}}) error: {‘data’: {‘stack’: {‘name’: ‘action’, ‘message’: ‘Missing parameter’, ‘type’: ‘string’}, ‘method’: ‘Input.ExecuteAction’}, ‘code’: -32602, ‘message’: ‘Invalid params.’}#033[0m

interesting, because from a browser window this works.

http://kodi-garage:8080/jsonrpc?request={ “jsonrpc”: “2.0”, “method”: “Input.ExecuteAction”, “params”: { “action”:“togglefullscreen” }, “id”: 1 }

can you try this. It is able to send ok for me but I am not sure if Kodi is executing.

{“method”: “Input.ExecuteAction”, “action”:“togglefullscreen”, “entity_id”:“media_player.kodi_garage” }

1 Like

WOW it works! Thank you for your time helping!
So now for the actions part in the rule… Do i understand that it should look like

  - service: media_player.kodi_call_method
    data:
      entity_id: media_player.cinema
      method: Input.ExecuteAction
      action: togglefullscreen

Very glad I checked out this thread as this bit of code will eliminate a ton of annoyance from my htpc setup through HA. Out of curiousity since folks are on the subject of kodi commands, is there a fairly straightforward manner to integrate the voice commands from an app like Yatse through HA?

Hi,

I am trying to set up Home Assistant it can jump to certain Kodi screens.
e.g. show the RecentlyAddedMovies screen on Kodi.

Based on the Kodi API you would need something like below:

  • service: media_player.kodi_call_method
    data:
    entity_id: media_player.cinema
    method: GUI.ActivateWindow
    window: videos
    parameters: RecentlyAddedMovies

However, this seems not to work
Anybody any suggestions?

I got it working in as per below:

Based on the Kodi API you would need something like below:
•service: media_player.kodi_call_method
data:
entity_id: media_player.cinema
method: GUI.ActivateWindow
window: videos
parameters:

  • RecentlyAddedMovies

I can not install python kodi json client on my sistem:

python kodi json client

error: -bash: pip: command not found

Please read up on how to get python and pip up and running on your OS.

~Cheers

I am running hass.io image. Can you help me out?

Now I installed kodi-json using this on hass.io

https://github.com/hassio-addons/addon-terminal

But now I don’t know how to use kodi-json?

This is not working?

I installed:
https://github.com/jcsaaddupuy/xbmc-client
on addon-terminal and commands from kodi-client working great.

But I can not run this commands from HA?

Don’t have a clue what you are trying to say. Everything is working :slight_smile:

I am saying that I don’t have pip installer on hass.io system and I don’t know how ti install it.

 core-ssh:~# pip install xbmc-client
-bash: pip: command not found

Now I figured how to do this right with script. :slight_smile:

Is there a option to search movie from library by entering text and when typeing names of movies show automaticaly. Like in kodi web interface:

How?