You can configure what actions should be taken when specific conditions are met.

Trigger

A trigger is fired when its specific condition is met. You can configure three types of triggers, ie., TRIGGER_EVENT, TRIGGER_INPUT, and TRIGGER_SCHEDULE.

message Trigger {
  uint32 deviceID; 
  TriggerType type;
  oneof entity {
    EventTrigger event;
    InputTrigger input;
    ScheduleTrigger schedule;
  }
}
deviceID
The ID of the device. If it is set to 0, it means that the trigger is from the same device where the configuration is written.
type
event
Valid only if the type is TRIGGER_EVENT.
input
Valid only if the type is TRIGGER_INPUT.
schedule
Valid only if the type is TRIGGER_SCHEDULE.
enum TriggerType {
  TRIGGER_NONE = 0x00;
  TRIGGER_EVENT = 0x01;
  TRIGGER_INPUT = 0x02;
  TRIGGER_SCHEDULE = 0x03;
}
TRIGGER_EVENT
The trigger is fired when the specified event occurs.
TRIGGER_INPUT
The trigger is fired when the specified input signal is detected.
TRIGGER_SCHEDULE
The trigger is fired on the specified schedule.
message EventTrigger {
  uint32 eventCode;
}
eventCode
The event type which will trigger the action.
message InputTrigger {
  uint32 port;
  device.SwitchType switchType;
  uint32 duration;
  uint32 scheduleID;
}
port
The index of the port.
switchType
The type of the input port.
duration
The minimum duration for which the signal should be detected in milliseconds.
scheduleID
Specify the schedule during which the input port is monitored. If it is 0, the port will be monitored all the time.
message ScheduleTrigger {
  ScheduleTriggerType type;
  uint32 scheduleID;
}
type
scheduleID
The ID of the schedule which will fire the trigger.
enum ScheduleTriggerType {
  SCHEDULE_TRIGGER_ON_START = 0x00;
  SCHEDULE_TRIGGER_ON_END = 0x01;
}
SCHEDULE_TRIGGER_ON_START
The trigger is fired on the start time of the schedule.
SCHEDULE_TRIGGER_ON_END
The trigger is fired on the end time of the schedule.

Action

You can configure several types of actions which will be executed when the specified trigger is fired.

message Action {
  uint32 deviceID;
  ActionType type;
  StopFlag stopFlag;
  uint32 delay;

  oneof entity {
    RelayAction relay;
    OutputPortAction outputPort;
    DisplayAction display;
    SoundAction sound;
    LEDAction LED;
    BuzzerAction buzzer;
    LiftAction lift;
  }
}
deviceID
The ID of the device. If it is set to 0, it means that the action is on the same device where the configuration is written.
type
stopFlag
Specify when the action is stopped on a door.
delay
The action will be taken after this delay in milliseconds.
relay
Valid only if the type is ACTION_RELAY.
outputPort
Valid only if the type is ACTION_TTL. Not yet supported.
display
Valid only if the type is ACTION_DISPLAY. Not yet supported.
sound
Valid only if the type is ACTION_SOUND.
LED
Valid only if the type is ACTION_LED.
buzzer
Valid only if the type is ACTION_BUZZER.
lift
Valid only if the type is ACTION_LIFT.
enum ActionType {
  ACTION_NONE = 0x00;

  ACTION_LOCK_DEVICE = 0x01;
  ACTION_UNLOCK_DEVICE = 0x02;
  ACTION_REBOOT_DEVICE = 0x03;
  ACTION_RELEASE_ALARM = 0x04;
  ACTION_GENERAL_INPUT = 0x05;

  ACTION_RELAY = 0x06;
  ACTION_TTL = 0x07;
  ACTION_SOUND = 0x08;
  ACTION_DISPLAY = 0x09;
  ACTION_BUZZER = 0x0A;
  ACTION_LED = 0x0B;

  ACTION_FIRE_ALARM_INPUT = 0x0C;

  ACTION_AUTH_SUCCESS = 0x0D;
  ACTION_AUTH_FAIL = 0x0E;

