Kodi Remote

Awesome, thanks a ton! This has some things in it I’ve never seen before so this is a great way to learn.

I’ve got 1 of my 3 kodi’s all set up now and it works great. Now to do the other 2. I’m thinking there should be a way to use the same script but change the entity id based on the card that’s pulling it. For now I’ll just do some find/replace and have more code in the files.

Thanks again!

1 Like

What does your config look like for Kodi? I have a similar set up.

thankyou for sharing this, works perfectly and just what I was after!

quick question on those 2 mdi icons, is this reliant on a new Hassio release to incorporate these icons? Thanks again for sharing this remote! Very cool

They are not available in 0.88.2 (the version I’m currently running) so I downloaded them and am using them from local storage (www folder).

1 Like

Thanks Tom!

Thank you for sharing, this is something I wanted to do !!!

Thanks. Did the same but with custom button card
image

      - type: vertical-stack
        cards:
          - type: 'custom:button-card'
            color_type: label-card
            template: remote_button_round
            color: rgba(150, 150, 150, 0.1)
            name: Kodi Remote
          - type: horizontal-stack
            cards:
              - type: 'custom:button-card'
                name: Menu
                size: 30%
                show_name: true
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ContextMenu
                    entity_id: media_player.kodi
                template: remote_button_round
                icon: 'mdi:menu'
              - type: 'custom:button-card'
                template: remote_button_round
                hold_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Up
                    entity_id: media_player.kodi
                  repeat: 100
                icon: 'mdi:arrow-up-bold-circle'
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Up
                    entity_id: media_player.kodi
              - icon: 'mdi:chevron-double-up'
                type: 'custom:button-card'
                template: remote_button_round
                hold_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ExecuteAction
                    entity_id: media_player.kodi
                    action: pageup
                  repeat: 100
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ExecuteAction
                    entity_id: media_player.kodi
                    action: pageup
          - type: horizontal-stack
            cards:
              - icon: 'mdi:arrow-left-bold-circle'
                type: 'custom:button-card'
                template: remote_button_round
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Left
                    entity_id: media_player.kodi
              - icon: 'mdi:check-circle-outline'
                type: 'custom:button-card'
                template: remote_button_round
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Select
                    entity_id: media_player.kodi
              - icon: 'mdi:arrow-right-bold-circle'
                type: 'custom:button-card'
                template: remote_button_round
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Right
                    entity_id: media_player.kodi
          - type: horizontal-stack
            cards:
              - icon: 'mdi:backburger'
                type: 'custom:button-card'
                template: remote_button_round
                show_name: true
                name: Return
                size: 30%
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Back
                    entity_id: media_player.kodi
              - icon: 'mdi:arrow-down-bold-circle'
                type: 'custom:button-card'
                template: remote_button_round
                hold_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Down
                    entity_id: media_player.kodi
                  repeat: 100
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Down
                    entity_id: media_player.kodi
              - icon: 'mdi:chevron-double-down'
                type: 'custom:button-card'
                template: remote_button_round
                hold_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ExecuteAction
                    entity_id: media_player.kodi
                    action: pagedown
                  repeat: 100
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ExecuteAction
                    entity_id: media_player.kodi
                    action: pagedown
          - type: horizontal-stack
            cards:
              - icon: 'mdi:chevron-double-left'
                type: 'custom:button-card'
                template: remote_button_round
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ExecuteAction
                    entity_id: media_player.kodi
                    action: stepback
              - icon: 'mdi:pause'
                type: 'custom:button-card'
                template: remote_button_round
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ExecuteAction
                    action: playpause
                    entity_id: media_player.kodi
              - icon: 'mdi:chevron-double-right'
                type: 'custom:button-card'
                template: remote_button_round
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ExecuteAction
                    action: stepforward
                    entity_id: media_player.kodi
          - type: horizontal-stack
            cards:
              - icon: 'mdi:home'
                type: 'custom:button-card'
                template: remote_button_round
                name: Home
                size: 30%
                show_name: true
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Home
                    entity_id: media_player.kodi
              - icon: 'mdi:stop'
                type: 'custom:button-card'
                template: remote_button_round
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.ExecuteAction
                    entity_id: media_player.kodi
                    action: stop
              - icon: 'mdi:information-outline'
                type: 'custom:button-card'
                template: remote_button_round
                name: Info
                size: 30%
                show_name: true
                tap_action:
                  service: media_player.kodi_call_method
                  action: call-service
                  service_data:
                    method: Input.Info
                    entity_id: media_player.kodi
