Premise Rudimentary Alarm System

Motorola Premise

123

Senior Member
Dinki plans to use a Weeder Digital I/O board to create a burglar alarm system. Naturally, there's some coding required to create the necessary alarm logic. The problem intrigued me and I cobbled together some code that uses Premise's SecuritySystem, SecurityZone, and Siren classes. It does the following:

  • ExitArm, StayArm, Disarm, PanicFire, PanicMedical, and PanicPolice.
  • Two types of zones: with Entrance/Exit delay and without.
  • 60 second exit delay and 30 second entrance delay.
  • Siren with 5 minute auto-shutoff.

All of the code is implemented in Premise Home and involves no Modules. This presented a challenge because it'd be easier to write the logic using a Module but it is easier, for a new user, to understand logic at the Home level than in a Module. The Disarm code is "1234" (see OnChangeExitArm) and it works via Premise Browser's Security panel.

Have fun tailoring it to your needs.
 

Attachments

Thanks for the compliment!

Version 2 has the following improvements:

PERIMETER and INTERIOR zones.
Changing one line of code (in a SecurityZone's OnChangeTriggered script) allows you to identify a SecurityZone as being either an Interior or a Perimeter zone. Windows should be set as Perimeter zones and Motion Detectors as Interior zones. In StayArmed mode, triggering an Interior zone will not activate an alarm.

Fixed a bug.
The previous version would not trigger an alarm if you activated ExitArmed mode, exited via a door, but failed to close it. The Exit Delay timer would expire but fail to notice that a zone had been violated. This bug has been fixed in the latest version.

Cleaned up the code.
This version has more comments and all displayed messages and alarm activations are centralized in the OnChangeSecurityState script.

Premise Event.
If Alarming mode is activated, a Premise Event is logged. This can be used to trigger an email message using a Premise Alarm.

A few things:
  • StayArmed activates immediately and is triggered exclusively by INTERIOR zones. There is no entrance delay for doors in this mode.
  • ExitArmed activates after a 60 second delay.
  • Both modes do not require a passcode to activate them (but you can easily add this requirement).
  • Both modes require you enter a passcode to deactivate them.
  • You cannot switch from StayArmed to ExitArmed without first deactivating StayArmed mode.
  • To Disarm via Premise Browser's SecurityControl panel, type "1234", press "Enter", press "Off".
I won't be putting any more work into BasicSecuritySystem (I use an ELK M1) but here are a few ideas for enhancements:
  • Use Premise's Speech driver to announce when the various security modes are activated/deactivated.
  • Use the Speech driver to count down the Exit Delay.
  • Use it to speak stern warnings while the siren is activated.
  • Use LogMaster or Logger to log the date and time when Exit mode is activated/deactivated.
  • Send email when in Alarming mode. You can use a Premise Alarm (triggered by the Premise Event mentioned above) or simply add a few lines of code to OnChangeSecurityState's "case 3:"
    Code:
    	 Dim myMail
    	 Set myMail = GetMailer()
    	 myMail.From = "[email protected]"
    	 myMail.To = "[email protected]"
    	 myMail.Subject = "Alarm activated: " & now
    	 myMail.Body = "Violated zone: " & this.LastZoneTriggered
    	 myMail.Server = "EmailServer"
    	 myMail.Send 
    	 Set myMail = Nothing
  • Extra for Experts: Gain greater flexibility by taking the logic from BasicSecuritySystem and incorporating it into the WeederTech module ... call it "WeederTechSecurity". The "WTNEt" class would inherit from the SecruitySystem class and the "Input" class would inherit from the SecurityZone class.
 

Attachments

I finally had a few hours yesterday to devote to figuring out my wiring. All wired up and things appear promising.

I did run into one problem. I set the security system to 'Stay Armed' and opened a door. This caused the state to change to 'Alarming'. Unfortunately, the state never reverted back to 'Stay Armed' and is still set to 'Alarming' hours later. I looked through the code and did not see where you set the state back to the previous state after it is set to 'Alarming'. Is this by design? I know that you are turning the siren off at a set period (haven't hooked the siren up yet), but is it normal to leave the state as 'Alarming' so that the homeowner knows that the alarm was tripped?
 
... is it normal to leave the state as 'Alarming' so that the homeowner knows that the alarm was tripped?
Yes. To cancel Alarming mode, enter the passcode and click Disarm ("Off" in Premise Browser).

No one should be able to cancel ExitArm/StayArm/Alarming modes unless they know the passcode.
 
Back
Top