WIP Screensaver Disable RPI Backlight
#1
Hello,

I use a Raspberry Pi 3 together width the official 7" Display and Kodi as an audio player. At the beginning I use the screensaver "Black". But there are two problems width this:

1. The display isn't really black because the backlight is always on. So, you can see the display glowing in a dark room.
2. Touching the Display stops the screensaver and, in addition, starts the action on the screen behind the screensaver. Because of this I often switch to another song when I touch the display.

To get a better solution I wrote a new Screensaver: The Disable RPI Backlight Screensaver

This Screensaver only supports Kodi, installed on a Linux distribution (i.E. LibreElec), running on a Raspberry Pi connected to the official 7" Display. When somebody is out there with such a set-up, please test it and tell me your opinion. Thanks.


The plugin can downloaded from Github: https://github.com/sebastiansIT/RPI-Disp...sabler.zip

The source code is under GPLv3 also on Github: https://github.com/sebastiansIT/RPI-Disp...t-disabler
Reply
#2
Thanks for this - just what I was looking for, although I've adapted it slightly so that it works with a "standard" external HDMI EnergyStar-compliant monitor. To do this replace two lines in screensaver.py:

Code:
shellCommand = 'echo 1 > /sys/class/backlight/rpi_backlight/bl_power'
and
Code:
shellCommand = 'echo 0 > /sys/class/backlight/rpi_backlight/bl_power'

with...

Code:
shellCommand = 'vcgencmd display_power 0'
and
Code:
shellCommand = 'vcgencmd display_power 1'

which toggles the HDMI monitor powersaving / standby on & off from my Slice (RPi-based player)

Also - the current downloadable ZIP packaging won't allow the Addon to be manually installed, at least under Kodi 17. Needs to be structured as per here: http://stackoverflow.com/questions/28286...-incorrect with all files in a top-level folder within the ZIP named as per the Addon.

Thanks for a VERY useful addon,
Brgds Phil
Reply
#3
To support the package structure of Kodi 17.0, I have released an update to version 0.1.1. It's functional the same as the version 0.1.0, only changed the addon.xml and the packaging.
Reply
#4
Hello, to get yr screen saver works on OpenElec, OSMC, LibreElec you need to be root to send the command

i propose this

Code:
def onInit(self):
        self.log('Start Screensaver')
        self.exit_monitor = self.ExitMonitor(self.exit)
        shellCommand = 'echo 1 > /sys/class/backlight/rpi_backlight/bl_power'
    if os.geteuid() != 0:
        shellCommand = 'sudo bash -c \'' + shellCommand + '\''      
    os.system(shellCommand)

    def exit(self):
        self.exit_monitor = None
        shellCommand = 'echo 0 > /sys/class/backlight/rpi_backlight/bl_power'
    if os.geteuid() != 0:    
        shellCommand = 'sudo bash -c \'' + shellCommand + '\''
    os.system(shellCommand)
        self.close()
        self.log('Stop Screensaver')

inspired by https://github.com/marklam/PiTsOff/blob/...ensaver.py

Working on my OSMC box !

@+
Reply
#5
Hi airvb,

thanks for your tip. Can you tell me in which distribution Kodi isn't run with the root account? I use LibreElec at the moment and it works well without sudo.
Reply
#6
(2017-03-27, 19:11)SebastiansIT Wrote: Hi airvb,

thanks for your tip. Can you tell me in which distribution Kodi isn't run with the root account? I use LibreElec at the moment and it works well without sudo.

I try again with OSMC fresh install without sudo tip , not working

Ok with sudo !
Reply
#7
(2016-09-04, 12:34)SebastiansIT Wrote: Hello,

I use a Raspberry Pi 3 together width the official 7" Display and Kodi as an audio player. At the beginning I use the screensaver "Black". But there are two problems width this:

1. The display isn't really black because the backlight is always on. So, you can see the display glowing in a dark room.
2. Touching the Display stops the screensaver and, in addition, starts the action on the screen behind the screensaver. Because of this I often switch to another song when I touch the display.

To get a better solution I wrote a new Screensaver: The Disable RPI Backlight Screensaver

This Screensaver only supports Kodi, installed on a Linux distribution (i.E. LibreElec), running on a Raspberry Pi connected to the official 7" Display. When somebody is out there with such a set-up, please test it and tell me your opinion. Thanks.


The plugin can downloaded from Github: https://github.com/sebastiansIT/RPI-Disp...sabler.zip

The source code is under GPLv3 also on Github: https://github.com/sebastiansIT/RPI-Disp...t-disabler

I just tried your Addon with "OpenELEC-RPi2.arm-8.0.4.img" (Krypton) and its working just fine.
(Raspberry Pi 3 + 7" Pi touchscreen)

Thank you!
Reply
#8
Is there a way to integrate this method into the Shutdown-script?
(Openelec 8.0.4 / Kodi Krypton)

btw.
Your screensaver is working perfectly...Thank you again.
It would be really nice to have an option within your Screensaver to select a "starting screensaver")

This way you could start the selected "starting Screensaver" first, and after XY-Min. your Screensaver starts-up to disable the Screen.
Just a small idea because i like to display different informations as Screensaver like Weather, Time, Date ...

greetings from Germany
Danke nochmal Wink
Reply
#9
Hi Doerek,

which method to you wish to integrate on shut down? Disabling the Display is a natural feature of power less devices Smile

I don't know if a screensaver can control another screensaver. I think the other way is much easier to implement: Look for your favourite screensaver and ask the author to integrate a function to dim the display after x minutes.

