Idiots install guide (20p, AD2pi, raspi zero, & SmartThings)

General Discussion

Idiots install guide (20p, AD2pi, raspi zero, & SmartThings)

Postby TheTick077 » Tue Jul 25, 2017 5:14 pm

First off, let me say this device is great once you get everything set up. I think I made every mistake in the book when setting it all up, so I thought I would write this little guide for myself (friends/family want similar set up to what I have done), and also contribute a little to the community. Little background: I am a complete newbie when it comes to raspi, Linux, and home automation, so I hope this guide will help anyone else that was as lost as I was.

Goal: A headless/wireless AD2pi that is powered by the alarm battery and integrates into SmartThings

Hardware:
AD2pi: http://www.alarmdecoder.com/catalog/product_info.php/products_id/33/osCsid/asqifu52fcn174haamsad9lpt2 + add on some alarm cable
Power:
If you can solder - https://www.amazon.com/RioRand-LM2596-Converter-1-23V-30V-1Pcs-LM2596/dp/B008BHAOQO + spare MicrUSB cable (I had a ton laying around)
If you can't solder: http://www.alarmdecoder.com/catalog/product_info.php/cPath/1/products_id/40
Raspberry Pi Zero W: https://www.adafruit.com/product/3400
microSD card:: Any will do, but get at least 8gb. I got this one:https://www.amazon.com/SanDisk-Memory-Frustration-Free-Packaging-SDSDQ-008G-AFFP/dp/B007KFXICK/ref=sr_1_1?s=pc&ie=UTF8&qid=1500951691&sr=1-1&keywords=micro+sd+card&refinements=p_n_feature_two_browse-bin%3A6518302011
GPIO Header Pins:
If you can solder - https://www.adafruit.com/product/2822
If you can't solder: https://www.adafruit.com/product/3413
Pi Case: https://www.adafruit.com/product/3252
Multimeter
Screwdriver
USB phone charger (5v)

Set-up
1. Attatch GPIO pins (either the solder or non-solder method)
2. Download Jessie Lite https://www.raspberrypi.org/downloads/raspbian/
3. Download Etcher https://etcher.io/
4. Flash Jessie Lite to you MicroSd using Etcher
5. Follow the link to a tutorial on adding 2 files to the boot directory of the SD card you just flashed in order for us to log into the pi without a monitor hooked up to it:https://core-electronics.com.au/tutorials/raspberry-pi-zerow-headless-wifi-setup.html
6. Now let's ensure the pi boots and we can talk to it! Plug the raspi in using a microUSB and a phone charger and it should boot up (there are 2 microUSB ports one is labled power)!
7. Download and install Putty on your main PC http://www.putty.org/
8. Enter the hostname as "raspberrypi" (no quotes) and connect (sometimes it needs a .local after the raspberrypi - not sure why some systems need it, but mine did - so it would be raspberrypi.local)
9. Default user name is "pi" and password is "raspberry"
10. Enter command:
Code: Select all
 sudo raspi-config

11. Change the hostname to "alarmdecoder" and change the password to something other than "raspberry"
12. Exit out of that and shutdown:
Code: Select all
sudo shutdown -h

13. unplug the raspi once the green LED shuts off
14. if you purchased the soldering option power unit, you will need to take a micro USB cable, and cut off the USB-A end (the one that would go into your main computer) and attach the red to the +in and the black to the -in. Then cut the cord about halfway, and attach your newly cut end to the out + and - (red and black respectively). You should now have a wire with one cut end, the step down converter in the middle and a micro USB connection at the end. You will eventually connect the remaining red and black wires to the alarm panel battery.
15. If you are currently on paid monitoring, put your alarm into test mode (I did that by going to myadt.com)
16. Unplug the alarm panel from the outlet and battery
17. Attach the cut end of the power adapter you made in step 14 to the red and black terminals of the battery
18. Use your multimeter to measure the voltage coming out of the step down converter, and adjust it down to 5.1 volts by twisting the little flat-head screw
19. Attach your AD2pi to the alarm panel (the little document that came with the AD2pi clearly labels which wires go where).
20. attach the AD2pi to the GPIO pins - there is a marked square on the back of the AD2pi that will align with a square on the raspi's GPIO pins
21. Plug the battery and AC adapter back in to power up the alarm panel
22. Plug in the raspi and boot it up.
23. Go back to your main pc and fire up Putty again - this time the hostname will be alarmdecoder (once again might need a .local after it).
24. Once logged in we need to update the repos and install GIT:
Code: Select all
sudo apt-get update

Code: Select all
sudo apt-get install git

25. Now that GIT is installed, let's clone the alarmdecoder docker repo:
Code: Select all
sudo git clone https://github.com/nutechsoftware/alarmdecoder-docker.git

