Kodi Community Forum
Release Turn Off screensaver - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Look and feel (https://forum.kodi.tv/forumdisplay.php?fid=178)
+---- Thread: Release Turn Off screensaver (/showthread.php?tid=331076)

Pages: 1 2 3 4


RE: Turn Off screensaver - mariofenech - 2023-03-05

(2023-03-05, 15:09)Nickg102 Wrote: Hi, not sure if you are still working on this at all, as it is many years later, but as of right now the add on is not working, and its EXACTLY what i need haha
What s not working?
Working fine on matrix even on nexus on Libreelec.


Turn Off on KODI/LibreELEC/RPi - tinca - 2023-05-29

Hello,

This is the functionality that I've been looking for some time!
My KODI runs on LibreELEC 9.2.8 and RPi 3B which is connected to a Samsung TV.
Now, I cannot make this add-on work. In the Screensaver session I tried all the available setting, but Preview didn't react.
KODI is mostly controlled by the TV's remote (via CEC), so at least that was supposed to work.

Is there anything more I can try?

Thank you!


RE: Turn Off on KODI/LibreELEC/RPi - mariofenech - 2023-05-30

(2023-05-29, 19:11)tinca Wrote: Hello,

This is the functionality that I've been looking for some time!
My KODI runs on LibreELEC 9.2.8 and RPi 3B which is connected to a Samsung TV.
Now, I cannot make this add-on work. In the Screensaver session I tried all the available setting, but Preview didn't react.
KODI is mostly controlled by the TV's remote (via CEC), so at least that was supposed to work.

Is there anything more I can try?

Thank you!

Did you go to settings - interface - screensaver and set screensavermode to Turn Off?


RE: Turn Off on KODI/LibreELEC/RPi - tinca - 2023-05-30

(2023-05-30, 01:11)mariofenech Wrote: Did you go to settings - interface - screensaver and set screensavermode to Turn Off?
Yes I did.


RE: Turn Off screensaver - mariofenech - 2023-05-30

Strange it works fine for me also on Libreelec Rpi but LE11 not LE9 altough it was always working since 9..I just use the cec option..


RE: Turn Off screensaver - mariofenech - 2023-05-30

What happens when you run command
Code:
kodi-send --action="CECStandby"



RE: Turn Off screensaver - tinca - 2023-05-30

Code:
LibreELEC:~ # kodi-send --action="CECStandby"
Sending: {'content': 'CECStandby', 'type': 'action'}
And after this the TV switched-on. Executing it again switched-off. If I get it right I need to retry, because it is supposed to work?


RE: Turn Off screensaver - mariofenech - 2023-05-30

Iff that works...addon should be working...you might need to post a log...
Are you using an official LE built?


RE: Turn Off screensaver - tinca - 2023-05-30

Yes it is the official 9.2.8 created by the LibreELEC image creator.

Before creating a log a sanity check: I want it to use for switching off the TV during music playback to save energy. Until a year ago I used this LELEC version 9, and as far as I remember I could switch off the TV (with the remote using CIC) and the play went on. Then used version 10 for a while, but had some problem with it, so reinstalled 9. But now I cannot do the same setup, switching off the TV turns off the music as well. That's why I am trying this add-on.


RE: Turn Off screensaver - tinca - 2023-05-30

One more thing: when I execute your command line during playback, it switches off the TV, but stops the playback as well, although I unticked the related option.


RE: Turn Off screensaver - mariofenech - 2023-05-31

Ok now I m understanding better what you need it for..but I think you cannot do that as CEC standby puts the TV on standby and that means also the speakers...
Your solution is this:
1) You output your sound to something else rather then the TV speakers and that has to be directly from Raspberry pi...You either use a bluetooth speaker or a sound system that connects to the raspberry pi via hdmi passtrough then from sound system to TV...another option is to connect audio from the headphone jack...
2) you go to Settings->System->Input->Peripherals->CEC Adapter->Action when switching to another source-> Ignore or None (whatever is available)

Then switch OFF your TV normally from remote and sound is still coming out of your speakers..


RE: Turn Off screensaver - tinca - 2023-05-31

Thank you for helping me way beyond the scope of this thread :-)
And my apologies that I did not make it clear up front what I am up to. Still, there is the other half of this story: I have a DAC on my RPi and the sound is outputted into an external amp. I do not know if it has any relevance, but with this reinstalled LELEC version there came another change I do not recall to have earlier: the sound device of the DAC (smth like snd_hifiberry_rpi_dac) is supposed to work, but it does not, instead it works with Pi:HDMI (of course I configured the card as it was prescribed). It seems to be a strange thing.


