# A description of the OpenDevice translator
> A guide to the OpenDevice translator - an accessory add-on which connects the Salto Space access control system with Lenel OnGuard.


## Overview {#overview}

The [OnGuard OAAP program](https://www.lenels2.com/en/us/security-solutions/third-party-integration/oaap/) allows third-party manufacturers (OAAP partners) to interface their products with the OnGuard software platform.
The OpenDevice APIs allow manufacturers of access control, elevator, fire, intrusion, central station receiver, life safety, and intercom systems to communicate with OnGuard.

To use the APIs, partners need to develop a translator [DLL](https://en.wikipedia.org/wiki/Dynamic-link_library) that implements a set of [COM interfaces](https://en.wikipedia.org/wiki/Component_Object_Model) published by LenelS2 for the API that is specific to the third-party product type.

## Translator installation {#translator-installation}

The OAAP partner receives the [enrollment kit](https://cdn.lenel.com/oaap/OAAPCertificationProcess.pdf), which includes OnGuard, the OnGuard Software Development Kit (SDK) and a license file.
Then, the OAAP partner completes the development of the translator DLL and sends a copy of the translator DLL to LenelS2.

LenelS2 creates and sends an accessory add-on for the panel type being integrated to the OAAP partner.
This is a small installation program that installs the translator DLL and any dependent DLLs, as well as publishing the new panel type in the OnGuard database.

Installing the accessory add-on allows users of OnGuard to use the OpenDevice translator in their installation.
After installing it, the panel type will be displayed and available to the user and new locks can be assigned to it.

To begin the installation, click on the `setup` file, as indicated below:

![Translator setup](images/translator-setup.png "Run the 'setup' file to get started")
{.border}

![Translator installation wizard](images/translator-installation-wizard.png "OpenDevice translator installation wizard")
{.border}

During the installation, the following information panel will display.
Ensure you have previously [installed the Web Configurator](/space/integrations/lenel-onguard/installation) before continuing.

![Add-on requirement information panel](images/add-on-requirement.png "Make sure you've installed the Web Configurator before continuing")
{.border}

![Installation completed successfully](images/successful-installation.png "If the installation is successful, the following screen displays")
{.border}

{{% info-panel %}}
`updatedatabase.exe` is only used to create the database record in Windows Enterprise.
{{% /info-panel %}}

{{% info-panel %}}
To verify that the translator is correctly installed, check that the file `LnlBlueVonnTranslatoru.dll` is correctly installed in the OnGuard installation folder, as indicated below.
{{% /info-panel %}}

![Correctly installed translator file](images/translator-correctly-installed.png "Make sure the translator file is correctly installed")
{.border}

Once the add-on is installed, you need to create a new panel in OnGuard.

![Panel button](images/access-panels-button.png "Panel creation button")
{.border}

![Panel creation](images/panel-creation.png "Panel creation")
{.border}

Please be aware of the following details when creating a new panel:

- **Other** panel is shown when the Salto Space license is listed in OnGuard
- **Add** button of panel is only active when the translator is installed successfully

Under **Access panel type** select **Salto Space**.

{{% info-panel %}}
Lenel panels are not synchronized and only Salto readers created in Lenel can be synchronized from OnGuard to Space.
{{% /info-panel %}}

![Salto readers panel](images/lenel-panels.png "Only Salto readers created in Lenel can be synchronized")
{.border}

And after this you need to restart the Lenel Service Communication Server (or restart the Lenel service).

![Lenel Service Communication Server](images/lenel-communication-server.png "Restart the Lenel Service Communication Server")
{.border}

After this operation, check that this folder is correctly created in the Lenel server:

`C:\PROGRAMDATA\SALTO\BLUECONN\`

To verify that the translator is correctly installed, you need to check that the `BlueConn` folder is created in `C:\PROGRAMDATA\SALTO` since the folder is automatically created after the translator installation.

![BlueConn folder](images/blueconn-folder.png "BlueConn folder location")
{.border}

If you get a "failed to login" error, like the one below, during the installation of the translator then check the permissions for the application installation.

![Error during installation](images/installer-error.png "Check the permissions if you receive this kind of error")
{.border}

If the installer cannot be installed, it is not possible to create Salto panels in OnGuard, synchronize doors from OnGuard to Salto, or manage Lenel OnGuard Alarm Monitoring.

## Translator configuration {#translator-configuration}

The OpenDevice translator uses a configuration file to store options related to Events API settings, event sync options and logging options.

This file is always stored at `C:\ProgramData\SALTO\BlueConn\BlueConn.ini`.

![File path for the installation file](images/file-path-for-blueconn.png "Check the file path for the installation file is correct")
{.border}

{{% info-panel %}}
Make sure you stop/start the translator for any changes to take effect.
**Important**: also make sure that the API credentials and password are the same in the following three places: this `BlueConn.ini` file, the Space Alarm setup, and in the configurator.
{{% /info-panel %}}

### Events API settings {#blueconn-api-settings}

The OpenDevice translator connects to the Events API in order to retrieve the latest events generated in Space.
For this it needs to provide valid credentials to connect to the API.
Note that these settings must match [those added in the Web Configurator](/space/integrations/lenel-onguard/settings#events-api-settings).

These are the following:

- **Username**: Enter the username used to connect to the Events API.
  - Default:*ApiUser*
- **Password**: Enter the password for the Events API user account.
  - Default:*Pass@Word!*

### Event sync options {#event-sync-options}

The OpenDevice translator works by invoking the `Lnl_PollPanelForEvents` method.
This is a polling mechanism native to the translator which runs several times per second.
By providing these sync options, you prevent the translator from querying the Events API too often, and it gives flexibility on how often new events should be fetched.

Currently, the following 4 event types are tracked:

- Card event: Granted Access
- Card event: Denied Access
- Device event: Communications Lost
- Device event: Communications Restored

![Alarm monitor example](images/alarm-monitor-example.png "Alarm monitor example")

#### Events frequency {#events-frequency}

Defines how often the translator will query the Events API to check if there are any new events generated in Space that still need to be processed.
If any events are found in the queue, the translator converts those Space events into OnGuard alarms depending on the event type.
For card events, OnGuard alarms are generated at that same moment.
For device events, a status update gets triggered so that the real-time status of the device is retrieved from Space.

#### Status frequency and update delay {#status-frequency-and-update-delay}

Whenever a device event is received, the status of the device is not at that same moment updated (mainly to avoid issues with alarms being generated before the status gets updated).
Instead, the **Status update delay** setting is used, so the sync process waits for a short number of seconds before calling the Events API to get the most up-to-date status of the devices.
A new OnGuard alarm will only be generated if the status has changed since the last time.
The alarm is skipped if the status is the same.

Even when Space events trigger a status update, sometimes these alarms are not sent or received by the Events API.
Status frequency provides a way to update the status of the devices given a certain frequency, to be sure that the statuses of the devices are always up to date.

![System status tree](images/system-status-tree.png "System status tree")

### Logging options {#logging-options}

By default, the OpenDevice translator stores error logs related to runtime exceptions or Events API errors in a logs folder.

{{% info-panel %}}
Logs are always stored at `C:\ProgramData\SALTO\BlueConn\Logs`.
{{% /info-panel %}}

#### API response and runtime logs enabled {#api-response-and-runtime-logs-enabled}

If you want to log every time the translator runs or every time it receives an API response, enable/disable these settings by using **ON/OFF**.
When enabled, the translator will generate these log files:

- `BlueConn_ApiResponses_YYYYMMDD.log`
- `BlueConn_Runtimes_YYYYMMDD.log`

{{% info-panel %}}
These logs are only recommended for debugging purposes, and they can grow large if they run for too long.
Make sure to turn the setting back to **OFF** or clean older log files manually.
{{% /info-panel %}}

The following screenshot is an example of how a real customer is listed:

![Real customer listing](images/real-listing.png "Real customer listing")
{.border}

Note: Access to Salto server URL is `space_pm_ts` but this is written `http://space_pm_ts:9121/api`

## Space alarm events configuration {#space-alarm-events-configuration}

To enable the OpenDevice translator to receive events from Salto Space, you need to configure an alarm event webhook which will forward all events to the Events API.

To configure an alarm event, go to Salto Space > **Tools** > **Alarm events**, and click on **Add**.

Add a representative name (for example: "OnGuard Alarm Webhook").
In the **Trigger** section, click on the **Edit** button, choose **Audit trail event** from the **Trigger type** dropdown and leave the default options as they are.
Then, click on **OK**.

![New alarm event in Space](images/space-alarm-events.png "Creating a new alarm event in Space")

In the **Actions** section, click on **Add**, choose **Make web request** from the **Type** dropdown.
In the URL field add `http://SERVER_NAME:9121/api/Events` where `SERVER_NAME` is the name of the host where the Web Configurator was previously installed.

Next, choose **POST** as **Method**, and **application/json** as **Content-Type**.
To authenticate to the Events API, you need to choose **Basic** authentication, and use the credentials defined previously using the Events API Settings section of the Web Configurator.

![New alarm event in Space](images/action-alarm-events.png "Choose the correct options in the 'Action' section")
{.border}

To finish, paste the following configuration into the **Body** field in JSON format:

```json
{
    "CardId": "(trigger.Card.ID}",
    "DoorId": "itrigger.Door.Gpf2",
    "DoorExtId": "{trigger.Door.ExtId}",
    "DoorName": "{trigger.Door.Name}",
    "UserExtId": "(trigger .User.ExtId}",
    "UserName": "{trigger.User.Name}",
    "CardNumber": "{trigger.User.Gpf4}",
    "IssueCode": "{trigger.User.Gpf5)",
    "EventType": "{trigger.EventType}",
    "OperationID": "{trigger.Operation.ID}",
    "EventUtcDate": "{trigger.UtcDate; format="yyyy-MM-dd HH:mm:ss"}"
}
```

After you've entered the configuration details, click **OK**.

Make sure that all the details for the alarm event are correct, and click on **Save**.
When this is enabled, Space will forward all alarm events to the Events API, which will be available for the OpenDevice translator to generate alarms in OnGuard.

{{% info-panel %}}
To check that event alarms are being correctly sent to the Events API, go to the Web Configurator dashboard, scroll down to **Alarm Event Sync Logs**, and check that events that are triggered by locks in Space are shown here.
{{% /info-panel %}}

Make sure that the [general purpose fields](/space/user-guide/operator/general-options/users#general-purpose-fields) (**GPF4** and **GPF5**) in the Space **Users** tab (**System** > **General options** > **Users**) are defined as below:

- **Enable field 4**: CardNumber
- **Enable field 5**: IssueCode

![Users tab in Space general options](images/users-general-options-space.png "Ensure the correct fields are defined in the 'Users' tab in Space")
{.border}

Meanwhile, in the Space **Doors** tab (**System** > **General options** > **Doors**), the GPF2 field should be defined as below:

- **Enable field 2**: DOORID

![Doors tab in Space general options](images/doors-tab-space.png "Ensure the correct field is defined in the 'Doors' tab in Space")
{.border}