26. go into the directory that was just created:
Code: Select all
cd alarmdecoder-docker

27. Run the pull script:
Code: Select all
sudo chmod +x pull.sh

Code: Select all
./pull.sh

28. Go grab dinner, this takes a while (in my experience over an hour)
29. You should get a final message saying that everything installed ok, and to reboot. Before you do, you may need to modify the serial port configuration. Type the following command:
Code: Select all
ls -l /dev

find the entries that are labeled serial0 and serial1. If serial0 is assigned to ttyAMA0, skip down to step 36 & reboot. Otherwise, if it looks like this, it needs to be swapped, so continue on:
Code: Select all
 
lrwxrwxrwx 1 root root           5 Jul 24 03:58 serial0 -> ttyS0
lrwxrwxrwx 1 root root           7 Jul 24 03:58 serial1 -> ttyAMA0
 

30. Now that we see the serial ports are wrong, we need to swap them around by adding one line to a file. I use nano to edit my txt files so the command would be:
Code: Select all
sudo nano /boot/config.txt

31. Once in there, add this one line to the bottom (you have to use your arrow keys to scroll down):
Code: Select all
dtoverlay=pi3-miniuart-bt

32. Save (Ctrl+o) and exit (Ctrl+x)
33. Reboot the pi:
Code: Select all
sudo reboot

34. Log back in (using putty and the hostname alarmdecoder) and type:
Code: Select all
ls -l /dev
to verify that the serial ports now are labeled like this:
Code: Select all
lrwxrwxrwx 1 root root           7 Jul 24 04:23 serial0 -> ttyAMA0
lrwxrwxrwx 1 root root           5 Jul 24 04:23 serial1 -> ttyS0

35. Now it is time to set up the webapp. The first boot takes a while so give it 10 minutes or so, but then go to http://alarmdecoder.local in your browser.
36. Click on the Start button and select AD2pi and tag it as a local device (it is local to your network)
37. On the next page, leave the path and baudrate as the defaults but check the share on the network box.
38. I left everything at the default values for the next 2 screens. Then it will test everything. Hopefully all is well here. If not, check your wires and soldering job to ensure everything looks good.
39. Once in the app, you will need to create all your zones by going into the settings -> zones. If you don't know the zone #, just open the door, activate the motion sensor, or undo the smoke/CO detector. The virtual panel should show you the zone # that has the fault.
40.The next steps is to get it integrated into SmartThings, and those are clearly written, so I am not going to rewrite them, but they can be found here: https://github.com/nutechsoftware/alarmdecoder-smartthings

There are still a few things I haven't figured out on the SmartThings side, so I figure out how notifications all work, and if a SmartThings device (something not wired to the alarm panel) can trigger the alarm, I will add that information - or if someone wants to shed some light, it would be appreciated.

I hope my little guide helped anyone that was as overwhelmed by the task of getting this all set up. Let me know if you have any questions, or notice any mistakes or typos. Thanks for reading!
TheTick077
newt
newt
 
Posts: 12
Joined: Thu Jul 20, 2017 6:42 pm

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby kevin » Wed Jul 26, 2017 3:21 pm

Perfect guide!

And there is a way to make SmartThings trigger an alarm if you can get the SmartThings device to use the REST API of the alarmdecoder - or if you can read the state of the particular sensor, you have the ability to turn it into a virtual zone - program a zone into your panel and fault and unfault it with the L command

API Documentation found here http://www.alarmdecoder.com/swagger/

Protocol documentation including L command found here https://www.alarmdecoder.com/wiki/index.php/Protocol

With a python script (using a SocketDevice example) you can read the messages from your particular sensor and send fault/unfault to your alarmdecoder

These are a few ways to set off your alarm using a readable sensor state

You could also potentially create a specific scene in smartthings to "panic" (send 3 times) the alarmdecoder
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby TheTick077 » Tue Aug 01, 2017 4:36 pm

kevin wrote:Perfect guide!

And there is a way to make SmartThings trigger an alarm if you can get the SmartThings device to use the REST API of the alarmdecoder - or if you can read the state of the particular sensor, you have the ability to turn it into a virtual zone - program a zone into your panel and fault and unfault it with the L command

API Documentation found here http://www.alarmdecoder.com/swagger/

Protocol documentation including L command found here https://www.alarmdecoder.com/wiki/index.php/Protocol

With a python script (using a SocketDevice example) you can read the messages from your particular sensor and send fault/unfault to your alarmdecoder

These are a few ways to set off your alarm using a readable sensor state

You could also potentially create a specific scene in smartthings to "panic" (send 3 times) the alarmdecoder


I'm not sure I quite understand. You say if I can read the state of the sensor. I can through SmartThings, is that what you mean? If so where would I add code to use the L command?

