# 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 BuildingPro Suites and Xovis People Counters.

### Installation

Install the Xovis app via the BuildingPro Suites App Store.

### Configuration

The Xovis app must be configured using the BuildingPro Suites settings interface. Below are the general steps and details for configuring the app.

### Xovis App Configuration and Sensor Discovery Workflow

Configurations can be created in BuildingPro Suites under `Settings > Apps > Xovis`, which opens the app interface [Generic Frontend](https://doc.eliona.io/collection/v/manuals/settings/apps). Below is the complete workflow for configuring Xovis devices.

#### Step 1: Creating a Xovis App Configuration

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

**Endpoint**: `/configs`

**Method**: `POST`

**Required Data**:

| Attribute          | Description                                                                                                                                                                  |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `checkCertificate` | Specifies whether to check the device certificate (`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 (Standard: 60 seconds). Can be reduced if Datapush is used.                                                    |
| `requestTimeout`   | Timeout in seconds for API requests to the Xovis device (Standard: 120 seconds).                                                                                             |
| `tenantIDs`        | List of BuildingPro Suites tenant IDs for which this device should collect data. Smart devices are automatically created as assets in BuildingPro Suites for each tenant ID. |

#### Example Configuration Request:

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

#### Response:

After successfully creating 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 detection (`disabled`, `L2` or `L3`).                                          |
| `l3_first_ip`      | (Optional) Starting IP address for Layer 3 (L3) discovery to find sensors in 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 completing the configuration and sensor discovery, BuildingPro Suites starts Continuous Asset Creation (CAC). The discovered sensors are automatically added as assets in BuildingPro Suites:

* Sensor Discovery: Identified sensors are added as assets.
* Automatic Asset Creation: Configured logics on the sensors are stored as assets in BuildingPro Suites.
* Notifications: The user receives a message via the BuildingPro Suites notification system when new assets have been created.

### Datapush

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

1. Go to the sensor's configuration interface.
2. Navigate to `Settings > Single Sensor > Data Push`.
3. Set up a new HTTPS connection with the destination `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: Omit empty frames
   * Normalization: Level 1
   * Full package info: off
   * Full sensor info: off
   * Pretty format: off
