onevent script abort condition when status changes (to prevent execution) to trigger smart wall socket #909
Replies: 3 comments 1 reply
-
Can we change this into a feature request maybe? (not quite sure how this is handled here). My script for librespot has a lot of hickups sadly / is not reliable. Shairport-Play (it's an Apple Airplay implementation) handles this fantastically. https://github.com/mikebrady/shairport-sync/ There I can achieve this by only adding two scripts to the config – and it works flawlessly – the "heavy lifting" is done in the codebase and it's not needed to figure out a complex logic in bash / python:
This is the code behind it (if that is of any help):
|
Beta Was this translation helpful? Give feedback.
-
/usr/local/bin/webhook_p3_amp_off_script.sh
/etc/default/raspotify-turnon-speakers.sh
and in /etc/default/raspotify
this works! It checks whether a process has high CPU load and if so doesn't turn off the amp. My script checks for librespot and shairpoint. Really cool! |
Beta Was this translation helpful? Give feedback.
-
I have found a workaround
this will check if one of the top processes is either shairport or librespot – if either of it is true, no turning off. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey!
Using the onevent feature for quite a time now but never managed to make it work properly to shut down my smart wall socket after pressing pause (and then leaving home) – which results in my speaker to stay powered on (which is obviously not very smart). So I reworked it a bit and now seems to work ... but now when I press pause and then press play again the script will trigger anyways. Which is also a problem (pressing play / pause sequentially a few times will trigger the scripts as many times as pressed...).
My script currently looks like this:
I figure I need another condition after sleep 10 to exit further execution of the script. Any idea how I can achieve this? Some kind of sub if-condition? Is that possible?
Beta Was this translation helpful? Give feedback.
All reactions