Turn off laptop screen running Hassio

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.


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
      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"

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!


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


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)


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?


I have the same issue but I was glad that Rixi gave me the proper answer I just close the lid

I’m having the same issue. Just a full page of ~

Got a chromebook that’s running HAOS. Even when I close it the screen remains lit.

Could anyone please specify how to edit the grub.cfg file? I am running Home Assistant OS installed directly on a Surface Pro 2 and I need to turn off the display. When I try to enter “vi /mnt/boot/EFI/BOOT/grub.cfg” in the Home Assistant OS terminal, it does not recognize the command.

I got this working on a Dell Precision M4700 laptop. The backlight turns off completely for me after 120 seconds and turns it back on with when any key is pressed. It took me a while to piece together how to do it so I’ll summarize the steps:

Step 1: On the laptop itself (not in the SSH hass add-on), type “login” and press enter i.e. ha > login. This didn’t work immediately for me but after a few tries, it worked. You should see a new line with # if it worked.

Step 2: Open file to edit with vim. # vi /mnt/boot/EFI/BOOT/grub.cfg

Step 3: Find the line starting with “default_cmdline=” and add “consoleblank=120” at the end of the line but before the double-quotes at the end of the line.
i.e. default_cmdline="rootwait <other stuff> consoleblank=120"
Note: To insert stuff in vim, press ‘i’ to enable insert mode. Edit the file. Then press ‘esc’ to exit insert mode. Then type :wq <ENTER> to save and exit vim.

Step 4: restart the laptop


Thanks, it works also on my Samsung series 7 laptop

Thanks @bitbrain for posting this grub.cfg command line modification solution!

For anyone who has implemented this update before Feb 2023, please be aware that you may have to repeat this edit due to a new grub.cfg. My laptop lid has been closed all this time and I had no idea that the screen had been turned back on after a HASS OS update.

I also see that there is logic in grub.cfg to read a text file /mnt/boot/cmdline.txt that will issue commands listed in it along with the default_cmdline commands. This file currently contains just “console=tty1”. I would assume we can add the consoleblank=xx command to this file instead of editing grub.cfg, but I haven’t tested it.

Was parsing cmdline.txt for additional commands a new addition for Intel/NUC grub bootloader, or normally included with grub?

1 Like

Here’s a way to make a service to set the brightness.

Tested on Home Assistant OS running on a Dell Latitude 7820
Based on the trick from @dglwilkins

1. Create the /config/set_backlight.sh file with this content:


if [ -z "$1" ]; then
    echo "Usage: $0 <brightness (0-100)>"
    exit 1

max_brightness=$(cat /sys/class/backlight/*/max_brightness)
scaled_brightness=$(( max_brightness * $1 / 100 ))
echo $scaled_brightness | tee /sys/class/backlight/*/brightness

2. Make it executable

chmod +x /config/set_backlight.sh

3. Add this to your configuration.yaml

  set_backlight: /config/set_backlight.sh "{{ brightness }}"

4. Restart Home Assistant

5. In the developer tools or an automation, call it like this:

service: shell_command.set_backlight
  brightness: 0 # from 0 to 100 percent