Turn off screen on laptop when not being used interactively

Can someone advise me as to how and where to have a command run when the automatic interactive logoff is triggered?

Can someone advise me as to how and where to have a command execute when a single interactive login attempt fails?

Here’s why I’m asking:
I’m running IPFire on a notebook computer to take advantage of the built-in battery backup. I’d like to turn off the backlight on the LCD screen so that the panel does not use as much energy and also so that it does not fail prematurely. This topic was touched on previously six years ago in this thread, but no solution was found that I can see about the screen Laptop screen saver and IPFire compatible wifi cards and USB sticks - Hardware - IPFire Community (I think that it was marked solved because of the discussion around networking in the same question.)

During interactive use, I can run this command to turn off the panel:
echo 0 > /sys/class/backlight/intel_backlight/brightness

and this command to turn it on to a reasonable level afterwards:
echo 10000 > /sys/class/backlight/intel_backlight/brightness
(The max_brightness file in the same path will tell you what your PC’s hardware is calibrated to, if you’re following along.)

I’d like to extend the automatic logoff of interactive sessions after a given time to run the above echo zero command, and I’d like to find a way to have a single failed login attempt trigger the echo 10000 command. In this way, the back light will be off most of the time and will automatically come on when needed.

For distributions that use PAM, the second of these is handled by this:
linux - Running a shell script on n failed login attempts - Unix & Linux Stack Exchange

but IPFire does not use PAM for normal logins so far as I can see.

Thanks for your help!

Consider to share the model of the laptop.
Some allows to configure in UEFI/Bios some parts of energy saving settings (while not that much in recent decades).

I can dig up the exact model number, but it doesn’t help with this issue. The reason it does not help is because I need to do this to a couple of different machines from multiple manufacturers. Some of them are converted chrome books and so you’d find the eufy available from Mrchromebox.tech, but none of them have exposed backlight control features.

I could imagine someone else might find it useful to run other controls when the automatic interactive logoff timer runs, or on a failed login. So, if there is a way of doing these things, it’s probably more helpful than for just my LCD backlight control.

Using manual control of the LCD backlight, I measured a power draw difference of about 2 W when I turned it off versus leaving it on. So, for people with electricity rates like in California, having the backlight off saves them about $10 a year. For anyone in Germany, who pays even higher electric areas, the savings (and also the environmental impact) would be even more.