Nerwyn / android-tv-card

A completely customizable universal remote card for Home Assistant. Supports multiple platforms out of the box.
Apache License 2.0
254 stars 13 forks source link

Unable to trigger skip_forward or skip_backward as described #66

Closed leedomike closed 9 months ago

leedomike commented 9 months ago

Setting up a remote, most functions work as described. Attempting to set up the skip_backward and skip_forward functions to go back.forward 10 seconds, seems to not be functioning with chromecast.

custom_actions: skip-backward: icon: mdi:rewind-10 tap_action: action: key key: skip_backward skip-forward: icon: mdi:fast-forward-10 action: key key: skip_forward

Error: Failed to call service remote.send_command. Enum RemoteKeyCode has no value defined for name 'KEYCODE_skip_backward'

Nerwyn commented 9 months ago

The skip backwards/forwards commands are from the Apple TV integration example and are not valid for Android TV. Android TV does not have separate skip backwards/forwards commands. You can sort of skip by adding hold_secs to the service call data to a fast forward or rewind command.

custom_actions:
  skip_forward:
    tap_action:
      action: call-service
      service: remote.send_command
      data:
        entity_id: remote.android_tv
        command: fast_forward
        hold_secs: 2

You can also now use momentary button mode to make the skip time scale with how long you've held the button.

custom_actions:
  fast_forward:
    momentary_end_action:
      action: call-service
      service: remote.send_command
      data:
        entity_id: remote.google_tv
        command: MEDIA_FAST_FORWARD
        hold_secs: HOLD_SECS
leedomike commented 9 months ago

Thanks for the info on the skip buttons.

I'm trying your workaround but I can't seem to figure it out. I broke it down into a one button remote to make it simpler.

type: custom:android-tv-card
remote_id: remote.living_room_tv_2
slider_id: media_player.living_room_tv_2
rows:
  - - skip-forward
custom_actions:
  skip-forward:
    icon: mdi:fast-forward-10
    momentary_end_action:
      action: call-service
      service: remote.send_command
      data:
        entity_id: remote.living_room_tv_2
        command: fast_forward
        hold_secs: 2

Thanks for the help!

Nerwyn commented 9 months ago

If you're not going to use HOLD_SECS for the value of hold_secs or momentary_start_action you should change momentary_end_action to tap_action. That way it'll trigger on a regular tap rather than release.

leedomike commented 9 months ago

I see, I misunderstood it as a place holder for the amount of time I want it held. I think I have the code right now, but still having major problems.