# Send Alarms

This example shows how to setup alarm via different bearer (SMS, call, email, Telegram).

# Configuration

To make phone calls and and send/receive SMS, PLMN must be active and a valid SIM card inserted.
To send and receive emails and Telegram messages the SMM server must be active and reachable through a WiFi or PLMN connection.

# Users

No users.

# Rules

Rule 001 is triggered at each change of state of the input 1.
Condition: digital input 1 closed (on input closing).
Two SMS are sent.

    – AlarmIn1.SMS
    ↯ Digital Input 1
    ✛ Input 1 - Value = 1
    ✛
    ✛
    ✛
    ✛
    > AT+SMS=+4412345678,"Alarm digital input 1"
    > AT+SMS=+4498765432,"Alarm digital input 1"
    >
    >
    >

Rule 002 is triggered at each change of state of the input 2.
Condition: digital input 2 closed (on input closing).
Make 2 phone calls each with a different audio file played if call is answered.

    – AlarmIn2.CALL
    ↯ Digital Input 2
    ✛ Input 2 - Value = 1
    ✛
    ✛
    ✛
    ✛
    > AT+CALL=+4412345678,alarm.wav,8
    > AT+CALL=+4498765432,alarm2.wav,8
    >
    >
    >

Rule 003 is triggered at each change of state of the input 3.
Condition: digital input 3 closed (on input closing).
Send email, body is the current status of device.
Send email, body is the LOG of device.
Send email, body is a custom text.

    – AlarmIn3.EMAIL
    ↯ Digital Input 3
    ✛ Input 3 - Value = 1
    ✛
    ✛
    ✛
    ✛
    > AT#EMAIL=address@email.com,"Alarm input 3",MAP
    > AT#EMAIL=your.email@domain.com,"Subject of email",LOG
    > AT#EMAIL=mymail@example.com,"Another subject","my email body"
    >
    >

Rule 004 is triggered at each change of state of the input 4.
Condition: digital input 4 closed (on input closing).
Two Telegram messages are sent to recipients of alarm.

    – AlarmIn4.TELEGR
    ↯ Digital Input 4
    ✛ Input 4 - Value = 1
    ✛
    ✛
    ✛
    ✛
    > AT#TGM=+4412345678,"Alarm input 4 via Telegram"
    > AT#TGM=+4498765432,"Another text to Telegram"
    >
    >
    >

Recipients can receive a Telegram message only if they have subscribed to the MyAviorBot service.
More info about Telegram use for Avior HERE.