Relay Script with relay in camera

Nico
edited July 2016 in SecuritySpy
Hi, I noticed SecuritySpy supports scripts for Web-i and WebRelay i/o ports. A lot of camera's (i.e. Axis) have got relay's built in however. Is it possible to use a script for an Axis camera relay, or another camera brand with built in i/o?

Comments

  • Did some research myself. It's possible to write a new script in apple script or java-script.

    But does this mean it is possible to run a C# script on a relay from another manufacturer then the pre-installed ones? Or run a JASONP command? As for example:

    "http://192.168.1.25/gpio/ts/2?ac=123456&delay=100"

    (In this example case relay is 2 closed 10 seconds and then released through a JASONP command. In which:
    - Path: /gpio/ts/{n}, n is used to indicate the relay number
    - Parameter: delay={#} )




  • Ben
    Ben
    edited July 2016
    Hi Nico,

    You can call any URL via an AppleScript using curl, like this:

    do shell script "curl 'http://the-url'"

    So using your example:

    do shell script "curl 'http://192.168.1.25/gpio/ts/2?ac=123456&delay=100'"

    Save the script into the ~/Documents/SecuritySpy/Scripts/ folder, and it will be available as an action in SecuritySpy.

    As for the Axis I/O ports, see this document: I/O Port API

    An example would be:

    do shell script "curl 'http://address/axis-cgi/io/port.cgi?action=2%3A%2F300%5C'"

    This sets port 2 to active, waits 300 ms and then sets the port to inactive. There are more examples in the Axis documentation.

    Hope this helps!