Beta [Plugin] Hdmi on/off
#1
Hi guys! I've made a plugin based on the Denny's ([email protected]) plugin for Kodi. My problem was that with Raspberry Pi and Openelec, if you use a PC monitor, when the screensaver is on, in the better case the screen turns black but the monitor is still on.

This screensaver plugin will turn off the hdmi when starts and on when it goes off without needing restart Kodi (improvement to the Denny's plugin).

Here is the plugin:
https://goo.gl/i5d9Cq

Comments and suggestions are welcome!
Reply
#2
Cool! Was looking for something like this. Will try this on OSMC and report back.

If it works on OSMC, is it alright if I post this on the OSMC-forums?
Reply
#3
Of course! Thanks for testing it! Wink i'll wait for your report!
Reply
#4
Unfortunately fails on OSMC (which is based off of Debian Jessie).
Relevant log:
Code:
21:15:29 T:1956614144   DEBUG: CAnnouncementManager - Announcement: OnScreensaverActivated from xbmc
21:15:29 T:1956614144   DEBUG: GOT ANNOUNCEMENT, type: 4, from xbmc, message OnScreensaverActivated
21:15:29 T:1956614144   DEBUG: Activating window ID: 12900
21:15:29 T:1751544864   DEBUG: service.libraryautoupdate-0.9.7 : screen saver on
21:15:30 T:1956614144   DEBUG: ------ Window Deinit (SettingsCategory.xml) ------
21:15:30 T:1956614144   DEBUG: ------ Window Init () ------
21:15:30 T:1639969824  NOTICE: Thread LanguageInvoker start, auto delete: false
21:15:30 T:1639969824    INFO: initializing python engine.
21:15:30 T:1639969824   DEBUG: CPythonInvoker(28, /home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py): start processing
21:15:30 T:1639969824  NOTICE: -->Python Interpreter Initialized<--
21:15:30 T:1639969824   DEBUG: CPythonInvoker(28, /home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py): the source file to load is "/home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py"
21:15:30 T:1639969824   DEBUG: CPythonInvoker(28, /home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py): setting the Python path to /home/osmc/.kodi/addons/script.screensaver.hdmioff:/usr/lib/python2.7:/usr/lib/python2.7/plat-arm-linux-gnueabihf:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gtk-2.0
21:15:30 T:1639969824   DEBUG: CPythonInvoker(28, /home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py): entering source directory /home/osmc/.kodi/addons/script.screensaver.hdmioff
21:15:30 T:1639969824   DEBUG: CPythonInvoker(28, /home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py): instantiating addon using automatically obtained id of "script.screensaver.hdmioff" dependent on version 2.1.0 of the xbmc.python api
21:15:30 T:1639969824   ERROR: EXCEPTION: Could not get AddonPtr given a script id of script.screensaver.xbian-hdmioff.If you are trying to use 'os.getcwd' to set the path, you cannot do that in a version 2.1.0 plugin.
21:15:30 T:1639969824   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.RuntimeError'>
                                            Error Contents: Could not get AddonPtr given a script id of script.screensaver.xbian-hdmioff.If you are trying to use 'os.getcwd' to set the path, you cannot do that in a version 2.1.0 plugin.
                                            Traceback (most recent call last):
                                              File "/home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py", line 7, in <module>
                                                Addon = xbmcaddon.Addon('script.screensaver.xbian-hdmioff')
                                            RuntimeError: Could not get AddonPtr given a script id of script.screensaver.xbian-hdmioff.If you are trying to use 'os.getcwd' to set the path, you cannot do that in a version 2.1.0 plugin.
                                            -->End of Python script error report<--
21:15:30 T:1956614144   DEBUG: ------ Window Init (DialogKaiToast.xml) ------
21:15:30 T:1639969824    INFO: Python script stopped
21:15:30 T:1639969824   DEBUG: Thread LanguageInvoker 1639969824 terminating
21:15:35 T:1956614144   DEBUG: ------ Window Deinit (DialogKaiToast.xml) ------
21:15:38 T:1956614144   DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x0000, modifier: 0x0
21:15:38 T:1956614144   DEBUG: CGUIWindowManager::PreviousWindow: Deactivate
21:15:38 T:1956614144   DEBUG: started alarm with name: sssssscreensaver
21:15:38 T:1956614144   DEBUG: ------ Window Deinit () ------
21:15:38 T:1956614144   DEBUG: CGUIWindowManager::PreviousWindow: Activate new
21:15:38 T:1956614144   DEBUG: ------ Window Init (SettingsCategory.xml) ------
21:15:38 T:1956614144   DEBUG: CAnnouncementManager - Announcement: OnScreensaverDeactivated from xbmc
21:15:38 T:1956614144   DEBUG: GOT ANNOUNCEMENT, type: 4, from xbmc, message OnScreensaverDeactivated
21:15:38 T:1956614144   DEBUG: OnKey: return (0xf00d) pressed, screen saver/dpms woken up
21:15:38 T:1751544864   DEBUG: service.libraryautoupdate-0.9.7 : screen saver off
21:15:39 T:1956614144   DEBUG: Keyboard: scancode: 0x66, sym: 0x0116, unicode: 0x0000, modifier: 0x0
21:15:39 T:1956614144   DEBUG: OnKey: home (0xf088) pressed, action is back
Reply
#5
Installed the original plugin (as it seemed to be needed according to the log) unfortunately that doesn't solve the issue, the screen just displays message that HDMI is going to be turned off but then nothing happens

Code:
00:18:17 T:1620046880  NOTICE: 1 Python Screensaver Started
00:18:18 T:1620046880  NOTICE: 2 Screensaver: onInit
00:18:23 T:1505752096  NOTICE: Thread AlarmClock start, auto delete: false
00:18:23 T:1620046880  NOTICE: 3 ExitMonitor: sending exit_callback
00:18:23 T:1620046880  NOTICE: 4 Screensaver: Exit requested
00:18:23 T:1620046880  NOTICE: 5 Python Screensaver Exited
00:18:23 T:1620046880   ERROR: CPythonInvoker(16, /home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py): failed to run the gc to clean up after running prior to shutting down the Interpreter
00:18:23 T:1620046880 WARNING: CPythonInvoker(16, /home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py): the python script "/home/osmc/.kodi/addons/script.screensaver.hdmioff/default.py" has left several classes in memory that we couldn't clean up. The classes include: N14PythonBindings42XBMCAddon_xbmcgui_WindowXMLDialog_DirectorE,N14PythonBindings31XBMCAddon_xbmc_Monitor_DirectorE
00:18:26 T:1620046880  NOTICE: Thread LanguageInvoker start, auto delete: false
00:18:26 T:1683346464  NOTICE: Previous line repeats 1 times.
Reply
#6
It seems that the plugin depends of a different version of python. Try running the following command from ssh:

vcgencmd display_power 0

To turn off the HDMI and the same with 1 to turn on. If it works we can try to build a new plugin compatible with your version of python and OS.
Reply
#7
That works perfectly!
Reply
#8
Ok! Great then! My plugin only calls to that command when the screensaver turns on.
We only have to start from a working plugin forma your os and modify it to run that command.
I invite you to unzip my plugin and see the code.

Contact me if you have any dobut!
Reply
#9
Is the monitor completely turned off?
Reply

Logout Mark Read Team Forum Stats Members Help
[Plugin] Hdmi on/off0