Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Automation

A base class for all automations. Allows for automations to be correctly registered and triggered.

Hierarchy

  • Automation

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Protected Readonly automationsService

automationsService: AutomationsService

A reference to automations service injected by the Nest.js Dependency Injection. Its value is not available in the constructor.

Readonly Abstract name

name: string

A name of the automation. Must be unique.

Readonly Abstract triggers

A list of not-yet-built triggers. Empty list means this automation won't be triggered.

example
// List of triggers this automation subscribes to.
readonly triggers = [TimerTrigger.every(10, 'seconds')];

Methods

Abstract handleEvent

  • A function called when an event matches any of automations triggers. This function is called by events services.

    Parameters

    • automationEvent: AutomationEvent

      The event accepted by any of automations triggers. The event is generalized to the AutomationEvent type, but can be narrowed down back to the original event within the automation.

    Returns Promise<void>

Generated using TypeDoc