---
name: "StripLocalTimerTransformer"
mode: "api"
versionRequirements:
  - { name: "@ray-js/panel-sdk", version: "1.0.0" }
title: "StripLocalTimerTransformer"
summary: "StripLocalTimerTransformer is used to parse the lighting `strip_local_timer` DP and provides parsing and formatting for strip local timer data."
questions:
  - "What is StripLocalTimerTransformer used for?"
  - "How does StripLocalTimerTransformer parse strip local timer data?"
  - "What are the input and output of StripLocalTimerTransformer?"
  - "What are the transformation rules of StripLocalTimerTransformer?"
---

## StripLocalTimerTransformer

> [VERSION] @ray-js/panel-sdk >= 1.0.0

> 💡 Local timer DP for light strip products (e.g., strip_local_timer), supporting four timer control types: switch, white mode, scene, and color mode. The protocol encodes the timer ID, enable state, weekly recurrence, trigger time, and lighting parameters via bit operations. When formatting, current time info (weekday, hour, minute, second) is included for device time calibration.

### Description

Light strip local timer protocol converter for bidirectional conversion between timer task data and the DP hexadecimal protocol

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `uuid` | `string` | No | DP identifier, defaults to 'strip_local_timer' |
| `defaultValue` | `ITimerData` | No | Default timer data returned when parsing fails |

### Return Value

Type: `StripLocalTimerTransformer`

StripLocalTimerTransformer instance

#### Methods

| Method | Description |
| --- | --- |
| `parser` | Parse a DP hexadecimal string into a timer task data object |
| `formatter` | Format a timer task data object into a DP hexadecimal string |

### Referenced Types

##### `type` ITimerData

| Property | Type | Description |
| --- | --- | --- |
| `power` | `boolean` | Enable: 0 = off, 1 = on |
| `id` | `number` | Timer ID |
| `weeks` | `number[]` | Weekly repeat |
| `time` | `number` | Scheduled time HH:mm |
| `mode` | `number` | 1: On/Off 2: White mode 3: Scene 4: Color mode |
| `minute` | `string` | Minutes |
| `hour` | `string` | Hours |
| `lampPower` | `boolean` | Light switch |
| `brightness` | `number` | Brightness |
| `temperature` | `number` | Color temperature |
| `now` | `Object` | Current time |

##### `type` ITimerData.now

| Property | Type | Description |
| --- | --- | --- |
| `day` | `number` | Weekday |
| `hour` | `number` | Hours |
| `minute` | `number` | Minutes |
| `seconds` | `number` | Seconds |


### Examples

#### Example

```ts
import { StripLocalTimerTransformer } from '@ray-js/panel-sdk';

const transformer = new StripLocalTimerTransformer();
// Parse timer DP string
const timer = transformer.parser('1001e0021c0164006e');

// Format to DP string
const dpStr = transformer.formatter({
  id: 0,
  power: true,
  weeks: [1, 1, 1, 1, 1, 0, 0, 0],
  time: 480,
  mode: 2,
  lampPower: true,
  brightness: 1000,
  temperature: 500,
});
```
