Hi, Kevin:
I'm sorry I haven't gotten back sooner, but I've been playing around with the webapp for a few days to see how it works and how custom notifications work. I want to explain in more detail on what I need to accomplish by using the Pi, ask you some questions on the current ways to accomplish it (without doing much/any coding on the Pi), and, if there aren't current capabilities to satisfy the requirements, what your recommendations would through custom development.
Please note that I am not a Linux person nor am I a Python person (I hate snakes). I'm sure Python is great, but I really want to avoid it if possible. I don't have room left in my head for another development language. Having said that, I have over 30 years of experience in software architecture and development -- primarily in C++, Java and C#.
At a high level, I have custom "software" that runs on a Raspberry Pi 3 using Windows 10 IoT Core as its OS. The location of the Pi is not near the alarm panel. It would be impossible to use the AD2USB standalone to get the job done, which is why i need the AD2PI.
This "software" does various things. What I want to do is add functionality to it that will act as a client to your AD2PI (server) using the webapp. I do not care about the UI on the webapp -- just the ability to send commands and/or receive alarm events. If the webapp isn't the approach to take, then I don't mind coding at a lower network level bypassing the webapp all together .
I have played around with the custom notification functionality on the webapp. I'm not sure if it can provide all of the data I need. Preferably, I would like for it to send me a notification (from the selected choices)
and include the raw data stream that was interpreted (webapp interfacing with AD2USB). For example, the data that is documented on
http://www.alarmdecoder.com/wiki/index.php/Protocol. If I can get all of the information needed from the event without having to send an http message to the REST API, then this could work by me opening an HttpListener on the my application and pointing the webapp's notifications to it.
Here are some questions regarding this scenario:
1. Can the custom notifications provide this level of information?
2. If not, what are all of the "substitution variables (i.e. {{message}}) that it can provide?
3. Can it provide Partition information in the message?
If this isn't the approach to take, then here are two other alternatives that would be considered:
- My ideal approach would be to use a publish/subscribe design (or something like a publish/subscribe pattern), where I subscribe to the events that are occurring on the AD2PI via the network and the AD2PI publishes them to me immediately -- again providing as much information as necessary. I am afraid if the software polled the AD2PI using the REST API continuously and indefinitely, I might miss some events and/or degrade the performance of both devices and the network. Can the AD2PI broadcast the data read from the AD2USB to other listeners on the network?
- OK. If not, then I don't mind getting my hands dirty in the webapp's Python code, but would need some help from you. Could you point me in the exact direction of where I could modify the "Notification logic" to add a substitution variable for the entire data stream"? Which source file would it be in? Where would I get the data stream to add? As much information as you could give me regarding this would help me out tremendously.
If none of these options sound good to you, how would you advise me to accomplish this?
I think I can use the REST API to send commands (i.e. keys) to the panel. The only thing I am unsure about is how to specify the partition (or keypad) that I want the keys sent to. I don't necessarily see how to do this. Is it possible?
Your input is greatly appreciated.
Also, I wanted to let you know that I got the webapp up and running on my Raspberry Pi 3 using the latest version of Raspbian Stretch Lite (9.1 - <2017-11-29>). The current pull.sh wasn't working -- primarily because of the version of "docker" that was being used. I replaced it with the latest "docker-ce" and it installed with no problems. If you like, here is the modified pull.sh (nothing fancy). Again, please note that I am not a Linux person:
- Code: Select all
#!/bin/bash
echo "Reading config...." >&2
source config.cfg
echo "******************************************" >&2
echo "********* Configuring Pi Hardware ********" >&2
echo "******************************************" >&2
echo "enable_uart=1" | sudo tee -a /boot/config.txt
echo "disabling serial console..." >&2
sudo sed -i 's/console=serial0,115200/ /g' /boot/cmdline.txt
sudo sed -i 's/kgdbog=ttyAMA0,115200/ /g' /boot/cmdline.txt
sudo systemctl disable serial-getty@ttyAMA0.service
echo "******************************************" >&2
echo "********* Installing Dependencies ********" >&2
echo "******************************************" >&2
sudo sed -i 's/frontend=pager/frontend=text/g' /etc/apt/listchanges.conf
sudo apt remove docker docker-engine docker.io
sudo apt update
sudo apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common rpi-update
if [ $? != 0 ]; then
echo "******************************************" >&2
echo *"*************** ERROR!!!! ***************" >&2
echo "********* Installing Dependencies ********" >&2
echo "******************************************" >&2
exit 1
fi
echo "******************************************" >&2
echo "************ Installing Docker ***********" >&2
echo "******************************************" >&2
echo "deb [arch=armhf] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update
sudo apt -y install docker-ce
if [ $? != 0 ]; then
echo "******************************************" >&2
echo *"*************** ERROR!!!! ***************" >&2
echo "************ Installing Docker ***********" >&2
echo "******************************************" >&2
exit 1
fi
echo "******************************************" >&2
echo "************* Enabling Docker ************" >&2
echo "******************************************" >&2
sudo systemctl enable docker
sudo service docker start
if [ $? != 0 ]; then
echo "******************************************" >&2
echo *"*************** ERROR!!!! ***************" >&2
echo "************* Enabling Docker ************" >&2
echo "******************************************" >&2
exit 1
fi
echo "******************************************" >&2
echo "*********** Show Docker Version **********" >&2
echo "******************************************" >&2
sudo docker version
echo "******************************************" >&2
echo "*** Getting Latest Alarm Decoder Image ***" >&2
echo "******************************************" >&2
echo "alarmdecoder" | sudo tee /etc/hostname
sudo docker pull alarmdecoder/alarmdecoder:latest
if [ $? != 0 ]; then
echo "******************************************" >&2
echo *"*************** ERROR!!!! ***************" >&2
echo "******* Getting alarmdecoder Image *******" >&2
echo "******************************************" >&2
exit 1
fi
sudo hostname alarmdecoder
sudo sed -i 's/raspberrypi/alarmdecoder/g' /etc/hosts
sudo /etc/init.d/hostname.sh start
echo "******************************************" >&2
echo "************ Fetching nsenter ************" >&2
echo "******************************************" >&2
sudo docker run --restart $RESTART_PARAM -v /usr/local/bin:/target jpetazzo/nsenter
echo "******************************************" >&2
echo "**** Starting alarmdecoder Container *****" >&2
echo "******************************************" >&2
sudo docker run --restart $RESTART_PARAM --net="host" --device=$DEVICE --privileged -d -ti -e "container=docker" -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p $EXTERNAL_HTTP_PORT:$INTERNAL_HTTP_PORT -p $EXTERNAL_HTTPS_PORT:$INTERNAL_HTTPS_PORT -p $EXTERNAL_WORKER_PORT:$INTERNAL_WORKER_PORT -p $EXTERNAL_SER2SOCK_PORT:$INTERNAL_SER2SOCK_PORT alarmdecoder/alarmdecoder
if [ $? != 0 ]; then
if [ $? != 0 ]; then
echo "******************************************" >&2
echo *"*************** ERROR!!!! ***************" >&2
echo "** alarmdecoder Container Start Failed ***" >&2
echo "******************************************" >&2
exit 1
fi
exit 1
else
echo "******************************************" >&2
echo "******************************************" >&2
echo "********** INSTALL SUCCESSFUL!!! *********" >&2
echo "******************************************" >&2
echo "******************************************" >&2
exit 0
fi