Manual installation on a Raspberry Pi


This installation of Open Peer Power Core requires the Raspberry Pi to run Raspbian Lite. The installation will be installed in a Virtual Environment with minimal overhead. Instructions assume this is a new installation of Raspbian Lite.

You must have Python 3.7 or later installed (including the package python3-dev) which is not the case for Raspbian Stretch.

Although these installation steps specifically mention a Raspberry Pi, you can go ahead and proceed on any Linux install as well. This guide is also referred to as the "Advanced Guide" for a virtual environment install.
Please remember to ensure you're using an [appropriate power supply](https://www.raspberrypi.org/documentation/faqs/#pi-power) with your Pi. Mobile chargers may not be suitable, since some are designed to only provide the full power with that manufacturer's handsets. USB ports on your computer also will not supply enough power and must not be used.

Connect to the Raspberry Pi over SSH. Default password is raspberry. You will need to enable SSH access. The Raspberry Pi website has instructions here.

$ ssh pi@ipaddress

Changing the default password is encouraged.

passwd

Update the system.

sudo apt-get update
sudo apt-get upgrade -y

Install the dependencies.

sudo apt-get install python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev

Add an account for Open Peer Power Core called openpeerpower. Since this account is only for running Open Peer Power Core the extra arguments of -rm is added to create a system account and create a home directory. The arguments -G dialout,gpio,i2c adds the user to the dialout, gpio and the i2c group. The first is required for using Z-Wave and Zigbee controllers, while the second is required to communicate with Raspberry’s GPIO.

sudo useradd -rm openpeerpower -G dialout,gpio,i2c

Next we will create a directory for the installation of Open Peer Power Core and change the owner to the openpeerpower account.

cd /srv
sudo mkdir openpeerpower
sudo chown openpeerpower:openpeerpower openpeerpower

Next up is to create and change to a virtual environment for Open Peer Power Core. This will be done as the openpeerpower account.

sudo -u openpeerpower -H -s
cd /srv/openpeerpower
python3 -m venv .
source bin/activate

Once you have activated the virtual environment (notice the prompt change to (openpeerpower) openpeerpower@raspberrypi:/srv/openpeerpower $) you will need to run the following command to install a required Python package.

python3 -m pip install wheel

Once you have installed the required Python package it is now time to install Open Peer Power Core!

pip3 install openpeerpower

Start Open Peer Power Core for the first time. This will complete the installation for you, automatically creating the .openpeerpower configuration directory in the /home/openpeerpower directory, and installing any basic dependencies.

opp

You can now reach your installation on your Raspberry Pi over the web interface on http://ipaddress:8123.

When you run the `opp` command for the first time, it will download, install and cache the necessary libraries/dependencies. This procedure may take anywhere between 5 to 10 minutes. During that time, you may get "site cannot be reached" error when accessing the web interface. This will only happen for the first time, and subsequent restarts will be much faster.

If you want to setup opp as a daemon and autostart it on boot please refer to Autostart Open Peer Power Core.

Updating

To update to the latest version of Open Peer Power Core follow these simple steps:

sudo -u openpeerpower -H -s
source /srv/openpeerpower/bin/activate
pip3 install --upgrade openpeerpower

Once the last command executes, restart the Open Peer Power Core service to apply the latest updates. Please keep in mind that some updates may take longer to start up than others. If Open Peer Power Core fails to start, make sure you check the Breaking Changes from the Release Notes.

Run a specific version

In the event that a Open Peer Power Core version doesn’t play well with your hardware setup, you can downgrade to a previous release. For example:

sudo -u openpeerpower -H -s
source /srv/openpeerpower/bin/activate
pip3 install openpeerpower==0.XX.X

Run the beta version

If you would like to test next release before anyone else, you can install the beta version released every two weeks, for example:

sudo -u openpeerpower -H -s
source /srv/openpeerpower/bin/activate
pip3 install --pre --upgrade openpeerpower

Run the development version

If you want to stay on the bleeding-edge Open Peer Power Core development branch, you can upgrade to dev.

The "dev" branch is likely to be unstable. Potential consequences include loss of data and instance corruption.

For example:

sudo -u openpeerpower -H -s
source /srv/openpeerpower/bin/activate
pip3 install --upgrade git+git://github.com/OpenPeerPower/Open-Peer-Power.git@dev

Activating the virtual environment

When instructions tell you to activate the virtual environment, the following commands will do this:

sudo -u openpeerpower -H -s
source /srv/openpeerpower/bin/activate