The goal of the Alarm Device is to serve as a hub for an alarm system. The Alarm Device has four basic functions: sensing alarm conditions, signaling alarms, reporting, and responding to external commands.
Alarm Device Terminals Description
The Alarm Device has a set of input and output terminals. Some terminals are predefined, and some are user defined. The alarm sensing terminals are user defined. Having user defined sense terminals allows the alarm conditions of the Alarm Device to be tailored for a specific application.
The Alarm Device has a single output terminal called "alarm" which signals whether there is an alarm or not. When an alarm is present, the terminal is
In addition to the "alarm" terminal, there is a "messages" terminal which has additional information about the alarm on the "alarm" terminal. Alarm information includes: which terminal triggered the alarm, the triggering value, and information about the other Alarm inputs.
Alarm Sensing is done using user defined input terminals. Each user defined terminal has a user defined condition or set of conditions that it looks for. When one of its conditions is met, the terminal triggers an alarm. When defining a terminal, the user assigns names to the terminals, and then, on a per terminal basis, defines what event conditions will cause an alarm. Event conditions can be single values (e.g. on, off, 27), greater thans, less thans, or ranges (e.g. between 57 and 80). A terminal can also be defined with no conditions; in this case, the terminal will give status to the alarm system (and show up in status messages), but it will never cause an alarm.
The Alarm Device has an input "command" terminal for inputting commands to the Alarm Device. Commands allow external control over the system. Typical commands will enable, disable, and reset the system. Every command will generate a response on the "messages" terminal.
The Alarm Device is created by running a basic "Alarm" Script, and user defined terminals on the Alarm Device are created by running various Alarm "InputTypes" Scripts. The terminals created by these Scripts are more fully described here:
Creating an Alarm Device
The Alarm Device is created by running the Alarm Script. The Alarm Script takes a "duration" and a "real_time" parameter. The "duration" defines how long an alarm will last, in seconds, after the alarm is initiated. After the duration expires, the Alarm Device will set its "alarm" terminal to
Anytime an Alarm Device receives an alarm stimulus, it will restart the alarm for its duration. However, it will only generate new messages on its "messages" terminal if the "alarm" output terminal is
Running the Alarm Script with the parameters listed below creates an Alarm Device with an alarm duration of 60 seconds.
Real Time Mode
By default, Alarm Devices set their "alarm" output terminal for a user defined "duration". However, this behavior can be overridden by setting the "real_time" parameter to true. Setting "real_time" to true, changes the behavior of the alarm output.
When in real time mode, the Alarm Device alarm output will be a pure function of its alarm inputs. If any input senses an alarm condition, the alarm output will be on. If all the inputs do not sense an alarm condition, the alarm output will be off. The alarm output just follows the inputs - no delays or durations. When in real time mode, the "duration" parameter value is ignored.
To put the Alarm Device in real time mode, run the Alarm Script with the following parameters.
Creating User Defined Alarm Input Terminals - the InputTypes Scripts
As we've seen, alarm input terminals and their triggers are created by the Alarm InputTypes Scripts. Here is an example using the Equal Script.
The following Script and Script parameters create a "water" input which triggers an Alarm Device with ID "my_alarm", when the input is
Run the InputTypes Equal Script with:
Some Alarm System Ideas
Easy to Use System
A system which monitors the environment, has a burglar alarm, and is controlled by email and/or text messages. Requires little or no user intervention.
This system is designed to be as easy to use as possible. When you want the alarm system armed, send a "reset" command. The Alarm will acknowledge your command and arm itself. If the last person to leave the premises forgets to reset the Alarm, the Alarm will arm itself in ~10 hours.
When a person trips the armed system, you will receive one message from the Alarm (probably from the burglar sensor). As long as people re-trigger one of the sensors every ~10 hours (or less), the alarm will stay on and you will get no additional Alarm messages (so the system won't harass you after you come home and stay home).
With a system like this, the only thing you might need to do is reset it when you leave. If you forget, it will eventually rearm itself anyway.
A system which monitors the environment, has a burglar alarm, and is controlled by email and/or text messages. Requires users to arm and disarm the system.
When you want the system armed, send the Alarm an "on" command. When you want the system disarmed, send the Alarm an "off" command.
When the Alarm is triggered it stays on for ~10 minutes. This is a typical amount of time to scare off an intruder, and it also is the minimum amount of time between sending messages, so your email or cell phone won't get flooded with messages. If there are no additional Alarms within ~10 minutes, the system will rearm itself and can send another message. With this type of system, you will want to turn it off when you are around, so you don't keep getting alarm messages. You'll need to turn it back on when you leave.
Monitoring another System
You already have a system in place which has all the right sensors, alarm durations, status outputs, etc., but it doesn't send email or text messages. You want it to send you email and text messages.
The Alarm Device's job is to report all the alarms the pre-existing system is signalling. The short Alarm duration time (~1 second) allows the Alarm Device to be monitoring almost continuously (while putting an upper limit on sending no more than one message per second).
Because the pre-existing system is emailing and texting via the Alarm Device, you can turn messaging on and off (with the Alarm on and off commands) and get the status of the Alarm inputs.
Customizing Alarm Output Messages
If you want to create your own alarm messages, read Customizing Alarm Output Messages.