If I saw everything in github correctly, you are using the EnvisaLink 3 IP module, correct?
If that’s the case, it seems like I should be able to figure out the differences between the DSC and Ademco functions based on their API documentation. True?
Please let me know because what you’ve done here has been a great help for me, thanks again.
The AlarmServer project interfaces via the Envisalink API so I would think it should work just fine for your system assuming the event numbers are the same?
Thanks @sanity, I really appreciate your willingness to help someone out. I think the event numbers may be the same. I will try this out as soon as I can today. Got to get to my honey-do stuff first…
@sanity, so far so good. I’m at step 5 of your documentation the the wiki, and it is the hard part for sure…
I’m going through the tutorial and I’m trying to get the App Endpoint Example to work, but no luck. This is a little more over my head than I thought, so it’s going to take me some time.
Basically you can ignore most of the REST API tutorial, the only part you need to tackle is in the exampleOauth.php portions and you don’t even need to do the PHP stuff, just extract the URL’s they are using out of that script and do them manually one at a time in a web browser with your oAuth client id and secret to get your resulting access code. The thing that I got hung up on was the redirect_uri= part since I didn’t know what to put in there. Just put “redirect_uri=http://localhost/blah” and don’t worry about running a web server on your machine or anything to actually answer at that address. It just needs a place to redirect you and your browser will throw an error message but the “access_code=” part will still show up properly in your browser, make sure you copy and save that for the AlarmServer bits.
I will write up some actual step-by-step instructions using a web browser for the REST API OAuth part shortly (tonight sometime) and post it on the Wiki instructions. It is by far the hardest part to do just because it’s not straight forward in the docs but it actually ends up being fairly easy overall.
Below is a decent reference guide to the various Smartthings API endpoints, it helped me a lot while I was building all this to just go look at some of those endpoints in a web browser, nothing fancy needed to view them.
I wrote some better (I hope) documentation for the Authorization setup part, you can find it at the link below.
I also moved the Smartthings device and app files to a separate Github repo since they don’t really belong in the AlarmServer repo as that project is not specific to Smartthings at all. You can find the updated documentation and files at the links below.
@sanity - success! I was able to make it through step 5 of your new documentation. I’m going to have a beer before going to step 6 because I’m not sure what/where AlarmServer is, so that’s my next challenge. That may be obvious, but any detailed help on those next steps would be great.
Thank you very much for what you’ve done.
Here’s my eventlog showing that I was successful:
Alarm Panel (Device) Events — displayed | all | from device
Date Source Type Name Value Displayed Text
30 Mar 2014 23:12:15
moments ago DEVICE zone2 closed Alarm Panel zone2 is closed
30 Mar 2014 23:12:15
moments ago APP_COMMAND closed Alarm Panel App sent closed command to Alarm Panel
30 Mar 2014 23:10:14
moments ago DEVICE zone1 open Alarm Panel zone1 is open
30 Mar 2014 23:10:14
moments ago APP_COMMAND open Alarm Panel App sent open command to Alarm Panel
AlarmServer is a python project by juggie and is available on Github at the link below.
You need to grab the “smartthings” branch when you check it out since that’s where all this callbackURL code lives right now.
Let me know if you have any issues getting that setup, it’s fairly straightforward if you are familiar with Python at all and it’s still pretty easy even if you are not familiar with it.
@sanity this is awesome! I’m probably going to ditch my GE Concord 4 panel in order to gain this capability. Do you know if it’s possible to arm the DSC panel in both “away” and “stay” modes?
AlarmServer is not tested with Python 3.X that I’m aware of.
I used 2.7 but if you want to use 3.X just change that line to print(sys.exec(info()[0]) basically just wrap it up in ()'s.
DSC Supports arming a panel in away and stay modes.
My app does not yet support that but will soon, I’m waiting for the local hub networking bits to become public before that feature can be enabled (waiting on Smartthings basically).
@sanity, this is probably a noob/config issue, or both, but v2.7 throws this message when running alarmserver.py :
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type “copyright”, “credits” or “license()” for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File “C:\Python27\AlarmServer-smartthings\alarmserver.py”, line 19, in <module>
import requests
ImportError: No module named requests
>>>
I have python in my path correctly, and I will admit that I’m not well versed with Python (although I expect I will before this is all over!)
Simple Python issue, you need an extra module called “requests”.
Depending on your platform you can usually type ‘pip install requests’ OR ‘easy_install requests’ to get it installed.
You can verify that it’s installed by launching a Python shell and typing (without the quotes) ‘import requests’.
If it doesn’t say anything or print any errors to the screen then it’s installed properly and you can exit out of that Python shell and fire up the AlarmServer app again.
@sanity - Hey, success! Looks like it’s trying to connect:
Using configuration file alarmserver.cfg
2014-03-31 19:37:07 Alarm Server Starting
2014-03-31 19:37:07 Currently Supporting Envisalink 2DS/3 only
2014-03-31 19:37:07 Tested on a DSC-1616 + EVL-3
2014-03-31 19:37:07 and on a DSC-1832 + EVL-2DS
2014-03-31 19:37:07 and on a DSC-1864 v4.6 + EVL-3
2014-03-31 19:37:07 Envisalink Proxy Started
2014-03-31 19:37:07 Connected to 192.168.1.27:4025
error: uncaptured python exception, closing channel <main.EnvisalinkClient connected at 0x230fe90> (<type ‘exceptions.ValueError’>:invalid literal for int() with base 10: ‘Log’ [C:\Python27\lib\asyncore.py|read|83] [C:\Python27\lib\asyncore.py|handle_read_event|444] [C:\Python27\lib\asynchat.py|handle_read|158] [C:\Python27\AlarmServer-smartthings\alarmserver.py|found_terminator|238] [C:\Python27\AlarmServer-smartthings\alarmserver.py|handle_line|270])
2014-03-31 19:37:07 Disconnected from 192.168.1.27:4025
2014-03-31 19:37:07 Connection failed, retrying in 10 seconds
I wonder is this could be related to the differences between the DSC panel and Vista?
That looks like it’s getting something back from the Envisalink connection that it doesn’t like.
On line 269 in alarmserver.py add the line below at the same spacing as the code= line below it.
Once you do that restart the alarmserver.py and try again, include the output from that print line when you get it on your screen.
Example line 269 and line 270:
print “input: %s” % input
code=int(input[:3])