DSC/Vista Alarm Smartapp and devices based on AlarmServer

dsc
smartapp_security
ademco
requires_server
project_security

(Kent) #1

Starting a new thread for the DSC alarm stuff in particular anything related to the current DSC Smartapp and the AlarmServer software that runs it behind the scenes.

Current status is: Full support for zone and partition status(s)
Current setup difficulty: medium to difficult depending on your knowledge of Python and computers

Required components:

  • DSC or Ademco/Vista alarm panel
  • Envisalink 2 or 3 connected to your panel
  • A server or computer to run the Python code on 24/7
  • Some technical skills
  • Smartthings IDE/Developer account (free to anyone)

Upcoming features include:

  • Automatic creation of zones and partition devices.
  • Easier setup (where possible)
  • Arm/Disarm panel

Code and documentation locations:

Smartthings App and custom Device types (along with setup info) can be found here

AlarmServer and HoneyAlarmServer

Many, MANY thanks to everyone who helped get all this going and have contributed patches, bug testing and new features! If you like reading you can visit the now very long original thread that started all this which is linked below.

Thanks and please post your questions/problems/successes/failures here!

Original thread:

DSC Alarm Integration - and Alarms in General


Envisalink 4 + DSC
DSC + Envisalink 4 + smartthings-dsc-alarm-server
Security System with imminent SmartThings Hub 2.0?
DSC Alarm Integration
Compatible DSC Panels with ST? And do I need an envisalink3?
DSC Alarm Integration - and Alarms in General
DSC -> EVL-3(4) -> Alarmserver -> Smartthings
Repurpose wireless alarm system components?
Routine command affects more than one Ecobee tstat
DSC Server = REST + Envisalink + DSC
Hardwired sensors
Smartapp and devices for Electronics Line and MyELAS based Security Panels
ADT Smartwatch Pro 3000EN Integration
(Nathan Cook) #2

@sanity So i am new to ST but i am pretty quick on uptake of most computer stuff. First, thanks for your work on this and thanks to anyone else who contributed. I have a few questions that maybe you can answer. I have a ADT (Vista 20p) I own and I already dispatched them and took control of the system. I have Envisalink up and running (full reports, arm/disarm, etc.) through there server. My next step it to try the ST integration you worked on. So here are my questions to understand this better:

  1. Can you explain the need for the computer? Is this taking the place of Envisalink servers or is it piggy backing on them.
  2. Do you think this will be come a ST integration? It seem complex which is an issue i would think. How long till integration if you think it will happen?
  3. Is there a step by step to set up the to this? I did the Nest integration and seem to working well but this seem more complicated.
  4. Any other pointers on doing this?

Thanks so much.


(Kent) #3

@natescook1

  1. The Envisalink doesn’t have a way to directly send events to ST so the computer is used to run an application that talks to the Envisalink TPI interface and then send them along to ST.

  2. I doubt it. It’s too complex/error prone right now and there are only a few ways we can make it less so.

  3. The README.md file in my repo has step by step directions including a pointer to the REST API setup part. https://github.com/kholloway/smartthings-dsc-alarm

  4. Read, a lot, of stuff… :smile:

Let me know if you get stuck or have issues along the way and good luck!


(Steve Jenkins) #4

Trying this out tonight. Thanks to all who have contributed.

One suggestion (so far) on the kholloway/smartthings-dsc-alarm github instructions. Those of us on CentOS would use “pip-python install requests” instead of “pip install requests.”


(Steve Jenkins) #5

Following the instructions as written on the smartthings-dsc-alarm github README, running alarmserver.py just gives me:

[root@mugello AlarmServer]# ./alarmserver.py
  File "./alarmserver.py", line 73
    class AlarmServerConfig():
                            ^
SyntaxError: invalid syntax

There’s no mention in the instructions how to reference the config file when running alarmserver.py

Renaming alarmserver-example.cfg to alarmserver.cfg (which was my guess of what the default config file should be) didn’t do anything to change the result.

Also, I’m not a programmer… but I’m comfortable editing config files and scripts. But where I really shine is documentation and how-tos, so once I get this figured out, I’ll be happy to write “n00b friendly” instructions to getting this working.


(Kent) #6

@SteveJenkins copy the example config file to alarmserver.cfg and modify it as needed. You need to also generate a SSL cert per the instructions on the AlarmServer page. You don’t need to run the AlarmServer.py as root also just FYI. It’s probably better to just run it as a normal user with no privileges. I’m not sure why you would get that error on line 73 though… Try starting it with the command line below and see what happens.

python alarmserver.py

