UI界面卡片分享:小米电视/盒子遥控器
需用到安装以下HACS插件:
xiaomi miot_auto
Universal Remote Card,遥控器卡片
Mini Media Player,适合预览电视画面
UI配置过程繁琐,以下直接给出卡片的xml配置的例子:
type: vertical-stack
cards:
- type: custom:mini-media-player
entity: media_player.xiaomi_mih1_3c98_play_control
artwork: full-cover
hide:
name: true
icon: true
info: true
power: true
source: true
sound_mode: true
controls: true
prev: true
next: true
play_pause: true
play_stop: true
jump: true
volume: true
volume_level: true
mute: true
progress: true
runtime: true
runtime_remaining: true
artwork_border: true
power_state: true
view_layout:
position: main
- type: custom:android-tv-card
rows:
- - power
- tv
- settings
- - game
- youtube
- cast
- bilibili
- jellyfin
- volume_buttons
- - dpad
- - back
- home
- menu
- - play
- play_pause
- pause
custom_actions:
- type: button
name: volume_down
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: volumedown
hold_action:
action: none
icon: mdi:volume-medium
- type: button
name: volume_mute
tap_action:
action: perform-action
perform_action: script.a65_2
target: {}
icon: mdi:volume-mute
hold_action:
action: none
- type: button
name: volume_up
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: volumeup
hold_action:
action: none
icon: mdi:volume-high
- type: button
name: left
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: left
hold_action:
action: none
icon: mdi:chevron-left
- type: button
name: right
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: right
hold_action:
action: none
icon: mdi:chevron-right
- type: button
name: up
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: up
hold_action:
action: none
icon: mdi:chevron-up
- type: button
name: down
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: down
hold_action:
action: none
icon: mdi:chevron-down
- type: button
name: back
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: back
icon: mdi:keyboard-backspace
- type: button
name: home
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: home
icon: mdi:home
- type: button
name: center
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: enter
icon: mdi:checkbox-blank-circle
- type: button
name: menu
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: menu
icon: mdi:menu
- type: button
name: youtube
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_app_current
data:
option: SmartTube - com.teamsmart.videomanager.tv
icon: mdi:youtube-tv
- type: button
name: power
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: power
icon: mdi:power
- type: button
name: game
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_app_current
data:
option: START云游戏 - com.tencent.start.tv
icon: mdi:controller
- type: button
name: tv
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_app_current
data:
option: 小苹果影视盒子 - com.phoenix.tv
icon: mdi:television-box
- type: button
name: bilibili
icon: my_bilibili
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_app_current
data:
option: BBLL - com.xx.blbl
- type: button
name: settings
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: settings
icon: mdi:cog
- type: button
name: play
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: play
icon: mdi:play
- type: button
name: pause
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: pause
icon: mdi:pause
- type: button
name: play_pause
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
data:
option: play_pause
icon: mdi:play-pause
- type: button
name: cast
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_app_current
data:
option: 无线投屏 - com.xiaomi.mitv.smartshare
icon: mdi:cast
- type: button
name: jellyfin
tap_action:
action: perform-action
perform_action: select.select_option
target:
entity_id: select.xiaomi_mih1_3c98_app_current
data:
option: Jellyfin - org.jellyfin.androidtv
icon: jellyfin
keyboard_id: media_player.xiaomi_mih1_3c98_play_control
media_player_id: media_player.xiaomi_mih1_3c98_play_control
custom_icons:
- name: my_bilibili
path: >-
M 21.744 7.284 C 22.412 8.008 22.72 8.872 22.676 9.912 V 18.008 C
22.66 19.064 22.308 19.932 21.616 20.612 C 20.928 21.292 20.052 21.648
18.996 21.68 H 5.88 C 4.824 21.648 3.952 21.288 3.268 20.592 C 2.588
19.896 2.232 18.98 2.2 17.848 V 9.912 C 2.232 8.872 2.588 8.008 3.268
7.284 C 3.952 6.632 4.824 6.272 5.88 6.24 H 7.056 L 6.044 5.208 C
5.812 4.98 5.696 4.688 5.696 4.336 C 5.696 3.984 5.812 3.692 6.044
3.464 C 6.272 3.236 6.564 3.12 6.916 3.12 C 7.268 3.12 7.56 3.236
7.792 3.464 L 10.724 6.24 H 14.244 L 17.224 3.464 C 17.468 3.236
17.768 3.12 18.12 3.12 C 18.472 3.12 18.764 3.236 18.996 3.464 C
19.224 3.692 19.34 3.984 19.34 4.336 C 19.34 4.688 19.224 4.98 18.996
5.208 L 17.984 6.24 L 19.156 6.24 C 20.212 6.272 21.076 6.632 21.744
7.284 H 21.744 z M 20.192 10.072 C 20.176 9.688 20.044 9.376 19.764
9.132 C 19.556 8.888 19.204 8.756 18.856 8.74 H 6.044 C 5.66 8.756
5.344 8.888 5.1 9.132 C 4.852 9.376 4.724 9.688 4.708 10.072 V 17.848
C 4.708 18.216 4.84 18.528 5.1 18.788 C 5.36 19.048 5.676 19.18 6.044
19.18 H 18.856 C 19.224 19.18 19.536 19.048 19.788 18.788 C 20.04
18.528 20.176 18.216 20.192 17.848 L 20.192 10.072 z M 9.62 11.78 C
9.872 12.032 10.008 12.344 10.024 12.708 V 14.04 C 10.008 14.408 9.876
14.716 9.632 14.968 C 9.384 15.22 9.072 15.348 8.688 15.348 C 8.304
15.348 7.988 15.22 7.744 14.968 C 7.5 14.716 7.368 14.408 7.352 14.04
V 12.708 C 7.368 12.344 7.504 12.032 7.756 11.78 C 8.008 11.528 8.284
11.396 8.688 11.38 C 9.056 11.396 9.368 11.528 9.62 11.78 H 9.62 z M
17.28 11.78 C 17.532 12.032 17.668 12.344 17.684 12.708 V 14.04 C
17.668 14.408 17.536 14.716 17.292 14.968 C 17.048 15.22 16.732 15.348
16.348 15.348 C 15.964 15.348 15.652 15.22 15.404 14.968 C 15.124
14.716 15.028 14.408 15.016 14.04 V 12.708 C 15.028 12.344 15.164
12.032 15.416 11.78 C 15.668 11.528 15.98 11.396 16.348 11.38 C 16.716
11.396 17.028 11.528 17.28 11.78 H 17.28 z
remote_id: remote.gao_jie_chi_tang_ling_zhu_de_xiao_mi_dian_shi_a65
其中静音按钮调用了一个脚本script.a65_2,xml配置如下:
alias: 小米电视静音
sequence:
- action: number.set_value
data:
value: "1"
target:
entity_id: number.xiaomi_mih1_3c98_volume
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 200
- action: select.select_option
metadata: {}
data:
option: volumedown
target:
entity_id: select.xiaomi_mih1_3c98_keycodes
mode: single
description: ""
icon: mdi:volume-mute
上述xml中,需要把以下实体替换为自己的小米电视/盒子的实体id:
media_player.xiaomi_mih1_3c98_play_control
select.xiaomi_mih1_3c98_keycodes
select.xiaomi_mih1_3c98_app_current
以下app可根据需要自行替换
1、xml中手搓了一个bilibili的svg图标,其按钮绑定了B站第三方播放器BBLL
2、游戏按钮绑定了start云游戏
2、油管按钮绑定了smartTube
|