Can't get hdmi-cec to work

Hi, I can’t seem to get HDMI-CEC working on HA. I’ve got this in my config:

Blockquote
switch:

  • platform: command_line
    switches:
    tv_rpi:
    command_on: ssh [email protected] “echo ‘on 0’ | cec-client -s”
    command_off: ssh [email protected] “echo ‘standby 0’ | cec-client -s”
    command_state: ssh [email protected] “echo ‘pow 0’ | cec-client -s |grep ‘power status:’”
    value_template: ‘{{ value == “power status: on” }}’

I can see the switch in my frontend but it doesn’t do anything. However, if I give the commands directly in in terminal, it does work.
My HA is installed in venv if that makes any difference.

Anyone any idea on what’s wrong ? Thx

Use the full path to cec client
Check where is your cec-client
$ whereis cec-client

My example:
tv:
command_on: /bin/echo “on 0” | /usr/osmc/bin/cec-client -s
command_off: /bin/echo “standby 0” | /usr/osmc/bin/cec-client -s
friendly_name: My awsome TV
command_state: >-
/bin/echo pow 0 | /usr/osmc/bin/cec-client -s -d 1 | grep -Po ‘power status: \K(.+)’
value_template: >-
{{ value != ‘standby’ }}

I have the same problem. How did you fix it?

I think there must be some serious problems with how CEC is working in the current versions of Home Assistant OS. I’ve seen multiple comments about how it doesn’t work anymore.