The AlarmServer project assumes a working knowledge of Python and Python modules which many people unfamiliar with Python would not have. The docs could certainly be cleaned up and simplified.


(Kent) #7

@SteveJenkins I use RedHat distros all the time and have never seen that pip-python thing, good to know! If pip isn’t available I usually just type ‘easy_install pip’ to get it installed then ‘pip install whatever module’.


(Steve Jenkins) #8

Thanks, Sanity.

Still same issues. The AlarmServer files came with default key and crt files, but I went ahead and generated a new set myself (generating keys is not new to me… I’m the packager for OpenDKIM for Fedora/EPEL).

But still getting the same errors, whether or not I run it direct from the command line or with the python command.

Anything else I should be checking? Does Python version matter (running 2.4.3)?


(Steve Jenkins) #9

To reply to my own question, I think Python version does matter. I just installed Python 2.6 and tried it with that:

/usr/bin/python26 alarmserver.py
Traceback (most recent call last):
File “alarmserver.py”, line 19, in
import requests
ImportError: No module named requests

Now it seems to be complaining that I don’t have the requests module handy. Still hacking…


(Steve Jenkins) #10

Did easy_install requests … hoping it would be as simple as that. Nope. :frowning:

# easy_install requests Searching for requests Reading http://cheeseshop.python.org/pypi/requests/ Reading http://python-requests.org Reading http://cheeseshop.python.org/pypi/requests/2.3.0 Best match: requests 2.3.0 Downloading https://pypi.python.org/packages/source/r/requests/requests-2.3.0.tar.gz#md5=7449ffdc8ec9ac37bbcd286003c80f00 Processing requests-2.3.0.tar.gz Running requests-2.3.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-LOWH_z/requests-2.3.0/egg-dist-tmp-nG10gO Traceback (most recent call last): File "/usr/bin/easy_install", line 7, in ? sys.exit( File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1670, in main with_ei_usage(lambda: File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1659, in with_ei_usage return f() File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 1674, in distclass=DistributionWithoutHelpCommands, **kw File "/usr/lib/python2.4/distutils/core.py", line 149, in setup dist.run_commands() File "/usr/lib/python2.4/distutils/dist.py", line 946, in run_commands self.run_command(cmd) File "/usr/lib/python2.4/distutils/dist.py", line 966, in run_command cmd_obj.run() File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 211, in run self.easy_install(spec, not self.no_deps) File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 446, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 471, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 655, in install_eggs return self.build_and_install(setup_script, setup_base) File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 930, in build_and_install self.run_setup(setup_script, setup_base, args) File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 919, in run_setup run_setup(setup_script, args) File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 26, in run_setup DirectorySandbox(setup_dir).run( File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 63, in run return func() File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 29, in {'__file__':setup_script, '__name__':'__main__'} File "setup.py", line 30 with open('README.rst') as f: ^ SyntaxError: invalid syntax

GULP!


(Kent) #11

@SteveJenkins so yes Python version matters, you likely need 2.6 or higher to run the AlarmServer program. Also you are running ‘easy_install’ but that will install the module into your default 2.4 python version. See if you have a ‘easy_install2.6’ instead, same with pip if you are using that. The default pip will be tied to the system 2.4 Python, see if you have a pip2.6 instead.

Also edit the alarmserver.py file and change the first line to look like below (or change further to match your exact python executable).

#!/usr/bin/env python26

Once you do that you can then run it again with the ./alarmserver.py syntax.


(Steve Jenkins) #12

That makes sense. But no such luck with 2.6 easy install or pip. There’s no site-packages dir on the server for 2.6, either.

Wondering about downloading the 2.6 source and just compiling it.


(Steve Jenkins) #13

And… bingo. Found python26-requests package and installed it with yum.

Edited cfg file for my password (I don’t use the default).

