Android TV HDMI

Do I understand you right, Is it not possible to change HDMI input source on a Android /Google TV ?

If i want to change the HDMI input, do I need to buy a Nvidia Shield like this one

No, there are many examples above demonstrating how to change HDMI input. It will differ depending on your specific TV brand and model, but here’s an example HA Automation action that will switch input on a Hisense U8K…

service: androidtv.adb_command
data:
  command: >-
    am start -a android.intent.action.VIEW -d
    content://android.media.tv/passthrough/com.vt.source.external%2F.hdmi.HdmiTvInputService%2FHW2
target:
  entity_id: media_player.hisense_85u8k

You’ll need to have ADB enabled on your TV and connected to the Android Debug Bridge integration in HA.

Here a Haier K-7 series Androd TV. When I press the Antenna input source, for example, I can see this log:

MtkTvInput(AbstractTvInputServiceBase)(Tuner)(CustomerTuner): broadcastIntent current inputsource to tv.samba.ssm

And for the HDMI input:

MtkTvInput(AbstractTvInputServiceBase)(Hdmi): broadcastIntent current inputsource to tv.samba.ssm

How can I adapt your intent.action to this type of broadcastIntent?

I have bought a Chromecast with Google TV, to control my Hisence 100U7KQ TV and I would like to be able to change the HDMI input on the TV.
I have the Android Debug Bridge and the Cgromecast addon up and running,
I can turn the tv on/off, change to an app, change the volume. But I don’t know what command to send to change the input HDMI on the TV.

I have tried with this code, and replace the code with the others but nothing works.

Is the code specific to the TV it is installed in?

service: androidtv.adb_command
data:
  command: >-
    am start -a android.intent.action.VIEW -d
    content://android.media.tv/passthrough/com.vt.source.external%2F.hdmi.HdmiTvInputService%2FHW2
target:
  entity_id: media_player.android_tv_192_168_1_171
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.droidlogic.tvinput%2F.services.ArcInputService%2FHW18


adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.tcl.tvinput%2F.TDTVInputService%2FHW1413742848



adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.hisense.tv.hitvinput%2F.hdmi.HdmiTvInputService%2FHW4


adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.vt.source.external%2F.hdmi.HdmiTvInputService%2FHW2


am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.vt.source.external%2F.hdmi.HdmiTvInputService%2FHW2

Working intents for switching HDMI inputs on 2023 Philips TVs (tested on OLED818):

HDMI1:

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tis%2F.HdmiInputService%2FHW2 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI2:

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tis%2F.HdmiInputService%2FHW3 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI3:

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tis%2F.HdmiInputService%2FHW4 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000

HDMI4:

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tis%2F.HdmiInputService%2FHW5 -n org.droidtv.playtv/.PlayTvActivity -f 0x10000000
2 Likes

Thank you so much. This works exactly as intended with my Xiaomi Mi TV Q1 75. They have the same main board as I learned when was disassembling it. Do you maybe, by chance, know an ADB command for Power ON? The TV goes into a DEEP sleep over time, and I still have not found a way to wake it and turn it on through ADB.

P.S. Once again - thank you so much.

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.droidlogic.tvinput%2F.services.Hdmi1InputService%2FHW5

That is the command, which changes input to my HDMI2 on a TV.

Glad you found it helpful!

I have a similar issue with waking the TV. There was a time when Home Assistant could turn it on from sleep as long as “Networked Standby” was available. At some point, that stopped working. I’ve attempted to mess with Developer Options (keep awake while power is connected), but nothing has been successful yet. Come to think of it, at one point I transitioned from WiFi to ethernet and I wonder if that may have something to do with it.

If you learn how to power it on or prevent deep sleep, please circle back here. I’d like to know the same!

I had the same issue with my XGimi Aura projector. It got sorted when I’ve got Sonos Arc plugged into it - now I can just say “Alexa, turn on TV”, and it turns on the projector via Sonos - HDMI. I didn’t have any use for HA turning it on automatically, but I guess it should be simple enough to send out Alexa command from HA (by turning on/off virtual switch exposed to Alexa). If you prefer local solution, I’d recommend getting one of those zigbee IR controls (https://www.aliexpress.com/item/1005005828181705.html) and sent “power button” command via that. I know both is more of a workaround to the non-working ADB, but it gets it done…

For my Hisense 75U7H the response from @lk229 worked fine, now I want to know if there is a way to change to AV input?

Thanks for this, also how do use this as trigger?
I need to turn on my tivo 4k stick when hdmi 3 is selected

TCL 98P74 LCD

HDMI 1:

service: androidtv.adb_command
data:
  command: >-
    adb shell am start -a android.intent.action.VIEW -d
    content://android.media.tv/passthrough/com.tcl.tvinput%2F.TvPassThroughService%2FHW15
target:
  entity_id: media_player.android_tv
1 Like

hi. Thank you for sharing, Works great on my 848 as well.

This one changed my tcl c635 to tv program. So how do i find out the code to use for HDMI1 and HDMI2? thanks

Manage to find out myself. Post it here for those use TCL 43C635 TV
HDMI 1
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.tcl.tvinput%2F.passthrough.TvPassThroughService%2FHW1413744128

HDMI 2
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.tcl.tvinput%2F.passthrough.TvPassThroughService%2FHW1413744384

I’m struggling with this. I have the TCL C805 and the codes I’ve tried here only allow me to switch to HDMI1 (this is despite changing the HW reference at the end of the command for the other HDMI inputs).

Does anyone have a solution for TCL C805 on how to change source to HDMI 2, 3 & 4?

EDIT: Solution for my TV in my follow up post here

1 Like

Hello again.
Now that this feature works nicely on my TV, I was wondering if I could implement one more with the help of ADB send command.
So, instead of using the remote control to go home_screen > Settings > System > Power & Energy > and lastly “Screen off”… could I just send a code?

This is what I see via the logcat, but I really don’t know how to convert this info into a command (if even possible):

02-24 09:59:44.687  1309 11400 D MtkLog  : 8
02-24 09:59:44.687  1628 11402 D MtkLog  : 8
02-24 09:59:44.688  1433 11403 D MtkLog  : 8
02-24 09:59:44.700  3315 11406 D MtkLog  : 8
02-24 09:59:44.806  1352  2070 D LogKeyEvent: : key=23,scan=353,src=3,sys=0
02-24 09:59:44.806  2073  3000 D TvPowerManagerService: scanCode = 353, src = 3
02-24 09:59:44.806  2073  3000 D TvInactivityTimer: mService android.os.Messenger@e873fb2
02-24 09:59:44.806  1352  2839 D DrvCustomNative: setInt
02-24 09:59:44.807  1352  2839 D DrvCustomNativeJni: <Java_org_droidtv_tv_drvcustom_DrvCustomNative_set:111> set: 2,1,1
02-24 09:59:44.806  1380  2676 D TPTvServiceAgent: ScreenOffGreenMute: false,false,23
02-24 09:59:44.807   546   546 D TPVDrvCustomService: <tpvdrvcust_hidl_set:44> type=2, value=1
02-24 09:59:44.807   546   546 D tpv_drv_cust_leds: <ir_blinking:132> ir_blinking called
02-24 09:59:44.807   546   809 D tpv_drv_cust_leds: <irLedService:40> irLedService IR blinking start...
02-24 09:59:44.808  2198  2198 D TvInactivitySvc: UserActivity
02-24 09:59:44.808  1352  2839 D DrvCustomNativeJni: <Java_org_droidtv_tv_drvcustom_DrvCustomNative_set:113> set: ret=0
02-24 09:59:44.808   546   809 D tpv_drv_cust_leds: <set:124> Set Leds ON/OFF. on_off=1
02-24 09:59:44.809  1681  1740 D candeebug.Gateway: Returning successfully for event: {"event-type":"unknown.15","boot-count":52,"standby-count":4,"kernel-time":47380912,"data":{"original-event-type":15,"device_name":1,"key_group":11,"rc_side":0,"ver":5}}
02-24 09:59:44.810   553   571 E FmsOledSaver: mark:0, logo:0, bmessage:0, #diff pix:  0, change:0, noClapse:   0, sSaving:0
02-24 09:59:44.810   553   571 E FmsOledSaver: sLevel:2, pMotion:0, bchange:0, noBClapse:   6, sDimming:0, ssFlag:0
02-24 09:59:44.909   546   809 D tpv_drv_cust_leds: <set:124> Set Leds ON/OFF. on_off=0
02-24 09:59:44.910   546   809 D tpv_drv_cust_leds: <set:124> Set Leds ON/OFF. on_off=0
02-24 09:59:44.910   546   809 D tpv_drv_cust_leds: <irLedService:56> irLedService IR blinking end...
02-24 09:59:44.918  1628  4305 I ImageStickingService: Amith keyCode23
02-24 09:59:44.918  1628  4305 D DreamerService: OnKeyPressed received:true
02-24 09:59:44.918  1628  4305 D DreamerService:  isScreenSaverTriggered=0globalosdcount:0forceTrigger:0gResetCounter0
02-24 09:59:44.918  1628  1628 E DreamerService: SSS:false:null:null:false
02-24 09:59:44.920  1433  1433 D TpvPowerAndEnergyFragment: onPreferenceTreeClick() key = screen_off
02-24 09:59:44.920  1433  1433 I TpvPowerAndEnergyFragment: enterScreenOff()
02-24 09:59:44.920  1433  1433 D KeyInputDevImpl: set: 6,1
02-24 09:59:44.920  1433  1433 D KeyInputDevN: setCustomValue: 6:1
02-24 09:59:44.920  1433  1433 D KeyInputDevN: Get ksvc
02-24 09:59:44.921  1380  2530 D TPTvServiceAgent: POWER_SCREEN_OFF_UI: 1,false,false
02-24 09:59:44.921  1804  1952 D UsbBreakinService: POWER_SCREEN_OFF_UI: 1,false,false
02-24 09:59:44.922  1433  1433 D GtvNotificationManager:  All GTV notifications are canceled
02-24 09:59:44.923   919  1073 W DevicePolicyManager: Unknown user type: UserInfo{10:new_user:1010}
02-24 09:59:44.929   919   919 I AlarmManager: Change Wakeup Alarm type to non Wakeup type, current type=[2] packageName = android statsTag = *walarm*:NotificationManagerService.TIMEOUT @91154029 and next wakeup alarm is @Sat Feb 24 20:41:02 GMT+01:00 2024

especially this part:

02-24 09:59:44.920  1433  1433 D TpvPowerAndEnergyFragment: onPreferenceTreeClick() key = screen_off
02-24 09:59:44.920  1433  1433 I TpvPowerAndEnergyFragment: enterScreenOff()

Any help/pointer is appreciated, thank you.

Hi all, I’ve worked out how to control HDMI Inputs and Home on TCL C805 TV (TCL 75C805 / TCL 75C805K in my case).

HDMI 1

adb shell am start -a android.intent.action.VIEW -d     content://android.media.tv/passthrough/com.tcl.tvinput%2F.TvPassThroughService%2FHW15

HDMI 2

adb shell am start -a android.intent.action.VIEW -d     content://android.media.tv/passthrough/com.tcl.tvinput%2F.TvPassThroughService%2FHW16

HDMI 3

adb shell am start -a android.intent.action.VIEW -d     content://android.media.tv/passthrough/com.tcl.tvinput%2F.TvPassThroughService%2FHW17

HDMI 4

adb shell am start -a android.intent.action.VIEW -d     content://android.media.tv/passthrough/com.tcl.tvinput%2F.TvPassThroughService%2FHW18

Home screen (Google TV Home screen)

am start -a android.intent.action.MAIN -c android.intent.category.HOME
1 Like

Anyone knows how to change to Cable or Antenna input from HDMI?

Thanks! Works for TCL 75C849

anyone get this to work for an xgimi? I have a horizon pro and I can get the hdmi to switch using the terminal from my pc, but not from homeassistant using that exact same command using androidtv_adb.command.

there is no error I can see using the dev tools for this service call.

this is what I am trying to use and I have verified that the home assistant machine has been allowed to run adb commands.

data:
  command: >-
    am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.xgimi.tvinput%2F.inputservice.Hdmi2TvInputService%2FHW2
target:
  entity_id: media_player.android_tv_192_168_20_166```