Android TV HDMI

I am trying to change the HDMI input on my android TV

Most of of the key commands work except the ones for HDMI, which is quite important to me.

It doesn’t work from sending an HDMI command is it is possible to do it from the “select source” component?

1 Like

What type of tv and what command are you currently trying? The built-in “HDMI1, HDMI2” ?

It’s a Philips 70PUS9005/12. 2020 Model.

Yes HDMI1, HDMI2 ect. There is no dedicated HDMI button so i have to scroll through a menu each time.

I’m sure Android would be able to do it, because I can switch to any HDMI connection using the TVs Google assistant.

You might be able to modify (in the androidtv component) to contain the command you need, but I don’t know enough about it/python programming to know if having a non-numerical value in one of those would affect anything…

What about

  service: androidtv.adb_command
    entity_id: media_player.androidtv_tv_living_room
    command: "KEY_HDMI1"

I believe the component is simply using KEY_HDMI1, KEY_HDMI2, etc for the associated HDMI1, HDMI2…


        "HDMI1": KEY_HDMI1,
        "HDMI2": KEY_HDMI2,
        "HDMI3": KEY_HDMI3,
        "HDMI4": KEY_HDMI4,

which then goes to…

KEY_HDMI1 = 243
KEY_HDMI2 = 244
KEY_HDMI3 = 245
KEY_HDMI4 = 246

the regular key_event

Yes the docs here refer to a list of keys here

These are the ones that aren’t working sadly.

Things like up down home and power work ok

I have tried:

command: “KEY_HDMI1”
command: “HDMI1”
command: “input keyevent KEYCODE_F1”
command: “KEYCODE_TV_INPUT_HDMI_1” (From android developers page)

Could this be because i am using the python method rather than an ADB server?

Thank you all for your help so far

Edit: could any of these be possible workarounds?

An App installed on the TV that I could send intents too?

Sending a search query to Google Assistant for example “search… HDMI 1”

Is the a way to listen to what actions Google assistant is carrying out when I do a voice search for HDMI1?

Python ADB vs. ADB server won’t make a difference.

Look at the ADB key event codes on this page:

Call the androidtv.adb_command service with a command of the form input keyevent x, where x is an integer from that page. Try anything that looks like it might be relevant.

You can also try this:

I have tried input key event with no luck, keyevents for up down back ect work, but not for HDMI :frowning:

I Also can’t see the option for learn send even in the developer options :frowning:

What version of HA are you running? Also, any chance you loaded a custom component for android tv and it’s using that instead of the current version?

I updated HA Core and i now have learn send event, but the behaviour is exactly the same as before.

Learn send event only captures the button press on the remote, not the action that happened. There are no dedicated HDMI Buttons on the remote.

What’s even more annoying is that i cant even setup a sequence of button presses, because the last used HDMI Device goes to the top of the sources list, so the list of HDMI devices is in a different order each time.

I tried a USB keyboard, and pressed all the Function keys and none of them worked, it’s looked like the function keys have been locked out on the TV.

The only way i can get it to go directly to an HDMI Input is with a Google Voice command.

Is there a way to directly send a voice command?

Or better, get a log of what actions it’s performing when I do a voice command?

Have you tried this? Android TV HDMI

I have tired those, and the the input keyevents from the android developers page

Right so what does the log say? Have you turned logging up to max?

The HA log? Nothing appears there, i will set it to max and try again.

But if i misstype it i get an error in the log

??? have you?


I can’t see a way to see set that too max

Sorry you need here :slight_smile:

debug should get (way) more info.

Ok, so i ran two commands from Androidtv.adb in dev tools

The 1st was “VOLUME_DOWN” which worked

The 2nd was “HDMI1” which didn’t work

Both look like they sent correctly? These are the entries in the log

Volume Down

