My TV supports Android TV. But there is no way to switch it on with Android TV, so I use wake_on_lan instead.
Now I need to create one device to support ‘turn_on’, ‘turn_off’, 'volume_up` etc.
I have the following code currently:
# https://www.home-assistant.io/integrations/wake_on_lan
wake_on_lan:
switch:
- platform: wake_on_lan
mac: 'd8:12:34:56:78:90' # TV
media_player:
- platform: universal
name: 'TV test'
children:
- media_player.android_tv_192_168_1_64 # https://www.home-assistant.io/integrations/androidtv/
commands:
turn_on:
service: switch.turn_on
data: {}
target:
entity_id: switch.wake_on_lan
volume_up:
service: media_player.volume_up
target:
entity_id: media_player.android_tv_192_168_1_64
volume_down:
service: media_player.volume_down
target:
entity_id: media_player.android_tv_192_168_1_64
volume_mute:
service: androidtv.adb_command
target:
entity_id: media_player.android_tv_192_168_1_64
data:
command: 'MUTE'
device_class: tv
unique_id: 'tv_test'
There are two problems:
- I have to repeat all android tv functions in this config manually;
- not all android tv functions are listed on the docs, I am trying to find them at source code - https://github.com/home-assistant/core/blob/838691f22f27852a05313809cdf9c51094ad3798/homeassistant/components/androidtv/media_player.py;
- volume up/volume down works well from android tv integration, with my universal player it doesn’t work sometimes.
Is there any better solution to achieve what I want?