add-ons / screensaver.turnoff

Kodi screensaver that turns your screen off to save power
Other
21 stars 14 forks source link

kodi on raspberry pi display_power command gives exception #8

Open rocus opened 5 years ago

rocus commented 5 years ago

I use this plugin to switch off my TV. The only method that works is turning the display_power off. I confirmed this on the command line of the raspberry: vcgencmd display_power 0. The plugin gives an error message when it cuts the display_power:

NOTICE: [Turn Off] Turn display signal off using method 2 ERROR: [Turn Off] Exception running 'vcgencmd': [Errno 2] No such file or directory When I change in the screensaver.py (the python file of this plugin) the lines "vcgencmd display_power 0/1" the text "vcgencmd" in "/opt/vc/bin/vcgencmd" the plugin works correctly.

unalterable commented 5 years ago

try creating a symbolic link where it expects vcgencmd to be:

sudo ln -s $(which vcgencmd) /usr/bin/vcgencmd

I believe this addon was made for raspbian and libreelec which store the vcgencmd in /usr/bin/vcgencmd. But OSMC and some other OSs install vcgencmd in: /usr/bin/vcgencmd

Looking at the code, i can't see why this error occurs - but the symbolic link worked for me.

rocus commented 5 years ago

You made a "small" typo at the end of your reply,"unalterable". OSMC install vcgencmd in the directory /opt/vc/bin. In a shell this directory is in the path. In Kodi it is apparently not. My solution was a change in the python file itself but your solution is the better one. (because updates destroy my solution)

By the way, I am not completely satisfied with this screensaver solution to turn of my TV. If the display power of the raspberry is turned off, the TV set shuts down (goes into standby) after some time and that is what I want.

But I prefer to turn off the TV with the CEC command but that does not work. I use Yatse as the remote for my Kodi raspberry and now the question is: who's fault is it. I would like to make a small (python) program that is supposed to send the "turn off" command to the TV set. I have sent an email to the TV maker support group but they answered with the suggestion to turn on the CEC command mode. If I had not done that already .

I could not find much documentation on this subject. Do you know of a simple program that sends CEC commands to the TV set? I am inclined to say the TV set is at fault and not Kodi. But I would like to have "hard" evidence.

Thanks very much.

rocus commented 5 years ago

To answer my own question: the raspberry and other linux systems have a tool cec-client that lets you control an attached TV. Because I am now not near my TV set I can not see results but because I can reach my OSMC / Kodi raspberry over the internet I can see the TV responds to the cec-client commands. To be continued...

dagwieers commented 5 years ago

I don't want to exclude CEC bugs (or incompatibilities) on Raspberry Pi, but some devices simply do not support CEC (like computer monitors or some TVs) or in some cases CEC is undesirable (projectors) and being able to remove the HDMI signal does work fine in those cases.

dagwieers commented 5 years ago

The problem with your PATH and Kodi is that Kodi was not started from a normal shell, and therefore does not get the same PATH (usually a very dumbed down PATH).

You have to report this to your Kodi platform upstream or packager so they can include a more extensive PATH so Kodi add-ons can find those useful tools. IMO these tools ought to go into standard binary paths (/bin or /usr/bin) rather than anything custom though.

FallingSnow commented 5 years ago

Adding the following to /etc/environment places /opt/vc/bin in all environments.

PATH=/opt/vc/bin