Which Schedule is running?
  • I am having great success running SS and find it very intuitive and powerful. Version 4.2.3
    I have a couple of Schedules that I can set by camera through two Schedule Presets - Home and Away.
    I communicate mostly with the system over Applescript to turn different schedules and capabilities on/off - works terrific. How can I ask SS which schedule is currently selected? I see that the browser based interface provides this information by pressing the "Scheduling" button. Anyway I can get the current schedule from the Applescript interface?
  • This has never actually been requested before, so there is no easy way to do this via AppleScript. It is possible in an indirect way, by first obtaining the "systemInfo" XML data from your SecuritySpy server via its web interface, then processing this in AppleScript to get the schedule IDs (each schedule has a unique ID).

    Below is some AppleScript code that determines the Continuous Capture schedule for camera 0 (it's a bit difficult to format correct here, but if you copy and paste the below code into Script Editor, it will format it correctly for you). To see which schedule has which ID, load the systemInfo XML in a web browser (i.e. go to http://localhost:8000/++systemInfo in Safari on the Mac that is running SecuritySpy) and towards the bottom of the resultant data you will see the list of schedules and IDs. Once created, the schedule IDs don't change, so you could hardcode the IDs into whatever script you are creating.

    property whichCamera : 0

    set xmlData to do shell script "curl http://username:password@localhost:8000/++systemInfo --max-time 10"

    if xmlData starts with "<?xml" then<br /> tell application "System Events"
    set x to make new XML data with data xmlData

    tell x
    tell XML element "system"
    tell XML element "cameralist"

    repeat with i from 1 to (count XML elements)
    tell XML element i
    set cameraNum to (value of XML element "number") as number

    if (cameraNum is equal to whichCamera) then
    set scheduleID to (value of XML element "schedule-id-cc") as number
    display alert ("Camera " & cameraNum & " is set to schedule ID " & scheduleID)
    end if
    end tell
    end repeat
    end tell
    end tell
    end tell
    end tell
    end if
  • Thanks for answer back.
    I am already getting the camera online/offline status out of the XML data as you show above to complete my AppleScript status request on the system when I am remote. I had not looked closer at the wealth of returned data in the XML data set - and that it already had the schedule information. This will be an easy update.

    I am puzzled that no one else has requested. My use case is that 2 people can independently set the system in Home or Away schedule with text messaging. Then when getting the status remote from the system, it is very helpful to know if the schedule has changed - or if it has been temporarily overridden, which is another nice feature. I see that I can get override status out of the XML data also. Terrific.
    Thanks again.
  • I'm glad this gives you the solution you need! Sounds like a great system you've set up.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!