The entire rule is
when Doorbell signals present or when Doorbell2 signals present then execute "/home/pi/bin/capture.sh 2>/dev/null"
When i remove the /dev/null part i get nothing in pimatic.log. The trigger should be fine, it works when i choose to send an email instead of running a script.
-
Rule not executed
-
Can you try sudo in front of the execute?
Is the parameter “2” correct ?Like my projects and help? Consider donating electroneum etnjwAKGPqF6omQWRmpp9u2BPyVDG9VuyRQjNJ1S8yfBdfR9qeUQ46kRy8KS2CNqbpNLRrsgmNW6F2TMzxmZgPrh6KctrkrYbm
-
@koffienl sudo doesn’t help either. The 2> /dev/null means to redirect all errors produced by this command to /dev/null, that is discard them, and don’t display them to the screen. This also works fine on the commandline.
-
@fregger please enable logging on the rule and check if the rule is executed at all. Regarding your
capture.sh
script does this terminate normally? What is the exit status of the script? You can check this by executeingecho $?
immediately after executing yourcapture.sh
script."It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig Logging is enabled and it looks like the rule is not executed at all, i just don’t understand why not. The exit status of the script is 0 so that seems to be ok.
-
Is capture.sh executable?
Maybe you need to do a
chmod +x capture.sh
-
@rrooggiieerr yes
-rwxr-xr-x 1 pi pi 167 Feb 21 23:17 capture.sh
I must be overlooking something… -
and what about using something like
execute "sudo bash /home/pi/bin/capture.sh 2>/dev/null"
?
(or without the sudo-part) -
What about if you rewrite your script to:
#!/bin/bash DATE=$(date +"%Y-%m-%d_%H%M%S") <path to>/fswebcam -r 640x480 /home/pi/webcam/$DATE.jpg
Thus with newlines and the full path to fswebcam
And is fswebcam executable?
-
I seem to have found the culprit!
I also have this rule:
when pimatic is starting then execute "/home/pi/bin/resetlcd.sh& 2>/dev/null"
of which the script is:
#!/bin/sh pkill -f mylcd.py python /home/pi/python/mylcd.py&
mylcd.py on its turn (re)starts the info on my lcd screen. After disabling this my capture script is finally triggered.Thanks, you guys are the best with all the suggestions, that’s why i love pimatic!
Although now offcourse i have another problem, how to make the lcd screen work
-
@fregger said in Rule not executed:
I seem to have found the culprit!
Sorry, I don’t get this! Why should the one rule affect the other?
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig I haven’t figured that out yet.
-
@mwittig Could it be because the python script for the lcd screen runs in a loop?
-
@fregger said in Rule not executed:
I seem to have found the culprit!
I also have this rule:
when pimatic is starting then execute "/home/pi/bin/resetlcd.sh& 2>/dev/null"
of which the script is:
#!/bin/sh pkill -f mylcd.py python /home/pi/python/mylcd.py&
mylcd.py on its turn (re)starts the info on my lcd screen. After disabling this my capture script is finally triggered.Thanks, you guys are the best with all the suggestions, that’s why i love pimatic!
Although now offcourse i have another problem, how to make the lcd screen work
What kind of LCD screen? There is a LCD plugin for pimatic
Like my projects and help? Consider donating electroneum etnjwAKGPqF6omQWRmpp9u2BPyVDG9VuyRQjNJ1S8yfBdfR9qeUQ46kRy8KS2CNqbpNLRrsgmNW6F2TMzxmZgPrh6KctrkrYbm
-
@koffienl I know, but i understand that it’s only for an lcd screen with an i2c. My 16x2 lcd screen is directly connected to the gpio, without an i2c, so i guess i can’t use the plugin. Or can i?
-
Correct, I2C only
Like my projects and help? Consider donating electroneum etnjwAKGPqF6omQWRmpp9u2BPyVDG9VuyRQjNJ1S8yfBdfR9qeUQ46kRy8KS2CNqbpNLRrsgmNW6F2TMzxmZgPrh6KctrkrYbm
-
@fregger said in Rule not executed:
Could it be because the python script for the lcd screen runs in a loop?
Yes, indeed. This may have caused the troubles. Shell scripts are expected to terminate. You can do so by creating a wrapper script if it is not possible to rewrite the script so that it’ll terminate. We had a similar topic on this a couple of weeks ago. See https://forum.pimatic.org/topic/2699/solved-shell-switch-timeout/3
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
@mwittig Nice, i’ll try that!
Again: thanx for all the help guys!