  ACTION_LIFT = 0x0F;
}
ACTION_LOCK_DEVICE
Lock the device.
ACTION_UNLOCK_DEVICE
Unlock the device.
ACTION_REBOOT_DEVICE
Reboot the device.
ACTION_RELEASE_ALARM
Release all the alarms on the device.
ACTION_GENERAL_INPUT
Not yet supported.
ACTION_RELAY
Activate a relay with the specified pattern.
ACTION_TTL
Not yet supported.
ACTION_SOUND
Play the specified sound.
ACTION_DISPLAY
Not yet supported.
ACTION_BUZZER
Play the buzzer with the specified pattern.
ACTION_LED
Enable the LEDs with the specified pattern.
ACTION_FIRE_ALARM_INPUT
Not yet supported.
ACTION_AUTH_SUCCESS
Play the same action as authentication succeeds.
ACTION_AUTH_FAIL
Play the same action as authentication fails.
ACTION_LIFT
Activate or deactivate the lift.
enum StopFlag {
  STOP_NONE = 0x00;
  STOP_ON_DOOR_CLOSED = 0x01;	
  STOP_BY_CMD_RUN_ACTION = 0x02;
}
STOP_ON_DOOR_CLOSED
The action will be stopped when the door is closed.
STOP_BY_CMD_RUN_ACTION
If Action.stopFlag is STOP_BY_CMD_RUN_ACTION, it will stop the specified action.
message RelayAction {
  uint32 relayIndex;
  Signal signal;
}
relayIndex
The index of the relay to be activated.
signal
The signal to be emitted on the relay.
message Signal {
  uint32 signalID;
  uint32 count;
  uint32 onDuration;
  uint32 offDuration;
  uint32 delay;
}
signalID
The index of the signal. It can be used for managing signals in your application.
count
The number of pulses.
onDuration
The duration of activation in a pulse. In milliseconds.
offDuration
The duration of deactivation in a pulse. In milliseconds.
delay
The starting delay of the signal in milliseconds.
message SoundAction {
  uint32 count;
  uint32 soundIndex;
  uint32 delay;
}
count
The number of repeats.
soundIndex
The index of the sound to be played.
delay
The starting delay of the sound in milliseconds.
message LEDAction {
  repeated LEDSignal signals;
}
signals
The signals to be emitted on the LEDs.
message LEDSignal {
  device.LEDColor color;
  uint32 duration;
  uint32 delay;
}
color
The color of the LED signal.
duration
The duration in milliseconds.
delay
The starting delay in milliseconds.
message BuzzerAction {
  repeated BuzzerSignal signals;
  uint32 count;
}
signals
The signals to be played on the buzzer.
count
The number of repeats.
message BuzzerSignal {
  device.BuzzerTone tone;
  bool fadeout;
  uint32 duration;
  uint32 delay;
}
tone
The tone index of the buzzer signal.
fadeout
If true, the buzzer sound will fade out.
duration
The duration of buzzer in milliseconds.
delay
The starting delay in milliseconds.
message LiftAction {
  uint32 liftID;
  LiftActionType type;
}
liftID
The ID of the lift.
type
The action to be executed on the lift.
enum LiftActionType {
  LIFT_ACTION_ACTIVATE_FLOORS;
  LIFT_ACTION_DEACTIVATE_FLOORS;
  LIFT_ACTION_RELEASE_FLOORS;
}
LIFT_ACTION_ACTIVATE_FLOORS
Activate the floors of the lift.
LIFT_ACTION_DEACTIVATE_FLOORS
Deactivate the floors of the lift.
LIFT_ACTION_RELEASE_FLOORS
Reset the flags of the lift.

Config

message TriggerActionConfig {
  repeated TriggerAction triggerActions;
}
triggerActions
Up to 128 trigger and action pairs can be stored on a device.
message TriggerAction {
  Trigger trigger;
  Action action;
}
trigger
action

GetConfig

Get the trigger & action configuration of a device.

Request
Parameter Type Description
deviceID uint32 The ID of the device
Response
Parameter Type Description
config TriggerActionConfig The trigger & action configuration of the device

SetConfig

Change the trigger & action configuration of a device.

Request
Parameter Type Description
deviceID uint32 The ID of the device
config TriggerActionConfig The trigger & action configuration to be written to the device

SetConfigMulti

Change the trigger & action configurations of multiple devices.

Request
Parameter Type Description
deviceIDs uint32[] The IDs of the devices
config TriggerActionConfig The trigger & action configuration to be written to the devices

Updated: