HDMI-CEC setup - Help needed

Hi all,

I am relatively new to HA (started the whole thing 5 days ago) so please bear with me :slight_smile:

I have setup almost everything I have at home with HA and my rasp3.

I would like now to setup commands for the Hisense TV (no Android) connected to the rasp by HDMI.
I have activated the HDMI-CEC on the TV and I am trying to have some working commands in my lovelace.

This is what I have in my configuration.yaml

hdmi_cec:
  types:
    hdmi_cec.hdmi_0: media_player  

After rebooting the system, I got a media player entity called Vizio TV (media_player.hdmi_0) and a TV 3 () (switch.hdmi_3) that I think is the decoder I have connected to the TV on HDMI port 3 (ports 1 and 4 are empty and port 2 is where the rasp is connected).

I can turn on and off the TV by adding the Vizio TV entity in lovelace using a default card, while the switch appearing doing the same for the TV3 () one doesn’t do anything (I don’t really need it as I can fully control my Decoder VU Zero 4k by the Enigma2 integration already).

Also, every time I restart Hassio, the TV input is switched to the rasp one automatically.

Now my questions are:

  • Why my Hisense h65m5500 is appearing as Vizio TV?
  • How can I add other commands like select_input, volume up/down?
  • Finally, how can I integrate them in a lovelace card?

Thanks a lot in advance for yor help!
kok

Because Vizio is OEM vendor…Vizio made it and put hisense name on it possibly. This info come from device

Look at HA UI>>developer tools>>“services” tab
You can look at available services to see what is available.

Lovelace buttons can call HA services

Also, devices like ROKU and AV receivers have their own integrations. ROKU will control connected HDMI devices using CEC(HA integration not needed).
EXAMPLE
I have Roku
I have recover
I have projector
All connect by HDMI. Volume up on roku cause volume up on receiver. Power OFF/ON roku powers OFF/ON receiver+projector also. Your items my differ but idea is this may enhance your setup
Depending on your setup it may be easier to use the native integration of another device to control a secondary device using CEC(natively, not HA integration)

HDMI-CEC - Home Assistant.

Hi @tmjpugh,

Thanks a lot for taking the time to answer me :slight_smile:

I tried again to have this working but no luck.

All clear!

Unfortunately I am still lacking the knowledge to understand how I should link the entity + services etc to generate what I need. I searched for a configuration template on internet to mimic and edit with my info but it seems not so many people are using the hdmi-cec (or it is so easy to use nobody needed to ask about it, :frowning: )

I don’t have other devices than the TV, the rasp connected to it (which video out I really don’t need, it is connected only to take advantage of its hdmi-cec capabilities) and the decoder connected to the TV (that I don’t need to control by hdmi-cec as I’m using the Enigma2 integration for it and it’s working perfectly).

Thanks!

Have you tried using UI>>developer tools>>services?
It shows examples. Also the link I previously provided showed some available services for HDMI CEC. I not use this integration anymore but I try to provide some example later

Hi @tmjpugh,

Thank you once again for your help on this.
I indeed tried the dev tools > services but not really sure what service to use (I tried media_player as it is the one my tv is recognized with, but could not find the select source one, for example).

I will dig a bit more there though.

Thanks again!

Hi again,

I tried to create an automation for this but it is not working and I do not understand why.

This is the code:

- id: '1606258611337'
  alias: input
  description: ''
  trigger:
  - platform: state
    entity_id: media_player.hdmi_0
    from: 'Off'
    to: 'On'
  condition: []
  action:
  - service: media_player.turn_on
    data:
      entity_id: media_player.vuzero_4k
  - service: hdmi_cec.select_device
    data:
      device: 3.0.0.0
  mode: single

My TV entity is media_player.hdmi_0, my decoder entity is media_player.vuzero_4k and the decoder is on HDMI3.
When I set my tv to hdmi2, turn it off and then on, my decoder does not turn on and the tv does not switch to HDMI3.

Can’t understand why…

Thank you in advance for the help!

Hey, anybody who may know how to fix this?

Is the off/on state of TV recognized by CEC. Does it actually trigger?
Test this by OFF/ON a light using it as trigger if you have no other way to verify.

You can use the developer tools to call services.
Verify your tv input will be changed by that service call. It looks OK but hdmi CEC can be a little unpredictable and manufacture did not always follown standard.

Hi again @tmjpugh, thank you for the patience :slight_smile:

So, it seems I can’t use the HDMI_CEC commands in any way.
The automation I posted above should work, at least for the VuZero part (turning the decoder on and off while executing the command), but unfortunately it doesn’t.
I then decided to completely change the approach, using the Media Player service.

I have now the following code:

alias: test
description: ''
trigger:
  - platform: state
    entity_id: switch.hdmi_0
    from: 'off'
    to: 'on'
condition: []
action:
  - service: media_player.turn_on
    data:
      entity_id: media_player.vuzero_4k
  - service: media_player.select_source
    data:
      entity_id: media_player.vuzero_4k
      source: switch.hdmi_0
mode: single

If I turn on the TV, the decoder turns on too (yay!), but unfortunately the source select part still doesn’t work.

I tried to use “Vizio TV” and “HDMI_0” as source names for the action but nothing happens.

What do you think?
Thanks again!

media_player.vuzero_4k is not hdmi_cec entity based on your config in original post. Was this added in another integration or autodiscovered by HA?

Can you look in developer_tools>>states for this entity to see available sources. You may also try adding it as media player in lovelace UI to verify if selecting source is available ui option.

Hey @tmjpugh,
The vuzero was added with a specific integration (enigma 2).
The sources supported for this integration are just specific channel of the precondigured channel list, not the HDMI input.

I now see calling this entity to switch the source is not right.
What should I call in your opinion?
Thanks!

Honestly, haven’t used this integration in a while.
If i have time tonight I will set it up again so I can give answer.

Ok so, after another round of checks, I finaly managed to have it working… and the issue was the Enigma2 had a very long set of options to properly activate the HDMI CEC on its HDMI port!
I realized it wasn’t working as it should by checking the TV HDMI-CEC checker on the TV options menu, since it was returning only the rasp on HDMI2 and not the decoder.

So, for me, things to keep in mind for the future:

  • HDMI CEC should be active on ALL the platforms of the HDMI net, not just the tv.
  • no matter if the devices on the HDMI-CEC are using switch or media.player platform, it will work anyway.

And with this, I say THANK YOU to you @tmjpugh for your time and patience. Hugely appreciated :slight_smile:

Cheers!