raspberry-pitelevisionhdmi

Sending CEC commands via command line over HDMI


My master plan is to be able to send CEC commands from my raspberry pi to do things such as turn on/off the tv as well as other devices connected to the TV. Then I will be adding voice recognition to send these commands...that's for another day. I have read up on CEC but from what I've gathered it seems like you can't send CEC commands directly through the command line without the CEC usb adapter? I have installed the cec-client and libCEC library on my pi but when I run cec-client -l it shows no devices.

My question is, how can I send CEC commands via the command line to my tv from the pi without the adapter? Am I missing some basic element about CEC?

UPDATE

In addition to the posts below here is a link that asked in the PI portion of stackoverflow which has some more CEC commands that I have put within my .bashrc to turn the tv on/off and change the input

https://raspberrypi.stackexchange.com/questions/5345/raspmbc-send-cec-commands-without-cec-adapter


Solution

  • Recent versions of libcec will recognize the Raspberry Pi hardware as a CEC adapter.
    To send control commands through the command line, basically:

    echo "on 0" | cec-client -s
    

    will power on device 0 (ie your TV)
    Check out cec-client interactive shell for more complex commands