# Raspberry Pi

## Domotz Collector Installation on Raspberry Pi

This section contains a few tips and tricks on how to get started with the Domotz Collector on your Raspberry Pi.

## Installing the Domotz Collector

### Option A: Installing the Domotz Collector on Raspberry Pi OS

If you have a brand new Raspberry PI with no OS, here a [useful article explaining how to install Raspberry Pi OS.](https://help.domotz.com/knowledge-base/installing-raspbian/)

Once Raspberry Pi OS is installed, you can proceed with the following steps.

**Step 1**
Make sure your Raspberry Pi is connected to the internet. We recommend using a network cable and connecting your Raspberry Pi directly to your router.

**Step 2**

**1.** If you don't have it already, you need to install the Snapcraft store first:

```
sudo apt-get update
sudo apt-get install snapd
```

**2.** Install the Domotz PRO Agent from the Snapcraft store and assign its permissions as follows:

```
sudo snap install domotzpro-agent-publicstore
sudo snap connect domotzpro-agent-publicstore:firewall-control
sudo snap connect domotzpro-agent-publicstore:network-observe
sudo snap connect domotzpro-agent-publicstore:raw-usb
sudo snap connect domotzpro-agent-publicstore:shutdown
sudo snap connect domotzpro-agent-publicstore:system-observe
```

**3.** Load the tun module needed for the VPN on Demand feature:

```
sudo sh -c 'echo tun >> /etc/modules'
sudo modprobe tun
```

**4.** Comment one line in this file **/etc/ld.so.preload** to disable a module that conflicts with the snap package:

```
sudo nano /etc/ld.so.preload
```

Before:

```
/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so
```

After:

```
#/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so
```

*Just add a** #** at the beginning of the line. If you can't find this line or the file, jump to the next step.

**5.** Restart the Domotz Pro Collector service:

```
sudo snap restart domotzpro-agent-publicstore
```

This preloaded module conflicts with the snap package causing VPN on Demand not to work.

**6.** Last step is commenting the line 19 of the file **/etc/ssh/ssh**_config:

```
sudo nano /etc/ssh/ssh_config
```

Before:

```
Include /etc/ssh/ssh_config.d/*.conf
```

After:

```
#Include /etc/ssh/ssh_config.d/*.conf
```

*Just add a** #** at the beginning of the line.

This setting conflicts with the snap package environment preventing remote sessions.

### First time setup

The next step is to configure your Domotz Collector. To do so, make sure you’ve downloaded and installed the Domotz App on your mobile device. Then simply tap on the drawer menu button and tap on “Add Site” towards the bottom of the menu. This will automatically detect any new Domotz Collectors on your network, as long as your mobile device is connected to the same network as your Domotz Collector. You can then proceed to configure your Domotz Collector following the steps below on your mobile device without having to know the IP address of your Domotz Collector.

Alternatively, you can type in the IP address and port shown in the Domotz App in a web browser on your PC. For example, if the IP address was 192.168.1.39 you type http://192.168.1.39:3000 and then hit enter (remember to use http:// and not https://). You should now see the Domotz Collector webpage.

At this point, you’ll be asked to create an account if you don’t already have one. Please follow the on-screen instructions.

**Note**: If you’re running any other web service on your Raspberry Pi that uses port 3000, the Domotz Collector will automatically use the next available port, i.e. 3001.

**Important Note:**The setup of the Domotz Collector may fail if the time and date isn’t set correctly on your Raspberry Pi. To fix this, simply update the time and date on your Raspberry Pi and you’ll be able to proceed with the setup.

If you already have a Domotz account, you can login straight away. Otherwise, you can create a Domotz account signing up from here (please make sure you specify the right Country):

Domotz Network Monitoring Login and Mobile Interface

1. On the left, there is a login section prompting to start monitoring your network with Domotz Agent. If you have an existing account, click "LOGIN." If new to Domotz, select "CREATE AN ACCOUNT" to register.

2. On the right, a mobile interface displays the "Device Types" section. Options include different categories such as "PC & Macbook," "Mobile," "Network Equipment," "Printer & Fax," "Sensor," and more. Select a device type to monitor specific devices within that category.

Domotz Account Creation Page

1. Enter your email address in the "Email address" field.
2. Enter your password in the "Password" field. Use the eye icon to toggle password visibility if needed.
3. Select your country from the dropdown menu labeled "Please Select Your Country."
4. Click the "Start Free Trial" button to proceed with account creation.
5. By clicking "Start Free Trial," you agree to the Product and Services Privacy Policy linked below the button.

Once logged in you can finally activate your collector, with the following steps:

1. Assign a name to the Collector
2. Specify whether you run the Collector at home or office
3. Press the “Activate your Collector” button

Activating Your Network Agent in Domotz

1. Enter a name for your network in the "Give a name to your Network" field.
2. Select the location where the agent will run by choosing either "Home" or "Office."
3. Click the "Activate Your Agent" button to complete the activation process.

Once this has been done, the Domotz Collector will proceed to scan your network for devices. This will take anything from a few minutes up to 15 minutes, depending on how many devices you have on your network.

Scanning for Devices with Domotz

1. The screen shows the Domotz application scanning for devices on your network. This process can take up to 15 minutes to complete.
2. After the initial scan, a continuous discovery procedure will begin, allowing you to start using Domotz.
3. To get started immediately, download the Domotz app from the iOS App Store or Google Play Store.
4. Once the scanning process is complete, click the "Done" button to proceed.

**Note:**
By pressing “Done” you will enter the local Domotz Collector Web UI.
This is not the main Domotz app, which is accessible from mobile apps and our website. The local Collector Web UI is only meant to provide a small subset of the Domotz features (Collector info, Network Info, Route Analysis, Speed Test).
