Kodi remote in Homeassistant

Hello,

I want to have a centralized place where i can change channels and be able to remote control my house totally from HomeAssistant, therefore I am asking if it is not possible to update our kodi to use the following:

If I understand correctly it would be just a matter of adding the following functions within the component:

kodi.Input.Left()
kodi.Input.Right()
kodi.Input.Up()
kodi.Input.Down()
kodi.Input.Back()
kodi.Input.Down()
kodi.Input.Info()

Am I wrong? Is it hard to achieve?

Best Regards,
HP

1 Like

Could anyone support me on showing me the way to achieve this?

Hi @HVPereira,

Iā€™ve upvoted your request.
For the time being Iā€™m using a shell_command:

shell_command:
  kodi_input_right: 'curl -u "username:password" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Right\"}" "http://192.168.0.xx:80/jsonrpc"'
  kodi_input_left: 'curl -u "username:password" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Left\"}" "http://192.168.0.xx:80/jsonrpc"'
3 Likes

I use Panel Iframe to show KODI website in home assistant.

panel_iframe:
  kodi:
    title: 'Kodi'
    url: 'xxx.xxx.xxx.xxx:8080'
    icon: mdi:kodi

I think this is really practical

2 Likes

I thought about the same solution as well but i guess it would be better to have it fully integrated at least to know the states and which music to play etcā€¦

I am quite happy with it that way, as I mainly use it for Films and TV-Shows and I prefer to control Kodi by directly starting something rather than going through the menus of the TV frontend.
For that I prefer my Harmony remote :wink:
Seeing the panel_iframe in a tab would be nice though as proposed here.


Actually I am quite impressed how nice the remote looks like on my phone. Maybe Iā€™ll use that as well sometimes in the future.

1 Like

States are important to me as well. I enjoy the current integration and hope those Kodi/HASS states never go away since I have it in mind to automate dimming house lights when kodi is playing (as soon as I have money for Ikea Tradfri stuff lol). Adding some control buttons would be cool too though I suppose.

hi, i add your code in my configuration file, but in the frame i can see the kodi ā€œloadingā€ page. i donā€™t use username and password in the kodi configuration, so the login is free.
any ideas?

@nebbiadigiorno
actually I donā€™t know
It just works for me like that.
Do you use SSL. This is the only thing I would think of.

@derdude1893 The strange thing is that the page works on the chrome web browser of the iPad, brut it doesnā€™t work on my pc chrome or On android chrome.

1 Like

Takes me a couple of refreshes on the PC. Zero luck on Android chrome.

Same here, either doesnt load or spins alot. Hass is on SSL but kodi is not.

Itā€™s a shame Kodi does not support https. I am unable to use this because:

ā€œIf you are accessing Home Assistant over HTTPS using SSL, you cannot access HTTP sites through an iframe panel.ā€

Here are the full set of shell commands I use in case anyone is interested. Note this is for the video player (id:1). For music (id:0) or picture (id:2) playback change the id.
I get error return codes of 52 in the log but it all appears to be working from the developer console, except ā€œskip forwardā€. No idea why.

Change your user, password and ip address.

kodi_input_back: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Back\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_contectx_menu: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.ContextMenu\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_down: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Down\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_execute: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.ExecuteAction\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_home: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Home\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_info: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Info\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_left: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Left\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_right: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Right\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_select: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Select\"}" "http://ipaddress:8080/jsonrpc"'
kodi_input_up: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Input.Up\"}" "http://ipaddress:8080/jsonrpc"'
kodi_player_fast_fwd: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"Player.SetSpeed\",\"params\":{\"playerid\":1,\"speed\":\"increment\"}}" "http://ipaddress:8080/jsonrpc"'
kodi_player_play_pause: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Player.PlayPause\",\"params\":{\"playerid\":1},\"id\":1}" "http://ipaddress:8080/jsonrpc"'
kodi_player_rewind: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"Player.SetSpeed\",\"params\":{\"playerid\":1,\"speed\":\"decrement\"}}" "http://ipaddress:8080/jsonrpc"'
kodi_player_skip_back: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Player.GoTo\",\"id\":1,\"params\":{\"playerid\":1,\"to\":\"previous\"}}" "http://ipaddress:8080/jsonrpc"'
kodi_player_skip_fwd: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Player.GoTo\",\"id\":1,\"params\":{\"playerid\":1,\"to\":\"next\"}}" "http://ipaddress:8080/jsonrpc"'
kodi_player_stop: 'curl -u "user:passwd" --header "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"Player.Stop\",\"params\":{\"playerid\":1},\"id\":1}" "http://ipaddress:8080/jsonrpc"'

EDIT, 4 years later: Donā€™t use these. It can all be done from the Kodi call_method now.

6 Likes

I would like to use more than one Kodi player with the WEB UI thrue iframe, but ik can only handley one instance:

panel_iframe:

  kodi:
title: 'Kodi@chillroom'
url: 'http://xxx.xxx.xxx.xx:8080/'
icon: mdi:kodi
  kodi:
title: 'Kodi@woonkamer'
url: 'http://xxx.xxx.xxx.xx:8080/'
icon: mdi:kodi

Log Details (ERROR)

Testing configuration at /config
ERROR:homeassistant.util.yaml:YAML file /config/configuration.yaml contains duplicate key ā€œkodiā€. Check lines 55 and 59.

Is there a workarround/solution for this matter?

Change the entity ids to something like,

kodi_chillroom:
  title: 'Kodi@chillroom'
  url: 'http://xxx.xxx.xxx.xx:8080/'
  icon: mdi:kodi

kodi_woonkamer:
  title: 'Kodi@woonkamer'
  url: 'http://xxx.xxx.xxx.xx:8080/'
  icon: mdi:kodi

That did the trick, thanks!

Hey, the same issue just came up.
Did you find a workaround to get the http kodi on the https hass.io?
Thanks in advance

Any chances for a lovelace card for this? Would be great

sharethelove.io

copy paste = profit