There have been some requests to control behaviour when Vero 4K / 4K + is put in to or woken from standby using via the Power → Suspend option.
It is now possible (as of the 2018-12.1 update) to run scripts when toggling standby state.
You can place Python scripts accordingly:
If your script is in the right place, you should see the following in your log (debug logging is not required):
CApplication::ToggleStandby – script /home/osmc/.kodi/userdata/wake.py found
CApplication::ToggleStandby – script /home/osmc/.kodi/userdata/standby.py found
These are run via Kodi’s context, so you can
import xbmc and use internal Kodi functions.
thanks sam, very useful to control the rest of the media setup.
is the mentioned update a “official” one? I’m not yet familiar with the update cycle on the vero… is there any link to a post to catch up?
That update should be out later today. Check in MyOSMC or wait for the announcement here. If you are not on automatic updates, download it manually.
thanks grahamh, is there any kind of changelog?
A link to the blog post will be provided on this forum at time of release.
have seen this by accident in the logs and just tried out - worked first try!
Now my Hyperion setup survives standby/resume cycles without manually restarting the hyperion service!!!
you == legend.
I’m trying to get my Vero to stop responding to ping requests during standby. I’ve tried the following:
os.system('sudo echo "1" >/proc/sys/net/ipv4/icmp_echo_ignore_all')
os.system('sudo echo "0" >/proc/sys/net/ipv4/icmp_echo_ignore_all')
However this does not work, the file is not written to (checked by FTP). I see in the Kodi logs that the scripts are called. Obviously the Python syntax is wrong. Can someone help? Thanks!
I think its because standby.py & wake.py are run by kodi they are not being run with super user rights. I think the following should get round that:
os.system('/bin/bash -c "echo "1" | sudo tee /proc/sys/net/ipv4/icmp_echo_ignore_all"')
os.system('/bin/bash -c "echo "0" | sudo tee /proc/sys/net/ipv4/icmp_echo_ignore_all"')
This did the trick! Thanks a lot and Happy New Year!
Is there a way to run a bash script on standby or wakeup?
Yes, the above examples are exactly that. You call open a bash which then can execute a command or a script.
Thank you, I got it to work with
os.system('sudo /bin/bash -c /home/path to my script here.sh')
I had to add the sudo though as it wouldn’t run without it. The script just creates a simple text file, which is owned by the osmc user when it’s finished so it will be OK doing it this way?
Did the script had execution flag set for user and is owned by user osmc?