2020-10-12 10:01:39 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.140224019611120] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "media_player.android_tv_1", "old_state": {"entity_id": "media_player.android_tv_1", "state": "idle", "attributes": {"source_list": ["STREAM_NOTIFICATION:", "", "org.droidtv.upnp", "", "dialserver", "", "org.droidtv.ambihue", "ord.droidtv.eum", "org.droidtv.nettvregistration", "", "com.ndcsolution.androidtv.leankeykeyboard", "", "", "", "", "", "org.droidtv.userlogger", "org.droidtv.ambiair", "org.droidtv.ambihue.common", "org.droidtv.philipstvdrawer", "Netflix", "Google Cast", "org.droidtv.amazonalexa", "org.droidtv.eum.demome", "", "org.droidtv.nettvapps", "org.droidtv.eum.sticker", "", "", "", "", "", "", "", "YouTube", "com.disney.disneyplus", "", "", "", ""], "volume_level": 0.0, "is_volume_muted": false, "app_id": "org.droidtv.playtv", "app_name": "org.droidtv.playtv", "source": "org.droidtv.playtv", "adb_response": null, "friendly_name": "Android TV 1", "entity_picture": "/api/media_player_proxy/media_player.android_tv_1?token=cc03c8815a8bc40eec724d517aa367c9c71845421a3f2c95266dab9469f21268&cache=1602493289.926554", "supported_features": 23997}, "last_changed": "2020-10-12T08:57:29.980407+00:00", "last_updated": "2020-10-12T09:01:29.926626+00:00", "context": {"id": "8483dddb0c6911ebbdad174cb0d60a2f", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "media_player.android_tv_1", "state": "idle", "attributes": {"source_list": ["STREAM_NOTIFICATION:", "", "org.droidtv.upnp", "", "dialserver", "", "org.droidtv.ambihue", "ord.droidtv.eum", "org.droidtv.nettvregistration", "", "com.ndcsolution.androidtv.leankeykeyboard", "", "", "", "", "", "org.droidtv.userlogger", "org.droidtv.ambiair", "org.droidtv.ambihue.common", "org.droidtv.philipstvdrawer", "Netflix", "Google Cast", "org.droidtv.amazonalexa", "org.droidtv.eum.demome", "", "org.droidtv.nettvapps", "org.droidtv.eum.sticker", "", "", "", "", "", "", "", "YouTube", "com.disney.disneyplus", "", "", "", ""], "volume_level": 0.0, "is_volume_muted": false, "app_id": "org.droidtv.playtv", "app_name": "org.droidtv.playtv", "source": "org.droidtv.playtv", "adb_response": null, "friendly_name": "Android TV 1", "entity_picture": "/api/media_player_proxy/media_player.android_tv_1?token=cc03c8815a8bc40eec724d517aa367c9c71845421a3f2c95266dab9469f21268&cache=1602493299.941363", "supported_features": 23997}, "last_changed": "2020-10-12T08:57:29.980407+00:00", "last_updated": "2020-10-12T09:01:39.941457+00:00", "context": {"id": "8a7c01e20c6911eb95801bccd4aa3f28", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2020-10-12T09:01:39.941481+00:00", "context": {"id": "8a7c01e20c6911eb95801bccd4aa3f28", "parent_id": null, "user_id": null}}}


2020-10-12 10:01:39 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.140224058484816] Sending {"id": 12, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "media_player.android_tv_1", "old_state": {"entity_id": "media_player.android_tv_1", "state": "idle", "attributes": {"source_list": ["STREAM_NOTIFICATION:", "", "org.droidtv.upnp", "", "dialserver", "", "org.droidtv.ambihue", "ord.droidtv.eum", "org.droidtv.nettvregistration", "", "com.ndcsolution.androidtv.leankeykeyboard", "", "", "", "", "", "org.droidtv.userlogger", "org.droidtv.ambiair", "org.droidtv.ambihue.common", "org.droidtv.philipstvdrawer", "Netflix", "Google Cast", "org.droidtv.amazonalexa", "org.droidtv.eum.demome", "", "org.droidtv.nettvapps", "org.droidtv.eum.sticker", "", "", "", "", "", "", "", "YouTube", "com.disney.disneyplus", "", "", "", ""], "volume_level": 0.0, "is_volume_muted": false, "app_id": "org.droidtv.playtv", "app_name": "org.droidtv.playtv", "source": "org.droidtv.playtv", "adb_response": null, "friendly_name": "Android TV 1", "entity_picture": "/api/media_player_proxy/media_player.android_tv_1?token=cc03c8815a8bc40eec724d517aa367c9c71845421a3f2c95266dab9469f21268&cache=1602493289.926554", "supported_features": 23997}, "last_changed": "2020-10-12T08:57:29.980407+00:00", "last_updated": "2020-10-12T09:01:29.926626+00:00", "context": {"id": "8483dddb0c6911ebbdad174cb0d60a2f", "parent_id": null, "user_id": null}}, "new_state": {"entity_id": "media_player.android_tv_1", "state": "idle", "attributes": {"source_list": ["STREAM_NOTIFICATION:", "", "org.droidtv.upnp", "", "dialserver", "", "org.droidtv.ambihue", "ord.droidtv.eum", "org.droidtv.nettvregistration", "", "com.ndcsolution.androidtv.leankeykeyboard", "", "", "", "", "", "org.droidtv.userlogger", "org.droidtv.ambiair", "org.droidtv.ambihue.common", "org.droidtv.philipstvdrawer", "Netflix", "Google Cast", "org.droidtv.amazonalexa", "org.droidtv.eum.demome", "", "org.droidtv.nettvapps", "org.droidtv.eum.sticker", "", "", "", "", "", "", "", "YouTube", "com.disney.disneyplus", "", "", "", ""], "volume_level": 0.0, "is_volume_muted": false, "app_id": "org.droidtv.playtv", "app_name": "org.droidtv.playtv", "source": "org.droidtv.playtv", "adb_response": null, "friendly_name": "Android TV 1", "entity_picture": "/api/media_player_proxy/media_player.android_tv_1?token=cc03c8815a8bc40eec724d517aa367c9c71845421a3f2c95266dab9469f21268&cache=1602493299.941363", "supported_features": 23997}, "last_changed": "2020-10-12T08:57:29.980407+00:00", "last_updated": "2020-10-12T09:01:39.941457+00:00", "context": {"id": "8a7c01e20c6911eb95801bccd4aa3f28", "parent_id": null, "user_id": null}}}, "origin": "LOCAL", "time_fired": "2020-10-12T09:01:39.941481+00:00", "context": {"id": "8a7c01e20c6911eb95801bccd4aa3f28", "parent_id": null, "user_id": null}}}