Security System Support

The Security System was quite complex to develop. However, if a person is not developing but simply copying then most of those background steps can be moved out of the project.

This page contains a lot of the detail required to develop or modify my implementation to meet your needs.

Get DSC Documentation

DSC offers a User Manual, but most of the other documents require you to be an installer

      • For the control panel, find the Installer’s Manual, User Manual, Reference Manual, and Programming Worksheet.

      • For the keypad, find the Installation Manual. The manual’s I found were all PDF files.

Several non-DSC sources of DSC manuals are available on-line. DSC manuals are not required for this instructable. These are merely references if you want to extend the instructable or if your system uses different parts.

LiveWatch.com is the best source of DSC manuals. LiveWatch was also very helpful in answering questions and getting me unstuck. I could not have completed this without help from LiveWatch.

Register EnvisaLink 3

Do not do this.

Once registered, you cannot unregister. EyezOn collects your data and may upgrade your board’s software at any time, without any notification. I ended up editing my EyezOn data and blocked all data from them.

If I were to do this again, I would not do this step. But if you feel compelled to register, here you go:

      • Open a browser and go to www.eyezon.com, Support drop down and select EnvisaLink 3 Primer Guide

      • Follow the directions in the Primer (Register, Login, Add New Device, etc,)

      • Username = [eyes-on username]

      • Password = [eyes-on password]

Generate Mobile Link [optional]

This step was after the step Change Default Password on Envisalink 3

You don’t need to do this step or the next two, but if you want to be done, then this is a good option.

Eyez-On offers a complete monitoring service. It is easy to use and works well. If you want to do use this service then follow the instructions in step 12 and 13. Please note, I did both 12 and 13 and then had to disable them. Both services worked fine and I had no issues, I just wanted to do it myself.

      • Open browser and go to Eyez-On

      • Login (in an earlier step you should have created an account)

      • Select Mobile Portal Link

      • Click generate mobile link

      • https://www.eyez-on.com/EZMOBILE/index.php?mid=13b7d2f4e95b7d62dbcfb801a835064ee4406c79

      • The link is long. Email it to your mobile device.

      • Open the link on your mobile device

      • Open another browser window or tab and go to Eyez-On, select support and select EnvisAlarms Monitoring Primer from drop down

      • Follow directions to download EV3 self-monitoring software

      • Follow the directions to set-up how you want to monitor

Install DSC Server App on You Smart Phone [optional]

You don’t need to do this step, the next one or the previous one, but if you want to be done, then this is a good option.

      • Go to the Android or Apple store and buy the DSC Security Server app from Mike P.

If you did the two previous steps, then you are done! You should be able to monitor and control your security system remotely.

Undo the Work in Previous Two Steps [optional]

Initially, I signed up for Envisalerts and for Mike P’s app.

Since I don’t want to send my security information sent to the internet, and I don’t want the Envisalink 3 software updated without my okay, I needed to block the Envisalink 3’s access to the internet.

      • Open browser

      • Go to ISP'S gateway. Enter in browser’s URL Box: 192.168.1.254

      • Login into gateway

      • Go to Home

      • Scroll down to Envisalink

      • Click on details

          • Save MAC Address (aka Hardware address) = [Envisalink MAC address]

          • [Envisalink MAC Address] = 00:1c:2a:00:9d:07

      • Go to Settings >> LAN >> Wireless

      • Scroll down to enable MAC Filtering

      • Click on MAC filtering

          • Click on Edit Blocked/Allowed Device List

          • Click Enable MAC filtering

          • Scroll down to Enter MAC Address

      • Paste MAC Address of Envisalink

      • Click add to list

      • Click >> to move to Blocked Devices

      • Scroll up and make sure MAC Filtering check box is checked

      • And Envisalink should be blocked

Important Notes About Envisalink 3 and PC1616

Communication from Envisalink 3 to EnvisAlerts uses UDP. Communication from Envisalink 3 to script uses TCP/IP.

The Envisalink 3 Ethernet port only communicates at 10Mbps. Most 1Gb or 100Mb Ethernet routers and switches will auto-negotiate down to 10Mbps.

In section 022 of the PC1616, option 1 cannot be enabled. This option requires a user access code to access user functions like bypassing zones, etc. The option is off by default.

Keypad Blanking and Zone Bypassing must be off for the Envisalink to work.

Third Party Interface (TPI) Programmer’s Document

There is nothing to do in this step.

The Third Party Interface (TPI) is a set of commands, responses and error codes allowing third-party applications to interface with the EnvisaLink 3 over a TCP/IP connection. I found this document very confusing. I hope this explanation helps explain the document a bit better.

In general, all TPI Commands, Responses and Error Codes are three digits:

      • Commands are greater than or equal to 500

      • Responses are less than or equal to 200

      • Error Codes are between 000 and 027, but responses are also in this range

Data is appended to the end of a Command or Response. For example, a login command might be:

      • 005pswdCS\n\r

where,

      • pswd = is data, in this case, your password

The following are required:

      • CS = checksum

      • \n = newline character

      • \r = carriage return character

On the web, I found many implementations for calculating the checksum. The checksum is required, and many implementations didn’t work. I am not sure why so many didn’t work for me. It may be bad code, or it may be different versions of the board or firmware versions running on the board. My checksum code works for my board and firmware.

The EnvisaLink acts as a server for a TCP connection to a Client application. The Client should only run on a secure server that can communicate with the EnvisaLink 3. The Client’s server should be on your home network, but should not be open to the internet. A self-signed cert is required (see my other instructable for a Garage Door Opener).

The EnvisaLink listens on port 4025 and will only accept one client connection. Subsequent connections will be denied. The EnvisaLink will close the connection if the client closes its side.

