Refresh of an old feature request - custom shell commands per camera

berkinet
edited April 2023 in Home automation

I have asked for this feature before, and you decided not to implement it. Since that time, my need for the feature has continued to expand. So, I am asking you to reconsider implementing it.

Feature: Add option to execute arbitrary server action from contextual menu on image display. The most flexible option would be to execute a pre-defined SecuritySpy action, or a shell script. This could be done by right clicking on the image and selecting the script, or a run script option, from the contextual menu. The action or shell script could then use shell programming, osascript, python, expect, etc.

These are my current use cases. Each one is associated with a camera with a view of the area where I would like the action to take place:

  1. open a gate at the entrance to our property
  2. open or close the door to a chicken coop
  3. turn on/off a light inside the chicken coop
  4. turn on/off the garden lights
  5. turn on/off the pool lights

Thank you for considering this.

Comments

  • Ben
    Ben
    edited April 2023

    This has now been implemented in the latest beta version of SecuritySpy (currently 5.5.8b3). You will find the new controls under Preferences > Cameras > Setup > Advanced Setup Options. Once configured, these custom commands will be accessible from the contextual menu when you right-click (or control-click) a camera's live video image in any video window, or its name in the Camera Info window.

    There is space to add up to four custom shell commands per camera. For example, you could use curl to issue a GET request (curl -X GET http://address/path) or use osascript to trigger an AppleScript (osascript path/to/script.scpt).

    Please let me know your feedback once you've had a chance to test.

  • PERFECT! Thank you for this.

    I have tested one action with a local lamp and it works exactly as expected. One question. It appears this only works on the local server where the image is being viewed. This is not an issue if I am using another Mac to view an image on the SS server, I can just add it in the local configuration. However, for the iOS client, will there be a way to select any actions I create on the server?

  • Great to hear it works as expected.

    Currently this is only available in the macOS user interface. We'll see if we can add it to the web interface at some point too. iOS is less likely so I don't want to promise this, but we'll see what we can do in the future.

  • Totally understandable. And, I do very much appreciate what you have done. I have already implemented all of the use cases noted in the original post in this thread.

    One more question. Are these commands stored in a file that can be easily copied or shared (iCloud?) and linked so I can "sync" the commands on my 3 Macs?

  • These settings, like all others, are stored in a single Preferences file that SecuritySpy creates. You can export/import these settings using the options in the File menu in SecuritySpy, but when you import this file it will overwrite ALL previous settings, so it isn't suitable for the syncing of just these commands.

  • 👍️🙏

  • Ben, this call out: is the sspy process waiting until it completes, or is it spawning a separate process etc.

    'back in the day' when I was trying to trigger OSA (?) / applescript events to do speech the timing was really wonky.

  • Hi @caseyd when SecuritySpy executes a shell or AppleScript command, this is done on a background thread so as not to interrupt any other task that is happening within the software. But, as long as the Mac isn't generally overloaded, the command should be executed pretty much immediately.

  • ah ok so it's a thread in the SSpy process, and not a separate spawned task.

    when I was dorking around I even tried shell scripts to launch other scripts in the background, to try and get the response times I was hoping for.

    I'll give it a shot with current software.