---
name: "openTimerPage"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "1.2.6" }
platform:
  - "iOS"
  - "Android"
async: true
---

## openTimerPage

> [VERSION] DeviceKit >= 1.2.6

> [PLATFORM] iOS, Android

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

### Description

Navigate to the Timer page

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | Yes | - | `1.2.6` | deviceId Device ID; pass at least one of deviceId or groupId |
| `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 default DP value, t.Integer     "rangeKeys": DP value range, Array<object>     "rangeValues": DP display range, Array<string> } |
| `timerConfig` | `TimerConfig` | No | - | `1.2.6` | timerConfig UI configuration |
| `complete` | `() => void` | No | - | - | Callback executed when the API call completes (runs on both success and failure) |
| `success` | `() => void` | No | - | - | Success callback |
| `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 extensions |

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

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Referenced Types

##### `interface` TimerConfig

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `background` | `string` | `1.2.6` | background Timer screen navigation bar background color, hexadecimal, for example: FFFFFF |


### Examples

#### Demo

```tsx
ty.device.openTimerPage({
  deviceId: "vdevo169137612787836",
  category: "1",
  data: [{
    dpId: 1,
    dpName: "Switch",
    rangeKeys: [1, 0],
    rangeValues: ["On", "Off"],
    selected: 0
  }],
  timerConfig: { background: "FFFFFF" },
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
