---
name: "createMatterKit"
mode: "api"
versionRequirements:
  - { name: "", version: "1.15.0" }
title: "createMatterKit"
summary: "Factory to create a matter-kit instance; options include shouldConvert, debug, and config (brightness / color temperature ranges)."
questions:
  - "Which fields on the createMatterKit result relate to SDM interceptors?"
  - "What is a typical use case for shouldConvert?"
  - "Why disable debug in production?"
---

## createMatterKit

> [VERSION] v1.15.0+

### Description

Create a matter-kit instance: provides an SDM interceptor, Matter ↔ standard DP conversion utilities, and hooks.

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `options` | `CreateMatterKitOptions` | No | Factory input parameters; see |

### Return Value

Type: `MatterKit`

{MatterKit} matter-kit instance

### Referenced Types

##### `interface` CreateMatterKitOptions

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `shouldConvert` | `(params: InitDpStateInterceptorParams) => boolean` | `1.15.0` | Whether to convert the DP state in the interceptor chain; by default, conversion runs on `init` and `onDpDataChange`. |
| `debug` | `boolean` | `1.15.0` | Whether to enable debug mode (log the conversion process in the console) |
| `config` | `Object` | `1.15.0` | Optional: min/max ranges for standard-side `bright_value` / `temp_value`. |

##### `type` DpState

Datapoint status object, where the key is the datapoint code and the value is the datapoint value.

```typescript
export type DpState = Record<string, DpValue>;
```

##### `type` InitDpStateInterceptorParams

| Property | Type | Description |
| --- | --- | --- |
| `dpState` | `DpState` | Current device DP state |
| `newDpState` | `DpState` | New device DP state |
| `action` | `"init" \| "onDpDataChange" \| "onDeviceInfoUpdated" \| "dp-kit"` | Interceptor action |

##### `type` DpValue

Datapoint value type, which can be boolean, number, or string.

```typescript
export type DpValue = boolean | number | string;
```

##### `type` CreateMatterKitOptions.config

| Property | Type | Description |
| --- | --- | --- |
| `brightnessRange` | `Object` | Standard-side brightness value range |
| `colorTemperatureRange` | `Object` | Standard-side color temperature value range |

##### `type` CreateMatterKitOptions.config.brightnessRange

| Property | Type | Description |
| --- | --- | --- |
| `min` | `number` | Minimum |
| `max` | `number` | Maximum |

##### `type` CreateMatterKitOptions.config.colorTemperatureRange

| Property | Type | Description |
| --- | --- | --- |
| `min` | `number` | Minimum |
| `max` | `number` | Maximum |


### Examples

#### Example

```ts
import { SmartDeviceModel, createMatterKit } from '@ray-js/panel-sdk';
import { defaultSchema } from '@/devices/schema';

type SmartDeviceSchema = typeof defaultSchema;

export const matterKit = createMatterKit({ debug: false });
export const devices = {
  common: new SmartDeviceModel<SmartDeviceSchema>({
    interceptors: matterKit.interceptors,
  }),
};
```
