Universal media player supports overwriting for several commands: turn on/off, volume up/down etc. But command: “play_media” is not supported. That do impossible to use any external devices (like IR blaster) to switch TV-channels natively.
Proposal
Add possibility to override the command “play_media” for Universal media player. It allows to switch TV-channels by external IR-device and may be usefull for other media types.
Example of use:
media_player:
platform: universal
name: Test Universal
children:
- media_player.living_room_tv
commands:
turn_on:
…
turn_off:
…
play_media:
service: script.set_channel
data:
channel_num: {{ media_content_id }}
media_type: {{ media_content_type }} # That’s needed to reject any other “media_content_type” inside script
…
script:
- alias: “Switch TV-channel”
fields:
channel_num:
media_type:
service: switch.turn_on
data_template:
entity_id:
{% if ((channel_num|int) == 1) %} switch.IR_send_1
{% elif ((channel_num|int) == 2) %} switch.IR_send_2
…