To initiate a connection:

      • Client starts a TCP session by establishing a TCP socket.

      • Client sends a login command [005]

      • EnvisaLink responds with one or more [505]

      • If [505] command’s data is a 3, then within 10 seconds respond with a login command [005]

      • If [505] data contains a 1, then login is successful

The login command’s data is a password up to six characters in length, which is the same password to log into the EnvisaLink's local web page.

See 505 command description in the TPI manual for a description of all data.

Once the password is accepted, the session is created and will continue until the TCP connection is dropped.

Command Line Control Script

I like to develop on a MacBook and then scp files over to the Raspberry

So, developed an interactive python script that could be run from a command line on a Mac Book Terminal window. Here are some clarifying comments:

      • I may have gone a bit overboard, but I think all the commands are in the script.

      • Open a terminal window (Click on MacBook disk, Applications, Utilities, Terminal).

      • I use a terminal window often. So, I have the terminal app pinned to the dock.

          • mkdir and/or cd to a directory where you want to keep the files

      • Download some of the scripts:

$ wget "https://raw.githubusercontent.com/dumbo25/ev3_cmd/master/ev3pi.py"

$ wget "https://raw.githubusercontent.com/dumbo25/ev3_cmd/master/ev3.py"

      • If running from a computer, read the comments and change the constants as described. For example, uncomment the line:

          • self.file_log = sys.stderr

      • In the terminal window, change to the directory and execute the script:

$ python ev3pi.py

      • Type [return] to see valid commands.

      • Type [ctrl-c] to exit the program.

Brief System Overview of Scripts

There is nothing to do in this step.

I want to set or monitor the security system from a smart phone, tablet or PC.

The command line python script monitors the security system, and can change the system’s state. However, it doesn’t provide good remote viewing capability.

A website provides an excellent interface for monitoring and changing the security system. However, the website is only “running” when it is being viewed. Whereas, the command line script should be running all the time. When the script is running, no one may be looking at the website. So, the data collected by the script should be stored in a database until someone wants to view it.

Also, a user should be able to change the security system’s state (arm, disarm). When state changes occur, the changes should be made quickly.

Both the script and database are potential points of failure, another script is needed that periodically checks if everything is working and restarts the script if necessary.

Install SQLite on MacBook [optional]

I like to develop on the Mac and then move the results to the Raspberry Pi.

Go to download page on sqlite.org and download sqlite-autoconf-*.tar.gz from source code section

On MacBook open downloads from your account

Click on downloaded tar.gx file

Open terminal window

$ cd Downloads

$ cd sqlite-autoconf-[latest version number]

$ ./configure --prefix=/usr/local

$ make

The make takes a few minutes, be patient.

$ sudo make install

[MacBook password]

Confirm it works:

$ sqlite3

sqlite>

Or try

$ which sqlite3

Redo steps in previous step to setup database, table and enter data on MacBook (or use the script. If db doesn't exist it will create and populate).

SQLITE

These are good explanations for connecting a python script to SQLite:

Personal Data:

Here is information that is used frequently. Replace items between ♣s with your information.

Alarm: enable and disable

Ensure all doors and windows are closed. On the control panel, enter the master code:

master code = ♣your master code♣

Disable phone line

My house has a telephone land line, but I do not have land line service. Around 11pm every night the system beeps. If the system loses power, then this has to be re-entered. To disable this beeping, on the keypad enter the following:

      • Disable the phone line: *8 5555 015 7 ##

      • Turn off phone line test transmissions *8 5555 371 9999 ##

      • Turn off the phone dialer: *8 5555 380 1 ##

Envisalink Alert Server

Login to Envisaiink

Get Envisalerts Server: 184.106.215.218

Open home router's IP address: 192.168.1.254

Go to Settings, Firewall

Envisalink login

Open Browser

Enter Envisalink IP address: http://192.168.1.92/3

envisalink username = ♣username♣

envisalink password = ♣envisalink-password♣

Envisalink IP Address

Envisalink IP address = 192.168.1.92

Eyes-on Username and Password

eyes-on username = ♣eyes-on-username♣

eyes-on password = ♣eyes-on-password♣

Installer’s code

Installer’s Code = ♣Installer's-Code♣

5555 is the default code. You can ask your installer for the code, or you can do a factory reset, which puts it back to 5555. I do not recommend doing a factory reset because there is a significant possibility of damaging the system.

Master Code

MasterCode = ♣master-code♣

Raspberry Pi IP

Raspberry Pi IP = ♣Raspberry-Pi-IP-address♣

Raspberry Pi login from Mac Book

On Mac Book, open terminal

ssh pi@♣Raspberry Pi IP♣

♣Raspberry-Pi-Password♣

Raspberry Pi password

Password = ♣Raspberry-Pi-Password♣

Router

Router IP Address = ♣router's-IP-address♣

Set DSC Time and Date

*611301hhmmMMDDYY#

hh are in military time, for pm add 12. So, 4pm is 16

Zone Programming

Zone Alarm Type

01 - Alarm after providing a delay (default 60 seconds) in Stay or Away mode

03 – Alarm instantly if violated when in Stay or Away mode

05 – Interior motion sensor. Alarm instantly if violated only when the Away mode (bypasses when in Stay)

On keypad, enter:

*8 [Installer Code] 001 01 03 05 05 87 # #

Explanation of above code sequence:

        • *8 [Installer's Code]

        • 001 – This gets you into zone programming for zones

        • 01 03 05 05 87 – This is my sequence of zone alarm types, in zone order from 1 to 5.

        • All zones must be properly set.

        • # # – This saves what you’ve done and gets you back out of programming mode.