RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    CEC control - Pi turns TV on when booted

    Scheduled Pinned Locked Moved Help and Support
    cec
    6 Posts 3 Posters 1.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sleve_mcdichael
      last edited by

      Any time I boot or reboot my RPi4, my TV will turn itself on if it wasn't already, and switch to the HDMI2 input. Can I have more control over this from the OS angle? Can I either, disable it so the TV doesn't do anything when the RPi boots, and/or is there a command I can send (over SSH, for example, or even just "blind" on an attached keyboard) that'll send the CEC signal which wakes up the TV, on-demand without doing a full reboot?

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        Try adding hdmi_ignore_cec_init = 1 to your config.txt.

        See more details at https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi_ignore_cec_init

        1 Reply Last reply Reply Quote 1
        • S
          sleve_mcdichael
          last edited by sleve_mcdichael

          And it looks like the other side (manual control) of this is handled with cec-utils:

          sudo apt -y install cec-utils
          

          Then you can use cec-client to send commands like on, standby, or as (active source):

          # turns on display 0 if it's off:
          echo 'on 0' | cec-client -s -d 1
          
          # turns off display 0 if it's on:
          echo 'standby 0' | cec-client -s -d 1
          
          # active source: powers on the display if it's not (all of them? I only have the one but this command doesn't specify which, unlike the other examples) , and channel-switches to HDMI source:
          echo 'as' | cec-client -s -d 1
          

          https://www.linuxuprising.com/2019/07/raspberry-pi-power-on-off-tv-connected.html?m=1

          R 1 Reply Last reply Reply Quote 0
          • R
            Retro Arcade Fan @sleve_mcdichael
            last edited by

            @sleve_mcdichael said in CEC control - Pi turns TV on when booted:

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

            I'm very intrigued by this! I never knew there would be a way for the pi to turn off the tv when it's shut down. I'd be glad to get rid of the remote.

            Upon my testing, was able to turn the tv on, but not off. I installed the utils. echo 'on 0' | cec-client -s -d 1 would turn it on. But echo 'standby 0' | cec-client -s -d 1 had no effect.

            Any insight? Thanks.

            S 1 Reply Last reply Reply Quote 1
            • S
              sleve_mcdichael @Retro Arcade Fan
              last edited by

              @Retro-Arcade-Fan sorry I can't be more help, I don't know much about it but what works for me. Unless your TV is something other than device #0? But you say that does work to turn it on, so I don't know...

              You can send the "scan" command to list available devices:

              pi@retropie:~ $ echo 'scan' | cec-client -s -d 1
              opening a connection to the CEC adapter...
              requesting CEC bus information ...
              CEC bus information
              ===================
              device #0: TV
              address:       0.0.0.0
              active source: no
              vendor:        Vizio
              osd string:    TV
              CEC version:   1.3a
              power status:  on
              language:      eng
              
              
              device #1: Recorder 1
              address:       2.0.0.0
              active source: no
              vendor:        Pulse Eight
              osd string:    CECTester
              CEC version:   1.4
              power status:  on
              language:      eng
              
              
              device #4: Playback 1
              address:       1.0.0.0
              active source: no
              vendor:        Google
              osd string:    Chromecast
              CEC version:   1.4
              power status:  on
              language:      ???
              
              
              currently active source: unknown (-1)
              

              You can also send commands by address instead of device number so in this example, it would be echo 'standby 0.0.0.0' | cec-client -s -d 1.

              R 1 Reply Last reply Reply Quote 0
              • R
                Retro Arcade Fan @sleve_mcdichael
                last edited by

                @sleve_mcdichael said in CEC control - Pi turns TV on when booted:

                echo 'standby 0.0.0.0' | cec-client -s -d 1

                Thanks @sleve_mcdichael. I did try both. It's odd that I can turn it on, but not off. But I've tried both methods. I appreciate the assist though. Maybe someone else will chime in.

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post

                Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.