ollo69/ha-samsungtv-smart

Allow sending keys via the `remote` service

Closed this issue · 7 comments

Is your feature request related to a problem? Please describe.
Currently, sending keys to the TV invokes the media_player.playmedia service. Several custom cards assume that such commands will be via the remote.send_command service (as it is on the integrated samsung tv integration, and as is expected by e.g. https://github.com/Nerwyn/android-tv-card )

Describe the solution you'd like
Allow remote.send_command to be used to send keycodes, so that:

target:
  device_id: foo
data:
  command:
    - KEY_CODE

functions equivalently to

    data:
      entity_id: media_player.samsung_tv55
      media_content_id: KEY_CODE
      media_content_type: "send_key"

Describe alternatives you've considered
In all cases I've seen, manual configuration of the buttons which assume the use of the remote service is possible - it just adds an extra fiddly layer to getting something set up.

ollo69 commented

Support for remote entity associated to device is available in last release. Please let me know if it works properly.

rlust commented

So far I have not any luck with the remote. It is unavailable.

ollo69 commented

So far I have not any luck with the remote. It is unavailable.

Can you be more clear? Do you have some error log?

rlust commented

So far I have not any luck with the remote. It is unavailable.

Can you be more clear? Do you have some error log?

Here is the error log when requesting remote to turn on:

This error originated from a custom integration.

Logger: custom_components.samsungtv_smart.media_player
Source: custom_components/samsungtv_smart/media_player.py:729
Integration: SamsungTV Smart (documentation, issues)
First occurred: November 3, 2023 at 7:29:49 PM (85 occurrences)
Last logged: 11:18:22 AM

media_player.bedroom_tv_samsungtv_smart - Error refreshing from SmartThings. Check connection status with TV on the phone App. Error: 500, message='Internal Server Error', url=URL('https://api.smartthings.com/v1/devices/4015a6e1-9dd6-4d39-b072-bd725a39ec2b/commands')
media_player.main_tv_samsungtv_smart - Error refreshing from SmartThings. Check connection status with TV on the phone App. Error: 500, message='Internal Server Error', url=URL('https://api.smartthings.com/v1/devices/0d4786b4-c6f1-4af3-816b-6047146116c8/commands')

ollo69 commented

This error is just saying that your connection to SmartThings is not working, not that remote is not available.

I've tried implementing a tv-remote-card on my HA dashboard using https://github.com/Nerwyn/android-tv-card.
It worked perfectly (using custom_keys, icons etc).
Here my custom card configuration, hope it can help:

type: custom:android-tv-card
media_player_id: media_player.samsung_tv_75_salotto_ci
custom_icons:
dazn: >-
m14.774 8.291.772-2.596.79 2.596zm3.848
2.268-2.025-6.128c-.045-.135-.097-.224-.154-.266a.497.497 0 0
0-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045
6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0
.139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0
.077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327
1.051c.026.09.051.16.077.213a.395.395 0 0 0
.087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0
.27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0
0-.036-.108l.003.006zm-.994 2.467h-.646c-.168
0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167
0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0
.148.025.246.077.294.052.048.16.072.328.072h.656c.167 0
.278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91
3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0
.278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581
1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504
9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24
0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67
18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0
.019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149
0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0
.172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0
0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0
.245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408
8.233c0 .264-.017.484-.052.661a1.08 1.08 0 0 1-.174.43.648.648 0 0
1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0
.63.11.79.324.16.215.241.571.241
1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167
0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0
.148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447
2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0
.054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z
custom_keys:
'0':
icon: mdi:numeric-0
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_0
'1':
icon: mdi:numeric-1
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_1
'2':
icon: mdi:numeric-2
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_2
'3':
icon: mdi:numeric-3
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_3
'4':
icon: mdi:numeric-4
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_4
'5':
icon: mdi:numeric-5
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_5
'6':
icon: mdi:numeric-6
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_6
'7':
icon: mdi:numeric-7
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_7
'8':
icon: mdi:numeric-8
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_8
'9':
icon: mdi:numeric-9
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_9
up:
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_UP
down:
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_DOWN
left:
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_LEFT
right:
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_RIGHT
center:
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_ENTER
power:
icon: mdi:power
service: media_player.toggle
target:
entity_id: media_player.samsung_tv_75_salotto_ci
home:
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_HOME
back:
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_RETURN
volume_mute:
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_MUTE
ch_up:
icon: mdi:arrow-up-bold
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_CHUP
ch_down:
icon: mdi:arrow-down-bold
service: media_player.play_media
data:
entity_id: media_player.samsung_tv_75_salotto_ci
media_content_type: send_key
media_content_id: KEY_CHDOWN
DAZN:
icon: dazn
service: media_player.select_source
data:
entity_id: media_player.samsung_tv_75_salotto_ci
source: DAZN
netflix:
icon: mdi:netflix
service: media_player.select_source
data:
entity_id: media_player.samsung_tv_75_salotto_ci
source: Netflix
youtube:
icon: mdi:youtube
service: media_player.select_source
data:
entity_id: media_player.samsung_tv_75_salotto_ci
source: YouTube
light_off:
icon: mdi:lightbulb-group-off
service: light.turn_off
target:
entity_id: light.all_lights
light_on:
icon: mdi:lightbulb
service: light.turn_on
target:
entity_id: light.soggiorno
rows:

    • power
    • null
    • volume_mute
    • null
    • light_on
    • light_off
    • volume_slider
    • null
    • ch_up
    • ch_down
    • null
    • netflix
    • youtube
    • DAZN
    • primevideo
    • spotify
    • navigation_touchpad
    • back
    • home
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 0

Close this as remote entity is implemented. Open new issue if you have problem with this.