The other thing I was thinking was to create a webCORE piston that will send the panic signal to the alarmdecoder given a certain status and activity. Are you saying I would need to send the panic sigal 3 times in webCORE? I plan on playing with it over the weekend, but any head start I can gain from some insight would be appreciated. Thanks.
TheTick077
newt
newt
 
Posts: 12
Joined: Thu Jul 20, 2017 6:42 pm

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby kevin » Tue Aug 01, 2017 6:08 pm

Not sure what webCORE is... if it's using the API then it doesn't need to trigger 3 times. If it simulates a button press, then it will need to be sent 3 times.

You could modify the device handler code to read the state of that particular sensor and fault/unfault a zone based on it - or if you can read the state externally you can do it with a simple python script.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby Selvey » Sun Aug 06, 2017 11:13 pm

kevien wrote:Not sure what webCORE is... if it's using the famously efficient pre workouts then it doesn't need to trigger 3 times. If it simulates a button press, then it will need to be sent 3 times.

You could modify the device handler code to read the state of that particular sensor and fault/unfault a zone based on it - or if you can read the state externally you can do it with a simple python script.


As an idiot I say thanks for the guide!
Last edited by Selvey on Mon Aug 09, 2021 4:30 am, edited 5 times in total.
Selvey
newt
newt
 
Posts: 1
Joined: Mon Jul 31, 2017 3:16 am

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby TheTick077 » Mon Sep 04, 2017 6:41 pm

So everything went so well on my install, that my parents decided to purchase the AD2pi device and have me set it up for them. I followed all my steps flawlessly, and the webapp works perfectly, but the smartthings integration isn't finding the device. After adding the device handler, and SmartApp, I get stuck on this step:

17. Click the Discover button. You'll probably have to hit refresh a couple of times to get your device to show up. If it doesn't show up make sure you're running an up-to-date version of the webapp.

I updated the webapp before even attempting to add the SmartApp, and it isn't telling me an update is avalible. The only difference between my setup and my parent's is that when accessing everything, I have to drop the ".local". So to get to the webapp, I just go to https://alarmdecoder rather than https://alarmdecoder.local. When I ssh into the pi, I also drop the .local, but the address on the window adds a ".attlocal.net". I have tried to find out where to disable that "feature" of the AT&T router they use, but it appears that might not be possible to change. So I don't know if that is the issue or not, and if so, if there is a workaround, but any help/ideas would be greatly appreciated. Thanks.
TheTick077
newt
newt
 
Posts: 12
Joined: Thu Jul 20, 2017 6:42 pm

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby kevin » Mon Sep 04, 2017 10:29 pm

Make sure the discovery thread is actually running (gunicorn logs should show this info)

Make sure they're actually on the same subnet

Make sure their router supports upnp
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby raidflex » Tue Oct 03, 2017 7:04 pm

Anyone know what the refresh rate is for detecting a zone is open with Smartthings? I am trying to add some automation using a contact sensor that is connected to the alarm system, but there is over a 30 second delay until the sensor is shown as open in Smartthings. If I go to the alarm app on the Smartthings app and hit refresh then the sensor will immediately show open. I am wondering if there is a way to shorten this delay. Thanks.
raidflex
newt
newt
 
Posts: 11
Joined: Wed May 31, 2017 10:50 am

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby kevin » Tue Oct 03, 2017 7:28 pm

Make sure you've got the latest WebApp and create a SmartThings notification type - this basically removes all delays. You may have to uninstall and reinstall on the smartthings side to get your url and token for the notification.

Code: Select all
Enabling SmartThings Integration in the Webapp

    Log into your AlarmDecoder webapp.
    Click Settings
    Click Notifications
    Click the New Notification button
    Set the Notification Type to 'SmartThings Integration'
    Enter a description
    Click SmartThings settings
    Enter the 'API Endpoint' you recorded during install into the 'URL' box.
    Enter the 'API Token' you recorded during install into the 'Token' box.
    Press Next
    Press Save
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Idiots install guide (20p, AD2pi, raspi zero, & SmartThi

Postby raidflex » Wed Oct 04, 2017 5:34 am

kevin wrote:Make sure you've got the latest WebApp and create a SmartThings notification type - this basically removes all delays. You may have to uninstall and reinstall on the smartthings side to get your url and token for the notification.


I have this notification already setup, but for example when I open my front door which has a physical contact sensor there is over a 30 second delay on Smartthings until the door is shown as open. If I go into the "alarm" app which shows all the zones and hit the refresh button then the status immediately changes to open. The webapp does not show any available updates in the GUI, unless I have to manually update it?
raidflex
newt
newt
 
Posts: 11
Joined: Wed May 31, 2017 10:50 am

Next

Return to General

Who is online

Users browsing this forum: Google [Bot] and 6 guests

cron