TrailGuard Event Type

This is the event type the TrailGuard integration needs. Set up the integration itself first; this article covers only the event type it writes to.

Supported event type

EarthRanger event type Display title Priority What it carries
nightjar_detection_rep Nightjar Detection Red One TrailGuard detection, at the camera's location.

It lives in the Analyzer Event category (analyzer_event) and records a point location.

Important

Create this event type before connecting TrailGuard. Until it exists, EarthRanger turns the events away with “You do not have permission to perform this action.”, and the Route Activity Logs show that message.

Fields

Field Label Type What it holds
note Note Text The message TrailGuard sends with the detection.

The event's title, time and location come with every detection and need no field on the form.

How to create this event type

1. Install the command-line tool and sign in

You need a terminal with Python 3.11 or newer and pipx installed, and an EarthRanger account on the target site.

pipx install earthranger-cli                         # install the tool; this gives you the 'er' command

er profile add sitename --server sitename --username you   # save the site as a profile ('sitename' is the site's subdomain, e.g. 'borana' for borana.pamdas.org)
export ER_PROFILE=sitename                                 # tell 'er' to use that profile in this terminal
er auth login                                              # asks for your EarthRanger password and signs you in

Important: the account you log in with must have permissions on the Event Category that will host this event type.

2. Save this spec as trailguard.yaml

The spec puts the event type in Analyzer Event. Change the category block at the top to use a different one.

category:
  value: analyzer_event
  display: Analyzer Event
event_types:
- value: nightjar_detection_rep
  display: Nightjar Detection
  icon_id: skylight-detection-satellite_rep
  default_priority: red
  default_state: new
  geometry_type: point
  layout:
    label: ''
    columns: 1
  fields:
  - key: note
    label: Note
    type: string

The value must stay nightjar_detection_rep exactly. The display title, icon and priority can be changed to suit the site.

3. Preview, then apply

er events apply trailguard.yaml --dry-run   # shows what will be created or changed
er events apply trailguard.yaml             # actually does it

Applying is safe to repeat: it creates what is missing and patches only what differs. Nothing is ever deleted.

4. Verify

er events show event-type nightjar_detection_rep

CLI tool and full spec documentation: https://github.com/PADAS/earthranger-cli