Thanks (also from Germany) for your feedback.
Reply
#10
(2017-08-03, 19:32)SebastiansIT Wrote: Hi Doerek,

which method to you wish to integrate on shut down? Disabling the Display is a natural feature of power less devices Smile

Hi,

I thought perhaps there could be a quick'n dirty (easy) way to disable the Touchscreens' Backlight right before the Pi shuts down completly. (Openelec 17; Krypton)
Because...if you power down the Pi and leave it connected to the power supply, you get a non-stopping white/Black flicker on the Screen.
(for example: integrate parts of your code into the shutdown process, or something like that)

Up-to-date Raspbian handles the shutdown perfectly...as far i remember
On the other Hand, i think this is actually the work of the "Openelec guys". Smile
Nevermind...

(2017-08-03, 19:32)SebastiansIT Wrote: I don't know if a screensaver can control another screensaver. I think the other way is much easier to implement: Look for your favourite screensaver and ask the author to integrate a function to dim the display after x minutes.
Yeah...i know what you mean.
It was just a quick thought on how you could keep using any Screensaver (e.g. your favorite, that displays information) and still have the Screen turn off after some Time.
no matter which one one is your Favorite

btw.
There should be a Repo where we can download your screensaver, just for good measures, Smile
I've tested countless Kodi builds in the last Year(s) and your addon is the key to actually use any of them with the 7" Touchscreen as a dedicaded Mediacenter, because none of them offerd an option to turn off the Screen.
Reply
#11
(2017-08-21, 14:09)doerek Wrote: I thought perhaps there could be a quick'n dirty (easy) way to disable the Touchscreens' Backlight right before the Pi shuts down completly. (Openelec 17; Krypton)
Because...if you power down the Pi and leave it connected to the power supply, you get a non-stopping white/Black flicker on the Screen.
(for example: integrate parts of your code into the shutdown process, or something like that)

I have write you a shut-down script for LibreELEC (OpenELEC should also work). This Script disables the backlight. Copy the Script to /storage/.config and it would work. For more Information about shut-down scripts see "Kodi 17 - Script when kodi shutdown"
Reply
#12
Thank you very much for this Screensaver Addon!
It works great with LibreELEC 8.2.4 on my raspi 1B together with the official 7" touchscreen.
Reply
#13
Smile 
Works like a charm on RPi 3b/7" Touchscreen with LibreElec 8.2.5.

Thanks a lot for providing us with a simple yet very useful add-on!
Reply
#14
(2016-09-04, 12:34)SebastiansIT Wrote: Hello,

I use a Raspberry Pi 3 together width the official 7" Display and Kodi as an audio player. At the beginning I use the screensaver "Black". But there are two problems width this:

1. The display isn't really black because the backlight is always on. So, you can see the display glowing in a dark room.
2. Touching the Display stops the screensaver and, in addition, starts the action on the screen behind the screensaver. Because of this I often switch to another song when I touch the display.

To get a better solution I wrote a new Screensaver: The Disable RPI Backlight Screensaver

This Screensaver only supports Kodi, installed on a Linux distribution (i.E. LibreElec), running on a Raspberry Pi connected to the official 7" Display. When somebody is out there with such a set-up, please test it and tell me your opinion. Thanks.


The plugin can downloaded from Github: https://github.com/sebastiansIT/RPI-Disp...sabler.zip

The source code is under GPLv3 also on Github: https://github.com/sebastiansIT/RPI-Disp...t-disabler

Hello!  Your screensaver looks great!  I have the same setup: Raspberry Pi with official 7" display, and I'm trying to adjust the backlight based on ambient light using the VCNL4010 from adafruit.  I have a script that works when I execute it in Raspbian, but I can't get it to work in Kodi (LibreElec).  Can you please help me?  My script that works in Raspbian is:

python:
#!/usr/bin/python

#This script controls the automatic backlight dimmer
import time
import board
import busio
import adafruit_vcnl4010
import rpi_backlight as bl

i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_vcnl4010.VCNL4010(i2c)

while True:
    time.sleep(.100)
    al = sensor.ambient_lux
    if al >= 0.25 and al <= 4095:
        bl.set_brightness(64, smooth=True, duration=3)
    elif al > 4095 and al <= 8191:
        bl.set_brightness(128, smooth=True, duration=3)
    elif al > 8191 and al <= 12286:
        bl.set_brightness(192, smooth=True, duration=3)
    elif al > 12286 and al <= 16383:
        bl.set_brightness(255, smooth=True, duration=3)
    else: 
        False

I execute it in Kodi via SSH on Windows 7 with this command:

kodi-send --action="RunScript(/pathtoscript/scriptname)"

But it doesn't work.  With Kodi running on my RPi, the screen does wake up from sleep mode once I run the script, but it's unresponsive to changes in light.  I know this is a little off topic, and years old, but I'm desperate for help.  Can you please help me?
Reply
#15
Hi dud3rs,

I doesn't use the python library you use. Instead I call directly shell commands to change the backlight power.
  1.  I have take a short look at the project page of rpi-backlight. Part of this Python package is a CLI. Have you try to call this manually in a SSL-Terminal? Doing so show you the package works or not.
  2. Have you changed the backlight rules like it is mentioned in the installation instructions of rpi-backlight?
  3. Print out the value of your sensor to see if this component works like you expect it?
Hope this helps
Reply

Logout Mark Read Team Forum Stats Members Help
Screensaver Disable RPI Backlight2