Username : pi
Password : **********
sudo apt-get update ( this updates the pi "like Windows Update" )
sudo apt-get install git ( Git is an Online repository Library , you can download programs from Git )
sudo apt-get install gcc make wget ( wget is a download tool , to download packages )
FOR LINUX
( this is how we use wget to download a vpnclient Software )
cd /home/pi ( Unzip vpnclient in this folder )
tar -zxvf softether-vpnclient-v4.27-9668-beta-2018.05.29-linux-x64-64bit.tar.gz ( here we unzip the vpn client we downloaded )
FOR RASPBERRY PI
cd /home/pi ( Unzip vpnclient in this folder )
tar -zxvf softether-vpnclient-v4.27-9668-beta-2018.05.29-linux-arm_eabi-32bit.tar.gz
cd /home/pi/vpnclient ( go into the vpnclient Folder )
make ( install the VPN Client )
git clone https://IntertradeSupport@bitbucket.org/cognitivesystemsza/amedevices.git
cd
git clone https://pauljonvv@bitbucket.org/pauljonvv/amedbimages.git
sudo reboot ( reboot the Pi )
sudo crontab -e
choose option 2 ( nano )
it take you into your crontab file , go to the bottom of crontab and add the below lines
* * * * * /home/pi/amedevices/vpn/vpn2.sh
0 17 * * * /home/pi/amedevices/videodevices/register.sh
0 10 * * * /home/pi/amedevices/videodevices/register.sh
*/5 * * * * /usr/bin/python3 /home/pi/amedevices/videodevices/APPS/edge_bot//online_status.py # Status
then hold control key and press o , this is like save.
then you press enter
then control key + x . this will exit the file.
Create a device_config.json file in /home/pi directory
Now lets check if there are any ame Updates.
cd /home/pi/amedevices
git pull
now we need to add a vpn certificate .
step one make a directory to Mount your Flash drive.
sudo mkdir /mnt/usb/
copy the VPN certificate on to a flash drive and make note of the folder structure...
plugin the Flash drive.
mount the flash drive in the folder we created.
sudo mount /dev/sda/ /mnt/usb/ ( /dev/sda is when you will find a usb device , but it must be mounted )
now your flash is mounted and accessible.
lsusb
df -h
then we copy your vpn certificate from lets call it , VPNFOLDER
first stop the vpn service
sudo /home/pi/vpnclient/vpnclient stop
sudo /home/pi/vpnclient/vpnclient start
sudo cp /mnt/usb/60/vpn_client.config /home/pi/cert/vpn_client.config
The second option is to copy the VPN Certificate with WinSCP Application.
on the device stop the vpn client and remove the vpn_client.config file and the back.up config file.
sudo ./vpnclient/vpnclient stop
sudo rm /vpnclient/vpn_client.config
sudo rm /vpnclient/backup.*
Then copy the config file over with winscp.
and then start the VPN Client
sudo ./vpnclient/vpnclient start
then we need to copy the Device Configuration to your Pi , we copy from a Sample file, then edit your Config.
cp /home/pi/amedevices/videodevices/device_config.json /home/pi/device_config.json
cp /home/paul/amedevices/videodevices/device_config.json /home/paul/device_config.json
now we register the device in the Cloud
cd /home/pi/amedevices/videodevices
./configure.sh
then reboot
sudo reboot
after reboot try to start the AME service
cd /home/pi/amedevices/videodevices
./upgrade.sh
Now we do some Host optimization and plugin installs.
sudo dphys-swapfile swapoff
sudo nano /etc/dphys-swapfile
sudo dphys-swapfile swapon
REGISTER DEVICE QUEUES
SSH KEYS
ssh-keygen -t rsa
ssh-copy-id pi@localhost
INSTALL PLUGINS
cd /home/pi/amedevices/videodevices/APPS/
./installplugins.sh
cd /home/pi/amedevices/videodevices/APPS/edge_bot/
./prereq.sh
Next we need to make sure that all the bot and telegram related config is done.
TELEGRAM
There are two locations that need configuration.
1) home/pi/device_config.json
2) home/pi/config/comms_config.json
open and edit device config.
nano device_config.json
edit these three
chatid: get the Chat id from telegram Maintenance Group
maintenance_chatid : get the Chat id from telegram Maintenance Group
authtoken: create a bot with botfather and put that bots auth token in here.
open and edit comms_config.json
nano /config/comms_config.json
there are two critical values to edit.
1) txtCRChat - This is the chat ID of the two way communication Telegram Group.
2) txtMosquittoServer - This is where the Edge Bot must consume messages from.
On the BRT txtMosquitttoServer is 127.0.0.1 and on an IBU the txtMosquittoServer is the local Network IP address of the Avlytics Nuc.
CONSUL SETUP
When a device is installed it comes with test / heartbeat signals unconfigured. you need to set the heartbeat interval to 30 Minutes and disable the heartbeat on all channels except channel1 .
If this is not configured , the device will be blocked on the control room software as it will send too many signals too frequently and the software will mark the device as OverActive and will not process alarms from this device.
to edit consul config go to this address and change the Client / device and Channel numbers.
when you go to the link you will be presented with a json config file. Look for these two entries :
"heartbeat_interval":"3600","heartbeat_bool":"true"
if they are not present , copy and past these values after the last value. first add a comma then paste the values and the end of the config file will look like this.
"somevaluewhichislastintheconfigfile","heartbeat_interval":"3600","heartbeat_bool":"True"}
After editing consul and clicking update, the config is sent to the hub, there is one other step to carry out before the change will take effect. Go to the Hub , http://192.168.7.1:8300 and find that device and channel configuration.
open the channel config and click Save . do not edit any of the config before clicking save or your consul changes will be cleared.
SETTING A STATIC IP ADDRESS
after a device is configured and running , the next step is to assign a static IP Address. Get a static IP from Donne and assign the static to the device.
FOR RASPBERRY PI
nano device_config.sh
is_static_ip='true'
vpn_ip='172.29.x,x' x.x must be changed to the address issued by Donne.
rabbit_host='192.168.7.10'
cd amedevices/vpn/
git pull
sudo ./setting_static_ip.sh 172.29.x.x
./run.sh
Then Reboot and the static address is set.
FOR UBUNTU NUC
nano device_config.sh
is_static_ip='true'
vpn_ip='172.29.x,x' x.x must be changed to the address issued by Donne.
rabbit_host='192.168.7.10'
sudo nano /etc/network/interfaces
Open the config file and paste this after all other config in the file. Ensure that you do not duplicate anything.
#Static vpn_ame Interface
auto vpn_ame
iface vpn_ame inet static
address 172.29.x.x
netmask 255.255.0.0
routers 192.168.7.0
domain_name_servers 8.8.8.8
#Nuc persistent routes
up route add -net 192.168.7.0/24 gw 172.29.0.2 dev vpn_ame
up route add -net 192.168.51.0/24 gw 172.29.0.3 dev vpn_ame
after these values have been inserted , this command will work on both nuc and brt
cd amedevices/vpn
./run.sh
sudo reboot
Next Step is Testing the deployment.
1) telegram bot
Issue the device with some telegram bot commands to ensure that the bot is functioning correctly.
ie. /test /arm_all_channels /status /ifconfig /menu /disarm_all_channels
2) Telegram Alerts
Check the telegram Alert Group and make sure you are receiving alerts.
3) Telegram Maintenance Alerts
Check the telegram Maintenance Group and make sure you are receiving Test messages and also Grafana Notifications.
If not go through Debugging articles to solve the issue.
4) Add the Device to Control Room Avlytics Software.
To add the device to the clients software, you will need four bits of information.
The VPN IP Address : this is the address you received from Donne
The Security Keys : you can get these from telegram with /getkeys command or on the user interface Dashboard page.
The number of channels : this is what you set in the device_config.json
The device ID : this is the Devices unique identifier.
After adding the device to the Clients Avlytics Software , Test the live view functionality and ensure that you are receiving alerts.
Next step is to pull the channel configuration and Snapshots in the Avlytics Software.
This is to ensure that the correct channel is referenced when an alert comes through and that the correct snapshot is displayed in the alarm manager when an alert comes in.
5) If this is an AR Software connected device you need to setup the comms_config.json so the device can report to the control room software.
To set this up you will require a radio/xmitter number and some basic end user details.
"txtClientName": "ISD Office",
"txtContact": "",
"txtAddress": "43 Pickering Street",
"txtArea": "Newton Park",
"txtCity": "Port Elizabeth",
"txtCountry": "SA",
"txtAccountCode": "10003", <------- Input the xmitter/radio number as the AccountCode.
Next we need to setup which AR Software package the device must report to
"dropdowns":
{
"platform_listener": "true", <------- Set to true is the device is reporting to Listener Software.
"platform_patriot": "false",
"platform_watchmanager": "true", <------- Set to true if Watchmanager software..
"platform_bvigilant": "false",
"rlys_true": "false", <------------- NB if the unit is a BRT this must be set to true or the Relays will NOT TRIGGER on event.
"rlys_false": "false",
"email_true": "false",
"email_false": "false"
}
Next we set which Event types get sent to the Control room AR Software package.
this is set per channel. and the config file for each channel is located at
/config/channel_triggers/channel_1
the file is
triggers.json
{"channel": "Channel 1", "Activity": "false", "Human presence": "true", "AME Global Human": "false", "Vehicle": "fals
e", "AME Global Vehicle": "false", "Animal": "false", "AME Global Animal": "false", "Background": "false", "AME Globa
l Background": "false", "test": "true", "heartbeat": "false", "tamper": "false", "stream_timeout": "false", "mains":
"false"}
In this file we set which event type should go to control room, by assigning the value "true" to the event type.
In the Above example , Human presence and test signals are the only alert types that get reported to the control room.
Remember that each channels trigger types need to be configured !