Monitor onScreensaverActivated
#1
I would like to notify Home Assistant based when the screensaver is activated and deactived.
So first I would like to write an addon that just log when the service addon notice that this has happend.

After looking at:
https://kodi.wiki/view/Service_add-ons
https://alwinesch.github.io/group__pytho...bd7e0ec797

I thought this would work, but only the service log is shown in the log. What am I missing?
python:

import time
import xbmc

if __name__ == '__main__':
monitor = xbmc.Monitor()
xbmc.log("screenserver service", level=xbmc.LOGNOTICE)

while not monitor.abortRequested():
    if monitor.onScreensaverActivated():
        xbmc.log("onScreensaverActivated", level=xbmc.LOGNOTICE)
    if monitor.onScreensaverDeactivated():
        xbmc.log("onScreensaverDeactivated", level=xbmc.LOGNOTICE)
Reply
#2
You can't call onScreensaverActivated() to check screensaver state, it's a callback.
You need to create your own class derived from monitor and declare callbacks there.
Reply

Logout Mark Read Team Forum Stats Members Help
Monitor onScreensaverActivated0