> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.kodelabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Xysense

> Connect Xysense to KODE OS for occupancy data

> Connect Xysense to KODE OS for occupancy data integration

## Overview

Use this integration to connect XY Sense area and entry sensors to KODE OS. You can discover coverage zones and devices, collect snapshot occupancy on your polling interval, and subscribe to webhooks so live space state stays current for utilization and capacity planning.

| Property            | Value          |
| ------------------- | -------------- |
| **System Type**     | Occupancy      |
| **Communication**   | REST + Webhook |
| **Collection**      | Pull           |
| **Collection Mode** | SNAPSHOT       |

## Supported Capabilities

* Discover Devices & Points
* Collect Sensor Data
* Receive Webhook Data

## Prerequisites

To integrate with the XY Sense API, ensure you have the following details:

* An active account in [https://app.xysense.io](https://app.xysense.io) with the appropriate access permissions.
* Valid username and password credentials for the XY Sense platform.

## Generate API Credentials

* Log in to the app.xysense.io using your username and password.
* Navigate to Settings → API Keys.
* Click Create Key.
* In the dialog:
* Enter a description for the key.
* Select the Customer.
* Choose the required permissions.
* Click Create.
* Copy the API Key and API Secret Key from the window and store them securely.
* The API Key is generated as a combination of the description and the selected Customer.
* Note: Once this window is closed, the Secret Key cannot be retrieved again.
  After completing the steps above, your API Key and  API Secret Key will be used in the next step.

## Configure Webhook

Fields marked with an asterisk \* are mandatory for completing the integration.

* Provide a name, select the Customer, and choose the Type (e.g., Occupancy Changes).
* Enter [integrations@kodelabs.com](mailto:integrations@kodelabs.com) in the Email field.
* Under Additional Headers, add:
* Key: Authorization
* Value: (obtain from [integrations@kodelabs.com](mailto:integrations@kodelabs.com))
* Max Batch Delay (ms): 2000
* Max Batch Size: 500
* Enabled: true

## Configure Connector in KODE OS

1. Navigate to **Data Sources** in your building
2. Click **API Catalog** and search for **Xysense**
3. Click **+ Add Datasource**
4. Fill in the fields below and complete the three-page setup flow

| Field               | Required | Type     | Description                                              |
| ------------------- | -------- | -------- | -------------------------------------------------------- |
| **URL**             | Yes      | text     | The base URL or IP address of the external system        |
| **API Key**         | Yes      | password | The API key for authenticating with the external system  |
| **API Secret Key**  | Yes      | password | The secret key for API authentication                    |
| **API Building ID** | Yes      | password | The building or source identifier in the external system |

## Discover Devices and Points

After configuring the connector, click **Discover** on the connector detail page. KODE OS will query the Xysense system and return a list of available devices and their data points.

Review the discovered items and select the devices you want to register in KODE OS.

For more details on the discovery process, see the [Discovery guide](/products/integrations/capabilities/discovery).

## Devices and Points

When you discover devices from Xysense, KODE OS maps them to the following device types and data points:

### Presence / Occupancy Sensor

Canonical Type: `presenceDetection`

| # | Point    | Description                                | Unit | Writable | Collection |
| - | -------- | ------------------------------------------ | ---- | -------- | ---------- |
| 1 | `status` | **True** -- active / **False** -- inactive | --   | No       | Webhook    |

## What Data You Get

### Point History

Time-series readings including status, collected at regular intervals from connected devices

### Polling Schedule

* **Point History** -- Default polling: 30 seconds (min: 30 seconds, max: 1 hours)

For more details on collection modes, see the [Data Collection guide](/products/integrations/capabilities/data-collection).

## Use Cases

Once connected, this integration enables you to:

* Track real-time space utilization rates across floors and zones
* Optimize HVAC and lighting schedules based on actual occupancy patterns
* Generate utilization reports to inform space planning and real estate decisions

## Troubleshooting

<AccordionGroup>
  <Accordion title="Authentication or connection error">
    Verify that the credentials are correct and have not expired. Check that the URL is reachable from the KODE OS environment. Ensure the API key or token is valid and has not been revoked or expired in the Xysense platform.
  </Accordion>

  <Accordion title="Webhook data not arriving">
    Verify the webhook URL is correctly registered in the Xysense platform. Check that the authentication header matches the value from the KODE OS connector detail page. Ensure the Xysense system can reach the KODE OS webhook endpoint over the network.
  </Accordion>

  <Accordion title="Discovery returns no devices">
    Verify the connector credentials have sufficient permissions in the Xysense system to list devices. Run a test connection first to confirm connectivity. Some systems require specific API scopes or roles for device enumeration.
  </Accordion>

  <Accordion title="Data collection stops or gaps appear">
    Check the connector status on the Data Sources page. If the status shows an error, review the error logs on the connector detail page. Common causes include expired credentials, network changes, or rate limiting by the Xysense API.
  </Accordion>
</AccordionGroup>
