usernein / tv-card

📺 TV Remote Card (with touchpad and haptic feedback)
Apache License 2.0
107 stars 26 forks source link

Scripts as custom_keys ? #21

Closed Rocologo closed 2 years ago

Rocologo commented 2 years ago

Is your feature request related to a problem? Please describe. I have an old Samsung TV and the STD remote commands does not work. Instead I use a Broadlink IR remote to send the correct commands and it work when I make ordinary button entities. To be able to use the Broadlink IR remote I have added a script for each button I need.

Either TV Card does not support scripts or I have made something wrong.

Describe the solution you'd like I would like to be able to use Scripts when sending custom keys.

Additional context Here is my current difinition. Is something wrong?

entity: media_player.samsung_tv
title: Samsung TV
power_row:
  - tv_power
  - tv_power_on
  - tv_power_off
channel_row:
  - channel_up
  - info
  - channel_down
apps_row:
  - netflix
  - youtube
  - spotify
volume_row: slider
navigation_row: touchpad
source_row:
  - return
  - home
  - source
media_control_row:
  - rewind
  - play
  - pause
  - fast_forward
custom_keys:
  tv_power_on:
    icon: mdi:power-on
    key: script.tv_power_on
  tv_power_off:
    icon: mdi:power-off
    key: script.tv_power_off
  tv_power:
    icon: mdi:power
    key: script.1592338242514
Rocologo commented 2 years ago

Ok I found out how to do it!

type: custom:tv-card
entity: media_player.samsung_tv
title: Samsung TV
power_row:
  - tv_power
channel_row:
  - channel_up
  - info
  - channel_down
apps_row:
  - netflix
  - youtube
  - spotify
volume_row: slider
navigation_row: touchpad
source_row:
  - return
  - home
  - source
media_control_row:
  - rewind
  - play
  - pause
  - fast_forward
custom_keys:
  tv_power_on:
    icon: mdi:power-on
    service: script.tv_power_on
  tv_power_off:
    icon: mdi:power-off
    service: script.tv_power_off
  tv_power:
    icon: mdi:power
    service: script.tv_power_toggle