15

When I boot my Raspberry my TV gets woken up over CEC.

Is there a way to send the wake up signal using shell so I could use cronjob to start my TV every morning at 7, for example?

  • I don't have any CEC devices so I can't test this by myself but cec-client from libcec seems to implement what you need. – Krzysztof Adamski Apr 16 '13 at 17:17
14

I'm using Raspbian “wheezy”.

Setup

sudo apt-get update;
sudo apt-get install gcc autoconf libtool pkg-config libselinux1-dev liblockdev1-dev gawk g++ c++ libgudev-1.0-dev libudev-dev;

mkdir -p $HOME/distr/libcec; 
wget -P $HOME/distr/libcec https://github.com/Pulse-Eight/libcec/archive/master.zip;
unzip $HOME/distr/libcec/master.zip -d $HOME/distr/libcec/;
cd $HOME/distr/libcec/libcec-master;
./bootstrap;
./configure --with-rpi-include-path=/opt/vc/include --with-rpi-lib-path=/opt/vc/lib --enable-rpi;
make;
sudo make install;
sudo apt-get install cec-utils;

Usage

Use echo 'standby 0' | cec-client -s to turn TV off and echo 'on 0' | cec-client -s to turn in on.

You may also have to substitute /usr/local/bin/cec-client for cec-client (or reconfigure your PATH) if the first one doesn't work.

2

The command:

echo 'on 0'|cec-client -s -d 1

is problematic, because it turns the TV on, but ALSO sets Raspberry Pi as the active source. It seems that the only way of changing the source to TV internal tuner is using JointSPACE framework for my Philips TV. I have unsuccessfully tried several different CEC command combinations to activate internal tuner. It is possible to switch between HDMI sources with CEC, but I have yet to discover how to switch to internal tuner...

1

I have something similar, the command echo 'on 0'|cec-client -s -d 1 only turns on the tv, I was curious if there is a single command to turn on tv and switch input to what the pi is on. I was also curious if its possible to run this at boot?

ANSWERED: (I answered the above, added to etc/rc.local to run at boot.) Still curious why single command does not work. Any Ideas?

echo 'on 0'|cec-client -s <- Turn on TV
echo 'as'|cec-client -s <- Initiate input Pi is active on

Yet the command to run both only gets me power. Not to big of a deal as I just run both at boot, but curious why the combined one isn't working.

protected by Darth Vader Feb 5 at 22:55

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.