Home Action Based on a Specific Trigger

Is it possible to execute a command in Home Action that is triggered only by an animal and not by humans and vehicles? I'd like to keep the camera settings for animals, humans, and vehicles unchanged, but I want a Home socket to be triggered only when an animal is detected.

The problem is the neighbor's cat keeps making its mess in front of the house. I have a HomeKit socket with a leaf blower attached to scare the cat away.

Currently, I have an additional camera set up with Action Triggers set only to "Animal." I find it quite cumbersome to have to use an extra camera for this purpose. It would be great if it were possible to select in the settings which trigger should activate the Home Action.

Similarly, when a sound is to be played during an action, it should only be played for a human, for example, but not for an animal or a car.

If it's not currently possible to configure it this way, it would be great if this could be included in the settings in an update.

Comments

  • I can think of 2 ways to do it.

    One is with an extra camera configured for that purpose. It doesn't count towards your limit and can be "hidden" if you create a group that doesn't include them and then show that group only.

    The other is using scripting and web hooks triggering another automation platform such as Home Assistant, or even Pushover.

  • Duplicating a camera is one way to do this, though not particularly elegant. The best way is with AppleScript - here's an example script that demonstrates how to achieve this:

    on run args
    	set reasons to item 3 of args
    
    	if reasons contains "Animal" then
    		tell application "SecuritySpy" to run home action "Scare Cat"
    	else if reasons contains "Human" then
    		tell application "SecuritySpy" to run home action "Play Sound"
    	end if
    end run
    

    Copy-paste this into Script Editor and make the necessary changes to the home action names to match up with what they are actually called in HomeHelper. Then save this as a script file to the Scripts folder within the SecuritySpy folder within your Home folder (i.e. to ~/SecuritySpy/Scripts). It will then be available to select as an Action for the camera that is pointed at this area, under Settings > Cameras > Actions.

  • Thank you.

    That worked for me.

  • Ben,

    Is there a way to play a system sound (such as the one indicated in the 'play sound' field of the Actions tab from within the Applescript script?

    Is there a way to run a home action if the action only occurs during a specific time frame, say from 6pm to 7am?

    Jim

  • Hi Jim, you can play a sound from your AppleScript using a line like this:

    do shell script "afplay /Path/To/Sound/File.aif"

    By using schedules, you can define when actions will happen, however this will apply to all actions, not just Home actions.

    If you need more flexibility, you can manage this from your AppleScript with the line:

    tell app "SecuritySpy" to run home action "Name"