9 Likes

just doing some reading

read your post had a brain fart

what about have a input_select

  kodi_machine:
    name: "Select Kodi Box"
    options:
      - kodi_main
    initial: kodi_main
    icon: mdi:kodi  

then couldnt you use the data_template

kodi_left:
  alias: "Kodi Left"
  sequence:
    data_template:
      entity_id: media_player.{{ states.input_select.kodi_machine.state}}
      method: Input.Left
    service: media_player.kodi_call_method    
media_player.kodi_call_method

Does this need replacing with the local service name? Or is this a custom service?

I’ve copied your scripts & lovelace code but not getting any response on Kodi.

I’m getting this in the log:

homeassistant.exceptions.ServiceNotFound: Unable to find service media_player/kodi_call_method
2019-09-07 23:28:35 ERROR (MainThread) [homeassistant.components.script] Error executing script script.kr_home. Service not found for call_service at pos 1: Unable to find service media_player/kodi_call_method
2019-09-07 23:28:35 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall script.kr_home (c:71fb774cf04f49d2ab7b9d4978533daf)>
Traceback (most recent call last):

Thanks.

The way you call kodi methods was changed in the recent HA update. Documented in the release notes

The only info I can find in the integrations docs is limited and doesn’t appear to actually give an example of using the call method. It just mentions it but then doesn’t give any obvious details.

Could you possibly share some code samples?

Thanks.

  • Kodi - Kodi services are now their own domain and the media_player.kodi_* services are now kodi.* - (@JeffLIrion - #25753 ) (kodi docs )
    • media_player.kodi_add_to_playlist is now kodi.add_to_playlist
    • media_player.kodi_call_method is now kodi.call_method

Error in subtitle script:

bedroom_rpi3_kodi_input_next_subtitle:
  sequence:
    - service: kodi.call_method
      data:
        entity_id: media_player.bedroom_rpi3_kodi
        method: Player.SetSubtitle
        playerid: 1
        subtitle: "next"
        enable: true

ERROR:

Run API method media_player.bedroom_rpi3_kodi.Player.SetSubtitle({'playerid': 1, 'subtitle': 'next', 'enable': True}) error: {'code': -32602, 'message': 'Invalid params.'}

Storitve ni bilo mogoče poklicati script/bedroom_rpi3_kodi_player_stop. Service not found

.

Yeah this PR https://github.com/home-assistant/home-assistant/pull/25753 seems to have broken a number of services that used to work. I haven’t had a chance to check why and submit an issue yet.

Can anybody provide some insight on how to integrate this? I’m not quite sure what’s needed to do this. Also, has a recent update broke this? Many thanks.

Hi guys. I am in doubt here. I’m in process of making Kodi Remote with code from @slipx06 post above. The code is working in HA lovelace, but it wont work from Tasker via HA plugin. Long story short, let’s focus on one button, for better overview - below is code for only one button from @slipx06 post:

      - hold_action:
          action: call-service
          repeat: 100
          service: kodi.call_method
          service_data:
            action: pageup
            entity_id: media_player.kodi
            method: Input.ExecuteAction
        icon: 'mdi:chevron-double-up'
        tap_action:
          action: call-service
          service: kodi.call_method
          service_data:
            action: pageup
            entity_id: media_player.kodi
            method: Input.ExecuteAction
        template: remote_button_round

and this is working perfect.

I created task in Tasker with only one action:

Plugin > Home Assistant > Call Service
Service: kodi.call_method
JSON data: { "entity_id": "media_player.kodi", "method": "Input.ExecuteAction", "action": "pageup" }

And this is not working. If I click on TEST SERVICE inside Tasker, I got “Success” toast notification, but nothing happens on Kodi screen. Also, in HA log, I have following (I was also try with Kodi Method “Input.Up”):

2020-03-19 11:35:37 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 11:39:42 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:28:32 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:28:47 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:29:04 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:32:21 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:35:29 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:36:41 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:38:09 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:39:28 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:44:08 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.ExecuteAction({'action': 'pageup'}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:45:15 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.Up({}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:45:18 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.Up({}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:45:41 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.Up({}) error: {'code': -32601, 'message': 'Method not found.'}
2020-03-19 12:45:44 ERROR (MainThread) [homeassistant.components.kodi.media_player] Run API method media_player.kodi. Input.Up({}) error: {'code': -32601, 'message': 'Method not found.'}

I cannot understand why it says ‘Method not found’ if I run action from Tasker via Home Assistant, cause same that method is working from lovelace in Home Assistant?

Any clue?

Thanks.

Hey,

Just thought I would post what the script is with the changes for future readers. Basically just changing kodi_call_method to kodi.call_method.

Cheers

  lounge_kodi_input_back:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.Back

  lounge_kodi_input_contectx_menu:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.ContextMenu

  lounge_kodi_input_down:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.Down

  lounge_kodi_input_next_subtitle:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Player.SetSubtitle
          playerid: 1
          subtitle: "next"
          enable: true

  lounge_kodi_input_home:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.Home

  lounge_kodi_input_info:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.Info

  lounge_kodi_input_left:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.Left

  lounge_kodi_input_right:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.Right

  lounge_kodi_input_select:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.Select

  lounge_kodi_input_up:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Input.Up

  lounge_kodi_player_fast_fwd:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Player.SetSpeed
          playerid: 1
          speed: "increment"

  lounge_kodi_player_play_pause:
    sequence:
      - service: media_player.media_play_pause
        data:
          entity_id: media_player.kodi

  lounge_kodi_player_rewind:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Player.SetSpeed
          playerid: 1
          speed: "decrement"

  lounge_kodi_player_skip_back:
    sequence:
      - service: media_player.media_previous_track
        data:
          entity_id: media_player.kodi

  lounge_kodi_player_skip_back_10:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Player.Seek
          playerid: 1
          value: "smallbackward"

  lounge_kodi_player_skip_back_30:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Player.Seek
          playerid: 1
          value: "bigbackward"

  lounge_kodi_player_skip_fwd:
    sequence:
      - service: media_player.media_next_track
        data:
          entity_id: media_player.kodi

  lounge_kodi_player_skip_fwd_10:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Player.Seek
          playerid: 1
          value: "smallforward"

  lounge_kodi_player_skip_fwd_30:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: Player.Seek
          playerid: 1
          value: "bigforward"

  lounge_kodi_player_stop:
    sequence:
      - service: media_player.media_stop
        data:
          entity_id: media_player.kodi

  lounge_update_kodi_library:
    sequence:
      - service: kodi.call_method
        data:
          entity_id: media_player.kodi
          method: VideoLibrary.Scan


You should know that I have only one kodi integration which doesnt have a custom name. I think if your Kodi integration was called something like “kodi_lounge” you would have to change the entity_id to reflect this, in this case i think it would be media_player.kodi_lounge

Nice work.
I was wondering if there is any way to:
-turn screensaver on/off (useful for music channels)
-display channel name
-view list of channels
?

Has anyone here figured out how to pass keyboard keys to Kodi? I’m trying to pass some of the keyboard shortcuts to it like ‘w’ via the Input.SendText method like below but every which way I’ve tried Kodi spits back a missing / invalid params error.

Run API method media_player.kodi_guest_bedroom_1.Input.SendText({'params': {'text': 'w', 'done': True}}) error: {'code': -32602, 'data': {'method': 'Input.SendText', 'stack': {'message': 'Missing parameter', 'name': 'text', 'type': 'string'}}, 'message': 'Invalid params.'}
kodi_toggle_watched:
  alias: Kodi Toggle Watched
  sequence:
  - service: kodi.call_method
    data_template:
      entity_id: >-
        {% if is_state('input_select.kodi_remote_select_dw', "Media Room") %}
          media_player.kodi_media_center_pc
        {% elif is_state('input_select.kodi_remote_select_dw', "Bedroom") %}
          media_player.kodi_bedroom_pc
        {% elif is_state('input_select.kodi_remote_select_dw', "Guest Room 1") %}
          media_player.kodi_guest_bedroom_1
        {% elif is_state('input_select.kodi_remote_select_dw', "Guest Room 2") %}
          media_player.kodi_guest_bedroom_2
        {% endif %}
      method: Input.SendText
      params:
        text: w
        done: true