# Zevvy

### Overview

This guide provides instructions for configuring, installing, and using the Zevvy app to manage resources and synchronize data between Eliona and Zevvy services.

### Installation

Install the Zevvy app via the Eliona App Store.

### Configuration

The Zevvy app requires configuration through the Eliona settings interface. Below are the general steps and details required to configure the app effectively.

#### Registration of the app in the Zevvy service

Create credentials in the Zevvy service to connect the Zevvy services from Eliona. All required credentials are listed below in the configuration section.

Log in to the Zevvy console and go to the settings page. Create a new client ID and a secret.

#### Configuring the Zevvy app

Configurations can be created in Eliona under `Apps > Zevvy > Settings` which opens the [generic user interface](https://doc.eliona.io/collection/v/eliona-english/manuals/settings/apps) of the app opens. Here you can use the corresponding endpoint with the POST method. Each configuration requires the following data:

| Attribute         | Description                                            |
| ----------------- | ------------------------------------------------------ |
| `authRootUrl`     | Root URL for the authentication process.               |
| `apiRootUrl`      | Root URL for API access.                               |
| `clientId`        | Client ID created in the Zevvy console for API access. |
| `clientSecret`    | Secret created in the Zevvy console for API access.    |
| `enable`          | Flag to enable or disable this configuration.          |
| `refreshInterval` | Interval in seconds for data synchronization.          |
| `requestTimeout`  | Timeout for API requests in seconds.                   |

Example configuration JSON:

```json
{
  "authRootUrl": "https://iam.zevvy.org/realms/zevvy-prod",
  "apiRootUrl": "https://api.zevvy.org",
  "clientId": "123abc",
  "clientSecret": "s3cr3t",
  "enable": true,
  "refreshInterval": 60,
  "requestTimeout": 120
}
```

After the technical basic configuration of the app, the app needs further information about which metrics should be reported to Zevvy. For this, it is necessary to configure the assets and the corresponding measurement attribute.

This can be done with the corresponding endpoint and the POST method. Each asset definition requires the following data:

| Attribute           | Description                                                                                                            |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `configId`          | The measurement is sent with this configuration.                                                                       |
| `assetId`           | The measurement is taken from this asset.                                                                              |
| `subtype`           | Measurement data has this subtype.                                                                                     |
| `attributeName`     | Name of the measurement attribute.                                                                                     |
| `deviceReference`   | Name of the device reference of the measurement in Zevvy. (Optional, default device reference is the GAI of the asset) |
| `registerReference` | Name of the register reference of the measurement in Zevvy. (Optional, register reference is the attribute name)       |

Example JSON for configuring a measurement record for Zevvy

```json
{
  "configId": 1,
  "assetId": 4711,
  "subtype": "input",
  "attributeName": "power"
}
```

### Zevvy

Once the configuration is complete, the app begins regularly sending measured values from the configured assets and attributes to Zevvy.
