Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article provides python samples and instructions on how to create events, trigger events, and view events in corresponding database

\uD83D\uDCD8 Instructions

...

Download python samples related to events API

...

View file
namestorage_api_get_events.py
View file
namecameras_

...

event_

...

processing_

...

events.py

...

View file
namecameras_enable_motion_detector.py

...

View file
namecameras_

...

create_

...

custom_

...

event.py

Info

Access tokens for cameras can be found on the integrations page of the VXG Cloud One web client.

Creating a Custom Event

  1. Get camera’s access token
    call camera api to get access token

  2. From the directory containing the python samples, call cameras_create_custom_event.py to create a custom event.

    Code Block
    pythonpython3 ./cameras_create_custom_event.py -a "dfasdfasdfasrwecsdcsdf=" -e "test event"


    Where -a is the camera’s access token and -e is the name of the new event being addedcreated.6.html#/servers/get_admin_servers_

Enabling Motion Detector Event

Camera Event Processing Events

END

...

  1. From the directory containing the python samples, call cameras_enable_motion_detector.py to enable motion detection events.

    Code Block
    python3 ./cameras_enable_motion_detector.py -access_token dfasdfasdfasrwecsdcsdf= -enabled true


    Where enabled is either true or false depending on if you would like to enable or disable motion detection.

How to Start and Stop Recording Events

  1. To begin recording events call cameras_event_processing_events.py

...

View file
namecameras_enable_motion_detector.py
View file
namecameras_create_custom_event.py

...

  1. with the parameter record_stat=on.

    Code Block
    python3 ./cameras_event_processing_events.py -access_token sdafasdfasdfasdfasdfasrwecsdcsdf= -ename motion -record_stat on


    Where access_token is the camera’s access token and ename is the name of the event.

  2. To stop recording events call cameras_event_processing_events.py with the parameter record_stat=off.

    Code Block
    python3 ./cameras_event_processing_events.py -access_token sdafasdfasdfasdfasdfasrwecsdcsdf= -ename motion -record_stat off


    Where access_token is the camera’s access token and ename is the name of the event.

How to View Event Records

  1. Call storage_api_get_events.py to view recorded events within a specified time interval.

    Code Block
    python3 ./storage_api_get_events.py -access_token sdafasdfasdfasdfasdfasrwecsdcsdf= -start 2022-12-01T08:30:00 -end 2022-12-02T08:30:00 -limit 10


    Where access_token is the camera’s access token, start is the beginning of the time interval, end is the end of the time interval, and limit is the maximum number of events to include in response.
    Event data is of shape:

    Code Block
    {
      'camid': int,
      'id': int, 
      'name': str, 
      'thumb': {
        'height': int, 
        'id': int, 
        'size': int, 
        'time': 'str', 
        'url': str, 
        'width': int
      }, 
      'time': str
    }

END