Audio trigger

Posted on
Mon Feb 10, 2020 9:41 am
vtmikel offline
Posts: 461
Joined: Aug 31, 2012
Location: Boston, MA

Audio trigger

For anyone interested - Perry's plugin does not support adjusting or toggling the audio trigger for a camera. I've written a basic script to make that change. My use case was that I was tired of endless video recordings due to my Roomba.

Improvements for the future:
1. Make it conditionally change the audio trigger only if it needs changing.
2. I do not have my SS protected with credentials. Needs to be added if your setup uses auth.

Code: Select all
import requests

securityspy_url = "http://127.0.0.1:8006"
include_cameras = [298010292, 1054448518, 1263858584, 1180490803]

# Set variable set_audio_to = True or False, or link it to another property like my example (for a Roomba vaccum)
set_audio_to = indigo.devices[603451062].states["deviceStatus"] != "Running"

#########################
# End Config
#########################

if set_audio_to:
   set_audio_action = "1"
else:
   set_audio_action = "0"

for camera in [s for s in indigo.devices.iter(filter="org.cynic.indigo.securityspy.camera") if s.enabled and s.id in include_cameras]:
   camera_num = camera.address[camera.address.find("(")+1:camera.address.find(")")]

   payload = {'cameraNum': int(camera_num),
      'action': "save",
      'mdSoundTriggerCheck': set_audio_action
   }

   post_url = securityspy_url + "/camerasettings"

   r = requests.post(post_url, data=payload)

   if set_audio_action == "1":
      indigo.server.log("ENABLING the audio trigger for '" + camera.name + "' (camera " + str(camera_num) + ")")
   else:
      indigo.server.log("DISABLING the audio trigger for '" + camera.name + "' (camera " + str(camera_num) + ")")


Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest