Invoke a script depending on which AI
I would like to tell whether the trigger is an animal or Human. Is there a way to pass the event to the script to have it make the selection.
Thanks
Comments
-
Yes - three parameters are passed to AppleScripts that are invoked upon motion detection:
- The camera number
- The camera name
- The reason for the trigger, which is a comma-separated list of the following reasons: Motion,Audio,Script,CameraEvent,WebEvent,OtherCamera,Manual,Human,Vehicle,Animal
Here's a simple script that will pop up an alert that shows the trigger reason:
on run arg display alert "Reason for trigger: " & item 3 of arg end run
-
Perfect - thanks.
Should I of found that in the docs , or the interface found in the script editor???
Thanks Dale
-
This is mentioned in the user manual, but it's easy to miss!
-
Thanks Ben.... After looking at what I am trying to achieve I find myself in a hole. We have lots of deer that eat the plants in our yard. I found that they however don't like the sprinkler system that I was going to turn on via web interface. The problem is I believe there is no easy way to shut off the notifications and email from Actions for animals and keep it going for Humans ( This we leave notifications/email on during the night and when we are away).
Can the script disable the notifications and email given the type of trigger and then re-enable it
I can't use HomeKit because of the age of the Mac. (not sure that would help anyway)
Thanks again
Dale
-
Hi Dale,
In that case, what you'll need to do is duplicate the camera by adding it twice to SecuritySpy using identical device settings. The first camera instance can detect animals and call the sprinkler script without notifications, while the second instance can detect humans and send you notifications.
-
I guess I am going to have to learn to read again. That works ! It also opens up a lot of other work arounds.
Thanks Dale
-
Hi @Ben , as I am learning more about AppleScript and how SS works, can you help clarify if this event trigger for objects respects the same thresholds for triggering an event as the GUI does?
I hope my question makes sense... trying to figure out why I am getting a high number of false positive triggers via script (specifically in the Home Assistant integration which I believe uses this mechanism) that do not show in the GUI as events (where I have my thresholds pretty high).
-
Hi @jimmyjohnson I can confirm that the thresholds used for passing the reason to the AppleScript are the same as for recording and Actions. For example, if the threshold for humans is 70, you will only get the "Human" tag added to the parameter that is passed to the AppleScript if the human prediction is 70 or above. Could the Home Assistant integration be using the basic motion detection information, rather than the AI detection results perhaps?
-
That's possible.
Using what you've confirmed, it feels as though the HA integration is using whatever object is detected at the time of a motion event.
I'll play around and see if I can sort it out on this side. Thanks.
