---
name: "openTimerPage"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "1.2.6" }
  - { name: "@ray-js/ray", version: "0.6.23" }
platform:
  - "iOS"
  - "Android"
async: true
---

## openTimerPage

> [VERSION] DeviceKit >= 1.2.6 | @ray-js/ray >= 0.6.23

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Navigate to the timer screen

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | Yes | - | `1.2.6` | deviceId Device ID; at least one of deviceId or groupId is required |
| `category` | `string` | Yes | - | `1.2.6` | category Timer category |
| `repeat` | `number` | No | - | `1.2.6` | Note: This field is deprecated |
| `data` | `Record<string, any>[]` | Yes | - | `1.2.6` | data DP data {     "dpName": DP name, string     "dpId": DP ID, string     "selected": index of the DP default value, t.Integer     "rangeKeys": value range of the DP, Array<object>     "rangeValues": display range of the DP, Array<string> } |
| `timerConfig` | `TimerConfig` | No | - | `1.2.6` | timerConfig UI configuration |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `() => void` | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Referenced Types

##### `interface` TimerConfig

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `background` | `string` | `1.2.6` | background Background color of the timer screen navigation bar, hexadecimal, e.g., FFFFFF |


### Examples

#### Basic usage

```tsx
import { device } from '@ray-js/ray'

const { openTimerPage } = device;

openTimerPage({
  deviceId: 'device_001',
  category: 'example',
  data: [],
  success: () => {
    console.log('openTimerPage success');
  },
  fail: (error) => {
    console.log('openTimerPage fail', error.errorMsg);
  },
});
```
