Raspberry Pi Turn Tv On/Off CEC

When building a dashboard using a Raspberry Pi, I wanted a way to schedule the tv to turn on/off automatically. Below are the steps using Consumer Electronics Control (CEC).

  1. sudo apt-get install cec-utils

Once everything is installed you should be able to control the tv using the command below:

Turn tv on: echo on 0 | cec-client -s -d 1
Turn tv off: echo standby 0 | cec-client -s -d 1
Tv status: echo pow 0 | cec-client -s -d 1

Troubleshooting Tips:

  • Make sure you tv supports cec and that it is enabled. Tv manufactures call CEC by different names so you may have to do some research depending on your brand.
  • Make sure oyu are using a new hdmi cable that is atleast HDMI 1.2a

Different names for HDMI CEC

  • Samsung – Anynet+
  • Sony – BRAVIA Link or BRAVIA Sync
  • Sharp – Aquos Link
  • Hitachi – HDMI-CEC
  • AOC – E-link
  • Pioneer – Kuro Link
  • Toshiba – Regza Link or CE-Link
  • Onkyo – RIHD (Remote Interactive over HDMI)
  • LG – SimpLink
  • Panasonic – VIERA Link or HDAVI Control or EZ-Sync
  • Philips – EasyLink
  • Mitsubishi – NetCommand for HDMI
  • Runco International – RuncoLink


Credits: http://raspberrypi.stackexchange.com/questions/7054/cec-wake-up-command

Also published on Medium.

7 thoughts on “Raspberry Pi Turn Tv On/Off CEC

  1. Thank you for this post !
    After searching and trying hours and hours it helps me.
    On my Pi B+ with Debian Wheezy 1.4 I only need to install by:
    sudo apt-get install cec-utils
    That’s all
    Sorry… You have error’s in the documentation for switching on and off.
    You must type in:
    echo standby 0 | cec-client -s -d 1
    echo on 0 | cec-client -s -d 1
    without ‘

    1. Thanks glad it helped you! Most likely it’s because I was using an older os version. Hopefully this comment will help someone else. I’ll update the post.

    1. From the libCEC Vendor Compatibility Site:
      Concerning “Samsung” and “Power Off”
      “Some models require you to turn on “Auto-Standby” in the Anynet+ settings to enable this feature”

Leave a Reply

Your email address will not be published. Required fields are marked *