Create webhooks to control a Controlbyweb WebRelay

Last modified: Friday November 18, 2022.

When creating rules in Alta Video to activate a web relay, you define webhooks that send the information needed by the web relay device when the rule triggers.

These example instructions were tested against a Controlbyweb WebRelay Quad P.O.E (model X-WR-4R3-E). Other models might differ slightly in the required API calls.

The process to configure web relays from other manufacturers, although broadly similar, might have syntax or command differences.

Check the user documentation for your specific make and model of web relay for information relating to the formatting of the webhooks needed to enable your specific web relay.

Prerequisites

  • Your web relay must be configured and running on the same physical network as your Avigilon Ava camera or Alta Cloud Connector, and must be routable from your Avigilon Alta device.
  • You must know the assigned IP address for the web relay.
  • Consult the relevant documentation for information on how to configure webhooks for your web relay.

Task — Create a webhook to activate a single relay

You can create and select Webhooks for any of the available rule types. The relevant options are defined in the Actions section of the Rules creation dialog.

  1. Choose Tools New tool > Rules Rules.
  2. Follow the instructions to configure the relevant type of rule.
    Any rule with a suitably defined webhook can be used to activate a web relay.
  3. In the rule you are creating, click Edit webhooks button Edit webhooks from Rules > Actions.
  4. Click Add new webhook Add new webhook.
  5. Type a name for the webhook. Press Enter.
  6. In URL, enter the information to be sent to control your web relay. This should be in the format:
    http://<web relay ip address>/stateFull.xml?relay<relay>State=<state>&pulseTime<relay>=<duration>, where:
    • <web relay ip address> is ip address for the web relays web server.
    • <relay> is the number for the individual relay to be activated.
    • <state> is the required activation status for the relay. This can be:
      • 0 = switch relay off
      • 1 = switch relay on
      • 2 = pulse (switch on, and then, after a time, switch off) the relay for the time configured in the web relay user interface
    • (Optional) &pulseTime<relay>=<duration> enables you to configure a pulse time that overrides the default values for the web relay. The <duration> is the number of seconds that relays are pulsed on.
    • To switch relay 1 on:

      http://<web relay ip address>/stateFull.xml?relay1State=1

      To switch relay 2 off:

      http://<web relay ip address>/stateFull.xml?relay2State=0

      To pulse relay 3 on for the default time:

      http://<web relay ip address>/stateFull.xml?relay3State=2

      To pulse relay 4 on for 10 seconds:

      http://<web relay ip address>stateFull.xml?relay4State=2&pulseTime4=10

      You can configure the URL to simultaneously send commands to more than one relay. So, for example, if you have red and green lights on an entrance, you can configure the web relay to switch one light on, and the other light off in a single URL.

      To switch relay 1 on and relay 2 off:

      http://<web relay ip address>/stateFull.xml?relay1State=1&relay2State=0

      You can also configure each relay to pulse on for a defined time. To switch relay 1 on for 5 seconds, and relay 2 on for 10 seconds, use:

      http://<web relay ip address>/stateFull.xml?relay1State=2&relay2State=2&pulseTime1=5&pulseTime2=10
  7. Sending Method, choose From Ava devices. The webhook is sent from either the Avigilon Ava camera or from the Alta Cloud Connector within your local network.
  8. From the Method dropdown, select HTTP Get.
  9. To proceed when there are certificate errors, enable Ignore HTTPS Certificate Errors.
  10. If you have configured your web relay to include a control password, select the Basic Authentication method, and enter the required username and password.
    Otherwise, select None.
  11. From Payload type, select Plain text.

    No additional headers or payload information is required, and you do not need to enter anything in the Headers or Payload areas of the Webhooks dialog.

  12. Click the Test to send the sample webhook to the web relay. You are prompted to send the webhook from your chosen Avigilon Alta device.
    • If all is configured correctly, you see a Test webhook sent response and the configured relays in the web relay are activated.
    • If there is a misconfiguration, you see a Failed to send webhook message after a short time.

    To correctly test that the webhook is working, Alta Video requires that the web relay send HTTP responses. If the web relay does not send the required responses, testing the webhook from Alta Video will show as failed, even though the relays activate as requested.

  13. Click Done.
  14. Enable Webhook and select the relevant webhook.
  15. Click Done.
    When the rule is triggered, the web relay is activated as configured in the webhook.