RE: Turn Off screensaver - mariofenech - 2023-05-31

(2023-05-31, 08:51)tinca Wrote: Thank you for helping me way beyond the scope of this thread :-)
And my apologies that I did not make it clear up front what I am up to. Still, there is the other half of this story: I have a DAC on my RPi and the sound is outputted into an external amp. I do not know if it has any relevance, but with this reinstalled LELEC version there came another change I do not recall to have earlier: the sound device of the DAC (smth like snd_hifiberry_rpi_dac) is supposed to work, but it does not, instead it works with Pi:HDMI (of course I configured the card as it was prescribed). It seems to be a strange thing
That seems a good setup if you need sound output while TV is on standby..
About your hifiberry issue I suggest you ask on the Libreelec forum..


RE: Turn Off screensaver - tinca - 2023-05-31

Thank you!


RE: Turn Off screensaver - abga - 2023-07-11

I had a more specific need for such a screen saver due to my dumb Philips monitor that always auto-switches between video signal inputs. Therefore I started to hack a little bit the source code of this add-on, considering to share my experience here.

I have a setup where I'm using Kodi (Matrix) mainly for playing audio streams (internet radio) in the background during the day and sharing a single monitor for both Kodi, running itself on a Linux thin client connected on DP and my workstation connected on HDMI.
Now, if my workstation puts the screen in standby, the dumb Philips monitor auto-switches (cannot disable the function - stupid OSD - made in China) to the next available video input - an that'll be Kodi on DP.

First, the only reliable way to suspend the monitor on Linux (x86) looks to be using xrandr and the code from this add-on is broken (simple Python syntax and xrandr arguments, both are wrong).
I used this package and unzipped it:
https://github.com/add-ons/screensaver.turnoff/releases/download/v0.10.3/screensaver.turnoff-0.10.3+matrix.1.zip
Edited the file screensaver.py - see here the source online:
https://github.com/add-ons/screensaver.turnoff/blob/master/screensaver.py
Not a Python coder myself, quite the contrary - a total noob, but learned from here the proper syntax for executing command line programs with arguments (need to split all arguments):
https://docs.python.org/2/library/subprocess.html#popen-constructor
So, in screensaver.py I commented the nonfunctional CRT-0 related lines and substituted with mine:
 
Code:
    dict(name='dpms-xrandr', title='DPMS (using xrandr)',
         function='run_command',
#         args_off=['xrandr', '--output CRT-0', 'off'],
#         args_on=['xrandr', '--output CRT-0', 'on']),
         args_off=['xrandr', '--display', ':0.0', '--output', 'DP-1', '--off'],
         args_on=['xrandr', '--display', ':0.0', '--output', 'DP-1', '--auto']),
Note that to enable the display with xrandr you have to use auto and not on. Then, to learn which video output (in my case Display Port 1)  you're using - run on the console:
 
Code:
xrandr -display :0.0 -q

Packed back the Addon zip file and side loaded it (Add-ons - install from ZIP file) into Kodi. Tested it and all worked fine (had to disable mute audio in the Addon config).
All worked fine except that it didn't execute while I was playing audio streams because for a reason I don't fully understand, the developer considered to add a conditional checking at the end of screensaver.py.
It checks the state of the player and if it's in use (playing) with some media, then it doesn't start the screensaver Smile
But all this logic and conditional checking is already available inside Kodi. And, Kodi itself doesn't start the whatever screensaver is installed if video media is played, it does only for audio playback if no visualization is active (which makes perfect sense).
Now, before further butchering screensaver.py, I tried to just substitute the checking for Player.HasMedia with Player.HasVideo and failed - see the reference:
https://xbmc.github.io/docs.kodi.tv/master/kodi-base/d5/d11/modules__infolabels_boolean_conditions.html

Finally I did the "right thing" and commented the whole useless conditional checking at the end of screensaver.py
See:
https://github.com/add-ons/screensaver.turnoff/blob/master/screensaver.py
 
Code:
def run():
    ''' Runs the screensaver '''
#    from xbmc import getCondVisibility

    # If player has media, avoid running
#    if getCondVisibility("Player.HasMedia"):
#        log(1, 'Screensaver not started because player has media.')
#        return

    TurnOffDialog('gui.xml', addon_path(), 'default').doModal()

Now I have a functional ScreenSaver that activates on idle and when playing audio without visualizations. Smile