2014-07-18 20:42:24 RX < 500 - Command Acknowledge 2014-07-18 20:42:24 RX < 610 - Zone A Restored 2014-07-18 20:42:25 RX < 610 - Zone B Restored 2014-07-18 20:42:26 RX < 610 - Zone C Restored 2014-07-18 20:42:27 RX < 610 - Zone D Restored 2014-07-18 20:42:28 RX < 610 - Zone E Restored 2014-07-18 20:42:29 RX < 610 - Zone F Restored 2014-07-18 20:42:30 RX < 610 - Zone G Restored 2014-07-18 20:42:31 RX < 610 - Zone H Restored 2014-07-18 20:42:32 RX < 610 - Zone I Restored 2014-07-18 20:42:33 RX < 610 - Zone J Restored 2014-07-18 20:42:34 RX < 610 - Zone K Restored 2014-07-18 20:42:35 RX < 610 - Zone L Restored 2014-07-18 20:42:36 RX < 610 - Zone M Restored 2014-07-18 20:42:37 RX < 610 - Zone N Restored 2014-07-18 20:42:38 RX < 610 - Zone O Restored 2014-07-18 20:42:39 RX < 610 - Zone P Restored 2014-07-18 20:42:40 RX < 610 - Zone 017 Restored 2014-07-18 20:42:40 RX < 610 - Zone 018 Restored 2014-07-18 20:42:40 RX < 610 - Zone 019 Restored 2014-07-18 20:42:40 RX < 610 - Zone 020 Restored 2014-07-18 20:42:40 RX < 610 - Zone 021 Restored 2014-07-18 20:42:40 RX < 610 - Zone 022 Restored 2014-07-18 20:42:40 RX < 610 - Zone 023 Restored 2014-07-18 20:42:40 RX < 610 - Zone 024 Restored 2014-07-18 20:42:40 RX < 610 - Zone 025 Restored 2014-07-18 20:42:40 RX < 610 - Zone 026 Restored 2014-07-18 20:42:40 RX < 610 - Zone 027 Restored 2014-07-18 20:42:40 RX < 610 - Zone 028 Restored 2014-07-18 20:42:40 RX < 610 - Zone 029 Restored 2014-07-18 20:42:40 RX < 610 - Zone 030 Restored 2014-07-18 20:42:40 RX < 610 - Zone 031 Restored 2014-07-18 20:42:40 RX < 610 - Zone 032 Restored 2014-07-18 20:42:40 RX < 650 - Partition Home Ready 2014-07-18 20:42:41 RX < 673 - Partition 2 is Busy 2014-07-18 20:42:41 RX < 841 - Partition Home Trouble LED OFF 2014-07-18 20:42:41 RX < 841 - Partition 2 Trouble LED OFF 2014-07-18 20:42:41 RX < 510 - Keypad Led State - Partition 1

Let’s party. :slight_smile:


(Steve Jenkins) #14

@sanity Back in n00b mode, but this will all be helpful for docs. :smile:
Your github instructions say:

“In the Web IDE for Smartthings create a new device type for each of the above devices and paste in the code for each device from the corresponding groovy files in the repo.”

But if I go to https://graph.api.smartthings.com/ide/device/create, there’s nowhere to paste in anything. I first clicked the two capabilities that I saw in your code (Polling and Refresh) and then the Create button.

I now realize I could have just hit the Create button and pasted everything, but since this is my first custom device type creation, you get the benefit of a completely fresh set of eyes. :slight_smile:


(Kent) #15

@SteveJenkins excellent feedback, Smartthings has changed the device create screen a few times since I wrote that doc, now it’s all self contained which is much nicer. Glad to see you got the Python part of it working with AlarmServer, hopefully the rest is easy! :smile:


(Steve Jenkins) #16

@sanity Another question. Your docs say:

“Create a new device and choose the type of “DSC Panel” that you published earlier. The network id needs to be partition1.”

Should that be set to “published” or “self published” in that drop-down?


(jmoose) #17

Thanks to everyone who has worked on this. I tried to get this running last week, but gave up pretty quickly, so I look forward to the detailed writeup. My suggestion - if possible - would be to write it for someone with ZERO programming experience - starting with where to download Python and how to make the code run 24/7. I think I at least did that part correctly, but wasn’t 100% sure I wasn’t on some fake site that was really going to install a virus. Thanks.


(Kent) #18

@jimmythemoose Getting Python setup for your OS can be difficult but it’s very OS specific.
https://www.python.org has all the software you should need to get a base Python install going (look in the download tab).
Many OS’s (OS X, Linux, many Unix distros) already include a working python but some of them have a Python that is too old. I will go over the docs again and see if I can’t clean them up a bit but I can’t include directions for every OS. I run Mac OS X and 2 flavors of Linux (Ubuntu and RedHat) so I can include directions for those.


(Kent) #19

@SteveJenkins all the device types and smart app code will be self-published or published “for you” only.


(Steve Jenkins) #20

@sanity Of course - you’re never going to be able to support EVERY host OS.

I run CentOS 6 boxes mainly in production, but I have an OLD CentOS 5 box in the basement of the house that I’ve used to run a few home automation scripts, so that’s why I was so gung-ho to get it working there. And because stuff starts breaking on CentOS 5 if you start messing with the packaged Python, I had to be careful.

Anyway… I’m REALLY close to getting it working… I can feel it. But I’m gonna get fresh eyes on it tomorrow, and maybe go through all the steps again. I can see the finish line. :smile: Thanks for your excellent help!