> ## 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.

# Milesight

> Connect Milesight to KODE OS for indoor environmental quality, occupancy data

> Connect Milesight to KODE OS for indoor environmental quality, occupancy data integration

## Overview

Use this integration to connect Milesight to KODE OS. You can discover multi-sensor devices and points, pull historical IEQ and occupancy data over REST, and consolidate smart-building sensor streams in Data Sources.

| Property            | Value                                   |
| ------------------- | --------------------------------------- |
| **System Type**     | Indoor Environmental Quality, Occupancy |
| **Communication**   | REST                                    |
| **Collection**      | Pull                                    |
| **Collection Mode** | HISTORICAL                              |

## Supported Capabilities

* Discover Devices & Points
* Collect Sensor Data

## Prerequisites

* An active account with Milesight and access to their API or developer portal
* OAuth client credentials (Client ID and Client Secret) from the Milesight developer portal
* KODE OS environment with access to Data Sources

## Generate API Credentials

1. Log in to the Milesight developer portal or admin console
2. Navigate to the API or developer settings section
3. Create a new API application or client
4. Note the **Client ID** and **Client Secret** -- you will need these when configuring the connector in KODE OS

## Configure Connector in KODE OS

1. Navigate to **Data Sources** in your building
2. Click **API Catalog** and search for **Milesight**
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          |
| **Client ID**     | Yes      | text     | The OAuth client ID from the vendor's developer portal     |
| **Client Secret** | Yes      | password | The OAuth client secret from the vendor's developer portal |

## Discover Devices and Points

After configuring the connector, click **Discover** on the connector detail page. KODE OS will query the Milesight 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 Milesight, KODE OS maps them to the following device types:

* **Air Quality Sensor** (`airQuality`)
* **Presence / Occupancy Sensor** (`presenceDetection`)
* **Traffic Counter** (`trafficCounter`)

| Point              | Display Name     |
| ------------------ | ---------------- |
| `Temperature`      | Temperature      |
| `Humidity`         | Humidity         |
| `Pir Status`       | Pir Status       |
| `Als Level`        | Als Level        |
| `CO2`              | CO2              |
| `Tvoc Level`       | Tvoc Level       |
| `Tvoc`             | Tvoc             |
| `Pressure`         | Pressure         |
| `ConnectStatus`    | ConnectStatus    |
| `Current_Total`    | Current Total    |
| `Current_Staff`    | Current Staff    |
| `Current_Children` | Current Children |

## What Data You Get

### Point History

Time-series sensor readings such as temperature, humidity, CO2, occupancy counts, energy consumption, light levels, and other measurable values from physical sensors

### Polling Schedule

* **Point History** -- Default polling: 30 minutes (min: 30 minutes, 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:

* Monitor air quality metrics (CO2, VOC, humidity, temperature) across all occupied spaces
* Generate compliance reports for indoor environmental quality standards
* Trigger ventilation adjustments when air quality thresholds are exceeded
* Track real-time space utilization rates across floors and zones

## 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 Client ID and Client Secret match the values from the Milesight developer portal.
  </Accordion>

  <Accordion title="Discovery returns no devices">
    Verify the connector credentials have sufficient permissions in the Milesight 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 Milesight API.
  </Accordion>
</AccordionGroup>
