Turn off laptop screen running Hassio

Turning off the backlight will reduce heat and darken the room, but it will still allow the LCD to burn in after months/years of displaying the exact same text.

I was having trouble writing to the brightness file. Running mount showed that sysfs was mounted read only, and running sudo mount -o remount,rw /sys said the /sys wasn’t in /proc/mount (even though it was in there). So I cheated.

  1. sudo mkdir /ss
  2. sudo mount /dev/null -t sysfs /ss
  3. echo 0 | sudo tee /ss/class/backlight/*/brightness
  4. sudo umount /ss
  5. sudo rmdir /ss

There’s probably a way to make sysfs mount rw on boot but I’m too lazy to find it. Using /dev/null bypasses some checks that try to prevent sysfs from being mounted multiple times.

1 Like

On an old toshiba satellite running debian 11, the following works for me:
sudo vbetool dpms off

1 Like

Is there a way to run this from the webui so I dont have to type it in the laptop itself?

Thanks in advance!

When I try to use this, it just gives me “command not found” for xset. Am I missing something here?

Sounds like the command is not available on HA OS.

Not sure if you need the screen?

I’ll be investigating just disconnecting mine. And maybe even removing the whole screen. Headless…

I’m adding my progress to this post.

I found a work around that’s stupid but at least it works on the 2014 MacBook Pro I’m using. If you close the lid fast enough after pushing the power button (as long as an external display is connected), it will disable the built in screen. So I guess if I get one of those HDMI dongles that fakes as a screen, and close the lid quickly, I found my solution

2 Likes

Actually mine works ok. Screen off when lid closed. I guess I didn’t visually check carefully enough the first time somehow. Roughly 27 Watts with screen on and 22 Watts with screen off.

rpi4 was roughly 7watts.

Shame really, I was starting to look forward to ripping off the screen lol. Now I am less motivated to do that.

1 Like

Testing HA oS on an old laptop right now and I disable the screen with the following:

Edit /mnt/boot/EFI/BOOT/grub.cfg and add consoleblank=10 (or whatever value you want in seconds) to the command line args.

Advantage is the screen is still usable if you ever need it. It’ll come on with a keypress.

7 Likes

I am running a Nix OS on a computer that I am using as a Kiosk. The OS is using wayland.
On a Wayland Nix system you can issue the following command to turn on / off the display.

# Lock
dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call --print-reply --reply-timeout=20000 /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:true

# Unlock
dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call --print-reply --reply-timeout=20000 /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:false

I have created a Command Line Switch in Home assistant that is driven by a motion sensor automation to turn on the screen if someone is detected near the display. And turn it off after 4 minutes undetected.

- platform: command_line
  switches:
    kiosk_screen_saver:
      command_on: "ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:true"
      command_off: "ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] dbus-send --session --dest=org.gnome.ScreenSaver --type=method_call /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:false"
      friendly_name: "Enable Kiosk ScreenSaver"
1 Like

Wanted to reply and say that adding “consoleblank=60” to the /mnt/boot/EFI/boot/grub.cfg at the end of the default_cmdline line fixed this for me. I have an HP Elite X2 1012 G1 (Surface clone). With the monitor running, its using 16-17 watts. After 60 seconds when the monitor shuts off, power drops to 9 watts (and doesn’t burn in my laptop screen). Thanks all!

2 Likes

Acer V123: a partial success. Font is no longer visible after the timeout. But the screen is still ON.

Also, it would be great to have HAOS running, the lid closed and the monitor power off. It was possible with OpenMediaVault. I installed it to manage HA in docker. But I moved to HAOS to benefit from supervisor. /etc/systemd/logind.conf is read-only. sudo is not enabled. Any idea on that?

I edited my previous post, probably during your reply.
I checked logind.conf and it’s already correctly configured.
Now it’s working. Don’t ask me why but I remember the pc supending with the lid closed. I can still access the HAOS, the monitor power is off.
Btw the logind.conf is read-only. I don’t know how to gain root in HAOS, I simply used login+ENTER to navigate the filesystem from the laptop (SSH not configured yet).

I’m pretty new to home assistant. If I try to sudo nano /mnt/boot/EFI/BOOT/grub.cfg to edit the file it comes back with "bash: sudo: command not found

Any thoughts?

1 Like

If you made it this far then you’re almost there.

edit the grub.cfg file with vi
working with vi; How to Use the VI Editor in Linux | Linux Journal

vi /mnt/boot/EFI/BOOT/grub.cfg
add “consoleblank=120” to the end of the line starting with default_cmdline before the " for 120 seconds of screen ontime.

Good luck

2 Likes

Hi all,
I have added consoleblank to grub.cfg as above and it clears the screen perfectly, but the backlight is still on. Anyone have any ideas?

Hi ejopzee,
Just wanted to say that as someone who writes a lot of tech documentation, your post is great.
So many people leave out details that they just “assume” people will just know - for example that you need to add “consoleblank=120” to the end of that specific line and that it has to be inside the “”'s and that the number value tells the command how many seconds.
Otherwise you would just bang it in at the end of the file itself on a new line and just wonder why it didnt work.

Hi @Coverdale ,

I experience the same problem: screen is blank, but backlight seems still to be on…

Somebody another suggestion?

(DELL, Lattitude E6510)

grtz
B

Worked perfectly for me on my Acer Travelmate B117. Thanks! :pray:
Screen goes completely off including the backlight. Comes back on after a keyboard key is pressed :ok_hand:

After implementing it I noticed that closing the lid does the same.
So I wouldn’t even needed the “consoleblank=120”, but now I’m “double safe”.

Hi all,
I too am trying to get my screen to turn off on an old Dell Latitude E7270.

I’m getting a bit more familiar now with HAOS and have used the Terminal Add-on in HAOS a few times before for some other operations but when I try to edit the grub.cfg file using:

vi /mnt/boot/EFI/BOOT/grub.cfg

I just get a page full of:

~
~
~
~
~
~

and nothing else. I can’t even exit out of it and have to re-install the terminal add-on to be able to back.

Am I doing something silly here?

Thanks!