Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom commands on motion detected. #373

Open
rayzorben opened this issue Dec 4, 2019 · 4 comments
Open

Add support for custom commands on motion detected. #373

rayzorben opened this issue Dec 4, 2019 · 4 comments
Assignees
Milestone

Comments

@rayzorben
Copy link
Contributor

Would like to call out to my own service/webhook/application when motion is detected. This could be things like

  • IFTTT
  • Pushover
  • Home Assistant

For example, my main use is Pushover as it seems the fastest in sending me alerts when motion is detected. IFTTT is 5-10 seconds, Email can be 1 second or 20 seconds. Pushover when called directly seems to be under 1 second. https://support.pushover.app/i44-example-code-and-pushover-libraries

However, it would be nice to support it in a generic way, whether that is calling out via shell exec to a command line application or?

It would support a set of variables such as
Device e.g., Front Porch
Username e.g. rayzorben
OccuredAt e.g. Wed Dec 04 4:34PM
Server e.g. Home
ImageFilename e.g. /tmp/2019120316340033717.jpg which is an image on disk that represents the motion.

@curtishall
Copy link
Member

Similar to issue #314 something that we need to add in version 3 for sure.

It won't make 3.0 as we already have that in production but would be something to add in later versions.

@curtishall
Copy link
Member

Thinking aloud you might be able to add onto the email notification routine and upload images and notifications that way in the short term - https://support.pushover.app/i44-example-code-and-pushover-libraries#unix-image

@rayzorben
Copy link
Contributor Author

Thinking aloud you might be able to add onto the email notification routine and upload images and notifications that way in the short term - https://support.pushover.app/i44-example-code-and-pushover-libraries#unix-image

Yep! Right now I am using the email capabilities of Pushover, but it still has to go through gmail SMTP server. And for some reason sometimes I get those in a heartbeat, and another times it just lags for 10-15 seconds. Right now it is 'good enough' but if I get frustrated I will just do what you suggest and modify the code around emails to call into libcurl or something using that API.

@maiksicks
Copy link

We can easily customize the file /usr/share/bluecherry/www/lib/mailer.php and add following line of code (shell_exec):

if ($argv[1] == "motion_event") {
     
    ...
    
    #run shell script
    shell_exec("/bin/sh /usr/share/bluecherry/events/motion.sh {$device_id} {$timestamp}");
}

This executes a shell script on every motion. @rayzorben You also could execute your pushover command directly (as HTTP request over cURL). It is possibly not the best "solution" but it works fine until this feature is built-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants