Turn TV on/off without CEC?

I was thinking an IR blaster type setup might work. I have a IR transmitter hiding around here somewhere that I could connect to GPIO, any way to get that to send my tv on/off signals?

Look in to DPMS. You could probably use the setterm command to turn the display on/off.

Did a quick skim of the man page before going to work, I tried some things. Am I doing it wrong?

osmc@osmc:~$ setterm --powerdown 1
e[14;1]osmc@osmc:~$ sudo setterm --powerdown 1
e[14;1]osmc@osmc:~$ sudo setterm --powersave powerdown
setterm: cannot (un)set powersave mode: Inappropriate ioctl for device
osmc@osmc:~$ sudo setterm off

I think you need to redirect it to the console, I.e with <

It’s also possible this doesn’t work on Pi. Maybe there is a vcgencmd for it

Edit: try vcgencmd display_power 0

vgencmd display_power 0 will turn the HDMI off which will eventually shut the TV off due to losing input on that source. When the HDMI is turned back on though the TV stays off. That’s why I’m thinking blasting an IR signal at it may be the best way.

I see.

I don’t believe the current framebuffer implementation supports turning the display off on Pi, which is why you get the ioctl error.

@sam_nazarko Check out this guide and let me know what you think.

Cool!! I was looking for something like this, as I always fall a sleep at night watching some TV Series.
Is there any addon which will trigger this command to switch the hdmi off (TV as consequence).
e.g. kodi not playing anything for 20 min -> vcgencmd display_power 0
TV on again -> vcgencmd display_power 1

Here you go, does (almost) exactly what you want. Though it won’t turn the TV back on for you, you’ll have to do that by remote or CEC or manually.

1 Like

Waw! that sounds exactly what I was looking for :slight_smile:
I’m not 100% sure how this will work in my setup:
Rpi connected via HDMI to LG TV → using CEC to control Kodi
if it turns HDMI off then when I switch back on my TV how the HDMI of the PI will turn back on, is CEC working while HDMI is off ?
I’m asking cause I don’t have a remote connected to my PI…

Never mind my post above!
It works like a charm!! You are my hero! :stuck_out_tongue:

This feature should be built-in OSMC! it is really greate!
I’d vote for a feature request to have this option as a service in OSMC, available in the appstore :slight_smile:

1 Like