Using the new Android TV remote integration of HA 2023.5 to switch off TV

Hi,

I’m using the new remote function that came in HA 2023.5 to control my Mibox 3 (Android TV with built-in chromecast). Since the box can switch on the TV over HDMI-CEC I suppose it must be possible to send that same command using the HA remote to switch on and of the TV (not the box). So I added a button with this code:

how_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: hdmi_cec.power_on
  target: {}
hold_action:
  action: none
icon: mdi:power
show_state: true

It is not working though. What am I doing wrong?

I assume you mean the Android TV Remote integration ( Android TV Remote - Home Assistant (home-assistant.io))?

Mmm no. The TV switches off because the box switches off.

Is this documented somewhere?

Indeed. Another integration that only works if the device is powered on all the time.

To use Android TV Remote with my JVC I found I needed a smart socket to turn on the power, an IR device to get it out of standby and an automation with lots of delays to allow the TV to pull itself together. Much more trouble than picking up the physical remote.

Thank you for you reply

Sorry, yes that’s what I mean.

My assumption came from the fact that an Raspberry Pi is capable of doing that using the HDMI_CEC integration, so I thought maybe an Android box can do it as well. See: GitHub - samueltardieu/homeassistant-addon-pi-cec: HomeAssistant add-on to expose Raspberry Pi HDMI CEC

As far as I understand if HA is on a Raspberry Pi this is all possible. In my case I don’t use a Raspberry Pi but an i5 server. It is connected to the TV using a HDMI cable, but the motherboard of the PC doesn’t support CEC over HDMI.
An alternative could be just to add a Raspberry Pi to switch the TV on/off and adjust the volume of the TV instead of the volume of the box. But that seems a bit overkill.

Yes. [androidtvremote2/src/androidtvremote2/remotemessage.proto at e29b8d1cd821383666a91565439b03b28d574348 · tronikos/androidtvremote2 · GitHub]
See line 525

Isn’t it easier in that case just to add a Raspberry Pi to do the job?

That’s just how HDMI-CEC works. Nothing to do with any integration.