# Xovis

> Please note that this is the documentation for the Xovis app, the successor to the [Xovis People Counter app](https://doc.eliona.io/collection/apps/apps/xovis-people-counter).

### Overview

This manual provides instructions for configuring, installing, and using the Xovis app to manage resources and synchronize data between Eliona and Xovis People Counters.

### Installation

Install the Xovis app via the Eliona App Store.

### Configuration

The Xovis app must be configured through Eliona's settings interface. Below you will find the general steps and details for configuring the app.

### Xovis app configuration and sensor discovery workflow

Configurations can be created in Eliona under `Settings > Apps > Xovis` created, thereby opening the app interface [Generic Frontend](https://doc.eliona.io/collection/v/manuals/settings/apps) opened. Below you will find the complete workflow for configuring Xovis devices.

#### Step 1: Creating an Xovis app configuration

First, a configuration must be created that defines how Eliona interacts with the Xovis device. This configuration contains important details such as device certificate verification, data collection frequency, and API timeouts.

**Endpoint**: `/configs`

**Method**: `POST`

**Required data**:

| Attribute          | Description                                                                                                                                             |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `checkCertificate` | Indicates whether the device certificate should be checked (`true` for publicly accessible devices, `false` for non-publicly accessible devices).       |
| `enable`           | Enables or disables data synchronization for this configuration.                                                                                        |
| `refreshInterval`  | Interval in seconds for data collection from the Xovis device (default: 60 seconds). Can be reduced when datapush is used.                              |
| `requestTimeout`   | Timeout in seconds for API requests to the Xovis device (default: 120 seconds).                                                                         |
| `projectIDs`       | List of Eliona project IDs for which this device should collect data. For each project ID, smart devices are automatically created as assets in Eliona. |

#### Example configuration request:

```json
{
  "checkCertificate": true,
  "enable": true,
  "refreshInterval": 60,
  "requestTimeout": 120,
  "projectIDs": ["10"]
}
```

#### Answer:

After successful creation of the configuration, you will receive a response with the internal ID (`id`) of the newly created configuration. This ID is required for configuring sensors in the next step.

#### Step 2: Adding Xovis sensors with the configuration ID

Using the configuration ID obtained in step 1 (e.g. `"id": 1`) you can now configure Xovis sensors. Each sensor is linked to a configuration and supports discovery methods such as Layer 2 (L2) or Layer 3 (L3).

**Endpoint**: `/sensors`

**Method**: `POST`

**Required data**:

| Attribute          | Description                                                                                        |
| ------------------ | -------------------------------------------------------------------------------------------------- |
| `configuration_id` | The ID of the configuration created in step 1. This links the sensor to the configuration.         |
| `username`         | Xovis sensor username.                                                                             |
| `password`         | Xovis sensor password.                                                                             |
| `hostname`         | Hostname or IP address of the Xovis sensor.                                                        |
| `port`             | Network port for communication with the sensor (e.g. 443 for HTTPS).                               |
| `discovery_mode`   | Mode for sensor discovery (`disabled`, `L2` or `L3`).                                              |
| `l3_first_ip`      | (Optional) Starting IP address for Layer 3 (L3) discovery to find sensors within a specific range. |
| `l3_count`         | (Optional) Number of IP addresses to scan in L3 discovery mode.                                    |

#### Example sensor request:

```json
{
  "configuration_id": 1,
  "username": "sensor_user",
  "password": "securepassword123",
  "hostname": "sensor1.local",
  "port": 8080,
  "discovery_mode": "L3",
  "l3_first_ip": "192.168.1.10",
  "l3_count": 50
}
```

#### Continuous Asset Creation (CAC)

After the configuration and sensor discovery are complete, Eliona starts Continuous Asset Creation (CAC). The discovered sensors are automatically added as assets in Eliona:

* **Sensor discovery**: Identified sensors are added as assets.
* **Automatic asset creation**: Configured logics on the sensors are stored in Eliona as assets.
* **Notifications**: The user receives a message through the Eliona notification system when new assets have been created.

#### Datapush

For continuous data transmission (so that data is transmitted immediately when people move under the sensors instead of waiting for the `refreshInterval` to wait for), Datapush can be configured:

1. Go to the sensor configuration interface
2. Navigate to `Settings > Single sensor > Data Push`
3. Set up a new HTTPS connection with target `https://{your-eliona-instance}/apps-public/xovis/{configuration_id}/datapush`, port 443
4. Create a new agent -> Live Data Push:
   * Data filtering: as desired
   * Format: JSON
   * Time format: Unix time MS
   * Empty frames: skip empty frames
   * Normalization: Level 1
   * Full packet info: off
   * Full sensor info: off
   * Pretty format: off
