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) + ")")