Sending HDMI CEC commands via ADB

I have a TCL Android TV and a JBL Link Bar (that also runs Android TV). I prefer to use the TV as the primary and the Link Bar for audio only. However, they seem to get confused after they are idle or goto sleep and when they wake, audio comes from the TV speakers and not the soundbar. In order to resolve this, I usually have to goto Settings > System > T-Link > JBL Link Bar > Power On. This usually fixes the connection between the TV and bar to where audio comes from the Bar but I use the interface of the TV.

This process has become rather annoying and I’d like to automate it with Home Assistant. Doing an add logcat | grep cec while doing the above yields these results:

05-08 12:02:34.021  3021  3021 I chatty  : uid=1000(system) /vendor/bin/hw/[email protected] expire 16 lines
05-08 12:02:34.129  2999  9754 D hdmicecd: printCecMessage, [8 -> 0] len: 2, body: 90 00, result: success
05-08 12:02:35.449  2999  3222 D hdmicecd: printCecMsgBuf, msg: 05 70 00 00
05-08 12:02:35.449  2999  3222 D hdmicecd: avr receives 70 with address 0
05-08 12:02:35.449  2999  3222 D hdmicecd: @Harman Core updating mTvTrustedRoutingPath from TV: 00
05-08 12:02:35.449  2999  3222 D hdmicecd: @Harman Core Handle RoutingCountrol Msg
05-08 12:02:35.449  2999  3222 D hdmicecd:                  from: 0
05-08 12:02:35.449  2999  3222 D hdmicecd:                  opcode: 70
05-08 12:02:35.449  2999  3222 D hdmicecd:                  para: 00
05-08 12:02:35.449  2999  3222 D hdmicecd:                  doFilterCmd false
05-08 12:02:35.449  2999  3222 D hdmicecd:                  mTvTrustedRoutingPath: 00
05-08 12:02:35.449  2999  3222 D hdmicecd:                  mAtomPhyaddr: 1000
05-08 12:02:35.449  2999  3222 D hdmicecd:                  mTxHotPlugFlag: normal
05-08 12:02:35.449  2999  3222 D hdmicecd:                  mRecvRCMsgAfterTxHotPlugIn: 03
05-08 12:02:35.449  2999  3222 D hdmicecd:                  mStandbyFlag: false
05-08 12:02:35.449  2999  3222 D hdmicecd:                  mNonOTPStandbyWakeUpFlag: normal
05-08 12:02:35.449  2999  3222 D hdmicecd:                  isUpStreamOTPFlag: false
05-08 12:02:35.449  2999  3222 D hdmicecd:                  mFlterRCMFlag: false
05-08 12:02:35.496  2999  9754 D hdmicecd: [hcc] getPhysicalAddress, physical addr: 1000, ret = 0
05-08 12:02:35.507  2999  9754 I hdmicecd: enableAudioReturnChannel portId: 0 enable:1
05-08 12:02:35.518  2999  9754 D hdmicecd: [hcc] setAudioReturnChannel, port id:0, flag:1, ret:0
05-08 12:02:35.569  2999  3222 D hdmicecd: printCecMsgBuf, msg: 05 70 00 00
05-08 12:02:35.569  2999  3222 D hdmicecd: avr receives 70 with address 0
05-08 12:02:35.569  2999  3222 D hdmicecd: @Harman Core updating mTvTrustedRoutingPath from TV: 00
05-08 12:02:35.569  2999  3222 D hdmicecd: @Harman Core Handle RoutingCountrol Msg
05-08 12:02:35.569  2999  3222 D hdmicecd:                  from: 0
05-08 12:02:35.569  2999  3222 D hdmicecd:                  opcode: 70
05-08 12:02:35.569  2999  3222 D hdmicecd:                  para: 00
05-08 12:02:35.569  2999  3222 D hdmicecd:                  doFilterCmd false
05-08 12:02:35.569  2999  3222 D hdmicecd:                  mTvTrustedRoutingPath: 00
05-08 12:02:35.569  2999  3222 D hdmicecd:                  mAtomPhyaddr: 1000
05-08 12:02:35.569  2999  3222 D hdmicecd:                  mTxHotPlugFlag: normal
05-08 12:02:35.569  2999  3222 D hdmicecd:                  mRecvRCMsgAfterTxHotPlugIn: 04
05-08 12:02:35.569  2999  3222 D hdmicecd:                  mStandbyFlag: false
05-08 12:02:35.569  2999  3222 D hdmicecd:                  mNonOTPStandbyWakeUpFlag: normal
05-08 12:02:35.569  2999  3222 D hdmicecd:                  isUpStreamOTPFlag: false
05-08 12:02:35.569  2999  3222 D hdmicecd:                  mFlterRCMFlag: false
05-08 12:02:35.660  2999  9754 D hdmicecd: printCecMessage, [5 -> 0] len: 1, body: c0, result: success
05-08 12:02:35.766  2999  9754 D hdmicecd: printCecMessage, [5 -> f] len: 2, body: 72 01, result: success
05-08 12:02:35.767  2999  9754 D hdmicecd: [hcc] getPhysicalAddress, physical addr: 1000, ret = 0

Does anyone have any familiarity with automating this in Home Assistant? Alternately, is anyone familiar with what steps I might take to reproduce this command in HA?

1 Like

For those who end up here - I ended up determining a solution in this thread: Android TV HDMI - #52 by jcconnell

1 Like