-
Notifications
You must be signed in to change notification settings - Fork 26
RPi Example
-
Install latest version of Raspbian. You may like to consider a light weight variant like Raspbian Lite (https://www.raspberrypi.org/downloads/raspbian/)
-
Change locale, timezone etc:
sudo raspi-config
- Undertake some mandatory configuration changes including password resets: Change root PW
passwd root
Add new user account (not root). Nb. Minibian does not have 'pi' user by default. This is not necessary for Raspbian distro's.
adduser pi
Add user to sudoers file:
adduser pi sudo
Change hostname:
nano /etc/hostname
- Reset passwords for pi and root:
passwd pi
passwd root
- Install pynx584 for interfacing with alarm:
sudo pip3 install pynx584
Nb. You can upgrade pynx584 by running: sudo pip3 install pynx584 --upgrade
- Insert your USB to serial device and give permission to the USB device for the pi user account:
sudo usermod -a -G dialout pi
Nb. If the usb-to-serial device is not detected, you may need to run:
apt-get install firmware-linux-free
- Run server at startup, add systemd service
sudo nano /etc/systemd/system/nx584.service
Add the following (or similar):
[Unit] Description=NX584 daemon After=network.target
[Service] Type=simple User=pi WorkingDirectory=/usr/local/bin/ ExecStart=/usr/local/bin/nx584_server --config /home/pi/config.ini --serial /dev/ttyUSB0 --baudrate 9600 --listen localhost --port 5007 --log /home/pi/nx585.log Restart=on-failure
[Install] WantedBy=multi-user.target
Nb. This will log output to /home/pi/nx584.log. Make sure log file exists, and that pi user has access to it:
sudo chown pi /home/pi/nx584.log
Reload the systemd files
sudo su
systemctl daemon-reload
Enable the new servce you created.
systemctl enable nx584.service
. Alternative method "This does not function on newer rpi versions, use 7. systemd service instead."
Run pynx584_server at startup by modifying /etc/rc.local
sudo nano /etc/rc.local
Add the following line (or similar):
sudo su - pi -c '/usr/local/bin/nx584_server --config /home/pi/config.ini --serial /dev/ttyUSB0 --baudrate 9600 --listen 192.168.1.100 --port 5007 --log /home/pi/nx584.log'
Nb. This will log output to /home/pi/nx584.log. Make sure log file exists, and that pi user has access to it:
sudo chown pi /home/pi/nx584.log